From 847f0d652dcf6c9019be074ee1f04b6ed4ff788a Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Tue, 4 Apr 2006 21:20:41 +0000 Subject: Add a `prefetch threshold' member to the bus_dma_tag_t, so that eventually we can determine whether or not to allocate a spill page on a per-mapping basis. From NetBSD ok martin@ --- sys/arch/alpha/include/bus.h | 12 +++++++++++- sys/arch/alpha/pci/apecs_dma.c | 6 +++++- sys/arch/alpha/pci/cia_dma.c | 6 +++++- sys/arch/alpha/pci/lca_dma.c | 9 ++++++++- sys/arch/alpha/pci/tsp_dma.c | 9 ++++++++- sys/arch/alpha/tc/tc_dma.c | 3 ++- sys/arch/alpha/tc/tc_dma_3000_500.c | 3 ++- 7 files changed, 41 insertions(+), 7 deletions(-) (limited to 'sys/arch') diff --git a/sys/arch/alpha/include/bus.h b/sys/arch/alpha/include/bus.h index ce668936a65..c18f5f16afc 100644 --- a/sys/arch/alpha/include/bus.h +++ b/sys/arch/alpha/include/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.21 2006/04/04 21:18:43 brad Exp $ */ +/* $OpenBSD: bus.h,v 1.22 2006/04/04 21:20:40 brad Exp $ */ /* $NetBSD: bus.h,v 1.10 1996/12/02 22:19:32 cgd Exp $ */ /* @@ -530,6 +530,16 @@ struct alpha_bus_dma_tag { */ struct alpha_sgmap *_sgmap; + /* + * The SGMAP MMU implements a prefetch FIFO to keep data + * moving down the pipe, when doing host->bus DMA writes. + * The threshold (distance until the next page) used to + * trigger the prefetch is differnet on different chipsets, + * and we need to know what it is in order to know whether + * or not to allocate a spill page. + */ + bus_size_t _pfthresh; + /* * Internal-use only utility methods. NOT TO BE USED BY * MACHINE-INDEPENDENT CODE! diff --git a/sys/arch/alpha/pci/apecs_dma.c b/sys/arch/alpha/pci/apecs_dma.c index a4ba8c61253..979081ea0e9 100644 --- a/sys/arch/alpha/pci/apecs_dma.c +++ b/sys/arch/alpha/pci/apecs_dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: apecs_dma.c,v 1.4 2006/03/20 01:00:58 martin Exp $ */ +/* $OpenBSD: apecs_dma.c,v 1.5 2006/04/04 21:20:40 brad Exp $ */ /* $NetBSD: apecs_dma.c,v 1.13 2000/06/29 08:58:45 mrg Exp $ */ /*- @@ -87,6 +87,9 @@ void apecs_bus_dmamap_unload_sgmap(bus_dma_tag_t, bus_dmamap_t); #define APECS_SGMAP_MAPPED_BASE (8*1024*1024) #define APECS_SGMAP_MAPPED_SIZE (8*1024*1024) +/* APECS has a 256-byte out-bound DMA prefetch threshold. */ +#define APECS_SGMAP_PFTHRESH 256 + /* * Macro to flush APECS scatter/gather TLB. */ @@ -140,6 +143,7 @@ apecs_dma_init(acp) t->_next_window = NULL; t->_boundary = 0; t->_sgmap = &acp->ac_sgmap; + t->_pfthresh = APECS_SGMAP_PFTHRESH; t->_get_tag = apecs_dma_get_tag; t->_dmamap_create = alpha_sgmap_dmamap_create; t->_dmamap_destroy = alpha_sgmap_dmamap_destroy; diff --git a/sys/arch/alpha/pci/cia_dma.c b/sys/arch/alpha/pci/cia_dma.c index 37394c9e799..5cc6c2a3fb4 100644 --- a/sys/arch/alpha/pci/cia_dma.c +++ b/sys/arch/alpha/pci/cia_dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cia_dma.c,v 1.6 2006/03/20 01:00:58 martin Exp $ */ +/* $OpenBSD: cia_dma.c,v 1.7 2006/04/04 21:20:40 brad Exp $ */ /* $NetBSD: cia_dma.c,v 1.16 2000/06/29 08:58:46 mrg Exp $ */ /*- @@ -90,6 +90,9 @@ void cia_bus_dmamap_unload_sgmap(bus_dma_tag_t, bus_dmamap_t); #define CIA_SGMAP_MAPPED_BASE (8*1024*1024) #define CIA_SGMAP_MAPPED_SIZE (8*1024*1024) +/* ALCOR/ALGOR2/PYXIS have a 256-byte out-bound DMA prefetch threshold. */ +#define CIA_SGMAP_PFTHRESH 256 + void cia_tlb_invalidate(void); void cia_broken_pyxis_tlb_invalidate(void); @@ -144,6 +147,7 @@ cia_dma_init(ccp) t->_next_window = NULL; t->_boundary = 0; t->_sgmap = &ccp->cc_sgmap; + t->_pfthresh = CIA_SGMAP_PFTHRESH; t->_get_tag = cia_dma_get_tag; t->_dmamap_create = alpha_sgmap_dmamap_create; t->_dmamap_destroy = alpha_sgmap_dmamap_destroy; diff --git a/sys/arch/alpha/pci/lca_dma.c b/sys/arch/alpha/pci/lca_dma.c index a6c4f293f4c..8655bc90210 100644 --- a/sys/arch/alpha/pci/lca_dma.c +++ b/sys/arch/alpha/pci/lca_dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lca_dma.c,v 1.6 2006/03/20 01:00:58 martin Exp $ */ +/* $OpenBSD: lca_dma.c,v 1.7 2006/04/04 21:20:40 brad Exp $ */ /* $NetBSD: lca_dma.c,v 1.13 2000/06/29 08:58:47 mrg Exp $ */ /*- @@ -87,6 +87,12 @@ void lca_bus_dmamap_unload_sgmap(bus_dma_tag_t, bus_dmamap_t); #define LCA_SGMAP_MAPPED_BASE (8*1024*1024) #define LCA_SGMAP_MAPPED_SIZE (8*1024*1024) +/* + * The LCA doesn't have a DMA prefetch threshold. However, it is known + * to lose if we don't allocate a spill page. So initialize it to 256. + */ +#define LCA_SGMAP_PFTHRESH 256 + /* * Macro to flush LCA scatter/gather TLB. */ @@ -139,6 +145,7 @@ lca_dma_init(lcp) t->_next_window = NULL; t->_boundary = 0; t->_sgmap = &lcp->lc_sgmap; + t->_pfthresh = LCA_SGMAP_PFTHRESH; t->_get_tag = lca_dma_get_tag; t->_dmamap_create = alpha_sgmap_dmamap_create; diff --git a/sys/arch/alpha/pci/tsp_dma.c b/sys/arch/alpha/pci/tsp_dma.c index 339daaf9648..ef8fb593a68 100644 --- a/sys/arch/alpha/pci/tsp_dma.c +++ b/sys/arch/alpha/pci/tsp_dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tsp_dma.c,v 1.4 2006/03/20 01:00:58 martin Exp $ */ +/* $OpenBSD: tsp_dma.c,v 1.5 2006/04/04 21:20:40 brad Exp $ */ /* $NetBSD: tsp_dma.c,v 1.1 1999/06/29 06:46:47 ross Exp $ */ /*- @@ -111,6 +111,12 @@ void tsp_bus_dmamap_unload_sgmap(bus_dma_tag_t, bus_dmamap_t); void tsp_tlb_invalidate(struct tsp_config *); +/* + * XXX Need to figure out what this is, if any. Initialize it to + * XXX something that should be safe. + */ +#define TSP_SGMAP_PFTHRESH 256 + void tsp_dma_init(pcp) struct tsp_config *pcp; @@ -179,6 +185,7 @@ tsp_dma_init(pcp) t->_next_window = NULL; t->_boundary = 0; t->_sgmap = &pcp->pc_sgmap; + t->_pfthresh = TSP_SGMAP_PFTHRESH; t->_get_tag = tsp_dma_get_tag; t->_dmamap_create = alpha_sgmap_dmamap_create; t->_dmamap_destroy = alpha_sgmap_dmamap_destroy; diff --git a/sys/arch/alpha/tc/tc_dma.c b/sys/arch/alpha/tc/tc_dma.c index 5de443eaaa5..a22b10b765f 100644 --- a/sys/arch/alpha/tc/tc_dma.c +++ b/sys/arch/alpha/tc/tc_dma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tc_dma.c,v 1.1 2002/05/02 22:56:06 miod Exp $ */ +/* $OpenBSD: tc_dma.c,v 1.2 2006/04/04 21:20:40 brad Exp $ */ /* $NetBSD: tc_dma.c,v 1.10 2001/07/19 06:40:02 thorpej Exp $ */ /*- @@ -54,6 +54,7 @@ struct alpha_bus_dma_tag tc_dmat_direct = { NULL, /* _next_window */ 0, /* _boundary */ NULL, /* _sgmap */ + 0, /* _pfthresh */ NULL, /* _get_tag */ _bus_dmamap_create, _bus_dmamap_destroy, diff --git a/sys/arch/alpha/tc/tc_dma_3000_500.c b/sys/arch/alpha/tc/tc_dma_3000_500.c index 49732d62ec9..51faf6d9262 100644 --- a/sys/arch/alpha/tc/tc_dma_3000_500.c +++ b/sys/arch/alpha/tc/tc_dma_3000_500.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tc_dma_3000_500.c,v 1.1 2002/05/02 22:56:06 miod Exp $ */ +/* $OpenBSD: tc_dma_3000_500.c,v 1.2 2006/04/04 21:20:40 brad Exp $ */ /* $NetBSD: tc_dma_3000_500.c,v 1.13 2001/07/19 06:40:03 thorpej Exp $ */ /*- @@ -61,6 +61,7 @@ struct alpha_bus_dma_tag tc_dmat_sgmap = { NULL, /* _next_window */ 0, /* _boundary */ NULL, /* _sgmap */ + 0, /* _pfthresh */ NULL, /* _get_tag */ tc_bus_dmamap_create_sgmap, tc_bus_dmamap_destroy_sgmap, -- cgit v1.2.3