aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/amr
diff options
context:
space:
mode:
authorMike Smith <msmith@FreeBSD.org>2000-06-10 19:22:39 +0000
committerMike Smith <msmith@FreeBSD.org>2000-06-10 19:22:39 +0000
commitff69e08ad6085115bb6655a42e9a4dd277ab0d51 (patch)
treea4824a0753a8f47c605fa8e44d2e75801cd3f469 /sys/dev/amr
parentc27f4d3c508275e394037e37d42c3ed5c809ec62 (diff)
downloadsrc-ff69e08ad6085115bb6655a42e9a4dd277ab0d51.tar.gz
src-ff69e08ad6085115bb6655a42e9a4dd277ab0d51.zip
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.
Notes
Notes: svn path=/head/; revision=61508
Diffstat (limited to 'sys/dev/amr')
-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 380ea3693a50..2f25a21e14f8 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);
}