Page MenuHomeFreeBSD

Fix 8259 IRQ priority resolver.
ClosedPublic

Authored by neel on Dec 16 2014, 7:25 AM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 11 2024, 11:56 PM
Unknown Object (File)
Nov 22 2024, 8:14 AM
Unknown Object (File)
Nov 14 2024, 2:53 PM
Unknown Object (File)
Oct 14 2024, 6:58 PM
Unknown Object (File)
Oct 14 2024, 6:58 PM
Unknown Object (File)
Oct 14 2024, 6:42 PM
Unknown Object (File)
Sep 30 2024, 7:43 PM
Unknown Object (File)
Sep 16 2024, 3:20 AM
Subscribers
None

Details

Reviewers
grehan
tychon
jhb
Summary

Fix 8259 IRQ priority resolver.
Initialize the 8259 such that IRQ7 is the lowest priority.

Test Plan

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

neel retitled this revision from to Fix 8259 IRQ priority resolver..
neel updated this object.
neel edited the test plan for this revision. (Show Details)
neel added reviewers: tychon, jhb, grehan.

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");
	}
}
tychon edited edge metadata.

I had written a similar test-stub when I wrote the code originally. Obviously, I misinterpreted the results :-(

Regardless, this change looks good!

This revision is now accepted and ready to land.Dec 16 2014, 9:18 PM