diff options
author | scottl <scottl@FreeBSD.org> | 2003-01-23 01:01:44 +0000 |
---|---|---|
committer | scottl <scottl@FreeBSD.org> | 2003-01-23 01:01:44 +0000 |
commit | 062887dc669d70e3e3f0a46869a8cfb50117b096 (patch) | |
tree | 53f1a9a0fa5569aee0aa1151ae7bbd9b7a2a68fe | |
parent | 521e2f4ce6e5420c54f62885b331170b5deb65be (diff) | |
download | FreeBSD-src-062887dc669d70e3e3f0a46869a8cfb50117b096.zip FreeBSD-src-062887dc669d70e3e3f0a46869a8cfb50117b096.tar.gz |
Hack around a bug in the 2200 and 2120 controllers that connot DMA
commands from below the first 8K of physical memory. A better fix
is to modify the busdma api to allow either inclusion ranges or
multiple exclusion ranges, but that debate is for another day.
MFC After: 2 days
-rw-r--r-- | sys/dev/aac/aac.c | 20 | ||||
-rw-r--r-- | sys/dev/aac/aac_pci.c | 2 |
2 files changed, 18 insertions, 4 deletions
diff --git a/sys/dev/aac/aac.c b/sys/dev/aac/aac.c index 046fa19..0738614 100644 --- a/sys/dev/aac/aac.c +++ b/sys/dev/aac/aac.c @@ -259,7 +259,8 @@ aac_attach(struct aac_softc *sc) return(error); /* - * Allocate command structures. + * Allocate command structures. This must be done before aac_init() + * in order to work around a 2120/2200 bug. */ if ((error = aac_alloc_commands(sc)) != 0) return(error); @@ -1119,11 +1120,24 @@ aac_alloc_commands(struct aac_softc *sc) printf("Not enough contiguous memory available.\n"); return (ENOMEM); } + + /* + * Work around a bug in the 2120 and 2200 that cannot DMA commands + * below address 8192 in physical memory. + * XXX If the padding is not needed, can it be put to use instead + * of ignored? + */ bus_dmamap_load(sc->aac_fib_dmat, sc->aac_fibmap, sc->aac_fibs, - AAC_FIB_COUNT * sizeof(struct aac_fib), + 8192 + AAC_FIB_COUNT * sizeof(struct aac_fib), aac_map_command_helper, sc, 0); - bzero(sc->aac_fibs, AAC_FIB_COUNT * sizeof(struct aac_fib)); + + if (sc->aac_fibphys < 8192) { + sc->aac_fibs += (8192 / sizeof(struct aac_fib)); + sc->aac_fibphys += 8192; + } + /* initialise constant fields in the command structure */ + bzero(sc->aac_fibs, AAC_FIB_COUNT * sizeof(struct aac_fib)); for (i = 0; i < AAC_FIB_COUNT; i++) { cm = &sc->aac_command[i]; cm->cm_sc = sc; diff --git a/sys/dev/aac/aac_pci.c b/sys/dev/aac/aac_pci.c index 6f6b7e3..1182342 100644 --- a/sys/dev/aac/aac_pci.c +++ b/sys/dev/aac/aac_pci.c @@ -275,7 +275,7 @@ aac_pci_attach(device_t dev) BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ - AAC_FIB_COUNT * + 8192 + AAC_FIB_COUNT * /* XXX dma hack */ sizeof(struct aac_fib), 1, /* maxsize, nsegments */ BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */ 0, /* flags */ |