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
This commit is contained in:
John Baldwin 2009-03-23 19:27:23 +00:00
parent 91f72cedda
commit f7c701d528
3 changed files with 13 additions and 7 deletions

View File

@ -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

View File

@ -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 */

View File

@ -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;
}