summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>2001-10-16 12:55:38 +0000
committerbde <bde@FreeBSD.org>2001-10-16 12:55:38 +0000
commitd5d14ab023c7b4b3a401d7d70aef4dbf952622d1 (patch)
treefedbd89cf3491a6388dbfcc3cc3af32e01532093 /sys
parenta06986b04d2d9449f65dfc0322642daaa6ff5279 (diff)
downloadFreeBSD-src-d5d14ab023c7b4b3a401d7d70aef4dbf952622d1.zip
FreeBSD-src-d5d14ab023c7b4b3a401d7d70aef4dbf952622d1.tar.gz
Commit my old fixes for cosmetic bugs in npxprobe() so that they aren't
lost when the buggy code goes away completely: - don't assume that the npx irq number is >= 8. Rev.1.73 only reversed part of the hard-coding of it to 13 in rev.1.66. - backed out the part of rev.1.84 that added a highly confused comment about an enable_intr() being "highly bogus". The whole reason for existence of npxprobe() (separate from the main probe, npxprobe1()) is to handle the complications to make this enable_intr() safe. - backed out the part of rev.1.94 that modified npxprobe(). It mainly broke the enable_intr() to restore_intr(). Restoring the interrupt state in a nested way is precisely what is not wanted here. It was harmless in practice because npxprobe() is called with interrupts enabled, so restoring the interrupt state enables interrupts. Most of npxprobe() is a no-op for the same reason...
Diffstat (limited to 'sys')
-rw-r--r--sys/amd64/amd64/fpu.c21
-rw-r--r--sys/amd64/isa/npx.c21
-rw-r--r--sys/i386/isa/npx.c21
3 files changed, 24 insertions, 39 deletions
diff --git a/sys/amd64/amd64/fpu.c b/sys/amd64/amd64/fpu.c
index 87bfe16..7323d19 100644
--- a/sys/amd64/amd64/fpu.c
+++ b/sys/amd64/amd64/fpu.c
@@ -297,7 +297,7 @@ npx_probe(dev)
#else /* SMP */
int result;
- critical_t savecrit;
+ u_long save_eflags;
u_char save_icu1_mask;
u_char save_icu2_mask;
struct gate_descriptor save_idt_npxtrap;
@@ -311,29 +311,24 @@ npx_probe(dev)
if (resource_int_value("npx", 0, "irq", &npx_irq) != 0)
npx_irq = 13;
npx_intrno = NRSVIDT + npx_irq;
- savecrit = critical_enter();
+ save_eflags = read_eflags();
+ disable_intr();
save_icu1_mask = inb(IO_ICU1 + 1);
save_icu2_mask = inb(IO_ICU2 + 1);
save_idt_npxintr = idt[npx_intrno];
save_idt_npxtrap = idt[16];
- outb(IO_ICU1 + 1, ~IRQ_SLAVE);
- outb(IO_ICU2 + 1, ~(1 << (npx_irq - 8)));
+ outb(IO_ICU1 + 1, ~(IRQ_SLAVE | (1 << npx_irq)));
+ outb(IO_ICU2 + 1, ~((1 << npx_irq) >> 8));
setidt(16, probetrap, SDT_SYS386TGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL));
setidt(npx_intrno, probeintr, SDT_SYS386IGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL));
-
- /*
- * XXX This looks highly bogus, but it appears that npc_probe1
- * needs interrupts enabled. Does this make any difference
- * here?
- */
- critical_exit(savecrit);
+ enable_intr();
result = npx_probe1(dev);
- savecrit = critical_enter();
+ disable_intr();
outb(IO_ICU1 + 1, save_icu1_mask);
outb(IO_ICU2 + 1, save_icu2_mask);
idt[npx_intrno] = save_idt_npxintr;
idt[16] = save_idt_npxtrap;
- critical_exit(savecrit);
+ write_eflags(save_eflags);
return (result);
#endif /* SMP */
diff --git a/sys/amd64/isa/npx.c b/sys/amd64/isa/npx.c
index 87bfe16..7323d19 100644
--- a/sys/amd64/isa/npx.c
+++ b/sys/amd64/isa/npx.c
@@ -297,7 +297,7 @@ npx_probe(dev)
#else /* SMP */
int result;
- critical_t savecrit;
+ u_long save_eflags;
u_char save_icu1_mask;
u_char save_icu2_mask;
struct gate_descriptor save_idt_npxtrap;
@@ -311,29 +311,24 @@ npx_probe(dev)
if (resource_int_value("npx", 0, "irq", &npx_irq) != 0)
npx_irq = 13;
npx_intrno = NRSVIDT + npx_irq;
- savecrit = critical_enter();
+ save_eflags = read_eflags();
+ disable_intr();
save_icu1_mask = inb(IO_ICU1 + 1);
save_icu2_mask = inb(IO_ICU2 + 1);
save_idt_npxintr = idt[npx_intrno];
save_idt_npxtrap = idt[16];
- outb(IO_ICU1 + 1, ~IRQ_SLAVE);
- outb(IO_ICU2 + 1, ~(1 << (npx_irq - 8)));
+ outb(IO_ICU1 + 1, ~(IRQ_SLAVE | (1 << npx_irq)));
+ outb(IO_ICU2 + 1, ~((1 << npx_irq) >> 8));
setidt(16, probetrap, SDT_SYS386TGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL));
setidt(npx_intrno, probeintr, SDT_SYS386IGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL));
-
- /*
- * XXX This looks highly bogus, but it appears that npc_probe1
- * needs interrupts enabled. Does this make any difference
- * here?
- */
- critical_exit(savecrit);
+ enable_intr();
result = npx_probe1(dev);
- savecrit = critical_enter();
+ disable_intr();
outb(IO_ICU1 + 1, save_icu1_mask);
outb(IO_ICU2 + 1, save_icu2_mask);
idt[npx_intrno] = save_idt_npxintr;
idt[16] = save_idt_npxtrap;
- critical_exit(savecrit);
+ write_eflags(save_eflags);
return (result);
#endif /* SMP */
diff --git a/sys/i386/isa/npx.c b/sys/i386/isa/npx.c
index 87bfe16..7323d19 100644
--- a/sys/i386/isa/npx.c
+++ b/sys/i386/isa/npx.c
@@ -297,7 +297,7 @@ npx_probe(dev)
#else /* SMP */
int result;
- critical_t savecrit;
+ u_long save_eflags;
u_char save_icu1_mask;
u_char save_icu2_mask;
struct gate_descriptor save_idt_npxtrap;
@@ -311,29 +311,24 @@ npx_probe(dev)
if (resource_int_value("npx", 0, "irq", &npx_irq) != 0)
npx_irq = 13;
npx_intrno = NRSVIDT + npx_irq;
- savecrit = critical_enter();
+ save_eflags = read_eflags();
+ disable_intr();
save_icu1_mask = inb(IO_ICU1 + 1);
save_icu2_mask = inb(IO_ICU2 + 1);
save_idt_npxintr = idt[npx_intrno];
save_idt_npxtrap = idt[16];
- outb(IO_ICU1 + 1, ~IRQ_SLAVE);
- outb(IO_ICU2 + 1, ~(1 << (npx_irq - 8)));
+ outb(IO_ICU1 + 1, ~(IRQ_SLAVE | (1 << npx_irq)));
+ outb(IO_ICU2 + 1, ~((1 << npx_irq) >> 8));
setidt(16, probetrap, SDT_SYS386TGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL));
setidt(npx_intrno, probeintr, SDT_SYS386IGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL));
-
- /*
- * XXX This looks highly bogus, but it appears that npc_probe1
- * needs interrupts enabled. Does this make any difference
- * here?
- */
- critical_exit(savecrit);
+ enable_intr();
result = npx_probe1(dev);
- savecrit = critical_enter();
+ disable_intr();
outb(IO_ICU1 + 1, save_icu1_mask);
outb(IO_ICU2 + 1, save_icu2_mask);
idt[npx_intrno] = save_idt_npxintr;
idt[16] = save_idt_npxtrap;
- critical_exit(savecrit);
+ write_eflags(save_eflags);
return (result);
#endif /* SMP */
OpenPOWER on IntegriCloud