summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorBrad Smith <brad@cvs.openbsd.org>2006-11-28 04:26:51 +0000
committerBrad Smith <brad@cvs.openbsd.org>2006-11-28 04:26:51 +0000
commitf83d6e276216af3560667ef8deb35394cbbd71f3 (patch)
tree0180cc394f155ad8b2361cce0a58211fcde27fbc /sys/dev
parent20b19009d18d3bc82abb12599f53aad5b9de3e7f (diff)
- ixgb_dma_alloc(): Uncomment the line setting the DMA tag to NUL upon failure.
- ixgb_dma_free(): Return if the DMA tag is NUL.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/if_ixgb.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/sys/dev/pci/if_ixgb.c b/sys/dev/pci/if_ixgb.c
index 9d49d8cba03..fa0a282d30e 100644
--- a/sys/dev/pci/if_ixgb.c
+++ b/sys/dev/pci/if_ixgb.c
@@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE.
***************************************************************************/
-/* $OpenBSD: if_ixgb.c,v 1.33 2006/11/28 02:22:39 brad Exp $ */
+/* $OpenBSD: if_ixgb.c,v 1.34 2006/11/28 04:26:50 brad Exp $ */
#include <dev/pci/if_ixgb.h>
@@ -1125,17 +1125,25 @@ fail_1:
bus_dmamap_destroy(dma->dma_tag, dma->dma_map);
fail_0:
dma->dma_map = NULL;
- /* dma->dma_tag = NULL; */
+ dma->dma_tag = NULL;
return (r);
}
void
ixgb_dma_free(struct ixgb_softc *sc, struct ixgb_dma_alloc *dma)
{
- bus_dmamap_unload(dma->dma_tag, dma->dma_map);
- bus_dmamem_unmap(dma->dma_tag, dma->dma_vaddr, dma->dma_size);
- bus_dmamem_free(dma->dma_tag, &dma->dma_seg, dma->dma_nseg);
- bus_dmamap_destroy(dma->dma_tag, dma->dma_map);
+ if (dma->dma_tag == NULL)
+ return;
+
+ if (dma->dma_map != NULL) {
+ bus_dmamap_sync(dma->dma_tag, dma->dma_map, 0,
+ dma->dma_map->dm_mapsize,
+ BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
+ bus_dmamap_unload(dma->dma_tag, dma->dma_map);
+ bus_dmamem_unmap(dma->dma_tag, dma->dma_vaddr, dma->dma_size);
+ bus_dmamem_free(dma->dma_tag, &dma->dma_seg, dma->dma_nseg);
+ bus_dmamap_destroy(dma->dma_tag, dma->dma_map);
+ }
}
/*********************************************************************