From ff69e08ad6085115bb6655a42e9a4dd277ab0d51 Mon Sep 17 00:00:00 2001 From: Mike Smith Date: Sat, 10 Jun 2000 19:22:39 +0000 Subject: [PATCH] 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. --- sys/dev/amr/amr.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/dev/amr/amr.c b/sys/dev/amr/amr.c index 380ea3693a5..2f25a21e14f 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); }