Sometimes, when asked to return region A..C, we'd return A+N..C+N
instead of failing. When looking for a region to allocate, we used to check to see if the start address was < end. In the case where A..B is allocated already, and one wants to allocate A..C (B < C), then this test would improperly fail (which means we'd examine that region as a possible one), and we'd return the region B+1..C+(B-A+1) rather than NULL. Since C+(B-A+1) is necessarily larger than C (end argument), this is incorrect behavior for rman_reserve_resource_bound(). The fix is to exclude those regions where r->r_start + count - 1 > end rather than r->r_start > end. This bug has been in this code for a very long time. I believe that all other tests against end are correctly done. This is why sio0 generated a message about interrupts not being enabled properly for the device. When fdc had a bug that allocated from 0x3f7 to 0x3fb, sio0 was then given 0x3fc-0x404 rather than the 0x3f8-0x3ff that it wanted. Now when fdc has the same bug, sio0 fails to allocate its ports, which is the proper behavior. Since the probe failed, we never saw the messed up resources reported. I suspect that there are other places in the tree that have weird looping or other odd work arounds to try to cope with the observed weirdness this bug can introduce. These workarounds should be located and eliminated. Minor debug write fix to match the above test done as well. 'nice' by: mdodd Sponsored by: timing solutions (http://www.timing.com/)
This commit is contained in:
parent
a33ab77447
commit
358fef538f
@ -217,8 +217,9 @@ rman_reserve_resource_bound(struct rman *rm, u_long start, u_long end,
|
||||
*/
|
||||
for (s = r; s; s = TAILQ_NEXT(s, r_link)) {
|
||||
DPRINTF(("considering [%#lx, %#lx]\n", s->r_start, s->r_end));
|
||||
if (s->r_start > end) {
|
||||
DPRINTF(("s->r_start (%#lx) > end (%#lx)\n", s->r_start, end));
|
||||
if (s->r_start + count - 1 > end) {
|
||||
DPRINTF(("s->r_start (%#lx) + count - 1> end (%#lx)\n",
|
||||
s->r_start, end));
|
||||
break;
|
||||
}
|
||||
if (s->r_flags & RF_ALLOCATED) {
|
||||
|
Loading…
Reference in New Issue
Block a user