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.
This commit is contained in:
Mike Smith 2000-06-10 19:22:39 +00:00
parent c27f4d3c50
commit ff69e08ad6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=61508

View File

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