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)
This commit is contained in:
parent
55287f2a60
commit
50736a153b
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user