svn commit: r190329 - head/sys/dev/twa
John Baldwin
jhb at FreeBSD.org
Mon Mar 23 12:27:24 PDT 2009
Author: jhb
Date: Mon Mar 23 19:27:23 2009
New Revision: 190329
URL: http://svn.freebsd.org/changeset/base/190329
Log:
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
Modified:
head/sys/dev/twa/tw_cl_init.c
head/sys/dev/twa/tw_osl.h
head/sys/dev/twa/tw_osl_freebsd.c
Modified: head/sys/dev/twa/tw_cl_init.c
==============================================================================
--- head/sys/dev/twa/tw_cl_init.c Mon Mar 23 19:10:38 2009 (r190328)
+++ head/sys/dev/twa/tw_cl_init.c Mon Mar 23 19:27:23 2009 (r190329)
@@ -692,7 +692,7 @@ tw_cli_init_connection(struct tw_cli_ctl
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
Modified: head/sys/dev/twa/tw_osl.h
==============================================================================
--- head/sys/dev/twa/tw_osl.h Mon Mar 23 19:10:38 2009 (r190328)
+++ head/sys/dev/twa/tw_osl.h Mon Mar 23 19:27:23 2009 (r190329)
@@ -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 */
Modified: head/sys/dev/twa/tw_osl_freebsd.c
==============================================================================
--- head/sys/dev/twa/tw_osl_freebsd.c Mon Mar 23 19:10:38 2009 (r190328)
+++ head/sys/dev/twa/tw_osl_freebsd.c Mon Mar 23 19:27:23 2009 (r190329)
@@ -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;
}
More information about the svn-src-head
mailing list