1/*- 2 * Copyright (c) 1997, 1998, 1999 3 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 30 * THE POSSIBILITY OF SUCH DAMAGE. 31 */ 32 33#include <sys/cdefs.h> |
34__FBSDID("$FreeBSD: head/sys/dev/sf/if_sf.c 267363 2014-06-11 14:53:58Z jhb $"); |
35 36/* 37 * Adaptec AIC-6915 "Starfire" PCI fast ethernet driver for FreeBSD. 38 * Programming manual is available from: 39 * http://download.adaptec.com/pdfs/user_guides/aic6915_pg.pdf. 40 * 41 * Written by Bill Paul <wpaul@ctr.columbia.edu> 42 * Department of Electical Engineering --- 1244 unchanged lines hidden (view full) --- 1287sf_dma_free(struct sf_softc *sc) 1288{ 1289 struct sf_txdesc *txd; 1290 struct sf_rxdesc *rxd; 1291 int i; 1292 1293 /* Tx ring. */ 1294 if (sc->sf_cdata.sf_tx_ring_tag) { |
1295 if (sc->sf_rdata.sf_tx_ring_paddr) |
1296 bus_dmamap_unload(sc->sf_cdata.sf_tx_ring_tag, 1297 sc->sf_cdata.sf_tx_ring_map); |
1298 if (sc->sf_rdata.sf_tx_ring) |
1299 bus_dmamem_free(sc->sf_cdata.sf_tx_ring_tag, 1300 sc->sf_rdata.sf_tx_ring, 1301 sc->sf_cdata.sf_tx_ring_map); 1302 sc->sf_rdata.sf_tx_ring = NULL; |
1303 sc->sf_rdata.sf_tx_ring_paddr = 0; |
1304 bus_dma_tag_destroy(sc->sf_cdata.sf_tx_ring_tag); 1305 sc->sf_cdata.sf_tx_ring_tag = NULL; 1306 } 1307 /* Tx completion ring. */ 1308 if (sc->sf_cdata.sf_tx_cring_tag) { |
1309 if (sc->sf_rdata.sf_tx_cring_paddr) |
1310 bus_dmamap_unload(sc->sf_cdata.sf_tx_cring_tag, 1311 sc->sf_cdata.sf_tx_cring_map); |
1312 if (sc->sf_rdata.sf_tx_cring) |
1313 bus_dmamem_free(sc->sf_cdata.sf_tx_cring_tag, 1314 sc->sf_rdata.sf_tx_cring, 1315 sc->sf_cdata.sf_tx_cring_map); 1316 sc->sf_rdata.sf_tx_cring = NULL; |
1317 sc->sf_rdata.sf_tx_cring_paddr = 0; |
1318 bus_dma_tag_destroy(sc->sf_cdata.sf_tx_cring_tag); 1319 sc->sf_cdata.sf_tx_cring_tag = NULL; 1320 } 1321 /* Rx ring. */ 1322 if (sc->sf_cdata.sf_rx_ring_tag) { |
1323 if (sc->sf_rdata.sf_rx_ring_paddr) |
1324 bus_dmamap_unload(sc->sf_cdata.sf_rx_ring_tag, 1325 sc->sf_cdata.sf_rx_ring_map); |
1326 if (sc->sf_rdata.sf_rx_ring) |
1327 bus_dmamem_free(sc->sf_cdata.sf_rx_ring_tag, 1328 sc->sf_rdata.sf_rx_ring, 1329 sc->sf_cdata.sf_rx_ring_map); 1330 sc->sf_rdata.sf_rx_ring = NULL; |
1331 sc->sf_rdata.sf_rx_ring_paddr = 0; |
1332 bus_dma_tag_destroy(sc->sf_cdata.sf_rx_ring_tag); 1333 sc->sf_cdata.sf_rx_ring_tag = NULL; 1334 } 1335 /* Rx completion ring. */ 1336 if (sc->sf_cdata.sf_rx_cring_tag) { |
1337 if (sc->sf_rdata.sf_rx_cring_paddr) |
1338 bus_dmamap_unload(sc->sf_cdata.sf_rx_cring_tag, 1339 sc->sf_cdata.sf_rx_cring_map); |
1340 if (sc->sf_rdata.sf_rx_cring) |
1341 bus_dmamem_free(sc->sf_cdata.sf_rx_cring_tag, 1342 sc->sf_rdata.sf_rx_cring, 1343 sc->sf_cdata.sf_rx_cring_map); 1344 sc->sf_rdata.sf_rx_cring = NULL; |
1345 sc->sf_rdata.sf_rx_cring_paddr = 0; |
1346 bus_dma_tag_destroy(sc->sf_cdata.sf_rx_cring_tag); 1347 sc->sf_cdata.sf_rx_cring_tag = NULL; 1348 } 1349 /* Tx buffers. */ 1350 if (sc->sf_cdata.sf_tx_tag) { 1351 for (i = 0; i < SF_TX_DLIST_CNT; i++) { 1352 txd = &sc->sf_cdata.sf_txdesc[i]; 1353 if (txd->tx_dmamap) { --- 1378 unchanged lines hidden --- |