Module Name: src
Committed By: dyoung
Date: Wed Sep 28 01:35:58 UTC 2011
Modified Files:
src/sys/arch/x86/x86: bus_dma.c
Log Message:
In bus_dma_tag_create(9), copy important properties (e.g., bounce
parameters) from the parent tag.
In bus_dma_tag_create(), increase the reference count on a parent
bus_dma_tag_t (if applicable), and decrease the reference count in
bus_dma_tag_destroy().
Don't let bus_dmatag_destroy(9) destroy an overridden bus_dma_tag_t.
To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/x86/x86/bus_dma.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/x86/x86/bus_dma.c
diff -u src/sys/arch/x86/x86/bus_dma.c:1.64 src/sys/arch/x86/x86/bus_dma.c:1.65
--- src/sys/arch/x86/x86/bus_dma.c:1.64 Wed Sep 28 01:33:26 2011
+++ src/sys/arch/x86/x86/bus_dma.c Wed Sep 28 01:35:58 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_dma.c,v 1.64 2011/09/28 01:33:26 dyoung Exp $ */
+/* $NetBSD: bus_dma.c,v 1.65 2011/09/28 01:35:58 dyoung Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2007 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.64 2011/09/28 01:33:26 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.65 2011/09/28 01:35:58 dyoung Exp $");
/*
* The following is included because _bus_dma_uiomove is derived from
@@ -1623,6 +1623,8 @@ bit_to_function_pointer(const struct bus
void
bus_dma_tag_destroy(bus_dma_tag_t bdt)
{
+ if (bdt->bdt_super != NULL)
+ bus_dmatag_destroy(bdt->bdt_super);
kmem_free(bdt, sizeof(struct x86_bus_dma_tag));
}
@@ -1642,6 +1644,10 @@ bus_dma_tag_create(bus_dma_tag_t obdt, c
if (bdt == NULL)
return ENOMEM;
+ *bdt = *obdt;
+ /* don't let bus_dmatag_destroy free these */
+ bdt->_tag_needs_free = 0;
+
bdt->bdt_super = obdt;
for (bits = present; bits != 0; bits = nbits) {
@@ -1661,6 +1667,8 @@ bus_dma_tag_create(bus_dma_tag_t obdt, c
bdt->bdt_ctx = ctx;
*bdtp = bdt;
+ if (obdt->_tag_needs_free)
+ obdt->_tag_needs_free++;
return 0;
einval: