summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorscottl <scottl@FreeBSD.org>2004-09-08 04:54:19 +0000
committerscottl <scottl@FreeBSD.org>2004-09-08 04:54:19 +0000
commite23092c9a97f1b039a77c6653725aa3ee0ef2053 (patch)
treeb4a52ac7a4f3b9428196e77949cd5fcfe552b0ab
parent143d77da28b1eae3998141ecdbf493f35562a44e (diff)
downloadFreeBSD-src-e23092c9a97f1b039a77c6653725aa3ee0ef2053.zip
FreeBSD-src-e23092c9a97f1b039a77c6653725aa3ee0ef2053.tar.gz
Fix a problem with tag->boundary inheritence that has existed since day one
and was propagated to nearly every platform. The boundary of the child needs to consider the boundary of the parent and pick the minimum of the two, not the maximum. However, if either is 0 then pick the appropriate one. This bug was exposed by a recent change to ATA, which should now be fixed by this change. The alignment and maxsegsz tag attributes likely also need a similar review in the near future. This is a MT5 candidate. Reviewed by: marcel Submitted by: sos (in part)
-rw-r--r--sys/alpha/alpha/busdma_machdep.c10
-rw-r--r--sys/amd64/amd64/busdma_machdep.c10
-rw-r--r--sys/arm/arm/busdma_machdep.c11
-rw-r--r--sys/i386/i386/busdma_machdep.c10
-rw-r--r--sys/ia64/ia64/busdma_machdep.c10
-rw-r--r--sys/powerpc/powerpc/busdma_machdep.c11
-rw-r--r--sys/sparc64/sparc64/bus_machdep.c11
7 files changed, 35 insertions, 38 deletions
diff --git a/sys/alpha/alpha/busdma_machdep.c b/sys/alpha/alpha/busdma_machdep.c
index 4497167..0dc361c 100644
--- a/sys/alpha/alpha/busdma_machdep.c
+++ b/sys/alpha/alpha/busdma_machdep.c
@@ -229,11 +229,11 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment,
if (parent != NULL) {
newtag->lowaddr = MIN(parent->lowaddr, newtag->lowaddr);
newtag->highaddr = MAX(parent->highaddr, newtag->highaddr);
- /*
- * XXX Not really correct??? Probably need to honor boundary
- * all the way up the inheritence chain.
- */
- newtag->boundary = MAX(parent->boundary, newtag->boundary);
+ if (newtag->boundary == 0)
+ newtag->boundary = parent->boundary;
+ else if (parent->boundary != 0)
+ newtag->boundary = MIN(parent->boundary,
+ newtag->boundary);
if (newtag->filter == NULL) {
/*
* Short circuit looking at our parent directly
diff --git a/sys/amd64/amd64/busdma_machdep.c b/sys/amd64/amd64/busdma_machdep.c
index 8ea33e9..c10bad3 100644
--- a/sys/amd64/amd64/busdma_machdep.c
+++ b/sys/amd64/amd64/busdma_machdep.c
@@ -248,11 +248,11 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment,
if (parent != NULL) {
newtag->lowaddr = MIN(parent->lowaddr, newtag->lowaddr);
newtag->highaddr = MAX(parent->highaddr, newtag->highaddr);
- /*
- * XXX Not really correct??? Probably need to honor boundary
- * all the way up the inheritence chain.
- */
- newtag->boundary = MAX(parent->boundary, newtag->boundary);
+ if (newtag->boundary == 0)
+ newtag->boundary = parent->boundary;
+ else if (parent->boundary != 0)
+ newtag->boundary = MIN(parent->boundary,
+ newtag->boundary);
if (newtag->filter == NULL) {
/*
* Short circuit looking at our parent directly
diff --git a/sys/arm/arm/busdma_machdep.c b/sys/arm/arm/busdma_machdep.c
index 117e808..2a97646 100644
--- a/sys/arm/arm/busdma_machdep.c
+++ b/sys/arm/arm/busdma_machdep.c
@@ -207,12 +207,11 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment,
if (parent != NULL) {
newtag->lowaddr = min(parent->lowaddr, newtag->lowaddr);
newtag->highaddr = max(parent->highaddr, newtag->highaddr);
-
- /*
- * XXX Not really correct??? Probably need to honor boundary
- * all the way up the inheritence chain.
- */
- newtag->boundary = max(parent->boundary, newtag->boundary);
+ if (newtag->boundary == 0)
+ newtag->boundary = parent->boundary;
+ else if (parent->boundary != 0)
+ newtag->boundary = min(parent->boundary,
+ newtag->boundary);
if (newtag->filter == NULL) {
/*
* Short circuit looking at our parent directly
diff --git a/sys/i386/i386/busdma_machdep.c b/sys/i386/i386/busdma_machdep.c
index 8ea33e9..c10bad3 100644
--- a/sys/i386/i386/busdma_machdep.c
+++ b/sys/i386/i386/busdma_machdep.c
@@ -248,11 +248,11 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment,
if (parent != NULL) {
newtag->lowaddr = MIN(parent->lowaddr, newtag->lowaddr);
newtag->highaddr = MAX(parent->highaddr, newtag->highaddr);
- /*
- * XXX Not really correct??? Probably need to honor boundary
- * all the way up the inheritence chain.
- */
- newtag->boundary = MAX(parent->boundary, newtag->boundary);
+ if (newtag->boundary == 0)
+ newtag->boundary = parent->boundary;
+ else if (parent->boundary != 0)
+ newtag->boundary = MIN(parent->boundary,
+ newtag->boundary);
if (newtag->filter == NULL) {
/*
* Short circuit looking at our parent directly
diff --git a/sys/ia64/ia64/busdma_machdep.c b/sys/ia64/ia64/busdma_machdep.c
index 517aef9..2c19085 100644
--- a/sys/ia64/ia64/busdma_machdep.c
+++ b/sys/ia64/ia64/busdma_machdep.c
@@ -247,11 +247,11 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment,
if (parent != NULL) {
newtag->lowaddr = MIN(parent->lowaddr, newtag->lowaddr);
newtag->highaddr = MAX(parent->highaddr, newtag->highaddr);
- /*
- * XXX Not really correct??? Probably need to honor boundary
- * all the way up the inheritence chain.
- */
- newtag->boundary = MAX(parent->boundary, newtag->boundary);
+ if (newtag->boundary == 0)
+ newtag->boundary = parent->boundary;
+ else if (parent->boundary != 0)
+ newtag->boundary = MIN(parent->boundary,
+ newtag->boundary);
if (newtag->filter == NULL) {
/*
* Short circuit looking at our parent directly
diff --git a/sys/powerpc/powerpc/busdma_machdep.c b/sys/powerpc/powerpc/busdma_machdep.c
index a97c535..f058f5f 100644
--- a/sys/powerpc/powerpc/busdma_machdep.c
+++ b/sys/powerpc/powerpc/busdma_machdep.c
@@ -167,12 +167,11 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment,
if (parent != NULL) {
newtag->lowaddr = min(parent->lowaddr, newtag->lowaddr);
newtag->highaddr = max(parent->highaddr, newtag->highaddr);
-
- /*
- * XXX Not really correct??? Probably need to honor boundary
- * all the way up the inheritence chain.
- */
- newtag->boundary = max(parent->boundary, newtag->boundary);
+ if (newtag->boundary == 0)
+ newtag->boundary = parent->boundary;
+ else if (parent->boundary != 0)
+ newtag->boundary = MIN(parent->boundary,
+ newtag->boundary);
if (newtag->filter == NULL) {
/*
* Short circuit looking at our parent directly
diff --git a/sys/sparc64/sparc64/bus_machdep.c b/sys/sparc64/sparc64/bus_machdep.c
index d1cdac8..47f4183 100644
--- a/sys/sparc64/sparc64/bus_machdep.c
+++ b/sys/sparc64/sparc64/bus_machdep.c
@@ -255,12 +255,11 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment,
newtag->dt_lowaddr);
newtag->dt_highaddr = ulmax(parent->dt_highaddr,
newtag->dt_highaddr);
- /*
- * XXX Not really correct??? Probably need to honor boundary
- * all the way up the inheritence chain.
- */
- newtag->dt_boundary = ulmin(parent->dt_boundary,
- newtag->dt_boundary);
+ if (newtag->dt_boundary == 0)
+ newtag->dt_boundary = parent->dt_boundary;
+ else if (parent->dt_boundary != 0)
+ newtag->dt_boundary = ulmin(parent->dt_boundary,
+ newtag->dt_boundary);
atomic_add_int(&parent->dt_ref_count, 1);
}
OpenPOWER on IntegriCloud