15b81b6b3SRodney W. Grimes /*- 25b81b6b3SRodney W. Grimes * Copyright (c) 1990 William Jolitz. 35b81b6b3SRodney W. Grimes * Copyright (c) 1991 The Regents of the University of California. 45b81b6b3SRodney W. Grimes * All rights reserved. 55b81b6b3SRodney W. Grimes * 65b81b6b3SRodney W. Grimes * Redistribution and use in source and binary forms, with or without 75b81b6b3SRodney W. Grimes * modification, are permitted provided that the following conditions 85b81b6b3SRodney W. Grimes * are met: 95b81b6b3SRodney W. Grimes * 1. Redistributions of source code must retain the above copyright 105b81b6b3SRodney W. Grimes * notice, this list of conditions and the following disclaimer. 115b81b6b3SRodney W. Grimes * 2. Redistributions in binary form must reproduce the above copyright 125b81b6b3SRodney W. Grimes * notice, this list of conditions and the following disclaimer in the 135b81b6b3SRodney W. Grimes * documentation and/or other materials provided with the distribution. 145b81b6b3SRodney W. Grimes * 3. All advertising materials mentioning features or use of this software 155b81b6b3SRodney W. Grimes * must display the following acknowledgement: 165b81b6b3SRodney W. Grimes * This product includes software developed by the University of 175b81b6b3SRodney W. Grimes * California, Berkeley and its contributors. 185b81b6b3SRodney W. Grimes * 4. Neither the name of the University nor the names of its contributors 195b81b6b3SRodney W. Grimes * may be used to endorse or promote products derived from this software 205b81b6b3SRodney W. Grimes * without specific prior written permission. 215b81b6b3SRodney W. Grimes * 225b81b6b3SRodney W. Grimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 235b81b6b3SRodney W. Grimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 245b81b6b3SRodney W. Grimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 255b81b6b3SRodney W. Grimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 265b81b6b3SRodney W. Grimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 275b81b6b3SRodney W. Grimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 285b81b6b3SRodney W. Grimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 295b81b6b3SRodney W. Grimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 305b81b6b3SRodney W. Grimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 315b81b6b3SRodney W. Grimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 325b81b6b3SRodney W. Grimes * SUCH DAMAGE. 335b81b6b3SRodney W. Grimes * 345c644711SRodney W. Grimes * from: @(#)npx.c 7.2 (Berkeley) 5/12/91 35c3aac50fSPeter Wemm * $FreeBSD$ 365b81b6b3SRodney W. Grimes */ 375b81b6b3SRodney W. Grimes 383f2076daSEivind Eklund #include "opt_debug_npx.h" 39d9256606SPeter Wemm #include "opt_math_emulate.h" 40a73af3a2SGarrett Wollman 41f540b106SGarrett Wollman #include <sys/param.h> 42f540b106SGarrett Wollman #include <sys/systm.h> 436182fdbdSPeter Wemm #include <sys/bus.h> 443a34a5c3SPoul-Henning Kamp #include <sys/kernel.h> 45cd59d49dSBruce Evans #include <sys/malloc.h> 466182fdbdSPeter Wemm #include <sys/module.h> 473a34a5c3SPoul-Henning Kamp #include <sys/sysctl.h> 48f540b106SGarrett Wollman #include <sys/proc.h> 496182fdbdSPeter Wemm #include <machine/bus.h> 506182fdbdSPeter Wemm #include <sys/rman.h> 5126add149SBruce Evans #ifdef NPX_DEBUG 52663f1485SBruce Evans #include <sys/syslog.h> 5326add149SBruce Evans #endif 54663f1485SBruce Evans #include <sys/signalvar.h> 552f86936aSGarrett Wollman 56e0605ebdSBruce Evans #ifndef SMP 579081eec1SJohn Polstra #include <machine/asmacros.h> 58e0605ebdSBruce Evans #endif 597f47cf2fSBruce Evans #include <machine/cputypes.h> 607f47cf2fSBruce Evans #include <machine/frame.h> 615400ed3bSPeter Wemm #include <machine/ipl.h> 62c673fe98SBruce Evans #include <machine/md_var.h> 635400ed3bSPeter Wemm #include <machine/pcb.h> 647f47cf2fSBruce Evans #include <machine/psl.h> 65e0605ebdSBruce Evans #ifndef SMP 66663f1485SBruce Evans #include <machine/clock.h> 67e0605ebdSBruce Evans #endif 686182fdbdSPeter Wemm #include <machine/resource.h> 69f540b106SGarrett Wollman #include <machine/specialreg.h> 707f47cf2fSBruce Evans #include <machine/segments.h> 712f86936aSGarrett Wollman 72e0605ebdSBruce Evans #ifndef SMP 73f540b106SGarrett Wollman #include <i386/isa/icu.h> 7468352337SDoug Rabson #include <i386/isa/intr_machdep.h> 75f540b106SGarrett Wollman #include <i386/isa/isa.h> 76e0605ebdSBruce Evans #endif 7754f1d0ceSGarrett Wollman #include <isa/isavar.h> 785b81b6b3SRodney W. Grimes 795b81b6b3SRodney W. Grimes /* 805b81b6b3SRodney W. Grimes * 387 and 287 Numeric Coprocessor Extension (NPX) Driver. 815b81b6b3SRodney W. Grimes */ 825b81b6b3SRodney W. Grimes 831fe04850SBruce Evans /* Configuration flags. */ 841fe04850SBruce Evans #define NPX_DISABLE_I586_OPTIMIZED_BCOPY (1 << 0) 851fe04850SBruce Evans #define NPX_DISABLE_I586_OPTIMIZED_BZERO (1 << 1) 861fe04850SBruce Evans #define NPX_DISABLE_I586_OPTIMIZED_COPYIO (1 << 2) 87a7674320SMartin Cracauer #define NPX_PREFER_EMULATOR (1 << 3) 881fe04850SBruce Evans 895b81b6b3SRodney W. Grimes #ifdef __GNUC__ 905b81b6b3SRodney W. Grimes 9137e52b59SBruce Evans #define fldcw(addr) __asm("fldcw %0" : : "m" (*(addr))) 925b81b6b3SRodney W. Grimes #define fnclex() __asm("fnclex") 935b81b6b3SRodney W. Grimes #define fninit() __asm("fninit") 9437e52b59SBruce Evans #define fnop() __asm("fnop") 951d37f051SBruce Evans #define fnsave(addr) __asm __volatile("fnsave %0" : "=m" (*(addr))) 961d37f051SBruce Evans #define fnstcw(addr) __asm __volatile("fnstcw %0" : "=m" (*(addr))) 971d37f051SBruce Evans #define fnstsw(addr) __asm __volatile("fnstsw %0" : "=m" (*(addr))) 9837e52b59SBruce Evans #define fp_divide_by_0() __asm("fldz; fld1; fdiv %st,%st(1); fnop") 9937e52b59SBruce Evans #define frstor(addr) __asm("frstor %0" : : "m" (*(addr))) 1005b81b6b3SRodney W. Grimes #define start_emulating() __asm("smsw %%ax; orb %0,%%al; lmsw %%ax" \ 1015b81b6b3SRodney W. Grimes : : "n" (CR0_TS) : "ax") 1025b81b6b3SRodney W. Grimes #define stop_emulating() __asm("clts") 1035b81b6b3SRodney W. Grimes 1045b81b6b3SRodney W. Grimes #else /* not __GNUC__ */ 1055b81b6b3SRodney W. Grimes 1065b81b6b3SRodney W. Grimes void fldcw __P((caddr_t addr)); 1075b81b6b3SRodney W. Grimes void fnclex __P((void)); 1085b81b6b3SRodney W. Grimes void fninit __P((void)); 10937e52b59SBruce Evans void fnop __P((void)); 1105b81b6b3SRodney W. Grimes void fnsave __P((caddr_t addr)); 1115b81b6b3SRodney W. Grimes void fnstcw __P((caddr_t addr)); 1125b81b6b3SRodney W. Grimes void fnstsw __P((caddr_t addr)); 1135b81b6b3SRodney W. Grimes void fp_divide_by_0 __P((void)); 1145b81b6b3SRodney W. Grimes void frstor __P((caddr_t addr)); 1155b81b6b3SRodney W. Grimes void start_emulating __P((void)); 1165b81b6b3SRodney W. Grimes void stop_emulating __P((void)); 1175b81b6b3SRodney W. Grimes 1185b81b6b3SRodney W. Grimes #endif /* __GNUC__ */ 1195b81b6b3SRodney W. Grimes 1205b81b6b3SRodney W. Grimes typedef u_char bool_t; 1215b81b6b3SRodney W. Grimes 1226182fdbdSPeter Wemm static int npx_attach __P((device_t dev)); 1236182fdbdSPeter Wemm void npx_intr __P((void *)); 124da4113b3SPeter Wemm static void npx_identify __P((driver_t *driver, device_t parent)); 1256182fdbdSPeter Wemm static int npx_probe __P((device_t dev)); 1266182fdbdSPeter Wemm static int npx_probe1 __P((device_t dev)); 127a4ca0596SDmitrij Tejblum #ifdef I586_CPU 128cd59d49dSBruce Evans static long timezero __P((const char *funcname, 129cd59d49dSBruce Evans void (*func)(void *buf, size_t len))); 130a4ca0596SDmitrij Tejblum #endif /* I586_CPU */ 1315b81b6b3SRodney W. Grimes 13237e52b59SBruce Evans int hw_float; /* XXX currently just alias for npx_exists */ 1333a34a5c3SPoul-Henning Kamp 1343a34a5c3SPoul-Henning Kamp SYSCTL_INT(_hw,HW_FLOATINGPT, floatingpoint, 1353a34a5c3SPoul-Henning Kamp CTLFLAG_RD, &hw_float, 0, 1363a34a5c3SPoul-Henning Kamp "Floatingpoint instructions executed in hardware"); 1373a34a5c3SPoul-Henning Kamp 138f1d19042SArchie Cobbs #ifndef SMP 1395f582114SBruce Evans static u_int npx0_imask = SWI_LOW_MASK; 140f1d19042SArchie Cobbs static struct gate_descriptor npx_idt_probeintr; 141407e5f39SBruce Evans static int npx_intrno; 142f1d19042SArchie Cobbs static volatile u_int npx_intrs_while_probing; 143f1d19042SArchie Cobbs static volatile u_int npx_traps_while_probing; 144f1d19042SArchie Cobbs #endif 145b3196e4bSPeter Wemm 1465b81b6b3SRodney W. Grimes static bool_t npx_ex16; 1475b81b6b3SRodney W. Grimes static bool_t npx_exists; 1485b81b6b3SRodney W. Grimes static bool_t npx_irq13; 1492f2ffb8dSPeter Wemm static int npx_irq; /* irq number */ 1505b81b6b3SRodney W. Grimes 1513902c3efSSteve Passe #ifndef SMP 1525b81b6b3SRodney W. Grimes /* 1535b81b6b3SRodney W. Grimes * Special interrupt handlers. Someday intr0-intr15 will be used to count 1545b81b6b3SRodney W. Grimes * interrupts. We'll still need a special exception 16 handler. The busy 15537e52b59SBruce Evans * latch stuff in probeintr() can be moved to npxprobe(). 1565b81b6b3SRodney W. Grimes */ 157663f1485SBruce Evans inthand_t probeintr; 15816967563SBruce Evans __asm(" \n\ 15916967563SBruce Evans .text \n\ 16016967563SBruce Evans .p2align 2,0x90 \n\ 161ea2b3e3dSBruce Evans .type " __XSTRING(CNAME(probeintr)) ",@function \n\ 16216967563SBruce Evans " __XSTRING(CNAME(probeintr)) ": \n\ 16316967563SBruce Evans ss \n\ 16416967563SBruce Evans incl " __XSTRING(CNAME(npx_intrs_while_probing)) " \n\ 16516967563SBruce Evans pushl %eax \n\ 16616967563SBruce Evans movb $0x20,%al # EOI (asm in strings loses cpp features) \n\ 16716967563SBruce Evans outb %al,$0xa0 # IO_ICU2 \n\ 16816967563SBruce Evans outb %al,$0x20 # IO_ICU1 \n\ 16916967563SBruce Evans movb $0,%al \n\ 17016967563SBruce Evans outb %al,$0xf0 # clear BUSY# latch \n\ 17116967563SBruce Evans popl %eax \n\ 17216967563SBruce Evans iret \n\ 1735b81b6b3SRodney W. Grimes "); 1745b81b6b3SRodney W. Grimes 175663f1485SBruce Evans inthand_t probetrap; 17616967563SBruce Evans __asm(" \n\ 17716967563SBruce Evans .text \n\ 17816967563SBruce Evans .p2align 2,0x90 \n\ 179ea2b3e3dSBruce Evans .type " __XSTRING(CNAME(probetrap)) ",@function \n\ 18016967563SBruce Evans " __XSTRING(CNAME(probetrap)) ": \n\ 18116967563SBruce Evans ss \n\ 18216967563SBruce Evans incl " __XSTRING(CNAME(npx_traps_while_probing)) " \n\ 18316967563SBruce Evans fnclex \n\ 18416967563SBruce Evans iret \n\ 1855b81b6b3SRodney W. Grimes "); 1863902c3efSSteve Passe #endif /* SMP */ 1873902c3efSSteve Passe 1885b81b6b3SRodney W. Grimes /* 189da4113b3SPeter Wemm * Identify routine. Create a connection point on our parent for probing. 190da4113b3SPeter Wemm */ 191da4113b3SPeter Wemm static void 192da4113b3SPeter Wemm npx_identify(driver, parent) 193da4113b3SPeter Wemm driver_t *driver; 194da4113b3SPeter Wemm device_t parent; 195da4113b3SPeter Wemm { 196da4113b3SPeter Wemm device_t child; 197da4113b3SPeter Wemm 198da4113b3SPeter Wemm child = BUS_ADD_CHILD(parent, 0, "npx", 0); 199da4113b3SPeter Wemm if (child == NULL) 200da4113b3SPeter Wemm panic("npx_identify"); 201da4113b3SPeter Wemm } 202da4113b3SPeter Wemm 203da4113b3SPeter Wemm /* 2045b81b6b3SRodney W. Grimes * Probe routine. Initialize cr0 to give correct behaviour for [f]wait 2055b81b6b3SRodney W. Grimes * whether the device exists or not (XXX should be elsewhere). Set flags 2065b81b6b3SRodney W. Grimes * to tell npxattach() what to do. Modify device struct if npx doesn't 2075b81b6b3SRodney W. Grimes * need to use interrupts. Return 1 if device exists. 2085b81b6b3SRodney W. Grimes */ 2095b81b6b3SRodney W. Grimes static int 2106182fdbdSPeter Wemm npx_probe(dev) 2116182fdbdSPeter Wemm device_t dev; 2125b81b6b3SRodney W. Grimes { 21397bf1787SPeter Wemm #ifdef SMP 2143902c3efSSteve Passe 2152f2ffb8dSPeter Wemm if (resource_int_value("npx", 0, "irq", &npx_irq) != 0) 2162f2ffb8dSPeter Wemm npx_irq = 13; 2176182fdbdSPeter Wemm return npx_probe1(dev); 2183902c3efSSteve Passe 2193902c3efSSteve Passe #else /* SMP */ 2203902c3efSSteve Passe 2215b81b6b3SRodney W. Grimes int result; 2225b81b6b3SRodney W. Grimes u_long save_eflags; 2235b81b6b3SRodney W. Grimes u_char save_icu1_mask; 2245b81b6b3SRodney W. Grimes u_char save_icu2_mask; 2255b81b6b3SRodney W. Grimes struct gate_descriptor save_idt_npxintr; 2265b81b6b3SRodney W. Grimes struct gate_descriptor save_idt_npxtrap; 2275b81b6b3SRodney W. Grimes /* 2285b81b6b3SRodney W. Grimes * This routine is now just a wrapper for npxprobe1(), to install 2295b81b6b3SRodney W. Grimes * special npx interrupt and trap handlers, to enable npx interrupts 2305b81b6b3SRodney W. Grimes * and to disable other interrupts. Someday isa_configure() will 2315b81b6b3SRodney W. Grimes * install suitable handlers and run with interrupts enabled so we 2325b81b6b3SRodney W. Grimes * won't need to do so much here. 2335b81b6b3SRodney W. Grimes */ 2342f2ffb8dSPeter Wemm if (resource_int_value("npx", 0, "irq", &npx_irq) != 0) 2352f2ffb8dSPeter Wemm npx_irq = 13; 2362f2ffb8dSPeter Wemm npx_intrno = NRSVIDT + npx_irq; 2375b81b6b3SRodney W. Grimes save_eflags = read_eflags(); 2385b81b6b3SRodney W. Grimes disable_intr(); 2395b81b6b3SRodney W. Grimes save_icu1_mask = inb(IO_ICU1 + 1); 2405b81b6b3SRodney W. Grimes save_icu2_mask = inb(IO_ICU2 + 1); 2415b81b6b3SRodney W. Grimes save_idt_npxintr = idt[npx_intrno]; 2425b81b6b3SRodney W. Grimes save_idt_npxtrap = idt[16]; 2436182fdbdSPeter Wemm outb(IO_ICU1 + 1, ~IRQ_SLAVE); 2442f2ffb8dSPeter Wemm outb(IO_ICU2 + 1, ~(1 << (npx_irq - 8))); 2452838c968SDavid Greenman setidt(16, probetrap, SDT_SYS386TGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); 2462838c968SDavid Greenman setidt(npx_intrno, probeintr, SDT_SYS386IGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); 2475b81b6b3SRodney W. Grimes npx_idt_probeintr = idt[npx_intrno]; 2485b81b6b3SRodney W. Grimes enable_intr(); 2496182fdbdSPeter Wemm result = npx_probe1(dev); 2505b81b6b3SRodney W. Grimes disable_intr(); 2515b81b6b3SRodney W. Grimes outb(IO_ICU1 + 1, save_icu1_mask); 2525b81b6b3SRodney W. Grimes outb(IO_ICU2 + 1, save_icu2_mask); 2535b81b6b3SRodney W. Grimes idt[npx_intrno] = save_idt_npxintr; 2545b81b6b3SRodney W. Grimes idt[16] = save_idt_npxtrap; 2555b81b6b3SRodney W. Grimes write_eflags(save_eflags); 2565b81b6b3SRodney W. Grimes return (result); 2573902c3efSSteve Passe 2583902c3efSSteve Passe #endif /* SMP */ 2595b81b6b3SRodney W. Grimes } 2605b81b6b3SRodney W. Grimes 2615b81b6b3SRodney W. Grimes static int 2626182fdbdSPeter Wemm npx_probe1(dev) 2636182fdbdSPeter Wemm device_t dev; 2645b81b6b3SRodney W. Grimes { 265f1d19042SArchie Cobbs #ifndef SMP 26637e52b59SBruce Evans u_short control; 26737e52b59SBruce Evans u_short status; 268f1d19042SArchie Cobbs #endif 26937e52b59SBruce Evans 2705b81b6b3SRodney W. Grimes /* 2715b81b6b3SRodney W. Grimes * Partially reset the coprocessor, if any. Some BIOS's don't reset 2725b81b6b3SRodney W. Grimes * it after a warm boot. 2735b81b6b3SRodney W. Grimes */ 2745b81b6b3SRodney W. Grimes outb(0xf1, 0); /* full reset on some systems, NOP on others */ 2755b81b6b3SRodney W. Grimes outb(0xf0, 0); /* clear BUSY# latch */ 2765b81b6b3SRodney W. Grimes /* 2775b81b6b3SRodney W. Grimes * Prepare to trap all ESC (i.e., NPX) instructions and all WAIT 2785b81b6b3SRodney W. Grimes * instructions. We must set the CR0_MP bit and use the CR0_TS 2795b81b6b3SRodney W. Grimes * bit to control the trap, because setting the CR0_EM bit does 2805b81b6b3SRodney W. Grimes * not cause WAIT instructions to trap. It's important to trap 2815b81b6b3SRodney W. Grimes * WAIT instructions - otherwise the "wait" variants of no-wait 2825b81b6b3SRodney W. Grimes * control instructions would degenerate to the "no-wait" variants 2835b81b6b3SRodney W. Grimes * after FP context switches but work correctly otherwise. It's 2845b81b6b3SRodney W. Grimes * particularly important to trap WAITs when there is no NPX - 2855b81b6b3SRodney W. Grimes * otherwise the "wait" variants would always degenerate. 2865b81b6b3SRodney W. Grimes * 2875b81b6b3SRodney W. Grimes * Try setting CR0_NE to get correct error reporting on 486DX's. 2885b81b6b3SRodney W. Grimes * Setting it should fail or do nothing on lesser processors. 2895b81b6b3SRodney W. Grimes */ 2905b81b6b3SRodney W. Grimes load_cr0(rcr0() | CR0_MP | CR0_NE); 2915b81b6b3SRodney W. Grimes /* 2925b81b6b3SRodney W. Grimes * But don't trap while we're probing. 2935b81b6b3SRodney W. Grimes */ 2945b81b6b3SRodney W. Grimes stop_emulating(); 2955b81b6b3SRodney W. Grimes /* 2965b81b6b3SRodney W. Grimes * Finish resetting the coprocessor, if any. If there is an error 2975b81b6b3SRodney W. Grimes * pending, then we may get a bogus IRQ13, but probeintr() will handle 2985b81b6b3SRodney W. Grimes * it OK. Bogus halts have never been observed, but we enabled 2995b81b6b3SRodney W. Grimes * IRQ13 and cleared the BUSY# latch early to handle them anyway. 3005b81b6b3SRodney W. Grimes */ 3015b81b6b3SRodney W. Grimes fninit(); 3023902c3efSSteve Passe 30397bf1787SPeter Wemm #ifdef SMP 3043902c3efSSteve Passe /* 3053902c3efSSteve Passe * Exception 16 MUST work for SMP. 3063902c3efSSteve Passe */ 3073902c3efSSteve Passe npx_irq13 = 0; 3083902c3efSSteve Passe npx_ex16 = hw_float = npx_exists = 1; 3096182fdbdSPeter Wemm device_set_desc(dev, "math processor"); 3106182fdbdSPeter Wemm return (0); 3113902c3efSSteve Passe 3126182fdbdSPeter Wemm #else /* !SMP */ 3136182fdbdSPeter Wemm device_set_desc(dev, "math processor"); 3143902c3efSSteve Passe 3157f3ae831SBruce Evans /* 3167f3ae831SBruce Evans * Don't use fwait here because it might hang. 3177f3ae831SBruce Evans * Don't use fnop here because it usually hangs if there is no FPU. 3187f3ae831SBruce Evans */ 31937e52b59SBruce Evans DELAY(1000); /* wait for any IRQ13 */ 3205b81b6b3SRodney W. Grimes #ifdef DIAGNOSTIC 3215b81b6b3SRodney W. Grimes if (npx_intrs_while_probing != 0) 3225b81b6b3SRodney W. Grimes printf("fninit caused %u bogus npx interrupt(s)\n", 3235b81b6b3SRodney W. Grimes npx_intrs_while_probing); 3245b81b6b3SRodney W. Grimes if (npx_traps_while_probing != 0) 3255b81b6b3SRodney W. Grimes printf("fninit caused %u bogus npx trap(s)\n", 3265b81b6b3SRodney W. Grimes npx_traps_while_probing); 3275b81b6b3SRodney W. Grimes #endif 3285b81b6b3SRodney W. Grimes /* 3295b81b6b3SRodney W. Grimes * Check for a status of mostly zero. 3305b81b6b3SRodney W. Grimes */ 3315b81b6b3SRodney W. Grimes status = 0x5a5a; 3325b81b6b3SRodney W. Grimes fnstsw(&status); 3335b81b6b3SRodney W. Grimes if ((status & 0xb8ff) == 0) { 3345b81b6b3SRodney W. Grimes /* 3355b81b6b3SRodney W. Grimes * Good, now check for a proper control word. 3365b81b6b3SRodney W. Grimes */ 3375b81b6b3SRodney W. Grimes control = 0x5a5a; 3385b81b6b3SRodney W. Grimes fnstcw(&control); 3395b81b6b3SRodney W. Grimes if ((control & 0x1f3f) == 0x033f) { 340501c2393SGarrett Wollman hw_float = npx_exists = 1; 3415b81b6b3SRodney W. Grimes /* 3425b81b6b3SRodney W. Grimes * We have an npx, now divide by 0 to see if exception 3435b81b6b3SRodney W. Grimes * 16 works. 3445b81b6b3SRodney W. Grimes */ 3455b81b6b3SRodney W. Grimes control &= ~(1 << 2); /* enable divide by 0 trap */ 3465b81b6b3SRodney W. Grimes fldcw(&control); 3475b81b6b3SRodney W. Grimes npx_traps_while_probing = npx_intrs_while_probing = 0; 3485b81b6b3SRodney W. Grimes fp_divide_by_0(); 3495b81b6b3SRodney W. Grimes if (npx_traps_while_probing != 0) { 3505b81b6b3SRodney W. Grimes /* 3515b81b6b3SRodney W. Grimes * Good, exception 16 works. 3525b81b6b3SRodney W. Grimes */ 3535b81b6b3SRodney W. Grimes npx_ex16 = 1; 3546182fdbdSPeter Wemm return (0); 3555b81b6b3SRodney W. Grimes } 3565b81b6b3SRodney W. Grimes if (npx_intrs_while_probing != 0) { 3576182fdbdSPeter Wemm int rid; 3586182fdbdSPeter Wemm struct resource *r; 3596182fdbdSPeter Wemm void *intr; 3605b81b6b3SRodney W. Grimes /* 3615b81b6b3SRodney W. Grimes * Bad, we are stuck with IRQ13. 3625b81b6b3SRodney W. Grimes */ 3635b81b6b3SRodney W. Grimes npx_irq13 = 1; 36437e52b59SBruce Evans /* 3652f2ffb8dSPeter Wemm * npxattach would be too late to set npx0_imask 36637e52b59SBruce Evans */ 3672f2ffb8dSPeter Wemm npx0_imask |= (1 << npx_irq); 3686182fdbdSPeter Wemm 3696182fdbdSPeter Wemm /* 3706182fdbdSPeter Wemm * We allocate these resources permanently, 3716182fdbdSPeter Wemm * so there is no need to keep track of them. 3726182fdbdSPeter Wemm */ 3736182fdbdSPeter Wemm rid = 0; 3746182fdbdSPeter Wemm r = bus_alloc_resource(dev, SYS_RES_IOPORT, 3756182fdbdSPeter Wemm &rid, IO_NPX, IO_NPX, 3766182fdbdSPeter Wemm IO_NPXSIZE, RF_ACTIVE); 3776182fdbdSPeter Wemm if (r == 0) 3786182fdbdSPeter Wemm panic("npx: can't get ports"); 3796182fdbdSPeter Wemm rid = 0; 3806182fdbdSPeter Wemm r = bus_alloc_resource(dev, SYS_RES_IRQ, 3812f2ffb8dSPeter Wemm &rid, npx_irq, npx_irq, 3826182fdbdSPeter Wemm 1, RF_ACTIVE); 3836182fdbdSPeter Wemm if (r == 0) 3846182fdbdSPeter Wemm panic("npx: can't get IRQ"); 3856182fdbdSPeter Wemm BUS_SETUP_INTR(device_get_parent(dev), 386566643e3SDoug Rabson dev, r, INTR_TYPE_MISC, 387566643e3SDoug Rabson npx_intr, 0, &intr); 3886182fdbdSPeter Wemm if (intr == 0) 3896182fdbdSPeter Wemm panic("npx: can't create intr"); 3906182fdbdSPeter Wemm 3916182fdbdSPeter Wemm return (0); 3925b81b6b3SRodney W. Grimes } 3935b81b6b3SRodney W. Grimes /* 3945b81b6b3SRodney W. Grimes * Worse, even IRQ13 is broken. Use emulator. 3955b81b6b3SRodney W. Grimes */ 3965b81b6b3SRodney W. Grimes } 3975b81b6b3SRodney W. Grimes } 3985b81b6b3SRodney W. Grimes /* 3995b81b6b3SRodney W. Grimes * Probe failed, but we want to get to npxattach to initialize the 4005b81b6b3SRodney W. Grimes * emulator and say that it has been installed. XXX handle devices 4015b81b6b3SRodney W. Grimes * that aren't really devices better. 4025b81b6b3SRodney W. Grimes */ 4036182fdbdSPeter Wemm return (0); 4043902c3efSSteve Passe #endif /* SMP */ 4055b81b6b3SRodney W. Grimes } 4065b81b6b3SRodney W. Grimes 4075b81b6b3SRodney W. Grimes /* 4085b81b6b3SRodney W. Grimes * Attach routine - announce which it is, and wire into system 4095b81b6b3SRodney W. Grimes */ 4105b81b6b3SRodney W. Grimes int 4116182fdbdSPeter Wemm npx_attach(dev) 4126182fdbdSPeter Wemm device_t dev; 4135b81b6b3SRodney W. Grimes { 4146182fdbdSPeter Wemm int flags; 415a7674320SMartin Cracauer 416a7674320SMartin Cracauer if (resource_int_value("npx", 0, "flags", &flags) != 0) 417a7674320SMartin Cracauer flags = 0; 418fe310de8SBruce Evans 419163473ebSPoul-Henning Kamp if (flags) 420a43a8fd7SDoug Rabson device_printf(dev, "flags 0x%x ", flags); 4216182fdbdSPeter Wemm if (npx_irq13) { 422a43a8fd7SDoug Rabson device_printf(dev, "using IRQ 13 interface\n"); 4236182fdbdSPeter Wemm } else { 42437e52b59SBruce Evans #if defined(MATH_EMULATE) || defined(GPL_MATH_EMULATE) 425a7674320SMartin Cracauer if (npx_ex16) { 426a7674320SMartin Cracauer if (!(flags & NPX_PREFER_EMULATOR)) 427a43a8fd7SDoug Rabson device_printf(dev, "INT 16 interface\n"); 428a7674320SMartin Cracauer else { 429a43a8fd7SDoug Rabson device_printf(dev, "FPU exists, but flags request " 430a7674320SMartin Cracauer "emulator\n"); 431a7674320SMartin Cracauer hw_float = npx_exists = 0; 432a7674320SMartin Cracauer } 433a7674320SMartin Cracauer } else if (npx_exists) { 434a43a8fd7SDoug Rabson device_printf(dev, "error reporting broken; using 387 emulator\n"); 4351fe04850SBruce Evans hw_float = npx_exists = 0; 43637e52b59SBruce Evans } else 437a43a8fd7SDoug Rabson device_printf(dev, "387 emulator\n"); 43837e52b59SBruce Evans #else 439a7674320SMartin Cracauer if (npx_ex16) { 440a43a8fd7SDoug Rabson device_printf(dev, "INT 16 interface\n"); 441a7674320SMartin Cracauer if (flags & NPX_PREFER_EMULATOR) { 442a43a8fd7SDoug Rabson device_printf(dev, "emulator requested, but none compiled " 443a7674320SMartin Cracauer "into kernel, using FPU\n"); 444a7674320SMartin Cracauer } 445a7674320SMartin Cracauer } else 446a43a8fd7SDoug Rabson device_printf(dev, "no 387 emulator in kernel and no FPU!\n"); 44737e52b59SBruce Evans #endif 4481fe04850SBruce Evans } 4495b81b6b3SRodney W. Grimes npxinit(__INITIAL_NPXCW__); 4501fe04850SBruce Evans 451cd59d49dSBruce Evans #ifdef I586_CPU 452a7674320SMartin Cracauer if (cpu_class == CPUCLASS_586 && npx_ex16 && npx_exists && 453cd59d49dSBruce Evans timezero("i586_bzero()", i586_bzero) < 454cd59d49dSBruce Evans timezero("bzero()", bzero) * 4 / 5) { 4556182fdbdSPeter Wemm if (!(flags & NPX_DISABLE_I586_OPTIMIZED_BCOPY)) { 4561fe04850SBruce Evans bcopy_vector = i586_bcopy; 4571fe04850SBruce Evans ovbcopy_vector = i586_bcopy; 4581fe04850SBruce Evans } 4596182fdbdSPeter Wemm if (!(flags & NPX_DISABLE_I586_OPTIMIZED_BZERO)) 4601fe04850SBruce Evans bzero = i586_bzero; 4616182fdbdSPeter Wemm if (!(flags & NPX_DISABLE_I586_OPTIMIZED_COPYIO)) { 4621fe04850SBruce Evans copyin_vector = i586_copyin; 4631fe04850SBruce Evans copyout_vector = i586_copyout; 4641fe04850SBruce Evans } 4651fe04850SBruce Evans } 4661fe04850SBruce Evans #endif 4671fe04850SBruce Evans 4686182fdbdSPeter Wemm return (0); /* XXX unused */ 4695b81b6b3SRodney W. Grimes } 4705b81b6b3SRodney W. Grimes 4715b81b6b3SRodney W. Grimes /* 4725b81b6b3SRodney W. Grimes * Initialize floating point unit. 4735b81b6b3SRodney W. Grimes */ 4745b81b6b3SRodney W. Grimes void 4755b81b6b3SRodney W. Grimes npxinit(control) 47637e52b59SBruce Evans u_short control; 4775b81b6b3SRodney W. Grimes { 4785b81b6b3SRodney W. Grimes struct save87 dummy; 4795b81b6b3SRodney W. Grimes 4805b81b6b3SRodney W. Grimes if (!npx_exists) 4815b81b6b3SRodney W. Grimes return; 4825b81b6b3SRodney W. Grimes /* 4835b81b6b3SRodney W. Grimes * fninit has the same h/w bugs as fnsave. Use the detoxified 48437e52b59SBruce Evans * fnsave to throw away any junk in the fpu. npxsave() initializes 4855b81b6b3SRodney W. Grimes * the fpu and sets npxproc = NULL as important side effects. 4865b81b6b3SRodney W. Grimes */ 4875b81b6b3SRodney W. Grimes npxsave(&dummy); 4885b81b6b3SRodney W. Grimes stop_emulating(); 4895b81b6b3SRodney W. Grimes fldcw(&control); 4905b81b6b3SRodney W. Grimes if (curpcb != NULL) 4915b81b6b3SRodney W. Grimes fnsave(&curpcb->pcb_savefpu); 4925b81b6b3SRodney W. Grimes start_emulating(); 4935b81b6b3SRodney W. Grimes } 4945b81b6b3SRodney W. Grimes 4955b81b6b3SRodney W. Grimes /* 4965b81b6b3SRodney W. Grimes * Free coprocessor (if we have it). 4975b81b6b3SRodney W. Grimes */ 4985b81b6b3SRodney W. Grimes void 4995b81b6b3SRodney W. Grimes npxexit(p) 5005b81b6b3SRodney W. Grimes struct proc *p; 5015b81b6b3SRodney W. Grimes { 5025b81b6b3SRodney W. Grimes 503663f1485SBruce Evans if (p == npxproc) 504663f1485SBruce Evans npxsave(&curpcb->pcb_savefpu); 50526add149SBruce Evans #ifdef NPX_DEBUG 506663f1485SBruce Evans if (npx_exists) { 507663f1485SBruce Evans u_int masked_exceptions; 508663f1485SBruce Evans 509663f1485SBruce Evans masked_exceptions = curpcb->pcb_savefpu.sv_env.en_cw 510663f1485SBruce Evans & curpcb->pcb_savefpu.sv_env.en_sw & 0x7f; 511663f1485SBruce Evans /* 51226add149SBruce Evans * Log exceptions that would have trapped with the old 51326add149SBruce Evans * control word (overflow, divide by 0, and invalid operand). 514663f1485SBruce Evans */ 515663f1485SBruce Evans if (masked_exceptions & 0x0d) 516663f1485SBruce Evans log(LOG_ERR, 517663f1485SBruce Evans "pid %d (%s) exited with masked floating point exceptions 0x%02x\n", 518663f1485SBruce Evans p->p_pid, p->p_comm, masked_exceptions); 5195b81b6b3SRodney W. Grimes } 52026add149SBruce Evans #endif 5215b81b6b3SRodney W. Grimes } 5225b81b6b3SRodney W. Grimes 5235b81b6b3SRodney W. Grimes /* 524a7674320SMartin Cracauer * The following mechanism is used to ensure that the FPE_... value 525a7674320SMartin Cracauer * that is passed as a trapcode to the signal handler of the user 526a7674320SMartin Cracauer * process does not have more than one bit set. 527a7674320SMartin Cracauer * 528a7674320SMartin Cracauer * Multiple bits may be set if the user process modifies the control 529a7674320SMartin Cracauer * word while a status word bit is already set. While this is a sign 530a7674320SMartin Cracauer * of bad coding, we have no choise than to narrow them down to one 531a7674320SMartin Cracauer * bit, since we must not send a trapcode that is not exactly one of 532a7674320SMartin Cracauer * the FPE_ macros. 533a7674320SMartin Cracauer * 534a7674320SMartin Cracauer * The mechanism has a static table with 127 entries. Each combination 535a7674320SMartin Cracauer * of the 7 FPU status word exception bits directly translates to a 536a7674320SMartin Cracauer * position in this table, where a single FPE_... value is stored. 537a7674320SMartin Cracauer * This FPE_... value stored there is considered the "most important" 538a7674320SMartin Cracauer * of the exception bits and will be sent as the signal code. The 539a7674320SMartin Cracauer * precedence of the bits is based upon Intel Document "Numerical 540a7674320SMartin Cracauer * Applications", Chapter "Special Computational Situations". 541a7674320SMartin Cracauer * 542a7674320SMartin Cracauer * The macro to choose one of these values does these steps: 1) Throw 543a7674320SMartin Cracauer * away status word bits that cannot be masked. 2) Throw away the bits 544a7674320SMartin Cracauer * currently masked in the control word, assuming the user isn't 545a7674320SMartin Cracauer * interested in them anymore. 3) Reinsert status word bit 7 (stack 546a7674320SMartin Cracauer * fault) if it is set, which cannot be masked but must be presered. 547a7674320SMartin Cracauer * 4) Use the remaining bits to point into the trapcode table. 548a7674320SMartin Cracauer * 549a7674320SMartin Cracauer * The 6 maskable bits in order of their preference, as stated in the 550a7674320SMartin Cracauer * above referenced Intel manual: 551a7674320SMartin Cracauer * 1 Invalid operation (FP_X_INV) 552a7674320SMartin Cracauer * 1a Stack underflow 553a7674320SMartin Cracauer * 1b Stack overflow 554a7674320SMartin Cracauer * 1c Operand of unsupported format 555a7674320SMartin Cracauer * 1d SNaN operand. 556a7674320SMartin Cracauer * 2 QNaN operand (not an exception, irrelavant here) 557a7674320SMartin Cracauer * 3 Any other invalid-operation not mentioned above or zero divide 558a7674320SMartin Cracauer * (FP_X_INV, FP_X_DZ) 559a7674320SMartin Cracauer * 4 Denormal operand (FP_X_DNML) 560a7674320SMartin Cracauer * 5 Numeric over/underflow (FP_X_OFL, FP_X_UFL) 561784648c6SMartin Cracauer * 6 Inexact result (FP_X_IMP) 562784648c6SMartin Cracauer */ 563a7674320SMartin Cracauer static char fpetable[128] = { 564a7674320SMartin Cracauer 0, 565a7674320SMartin Cracauer FPE_FLTINV, /* 1 - INV */ 566a7674320SMartin Cracauer FPE_FLTUND, /* 2 - DNML */ 567a7674320SMartin Cracauer FPE_FLTINV, /* 3 - INV | DNML */ 568a7674320SMartin Cracauer FPE_FLTDIV, /* 4 - DZ */ 569a7674320SMartin Cracauer FPE_FLTINV, /* 5 - INV | DZ */ 570a7674320SMartin Cracauer FPE_FLTDIV, /* 6 - DNML | DZ */ 571a7674320SMartin Cracauer FPE_FLTINV, /* 7 - INV | DNML | DZ */ 572a7674320SMartin Cracauer FPE_FLTOVF, /* 8 - OFL */ 573a7674320SMartin Cracauer FPE_FLTINV, /* 9 - INV | OFL */ 574a7674320SMartin Cracauer FPE_FLTUND, /* A - DNML | OFL */ 575a7674320SMartin Cracauer FPE_FLTINV, /* B - INV | DNML | OFL */ 576a7674320SMartin Cracauer FPE_FLTDIV, /* C - DZ | OFL */ 577a7674320SMartin Cracauer FPE_FLTINV, /* D - INV | DZ | OFL */ 578a7674320SMartin Cracauer FPE_FLTDIV, /* E - DNML | DZ | OFL */ 579a7674320SMartin Cracauer FPE_FLTINV, /* F - INV | DNML | DZ | OFL */ 580a7674320SMartin Cracauer FPE_FLTUND, /* 10 - UFL */ 581a7674320SMartin Cracauer FPE_FLTINV, /* 11 - INV | UFL */ 582a7674320SMartin Cracauer FPE_FLTUND, /* 12 - DNML | UFL */ 583a7674320SMartin Cracauer FPE_FLTINV, /* 13 - INV | DNML | UFL */ 584a7674320SMartin Cracauer FPE_FLTDIV, /* 14 - DZ | UFL */ 585a7674320SMartin Cracauer FPE_FLTINV, /* 15 - INV | DZ | UFL */ 586a7674320SMartin Cracauer FPE_FLTDIV, /* 16 - DNML | DZ | UFL */ 587a7674320SMartin Cracauer FPE_FLTINV, /* 17 - INV | DNML | DZ | UFL */ 588a7674320SMartin Cracauer FPE_FLTOVF, /* 18 - OFL | UFL */ 589a7674320SMartin Cracauer FPE_FLTINV, /* 19 - INV | OFL | UFL */ 590a7674320SMartin Cracauer FPE_FLTUND, /* 1A - DNML | OFL | UFL */ 591a7674320SMartin Cracauer FPE_FLTINV, /* 1B - INV | DNML | OFL | UFL */ 592a7674320SMartin Cracauer FPE_FLTDIV, /* 1C - DZ | OFL | UFL */ 593a7674320SMartin Cracauer FPE_FLTINV, /* 1D - INV | DZ | OFL | UFL */ 594a7674320SMartin Cracauer FPE_FLTDIV, /* 1E - DNML | DZ | OFL | UFL */ 595a7674320SMartin Cracauer FPE_FLTINV, /* 1F - INV | DNML | DZ | OFL | UFL */ 596a7674320SMartin Cracauer FPE_FLTRES, /* 20 - IMP */ 597a7674320SMartin Cracauer FPE_FLTINV, /* 21 - INV | IMP */ 598a7674320SMartin Cracauer FPE_FLTUND, /* 22 - DNML | IMP */ 599a7674320SMartin Cracauer FPE_FLTINV, /* 23 - INV | DNML | IMP */ 600a7674320SMartin Cracauer FPE_FLTDIV, /* 24 - DZ | IMP */ 601a7674320SMartin Cracauer FPE_FLTINV, /* 25 - INV | DZ | IMP */ 602a7674320SMartin Cracauer FPE_FLTDIV, /* 26 - DNML | DZ | IMP */ 603a7674320SMartin Cracauer FPE_FLTINV, /* 27 - INV | DNML | DZ | IMP */ 604a7674320SMartin Cracauer FPE_FLTOVF, /* 28 - OFL | IMP */ 605a7674320SMartin Cracauer FPE_FLTINV, /* 29 - INV | OFL | IMP */ 606a7674320SMartin Cracauer FPE_FLTUND, /* 2A - DNML | OFL | IMP */ 607a7674320SMartin Cracauer FPE_FLTINV, /* 2B - INV | DNML | OFL | IMP */ 608a7674320SMartin Cracauer FPE_FLTDIV, /* 2C - DZ | OFL | IMP */ 609a7674320SMartin Cracauer FPE_FLTINV, /* 2D - INV | DZ | OFL | IMP */ 610a7674320SMartin Cracauer FPE_FLTDIV, /* 2E - DNML | DZ | OFL | IMP */ 611a7674320SMartin Cracauer FPE_FLTINV, /* 2F - INV | DNML | DZ | OFL | IMP */ 612a7674320SMartin Cracauer FPE_FLTUND, /* 30 - UFL | IMP */ 613a7674320SMartin Cracauer FPE_FLTINV, /* 31 - INV | UFL | IMP */ 614a7674320SMartin Cracauer FPE_FLTUND, /* 32 - DNML | UFL | IMP */ 615a7674320SMartin Cracauer FPE_FLTINV, /* 33 - INV | DNML | UFL | IMP */ 616a7674320SMartin Cracauer FPE_FLTDIV, /* 34 - DZ | UFL | IMP */ 617a7674320SMartin Cracauer FPE_FLTINV, /* 35 - INV | DZ | UFL | IMP */ 618a7674320SMartin Cracauer FPE_FLTDIV, /* 36 - DNML | DZ | UFL | IMP */ 619a7674320SMartin Cracauer FPE_FLTINV, /* 37 - INV | DNML | DZ | UFL | IMP */ 620a7674320SMartin Cracauer FPE_FLTOVF, /* 38 - OFL | UFL | IMP */ 621a7674320SMartin Cracauer FPE_FLTINV, /* 39 - INV | OFL | UFL | IMP */ 622a7674320SMartin Cracauer FPE_FLTUND, /* 3A - DNML | OFL | UFL | IMP */ 623a7674320SMartin Cracauer FPE_FLTINV, /* 3B - INV | DNML | OFL | UFL | IMP */ 624a7674320SMartin Cracauer FPE_FLTDIV, /* 3C - DZ | OFL | UFL | IMP */ 625a7674320SMartin Cracauer FPE_FLTINV, /* 3D - INV | DZ | OFL | UFL | IMP */ 626a7674320SMartin Cracauer FPE_FLTDIV, /* 3E - DNML | DZ | OFL | UFL | IMP */ 627a7674320SMartin Cracauer FPE_FLTINV, /* 3F - INV | DNML | DZ | OFL | UFL | IMP */ 628a7674320SMartin Cracauer FPE_FLTSUB, /* 40 - STK */ 629a7674320SMartin Cracauer FPE_FLTSUB, /* 41 - INV | STK */ 630a7674320SMartin Cracauer FPE_FLTUND, /* 42 - DNML | STK */ 631a7674320SMartin Cracauer FPE_FLTSUB, /* 43 - INV | DNML | STK */ 632a7674320SMartin Cracauer FPE_FLTDIV, /* 44 - DZ | STK */ 633a7674320SMartin Cracauer FPE_FLTSUB, /* 45 - INV | DZ | STK */ 634a7674320SMartin Cracauer FPE_FLTDIV, /* 46 - DNML | DZ | STK */ 635a7674320SMartin Cracauer FPE_FLTSUB, /* 47 - INV | DNML | DZ | STK */ 636a7674320SMartin Cracauer FPE_FLTOVF, /* 48 - OFL | STK */ 637a7674320SMartin Cracauer FPE_FLTSUB, /* 49 - INV | OFL | STK */ 638a7674320SMartin Cracauer FPE_FLTUND, /* 4A - DNML | OFL | STK */ 639a7674320SMartin Cracauer FPE_FLTSUB, /* 4B - INV | DNML | OFL | STK */ 640a7674320SMartin Cracauer FPE_FLTDIV, /* 4C - DZ | OFL | STK */ 641a7674320SMartin Cracauer FPE_FLTSUB, /* 4D - INV | DZ | OFL | STK */ 642a7674320SMartin Cracauer FPE_FLTDIV, /* 4E - DNML | DZ | OFL | STK */ 643a7674320SMartin Cracauer FPE_FLTSUB, /* 4F - INV | DNML | DZ | OFL | STK */ 644a7674320SMartin Cracauer FPE_FLTUND, /* 50 - UFL | STK */ 645a7674320SMartin Cracauer FPE_FLTSUB, /* 51 - INV | UFL | STK */ 646a7674320SMartin Cracauer FPE_FLTUND, /* 52 - DNML | UFL | STK */ 647a7674320SMartin Cracauer FPE_FLTSUB, /* 53 - INV | DNML | UFL | STK */ 648a7674320SMartin Cracauer FPE_FLTDIV, /* 54 - DZ | UFL | STK */ 649a7674320SMartin Cracauer FPE_FLTSUB, /* 55 - INV | DZ | UFL | STK */ 650a7674320SMartin Cracauer FPE_FLTDIV, /* 56 - DNML | DZ | UFL | STK */ 651a7674320SMartin Cracauer FPE_FLTSUB, /* 57 - INV | DNML | DZ | UFL | STK */ 652a7674320SMartin Cracauer FPE_FLTOVF, /* 58 - OFL | UFL | STK */ 653a7674320SMartin Cracauer FPE_FLTSUB, /* 59 - INV | OFL | UFL | STK */ 654a7674320SMartin Cracauer FPE_FLTUND, /* 5A - DNML | OFL | UFL | STK */ 655a7674320SMartin Cracauer FPE_FLTSUB, /* 5B - INV | DNML | OFL | UFL | STK */ 656a7674320SMartin Cracauer FPE_FLTDIV, /* 5C - DZ | OFL | UFL | STK */ 657a7674320SMartin Cracauer FPE_FLTSUB, /* 5D - INV | DZ | OFL | UFL | STK */ 658a7674320SMartin Cracauer FPE_FLTDIV, /* 5E - DNML | DZ | OFL | UFL | STK */ 659a7674320SMartin Cracauer FPE_FLTSUB, /* 5F - INV | DNML | DZ | OFL | UFL | STK */ 660a7674320SMartin Cracauer FPE_FLTRES, /* 60 - IMP | STK */ 661a7674320SMartin Cracauer FPE_FLTSUB, /* 61 - INV | IMP | STK */ 662a7674320SMartin Cracauer FPE_FLTUND, /* 62 - DNML | IMP | STK */ 663a7674320SMartin Cracauer FPE_FLTSUB, /* 63 - INV | DNML | IMP | STK */ 664a7674320SMartin Cracauer FPE_FLTDIV, /* 64 - DZ | IMP | STK */ 665a7674320SMartin Cracauer FPE_FLTSUB, /* 65 - INV | DZ | IMP | STK */ 666a7674320SMartin Cracauer FPE_FLTDIV, /* 66 - DNML | DZ | IMP | STK */ 667a7674320SMartin Cracauer FPE_FLTSUB, /* 67 - INV | DNML | DZ | IMP | STK */ 668a7674320SMartin Cracauer FPE_FLTOVF, /* 68 - OFL | IMP | STK */ 669a7674320SMartin Cracauer FPE_FLTSUB, /* 69 - INV | OFL | IMP | STK */ 670a7674320SMartin Cracauer FPE_FLTUND, /* 6A - DNML | OFL | IMP | STK */ 671a7674320SMartin Cracauer FPE_FLTSUB, /* 6B - INV | DNML | OFL | IMP | STK */ 672a7674320SMartin Cracauer FPE_FLTDIV, /* 6C - DZ | OFL | IMP | STK */ 673a7674320SMartin Cracauer FPE_FLTSUB, /* 6D - INV | DZ | OFL | IMP | STK */ 674a7674320SMartin Cracauer FPE_FLTDIV, /* 6E - DNML | DZ | OFL | IMP | STK */ 675a7674320SMartin Cracauer FPE_FLTSUB, /* 6F - INV | DNML | DZ | OFL | IMP | STK */ 676a7674320SMartin Cracauer FPE_FLTUND, /* 70 - UFL | IMP | STK */ 677a7674320SMartin Cracauer FPE_FLTSUB, /* 71 - INV | UFL | IMP | STK */ 678a7674320SMartin Cracauer FPE_FLTUND, /* 72 - DNML | UFL | IMP | STK */ 679a7674320SMartin Cracauer FPE_FLTSUB, /* 73 - INV | DNML | UFL | IMP | STK */ 680a7674320SMartin Cracauer FPE_FLTDIV, /* 74 - DZ | UFL | IMP | STK */ 681a7674320SMartin Cracauer FPE_FLTSUB, /* 75 - INV | DZ | UFL | IMP | STK */ 682a7674320SMartin Cracauer FPE_FLTDIV, /* 76 - DNML | DZ | UFL | IMP | STK */ 683a7674320SMartin Cracauer FPE_FLTSUB, /* 77 - INV | DNML | DZ | UFL | IMP | STK */ 684a7674320SMartin Cracauer FPE_FLTOVF, /* 78 - OFL | UFL | IMP | STK */ 685a7674320SMartin Cracauer FPE_FLTSUB, /* 79 - INV | OFL | UFL | IMP | STK */ 686a7674320SMartin Cracauer FPE_FLTUND, /* 7A - DNML | OFL | UFL | IMP | STK */ 687a7674320SMartin Cracauer FPE_FLTSUB, /* 7B - INV | DNML | OFL | UFL | IMP | STK */ 688a7674320SMartin Cracauer FPE_FLTDIV, /* 7C - DZ | OFL | UFL | IMP | STK */ 689a7674320SMartin Cracauer FPE_FLTSUB, /* 7D - INV | DZ | OFL | UFL | IMP | STK */ 690a7674320SMartin Cracauer FPE_FLTDIV, /* 7E - DNML | DZ | OFL | UFL | IMP | STK */ 691a7674320SMartin Cracauer FPE_FLTSUB, /* 7F - INV | DNML | DZ | OFL | UFL | IMP | STK */ 692a7674320SMartin Cracauer }; 693a7674320SMartin Cracauer 694a7674320SMartin Cracauer /* 69537e52b59SBruce Evans * Preserve the FP status word, clear FP exceptions, then generate a SIGFPE. 6965b81b6b3SRodney W. Grimes * 69737e52b59SBruce Evans * Clearing exceptions is necessary mainly to avoid IRQ13 bugs. We now 69837e52b59SBruce Evans * depend on longjmp() restoring a usable state. Restoring the state 69937e52b59SBruce Evans * or examining it might fail if we didn't clear exceptions. 7005b81b6b3SRodney W. Grimes * 701a7674320SMartin Cracauer * The error code chosen will be one of the FPE_... macros. It will be 702a7674320SMartin Cracauer * sent as the second argument to old BSD-style signal handlers and as 703a7674320SMartin Cracauer * "siginfo_t->si_code" (second argument) to SA_SIGINFO signal handlers. 70437e52b59SBruce Evans * 70537e52b59SBruce Evans * XXX the FP state is not preserved across signal handlers. So signal 70637e52b59SBruce Evans * handlers cannot afford to do FP unless they preserve the state or 70737e52b59SBruce Evans * longjmp() out. Both preserving the state and longjmp()ing may be 70837e52b59SBruce Evans * destroyed by IRQ13 bugs. Clearing FP exceptions is not an acceptable 70937e52b59SBruce Evans * solution for signals other than SIGFPE. 7105b81b6b3SRodney W. Grimes */ 7115b81b6b3SRodney W. Grimes void 7126182fdbdSPeter Wemm npx_intr(dummy) 7136182fdbdSPeter Wemm void *dummy; 7145b81b6b3SRodney W. Grimes { 7155b81b6b3SRodney W. Grimes int code; 716784648c6SMartin Cracauer u_short control; 7172e69f359SBruce Evans struct intrframe *frame; 7185b81b6b3SRodney W. Grimes 7195b81b6b3SRodney W. Grimes if (npxproc == NULL || !npx_exists) { 72037e52b59SBruce Evans printf("npxintr: npxproc = %p, curproc = %p, npx_exists = %d\n", 72137e52b59SBruce Evans npxproc, curproc, npx_exists); 7225b81b6b3SRodney W. Grimes panic("npxintr from nowhere"); 7235b81b6b3SRodney W. Grimes } 7245b81b6b3SRodney W. Grimes if (npxproc != curproc) { 72537e52b59SBruce Evans printf("npxintr: npxproc = %p, curproc = %p, npx_exists = %d\n", 72637e52b59SBruce Evans npxproc, curproc, npx_exists); 7275b81b6b3SRodney W. Grimes panic("npxintr from non-current process"); 7285b81b6b3SRodney W. Grimes } 72937e52b59SBruce Evans 730390784fbSBruce Evans outb(0xf0, 0); 73137e52b59SBruce Evans fnstsw(&curpcb->pcb_savefpu.sv_ex_sw); 732784648c6SMartin Cracauer fnstcw(&control); 73337e52b59SBruce Evans fnclex(); 7345b81b6b3SRodney W. Grimes 7355b81b6b3SRodney W. Grimes /* 7365b81b6b3SRodney W. Grimes * Pass exception to process. 7375b81b6b3SRodney W. Grimes */ 7386182fdbdSPeter Wemm frame = (struct intrframe *)&dummy; /* XXX */ 73940d50994SPhilippe Charnier if ((ISPL(frame->if_cs) == SEL_UPL) || (frame->if_eflags & PSL_VM)) { 7405b81b6b3SRodney W. Grimes /* 7415b81b6b3SRodney W. Grimes * Interrupt is essentially a trap, so we can afford to call 7425b81b6b3SRodney W. Grimes * the SIGFPE handler (if any) as soon as the interrupt 7435b81b6b3SRodney W. Grimes * returns. 7445b81b6b3SRodney W. Grimes * 7455b81b6b3SRodney W. Grimes * XXX little or nothing is gained from this, and plenty is 7465b81b6b3SRodney W. Grimes * lost - the interrupt frame has to contain the trap frame 7475b81b6b3SRodney W. Grimes * (this is otherwise only necessary for the rescheduling trap 7485b81b6b3SRodney W. Grimes * in doreti, and the frame for that could easily be set up 7495b81b6b3SRodney W. Grimes * just before it is used). 7505b81b6b3SRodney W. Grimes */ 751cd121c9cSLuoqi Chen curproc->p_md.md_regs = INTR_TO_TRAPFRAME(frame); 7525b81b6b3SRodney W. Grimes /* 7535b81b6b3SRodney W. Grimes * Encode the appropriate code for detailed information on 7545b81b6b3SRodney W. Grimes * this exception. 7555b81b6b3SRodney W. Grimes */ 756784648c6SMartin Cracauer code = 757784648c6SMartin Cracauer fpetable[(curpcb->pcb_savefpu.sv_ex_sw & ~control & 0x3f) | 758784648c6SMartin Cracauer (curpcb->pcb_savefpu.sv_ex_sw & 0x40)]; 7595b81b6b3SRodney W. Grimes trapsignal(curproc, SIGFPE, code); 7605b81b6b3SRodney W. Grimes } else { 7615b81b6b3SRodney W. Grimes /* 7625b81b6b3SRodney W. Grimes * Nested interrupt. These losers occur when: 7635b81b6b3SRodney W. Grimes * o an IRQ13 is bogusly generated at a bogus time, e.g.: 7645b81b6b3SRodney W. Grimes * o immediately after an fnsave or frstor of an 7655b81b6b3SRodney W. Grimes * error state. 7665b81b6b3SRodney W. Grimes * o a couple of 386 instructions after 7675b81b6b3SRodney W. Grimes * "fstpl _memvar" causes a stack overflow. 7685b81b6b3SRodney W. Grimes * These are especially nasty when combined with a 7695b81b6b3SRodney W. Grimes * trace trap. 7705b81b6b3SRodney W. Grimes * o an IRQ13 occurs at the same time as another higher- 7715b81b6b3SRodney W. Grimes * priority interrupt. 7725b81b6b3SRodney W. Grimes * 7735b81b6b3SRodney W. Grimes * Treat them like a true async interrupt. 7745b81b6b3SRodney W. Grimes */ 77537e52b59SBruce Evans psignal(curproc, SIGFPE); 7765b81b6b3SRodney W. Grimes } 7775b81b6b3SRodney W. Grimes } 7785b81b6b3SRodney W. Grimes 7795b81b6b3SRodney W. Grimes /* 7805b81b6b3SRodney W. Grimes * Implement device not available (DNA) exception 7815b81b6b3SRodney W. Grimes * 78237e52b59SBruce Evans * It would be better to switch FP context here (if curproc != npxproc) 78337e52b59SBruce Evans * and not necessarily for every context switch, but it is too hard to 78437e52b59SBruce Evans * access foreign pcb's. 7855b81b6b3SRodney W. Grimes */ 7865b81b6b3SRodney W. Grimes int 7875b81b6b3SRodney W. Grimes npxdna() 7885b81b6b3SRodney W. Grimes { 7895b81b6b3SRodney W. Grimes if (!npx_exists) 7905b81b6b3SRodney W. Grimes return (0); 7915b81b6b3SRodney W. Grimes if (npxproc != NULL) { 79237e52b59SBruce Evans printf("npxdna: npxproc = %p, curproc = %p\n", 79337e52b59SBruce Evans npxproc, curproc); 7945b81b6b3SRodney W. Grimes panic("npxdna"); 7955b81b6b3SRodney W. Grimes } 7965b81b6b3SRodney W. Grimes stop_emulating(); 7975b81b6b3SRodney W. Grimes /* 7985b81b6b3SRodney W. Grimes * Record new context early in case frstor causes an IRQ13. 7995b81b6b3SRodney W. Grimes */ 8005b81b6b3SRodney W. Grimes npxproc = curproc; 80137e52b59SBruce Evans curpcb->pcb_savefpu.sv_ex_sw = 0; 8025b81b6b3SRodney W. Grimes /* 8035b81b6b3SRodney W. Grimes * The following frstor may cause an IRQ13 when the state being 8045b81b6b3SRodney W. Grimes * restored has a pending error. The error will appear to have been 8055b81b6b3SRodney W. Grimes * triggered by the current (npx) user instruction even when that 8065b81b6b3SRodney W. Grimes * instruction is a no-wait instruction that should not trigger an 8075b81b6b3SRodney W. Grimes * error (e.g., fnclex). On at least one 486 system all of the 8085b81b6b3SRodney W. Grimes * no-wait instructions are broken the same as frstor, so our 8095b81b6b3SRodney W. Grimes * treatment does not amplify the breakage. On at least one 8105b81b6b3SRodney W. Grimes * 386/Cyrix 387 system, fnclex works correctly while frstor and 8115b81b6b3SRodney W. Grimes * fnsave are broken, so our treatment breaks fnclex if it is the 8125b81b6b3SRodney W. Grimes * first FPU instruction after a context switch. 8135b81b6b3SRodney W. Grimes */ 8145b81b6b3SRodney W. Grimes frstor(&curpcb->pcb_savefpu); 8155b81b6b3SRodney W. Grimes 8165b81b6b3SRodney W. Grimes return (1); 8175b81b6b3SRodney W. Grimes } 8185b81b6b3SRodney W. Grimes 8195b81b6b3SRodney W. Grimes /* 8205b81b6b3SRodney W. Grimes * Wrapper for fnsave instruction to handle h/w bugs. If there is an error 8215b81b6b3SRodney W. Grimes * pending, then fnsave generates a bogus IRQ13 on some systems. Force 8225b81b6b3SRodney W. Grimes * any IRQ13 to be handled immediately, and then ignore it. This routine is 8235b81b6b3SRodney W. Grimes * often called at splhigh so it must not use many system services. In 8245b81b6b3SRodney W. Grimes * particular, it's much easier to install a special handler than to 8255b81b6b3SRodney W. Grimes * guarantee that it's safe to use npxintr() and its supporting code. 8265b81b6b3SRodney W. Grimes */ 8275b81b6b3SRodney W. Grimes void 8285b81b6b3SRodney W. Grimes npxsave(addr) 8295b81b6b3SRodney W. Grimes struct save87 *addr; 8305b81b6b3SRodney W. Grimes { 8313902c3efSSteve Passe #ifdef SMP 8323902c3efSSteve Passe 8333902c3efSSteve Passe stop_emulating(); 8343902c3efSSteve Passe fnsave(addr); 8353902c3efSSteve Passe /* fnop(); */ 8363902c3efSSteve Passe start_emulating(); 8373902c3efSSteve Passe npxproc = NULL; 8383902c3efSSteve Passe 8393902c3efSSteve Passe #else /* SMP */ 8403902c3efSSteve Passe 8415b81b6b3SRodney W. Grimes u_char icu1_mask; 8425b81b6b3SRodney W. Grimes u_char icu2_mask; 8435b81b6b3SRodney W. Grimes u_char old_icu1_mask; 8445b81b6b3SRodney W. Grimes u_char old_icu2_mask; 8455b81b6b3SRodney W. Grimes struct gate_descriptor save_idt_npxintr; 8465b81b6b3SRodney W. Grimes 8475b81b6b3SRodney W. Grimes disable_intr(); 8485b81b6b3SRodney W. Grimes old_icu1_mask = inb(IO_ICU1 + 1); 8495b81b6b3SRodney W. Grimes old_icu2_mask = inb(IO_ICU2 + 1); 8505b81b6b3SRodney W. Grimes save_idt_npxintr = idt[npx_intrno]; 851d2306226SDavid Greenman outb(IO_ICU1 + 1, old_icu1_mask & ~(IRQ_SLAVE | npx0_imask)); 852d2306226SDavid Greenman outb(IO_ICU2 + 1, old_icu2_mask & ~(npx0_imask >> 8)); 8535b81b6b3SRodney W. Grimes idt[npx_intrno] = npx_idt_probeintr; 8545b81b6b3SRodney W. Grimes enable_intr(); 8555b81b6b3SRodney W. Grimes stop_emulating(); 8565b81b6b3SRodney W. Grimes fnsave(addr); 85737e52b59SBruce Evans fnop(); 8585b81b6b3SRodney W. Grimes start_emulating(); 8595b81b6b3SRodney W. Grimes npxproc = NULL; 8605b81b6b3SRodney W. Grimes disable_intr(); 8615b81b6b3SRodney W. Grimes icu1_mask = inb(IO_ICU1 + 1); /* masks may have changed */ 8625b81b6b3SRodney W. Grimes icu2_mask = inb(IO_ICU2 + 1); 8635b81b6b3SRodney W. Grimes outb(IO_ICU1 + 1, 864d2306226SDavid Greenman (icu1_mask & ~npx0_imask) | (old_icu1_mask & npx0_imask)); 8655b81b6b3SRodney W. Grimes outb(IO_ICU2 + 1, 866d2306226SDavid Greenman (icu2_mask & ~(npx0_imask >> 8)) 867d2306226SDavid Greenman | (old_icu2_mask & (npx0_imask >> 8))); 8685b81b6b3SRodney W. Grimes idt[npx_intrno] = save_idt_npxintr; 8695b81b6b3SRodney W. Grimes enable_intr(); /* back to usual state */ 8703902c3efSSteve Passe 8713902c3efSSteve Passe #endif /* SMP */ 8725b81b6b3SRodney W. Grimes } 8735b81b6b3SRodney W. Grimes 874cd59d49dSBruce Evans #ifdef I586_CPU 875cd59d49dSBruce Evans static long 876cd59d49dSBruce Evans timezero(funcname, func) 877cd59d49dSBruce Evans const char *funcname; 878cd59d49dSBruce Evans void (*func) __P((void *buf, size_t len)); 879cd59d49dSBruce Evans 880cd59d49dSBruce Evans { 881cd59d49dSBruce Evans void *buf; 882cd59d49dSBruce Evans #define BUFSIZE 1000000 883cd59d49dSBruce Evans long usec; 884cd59d49dSBruce Evans struct timeval finish, start; 885cd59d49dSBruce Evans 886cd59d49dSBruce Evans buf = malloc(BUFSIZE, M_TEMP, M_NOWAIT); 887cd59d49dSBruce Evans if (buf == NULL) 888cd59d49dSBruce Evans return (BUFSIZE); 889cd59d49dSBruce Evans microtime(&start); 890cd59d49dSBruce Evans (*func)(buf, BUFSIZE); 891cd59d49dSBruce Evans microtime(&finish); 892cd59d49dSBruce Evans usec = 1000000 * (finish.tv_sec - start.tv_sec) + 893cd59d49dSBruce Evans finish.tv_usec - start.tv_usec; 894cd59d49dSBruce Evans if (usec <= 0) 895cd59d49dSBruce Evans usec = 1; 896cd59d49dSBruce Evans if (bootverbose) 897cd59d49dSBruce Evans printf("%s bandwidth = %ld bytes/sec\n", 89816967563SBruce Evans funcname, (long)(BUFSIZE * (int64_t)1000000 / usec)); 899cd59d49dSBruce Evans free(buf, M_TEMP); 900cd59d49dSBruce Evans return (usec); 901cd59d49dSBruce Evans } 902cd59d49dSBruce Evans #endif /* I586_CPU */ 903cd59d49dSBruce Evans 9046182fdbdSPeter Wemm static device_method_t npx_methods[] = { 9056182fdbdSPeter Wemm /* Device interface */ 906da4113b3SPeter Wemm DEVMETHOD(device_identify, npx_identify), 9076182fdbdSPeter Wemm DEVMETHOD(device_probe, npx_probe), 9086182fdbdSPeter Wemm DEVMETHOD(device_attach, npx_attach), 9096182fdbdSPeter Wemm DEVMETHOD(device_detach, bus_generic_detach), 9106182fdbdSPeter Wemm DEVMETHOD(device_shutdown, bus_generic_shutdown), 9116182fdbdSPeter Wemm DEVMETHOD(device_suspend, bus_generic_suspend), 9126182fdbdSPeter Wemm DEVMETHOD(device_resume, bus_generic_resume), 9136182fdbdSPeter Wemm 9146182fdbdSPeter Wemm { 0, 0 } 9156182fdbdSPeter Wemm }; 9166182fdbdSPeter Wemm 9176182fdbdSPeter Wemm static driver_t npx_driver = { 9186182fdbdSPeter Wemm "npx", 9196182fdbdSPeter Wemm npx_methods, 9206182fdbdSPeter Wemm 1, /* no softc */ 9216182fdbdSPeter Wemm }; 9226182fdbdSPeter Wemm 9236182fdbdSPeter Wemm static devclass_t npx_devclass; 9246182fdbdSPeter Wemm 9256182fdbdSPeter Wemm /* 9266182fdbdSPeter Wemm * We prefer to attach to the root nexus so that the usual case (exception 16) 9276182fdbdSPeter Wemm * doesn't describe the processor as being `on isa'. 9286182fdbdSPeter Wemm */ 9296182fdbdSPeter Wemm DRIVER_MODULE(npx, nexus, npx_driver, npx_devclass, 0, 0); 93054f1d0ceSGarrett Wollman 93154f1d0ceSGarrett Wollman /* 93254f1d0ceSGarrett Wollman * This sucks up the legacy ISA support assignments from PNPBIOS. 93354f1d0ceSGarrett Wollman */ 93454f1d0ceSGarrett Wollman static struct isa_pnp_id npxisa_ids[] = { 93554f1d0ceSGarrett Wollman { 0x040cd041, "Legacy ISA coprocessor support" }, /* PNP0C04 */ 93654f1d0ceSGarrett Wollman { 0 } 93754f1d0ceSGarrett Wollman }; 93854f1d0ceSGarrett Wollman 93954f1d0ceSGarrett Wollman static int 94054f1d0ceSGarrett Wollman npxisa_probe(device_t dev) 94154f1d0ceSGarrett Wollman { 942bb9c06c1SMike Smith int result; 943bb9c06c1SMike Smith if ((result = ISA_PNP_PROBE(device_get_parent(dev), dev, npxisa_ids)) <= 0) { 944bb9c06c1SMike Smith device_quiet(dev); 945bb9c06c1SMike Smith } 946bb9c06c1SMike Smith return(result); 94754f1d0ceSGarrett Wollman } 94854f1d0ceSGarrett Wollman 94954f1d0ceSGarrett Wollman static int 95054f1d0ceSGarrett Wollman npxisa_attach(device_t dev) 95154f1d0ceSGarrett Wollman { 95254f1d0ceSGarrett Wollman return (0); 95354f1d0ceSGarrett Wollman } 95454f1d0ceSGarrett Wollman 95554f1d0ceSGarrett Wollman static device_method_t npxisa_methods[] = { 95654f1d0ceSGarrett Wollman /* Device interface */ 95754f1d0ceSGarrett Wollman DEVMETHOD(device_probe, npxisa_probe), 95854f1d0ceSGarrett Wollman DEVMETHOD(device_attach, npxisa_attach), 95954f1d0ceSGarrett Wollman DEVMETHOD(device_detach, bus_generic_detach), 96054f1d0ceSGarrett Wollman DEVMETHOD(device_shutdown, bus_generic_shutdown), 96154f1d0ceSGarrett Wollman DEVMETHOD(device_suspend, bus_generic_suspend), 96254f1d0ceSGarrett Wollman DEVMETHOD(device_resume, bus_generic_resume), 96354f1d0ceSGarrett Wollman 96454f1d0ceSGarrett Wollman { 0, 0 } 96554f1d0ceSGarrett Wollman }; 96654f1d0ceSGarrett Wollman 96754f1d0ceSGarrett Wollman static driver_t npxisa_driver = { 96854f1d0ceSGarrett Wollman "npxisa", 96954f1d0ceSGarrett Wollman npxisa_methods, 97054f1d0ceSGarrett Wollman 1, /* no softc */ 97154f1d0ceSGarrett Wollman }; 97254f1d0ceSGarrett Wollman 97354f1d0ceSGarrett Wollman static devclass_t npxisa_devclass; 97454f1d0ceSGarrett Wollman 97554f1d0ceSGarrett Wollman DRIVER_MODULE(npxisa, isa, npxisa_driver, npxisa_devclass, 0, 0); 97654f1d0ceSGarrett Wollman 977