summaryrefslogtreecommitdiffstats
path: root/sys/dev/amr/amr.c
diff options
context:
space:
mode:
authormsmith <msmith@FreeBSD.org>2000-06-10 19:22:39 +0000
committermsmith <msmith@FreeBSD.org>2000-06-10 19:22:39 +0000
commit8e775051fdffb1677418b3eaa04d8ce0071cf12e (patch)
treef7a4f438a6e9f694ac2c1028b6ff52c4c6b84ce7 /sys/dev/amr/amr.c
parent5c2142e36b51c577d17398fc1c53e5d3643c6158 (diff)
downloadFreeBSD-src-8e775051fdffb1677418b3eaa04d8ce0071cf12e.zip
FreeBSD-src-8e775051fdffb1677418b3eaa04d8ce0071cf12e.tar.gz
The AMI MegaRAID's internal memory map conflicts with scatter/gather
map physical addresses below 0x2000 (accoding to AMI). If we allocate our s/g tables and get an address below this point, leak the memory and try again. This should fix booting from these controllers.
Diffstat (limited to 'sys/dev/amr/amr.c')
-rw-r--r--sys/dev/amr/amr.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/dev/amr/amr.c b/sys/dev/amr/amr.c
index 380ea36..2f25a21 100644
--- a/sys/dev/amr/amr.c
+++ b/sys/dev/amr/amr.c
@@ -245,13 +245,22 @@ amr_sglist_map(struct amr_softc *sc)
* XXX this assumes we can get enough space for all the s/g maps in one
* contiguous slab. We may need to switch to a more complex arrangement where
* we allocate in smaller chunks and keep a lookup table from slot to bus address.
+ *
+ * XXX HACK ALERT: at least some controllers don't like the s/g memory being
+ * allocated below 0x2000. We leak some memory if we get some
+ * below this mark and allocate again.
*/
+retry:
error = bus_dmamem_alloc(sc->amr_sg_dmat, (void **)&sc->amr_sgtable, BUS_DMA_NOWAIT, &sc->amr_sg_dmamap);
if (error) {
device_printf(sc->amr_dev, "can't allocate s/g table\n");
return(ENOMEM);
}
bus_dmamap_load(sc->amr_sg_dmat, sc->amr_sg_dmamap, sc->amr_sgtable, segsize, amr_dma_map_sg, sc, 0);
+ if (sc->amr_sgbusaddr < 0x2000) {
+ device_printf(sc->amr_dev, "s/g table too low (0x%x), reallocating\n", sc->amr_sgbusaddr);
+ goto retry;
+ }
return(0);
}
OpenPOWER on IntegriCloud