From 1fe37e43e300d53b7f91e99c64116556ef9187cd Mon Sep 17 00:00:00 2001 From: mux Date: Wed, 19 Feb 2003 18:33:29 +0000 Subject: Fix panic on sparc64 introduced in my last commit. I really wish the busdma APIs were more consistent accross architectures. We should probably move all the other DMA map creations in xl_attach() where we can really handle them failing, since xl_init() is void and shouldn't fail. Pointy hat to: mux Tested by: Anders Andersson --- sys/pci/if_xl.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'sys/pci') diff --git a/sys/pci/if_xl.c b/sys/pci/if_xl.c index e4c7ad6..7920792 100644 --- a/sys/pci/if_xl.c +++ b/sys/pci/if_xl.c @@ -1544,6 +1544,11 @@ xl_attach(dev) goto fail_txmap; } + /* We need a spare DMA map for the RX ring. */ + error = bus_dmamap_create(sc->xl_mtag, 0, &sc->xl_tmpmap); + if (error) + return(error); + /* * Figure out the card type. 3c905B adapters have the * 'supportsNoTxLength' bit set in the capabilities @@ -1781,6 +1786,7 @@ xl_detach(dev) bus_release_resource(dev, SYS_RES_MEMORY, XL_PCI_FUNCMEM, sc->xl_fres); bus_release_resource(dev, XL_RES, XL_RID, sc->xl_res); + bus_dmamap_destroy(sc->xl_mtag, sc->xl_tmpmap); bus_dmamap_unload(sc->xl_ldata.xl_rx_tag, sc->xl_ldata.xl_rx_dmamap); bus_dmamap_unload(sc->xl_ldata.xl_tx_tag, sc->xl_ldata.xl_tx_dmamap); bus_dmamem_free(sc->xl_ldata.xl_rx_tag, sc->xl_ldata.xl_rx_list, @@ -1893,10 +1899,6 @@ xl_list_rx_init(sc) cd = &sc->xl_cdata; ld = &sc->xl_ldata; - error = bus_dmamap_create(sc->xl_mtag, 0, &sc->xl_tmpmap); - if (error) - return(error); - for (i = 0; i < XL_RX_LIST_CNT; i++) { cd->xl_rx_chain[i].xl_ptr = &ld->xl_rx_list[i]; error = bus_dmamap_create(sc->xl_mtag, 0, @@ -3201,7 +3203,6 @@ xl_stop(sc) sc->xl_cdata.xl_rx_chain[i].xl_mbuf = NULL; } } - bus_dmamap_destroy(sc->xl_mtag, sc->xl_tmpmap); bzero(sc->xl_ldata.xl_rx_list, XL_RX_LIST_SZ); /* * Free the TX list buffers. -- cgit v1.1