1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-17 15:27:36 +00:00

Don't hardcode IRQ 13 for NPX. It's as good as hardwired in the hardware

though, on systems (386 mostly) that still have a seperate fpu, but it
might be possible to find systems where the FPU coprocessor is wired to
a different IRQ pin.
This commit is contained in:
Peter Wemm 1999-05-15 17:58:58 +00:00
parent 64cd03f38e
commit 2f2ffb8d2c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=47226
3 changed files with 33 additions and 18 deletions

View File

@ -32,7 +32,7 @@
* SUCH DAMAGE.
*
* from: @(#)npx.c 7.2 (Berkeley) 5/12/91
* $Id: npx.c,v 1.71 1999/05/08 21:59:27 dfr Exp $
* $Id: npx.c,v 1.72 1999/05/11 16:29:18 luoqi Exp $
*/
#include "npx.h"
@ -146,6 +146,7 @@ static volatile u_int npx_traps_while_probing;
static bool_t npx_ex16;
static bool_t npx_exists;
static bool_t npx_irq13;
static int npx_irq; /* irq number */
#ifndef SMP
/*
@ -196,6 +197,8 @@ npx_probe(dev)
{
#ifdef SMP
if (resource_int_value("npx", 0, "irq", &npx_irq) != 0)
npx_irq = 13;
return npx_probe1(dev);
#else /* SMP */
@ -213,7 +216,9 @@ npx_probe(dev)
* install suitable handlers and run with interrupts enabled so we
* won't need to do so much here.
*/
npx_intrno = NRSVIDT + 13;
if (resource_int_value("npx", 0, "irq", &npx_irq) != 0)
npx_irq = 13;
npx_intrno = NRSVIDT + npx_irq;
save_eflags = read_eflags();
disable_intr();
save_icu1_mask = inb(IO_ICU1 + 1);
@ -221,7 +226,7 @@ npx_probe(dev)
save_idt_npxintr = idt[npx_intrno];
save_idt_npxtrap = idt[16];
outb(IO_ICU1 + 1, ~IRQ_SLAVE);
outb(IO_ICU2 + 1, ~(1 << (13 - 8)));
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));
npx_idt_probeintr = idt[npx_intrno];
@ -342,9 +347,9 @@ npx_probe1(dev)
*/
npx_irq13 = 1;
/*
* npxattach would be too late to set npx0_imask.
* npxattach would be too late to set npx0_imask
*/
npx0_imask |= (1 << 13);
npx0_imask |= (1 << npx_irq);
/*
* We allocate these resources permanently,
@ -358,7 +363,7 @@ npx_probe1(dev)
panic("npx: can't get ports");
rid = 0;
r = bus_alloc_resource(dev, SYS_RES_IRQ,
&rid, 13, 13,
&rid, npx_irq, npx_irq,
1, RF_ACTIVE);
if (r == 0)
panic("npx: can't get IRQ");

View File

@ -32,7 +32,7 @@
* SUCH DAMAGE.
*
* from: @(#)npx.c 7.2 (Berkeley) 5/12/91
* $Id: npx.c,v 1.71 1999/05/08 21:59:27 dfr Exp $
* $Id: npx.c,v 1.72 1999/05/11 16:29:18 luoqi Exp $
*/
#include "npx.h"
@ -146,6 +146,7 @@ static volatile u_int npx_traps_while_probing;
static bool_t npx_ex16;
static bool_t npx_exists;
static bool_t npx_irq13;
static int npx_irq; /* irq number */
#ifndef SMP
/*
@ -196,6 +197,8 @@ npx_probe(dev)
{
#ifdef SMP
if (resource_int_value("npx", 0, "irq", &npx_irq) != 0)
npx_irq = 13;
return npx_probe1(dev);
#else /* SMP */
@ -213,7 +216,9 @@ npx_probe(dev)
* install suitable handlers and run with interrupts enabled so we
* won't need to do so much here.
*/
npx_intrno = NRSVIDT + 13;
if (resource_int_value("npx", 0, "irq", &npx_irq) != 0)
npx_irq = 13;
npx_intrno = NRSVIDT + npx_irq;
save_eflags = read_eflags();
disable_intr();
save_icu1_mask = inb(IO_ICU1 + 1);
@ -221,7 +226,7 @@ npx_probe(dev)
save_idt_npxintr = idt[npx_intrno];
save_idt_npxtrap = idt[16];
outb(IO_ICU1 + 1, ~IRQ_SLAVE);
outb(IO_ICU2 + 1, ~(1 << (13 - 8)));
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));
npx_idt_probeintr = idt[npx_intrno];
@ -342,9 +347,9 @@ npx_probe1(dev)
*/
npx_irq13 = 1;
/*
* npxattach would be too late to set npx0_imask.
* npxattach would be too late to set npx0_imask
*/
npx0_imask |= (1 << 13);
npx0_imask |= (1 << npx_irq);
/*
* We allocate these resources permanently,
@ -358,7 +363,7 @@ npx_probe1(dev)
panic("npx: can't get ports");
rid = 0;
r = bus_alloc_resource(dev, SYS_RES_IRQ,
&rid, 13, 13,
&rid, npx_irq, npx_irq,
1, RF_ACTIVE);
if (r == 0)
panic("npx: can't get IRQ");

View File

@ -32,7 +32,7 @@
* SUCH DAMAGE.
*
* from: @(#)npx.c 7.2 (Berkeley) 5/12/91
* $Id: npx.c,v 1.71 1999/05/08 21:59:27 dfr Exp $
* $Id: npx.c,v 1.72 1999/05/11 16:29:18 luoqi Exp $
*/
#include "npx.h"
@ -146,6 +146,7 @@ static volatile u_int npx_traps_while_probing;
static bool_t npx_ex16;
static bool_t npx_exists;
static bool_t npx_irq13;
static int npx_irq; /* irq number */
#ifndef SMP
/*
@ -196,6 +197,8 @@ npx_probe(dev)
{
#ifdef SMP
if (resource_int_value("npx", 0, "irq", &npx_irq) != 0)
npx_irq = 13;
return npx_probe1(dev);
#else /* SMP */
@ -213,7 +216,9 @@ npx_probe(dev)
* install suitable handlers and run with interrupts enabled so we
* won't need to do so much here.
*/
npx_intrno = NRSVIDT + 13;
if (resource_int_value("npx", 0, "irq", &npx_irq) != 0)
npx_irq = 13;
npx_intrno = NRSVIDT + npx_irq;
save_eflags = read_eflags();
disable_intr();
save_icu1_mask = inb(IO_ICU1 + 1);
@ -221,7 +226,7 @@ npx_probe(dev)
save_idt_npxintr = idt[npx_intrno];
save_idt_npxtrap = idt[16];
outb(IO_ICU1 + 1, ~IRQ_SLAVE);
outb(IO_ICU2 + 1, ~(1 << (13 - 8)));
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));
npx_idt_probeintr = idt[npx_intrno];
@ -342,9 +347,9 @@ npx_probe1(dev)
*/
npx_irq13 = 1;
/*
* npxattach would be too late to set npx0_imask.
* npxattach would be too late to set npx0_imask
*/
npx0_imask |= (1 << 13);
npx0_imask |= (1 << npx_irq);
/*
* We allocate these resources permanently,
@ -358,7 +363,7 @@ npx_probe1(dev)
panic("npx: can't get ports");
rid = 0;
r = bus_alloc_resource(dev, SYS_RES_IRQ,
&rid, 13, 13,
&rid, npx_irq, npx_irq,
1, RF_ACTIVE);
if (r == 0)
panic("npx: can't get IRQ");