Fix 8259 IRQ priority resolver.
Initialize the 8259 such that IRQ7 is the lowest priority.
Details
I wrote a small C program to dump the priorities using the current method
and the new method. It is easy to see the difference in behavior using this.
oldprio(7) 0 1 2 3 4 5 6 7
newprio(7) 0 1 2 3 4 5 6 7
oldprio(6) 1 2 3 4 5 6 7 0
newprio(6) 7 0 1 2 3 4 5 6
oldprio(5) 2 3 4 5 6 7 0 1
newprio(5) 6 7 0 1 2 3 4 5
oldprio(4) 3 4 5 6 7 0 1 2
newprio(4) 5 6 7 0 1 2 3 4
oldprio(3) 4 5 6 7 0 1 2 3
newprio(3) 4 5 6 7 0 1 2 3
oldprio(2) 5 6 7 0 1 2 3 4
newprio(2) 3 4 5 6 7 0 1 2
oldprio(1) 6 7 0 1 2 3 4 5
newprio(1) 2 3 4 5 6 7 0 1
oldprio(0) 7 0 1 2 3 4 5 6
newprio(0) 1 2 3 4 5 6 7 0
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
No Lint Coverage - Unit
No Test Coverage
Event Timeline
The C program mentioned in the Test Plan:
#include <stdio.h> static void dump_old_priorities(int prio) { int i, pin; for (i = 0; i < 8; i++) { pin = (i + 7 - prio) & 0x7; printf(" %d", pin); } } #define ATPIC_PIN_FOREACH(pinvar, tmpvar) \ for (tmpvar = 0, pinvar = (prio + 1) & 0x7; \ tmpvar < 8; \ tmpvar++, pinvar = (pinvar + 1) & 0x7) static void dump_new_priorities(int prio) { int pin, tmp; ATPIC_PIN_FOREACH(pin, tmp) { printf(" %d", pin); } } int main(int argc, char *argv[]) { int prio; for (prio = 7; prio >= 0; prio--) { printf("oldprio(%d)\t", prio); dump_old_priorities(prio); printf("\n"); printf("newprio(%d)\t", prio); dump_new_priorities(prio); printf("\n\n"); } }
I had written a similar test-stub when I wrote the code originally. Obviously, I misinterpreted the results :-(
Regardless, this change looks good!