aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/twa
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2009-03-23 19:27:23 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2009-03-23 19:27:23 +0000
commitf7c701d528f76021ddae78abb6492d20bbe88f5f (patch)
treeb64f02976be232967b0adf254d52948ee9618975 /sys/dev/twa
parent91f72cedda0e823d1576fc3783438224e26d0b0a (diff)
downloadsrc-f7c701d528f76021ddae78abb6492d20bbe88f5f.tar.gz
src-f7c701d528f76021ddae78abb6492d20bbe88f5f.zip
Reenable 64-bit DMA for twa(4) controllers, but use a boundary of 4GB to
prevent individual transactions from crossing a 4GB address boundary. Due to bus_size_t type limitations, the driver uses a 2GB boundary in PAE kernels. Reviewed by: scottl MFC after: 1 week
Notes
Notes: svn path=/head/; revision=190329
Diffstat (limited to 'sys/dev/twa')
-rw-r--r--sys/dev/twa/tw_cl_init.c2
-rw-r--r--sys/dev/twa/tw_osl.h6
-rw-r--r--sys/dev/twa/tw_osl_freebsd.c12
3 files changed, 13 insertions, 7 deletions
diff --git a/sys/dev/twa/tw_cl_init.c b/sys/dev/twa/tw_cl_init.c
index 52864b2c6de5..ca282faa237c 100644
--- a/sys/dev/twa/tw_cl_init.c
+++ b/sys/dev/twa/tw_cl_init.c
@@ -692,7 +692,7 @@ tw_cli_init_connection(struct tw_cli_ctlr_context *ctlr,
init_connect->message_credits = TW_CL_SWAP16(message_credits);
init_connect->features = TW_CL_SWAP32(set_features);
if (ctlr->flags & TW_CL_64BIT_ADDRESSES)
- init_connect->features |= TWA_64BIT_SG_ADDRESSES;
+ init_connect->features |= TW_CL_SWAP32(TWA_64BIT_SG_ADDRESSES);
if (set_features & TWA_EXTENDED_INIT_CONNECT) {
/*
* Fill in the extra fields needed for an extended
diff --git a/sys/dev/twa/tw_osl.h b/sys/dev/twa/tw_osl.h
index d68cc5ec600f..6082253b6ffa 100644
--- a/sys/dev/twa/tw_osl.h
+++ b/sys/dev/twa/tw_osl.h
@@ -57,6 +57,12 @@
#define TW_OSLI_DEFERRED_INTR_USED
*/
+#ifdef PAE
+#define TW_OSLI_DMA_BOUNDARY (1u << 31)
+#else
+#define TW_OSLI_DMA_BOUNDARY ((bus_size_t)((uint64_t)1 << 32))
+#endif
+
/* Possible values of req->state. */
#define TW_OSLI_REQ_STATE_INIT 0x0 /* being initialized */
#define TW_OSLI_REQ_STATE_BUSY 0x1 /* submitted to CL */
diff --git a/sys/dev/twa/tw_osl_freebsd.c b/sys/dev/twa/tw_osl_freebsd.c
index d18fd0a746b0..85b3af1c5962 100644
--- a/sys/dev/twa/tw_osl_freebsd.c
+++ b/sys/dev/twa/tw_osl_freebsd.c
@@ -491,8 +491,8 @@ tw_osli_alloc_mem(struct twa_softc *sc)
/* Create the parent dma tag. */
if (bus_dma_tag_create(NULL, /* parent */
sc->alignment, /* alignment */
- 0, /* boundary */
- BUS_SPACE_MAXADDR_32BIT,/* lowaddr */
+ TW_OSLI_DMA_BOUNDARY, /* boundary */
+ BUS_SPACE_MAXADDR, /* lowaddr */
BUS_SPACE_MAXADDR, /* highaddr */
NULL, NULL, /* filter, filterarg */
TW_CL_MAX_IO_SIZE, /* maxsize */
@@ -515,7 +515,7 @@ tw_osli_alloc_mem(struct twa_softc *sc)
if (bus_dma_tag_create(sc->parent_tag, /* parent */
sc->alignment, /* alignment */
0, /* boundary */
- BUS_SPACE_MAXADDR_32BIT,/* lowaddr */
+ BUS_SPACE_MAXADDR, /* lowaddr */
BUS_SPACE_MAXADDR, /* highaddr */
NULL, NULL, /* filter, filterarg */
dma_mem_size, /* maxsize */
@@ -562,7 +562,7 @@ tw_osli_alloc_mem(struct twa_softc *sc)
if (bus_dma_tag_create(sc->parent_tag, /* parent */
sc->alignment, /* alignment */
0, /* boundary */
- BUS_SPACE_MAXADDR_32BIT,/* lowaddr */
+ BUS_SPACE_MAXADDR, /* lowaddr */
BUS_SPACE_MAXADDR, /* highaddr */
NULL, NULL, /* filter, filterarg */
TW_CL_MAX_IO_SIZE, /* maxsize */
@@ -588,7 +588,7 @@ tw_osli_alloc_mem(struct twa_softc *sc)
if (bus_dma_tag_create(sc->parent_tag, /* parent */
sc->alignment, /* alignment */
0, /* boundary */
- BUS_SPACE_MAXADDR_32BIT,/* lowaddr */
+ BUS_SPACE_MAXADDR, /* lowaddr */
BUS_SPACE_MAXADDR, /* highaddr */
NULL, NULL, /* filter, filterarg */
TW_CL_MAX_IO_SIZE, /* maxsize */
@@ -1347,7 +1347,7 @@ static TW_VOID
twa_map_load_callback(TW_VOID *arg, bus_dma_segment_t *segs,
TW_INT32 nsegments, TW_INT32 error)
{
- *((bus_addr_t *)arg) = segs[0].ds_addr;
+ *((TW_UINT64 *)arg) = segs[0].ds_addr;
}