auto conf, bus control, conventions, interrupt control, per host config
authorBill Joy <bill@ucbvax.Berkeley.EDU>
Mon, 19 Nov 1990 03:32:13 +0000 (19:32 -0800)
committerBill Joy <bill@ucbvax.Berkeley.EDU>
Mon, 19 Nov 1990 03:32:13 +0000 (19:32 -0800)
SCCS-vsn: sys/i386/isa/clock.c 5.4
SCCS-vsn: sys/i386/isa/pccons.c 5.4
SCCS-vsn: sys/i386/isa/fd.c 5.3
SCCS-vsn: sys/i386/isa/if_ne.c 1.5
SCCS-vsn: sys/i386/isa/if_we.c 5.4
SCCS-vsn: sys/i386/isa/isa.c 1.2
SCCS-vsn: sys/i386/isa/npx.c 1.2
SCCS-vsn: sys/i386/isa/wd.c 5.8
SCCS-vsn: sys/i386/isa/wt.c 1.2
SCCS-vsn: sys/i386/isa/icu.h 5.4
SCCS-vsn: sys/i386/isa/icu.s 5.4
SCCS-vsn: sys/i386/isa/isa.h 5.5

12 files changed:
usr/src/sys/i386/isa/clock.c
usr/src/sys/i386/isa/fd.c
usr/src/sys/i386/isa/icu.h
usr/src/sys/i386/isa/icu.s
usr/src/sys/i386/isa/if_ne.c
usr/src/sys/i386/isa/if_we.c
usr/src/sys/i386/isa/isa.c
usr/src/sys/i386/isa/isa.h
usr/src/sys/i386/isa/npx.c
usr/src/sys/i386/isa/pccons.c
usr/src/sys/i386/isa/wd.c
usr/src/sys/i386/isa/wt.c

index dfc401b..fa14032 100644 (file)
@@ -9,7 +9,7 @@
  *
  * %sccs.include.386.c%
  *
  *
  * %sccs.include.386.c%
  *
- *     @(#)clock.c     5.3 (Berkeley) %G%
+ *     @(#)clock.c     5.4 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
@@ -18,8 +18,9 @@
 #include "param.h"
 #include "time.h"
 #include "kernel.h"
 #include "param.h"
 #include "time.h"
 #include "kernel.h"
-#include "icu.h"
-#include "isa.h"
+#include "machine/segments.h"
+#include "machine/isa/icu.h"
+#include "machine/isa/isa.h"
 
 #define DAYST 119
 #define DAYEN 303
 
 #define DAYST 119
 #define DAYEN 303
@@ -27,9 +28,9 @@
 startrtclock() {
 
        /* initialize 8253 clock */
 startrtclock() {
 
        /* initialize 8253 clock */
-       outb (IO_TIMER0+3, 0x36);
-       outb (IO_TIMER0, 1193182/hz);
-       outb (IO_TIMER0, (1193182/hz)/256);
+       outb (IO_TIMER1+3, 0x36);
+       outb (IO_TIMER1, 1193182/hz);
+       outb (IO_TIMER1, (1193182/hz)/256);
 }
 
 /* convert 2 digit BCD number */
 }
 
 /* convert 2 digit BCD number */
@@ -153,7 +154,10 @@ resettodr()
 {
 }
 
 {
 }
 
+#define V(s)   V/**/s
+extern V(clk)();
 enablertclock() {
        INTREN(IRQ0);
 enablertclock() {
        INTREN(IRQ0);
+       setidt(ICU_OFFSET+0, &V(clk), SDT_SYS386IGT, SEL_KPL);
        splnone();
 }
        splnone();
 }
index 39adfcc..d0fd7a9 100644 (file)
@@ -9,7 +9,7 @@
  *
  * %sccs.include.386.c%
  *
  *
  * %sccs.include.386.c%
  *
- *     @(#)fd.c        5.2 (Berkeley) %G%
+ *     @(#)fd.c        5.3 (Berkeley) %G%
  */
 
 /****************************************************************************/
  */
 
 /****************************************************************************/
@@ -28,7 +28,7 @@
 #include "vm.h"
 #include "uio.h"
 #include "machine/pte.h"
 #include "vm.h"
 #include "uio.h"
 #include "machine/pte.h"
-#include "machine/isa/device.h"
+#include "machine/isa/isa_device.h"
 #include "machine/isa/fdreg.h"
 #include "icu.h"
 
 #include "machine/isa/fdreg.h"
 #include "icu.h"
 
index 5a29a9f..8b7fd7f 100644 (file)
@@ -7,7 +7,7 @@
  *
  * %sccs.include.386.c%
  *
  *
  * %sccs.include.386.c%
  *
- *     @(#)icu.h       5.3 (Berkeley) %G%
+ *     @(#)icu.h       5.4 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
 #define        __ICU__
 
 #ifndef        LOCORE
 #define        __ICU__
 
 #ifndef        LOCORE
+
+/*
+ * Interrupt "level" mechanism variables, masks, and macros
+ */
 extern unsigned short  imen;   /* interrupt mask enable */
 extern unsigned short  imen;   /* interrupt mask enable */
-extern unsigned short  cpl;    /* current priority level */
+extern unsigned short  cpl;    /* current priority level mask */
 
 
-extern unsigned short ttymask; /* things that get masked with spltty() */
-extern unsigned short biomask; /* things that get masked with splbio() */
-extern unsigned short netmask; /* things that get masked with splimp() */
+extern unsigned short highmask; /* group of interrupts masked with splhigh() */
+extern unsigned short ttymask; /* group of interrupts masked with spltty() */
+extern unsigned short biomask; /* group of interrupts masked with splbio() */
+extern unsigned short netmask; /* group of interrupts masked with splimp() */
 
 #define        INTREN(s)       imen &= ~(s)
 #define        INTRDIS(s)      imen |= (s)
 #define        INTRMASK(msk,s) msk |= (s)
 
 #define        INTREN(s)       imen &= ~(s)
 #define        INTRDIS(s)      imen |= (s)
 #define        INTRMASK(msk,s) msk |= (s)
+
+#else
+
+/*
+ * Macro's for interrupt level priority masks (used in interrupt vector entry)
+ */
+
+/* Just mask this interrupt only */
+#define        INTR(a) \
+       pushl   $0 ; \
+       pushl   $ T_ASTFLT ; \
+       pushal ; \
+       push    %ds ; \
+       push    %es ; \
+       movw    $0x10, %ax ; \
+       movw    %ax, %ds ; \
+       movw    %ax,%es ; \
+       incl    _cnt+V_INTR ; \
+       movzwl  _cpl,%eax ; \
+       pushl   %eax ; \
+       pushl   $ a ; \
+       orw     $ IRQ/**/a ,%ax ; \
+       movw    %ax,_cpl ; \
+       orw     _imen,%ax ; \
+       NOP ; \
+       outb    %al,$ IO_ICU1+1 ; \
+       NOP ; \
+       movb    %ah,%al ; \
+       outb    %al,$ IO_ICU2+1 ; \
+       NOP     ; \
+       sti
+
+/* Mask a group of interrupts atomically */
+#define        INTRN(a,b) \
+       pushl   $0 ; \
+       pushl   $ T_ASTFLT ; \
+       pushal ; \
+       push    %ds ; \
+       push    %es ; \
+       movw    $0x10, %ax ; \
+       movw    %ax, %ds ; \
+       movw    %ax,%es ; \
+       incl    _cnt+V_INTR ; \
+       movzwl  _cpl,%eax ; \
+       pushl   %eax ; \
+       pushl   $ a ; \
+       orw     $ IRQ/**/a ,%ax ; \
+       orw     b ,%ax ; \
+       movw    %ax,_cpl ; \
+       orw     _imen,%ax ; \
+       NOP ; \
+       outb    %al,$ IO_ICU1+1 ; \
+       NOP ; \
+       movb    %ah,%al ; \
+       outb    %al,$ IO_ICU2+1 ; \
+       NOP     ; \
+       sti
+
+/* Interrupt vector exit macros */
+
+/* First eight interrupts (ICU1) */
+#define        INTREXT1        \
+       movb    $0x20,%al ; \
+       outb    %al,$ IO_ICU1 ; \
+       jmp     doreti
+
+/* Second eight interrupts (ICU2) */
+#define        INTREXT2        \
+       movb    $0x20,%al ; \
+       outb    %al,$ IO_ICU1 ; \
+       outb    %al,$ IO_ICU2 ; \
+       jmp     doreti
+
 #endif
 
 #endif
 
-/* Interrupt enable bits -- in order of priority */
+/*
+ * Interrupt enable bits -- in order of priority
+ */
 #define        IRQ0            0x0001          /* highest priority - timer */
 #define        IRQ1            0x0002
 #define        IRQ_SLAVE       0x0004
 #define        IRQ0            0x0001          /* highest priority - timer */
 #define        IRQ1            0x0002
 #define        IRQ_SLAVE       0x0004
@@ -50,4 +130,10 @@ extern      unsigned short netmask; /* things that get masked with splimp() */
 #define        IRQ6            0x0040
 #define        IRQ7            0x0080          /* lowest - parallel printer */
 
 #define        IRQ6            0x0040
 #define        IRQ7            0x0080          /* lowest - parallel printer */
 
+/*
+ * Interrupt Control offset into Interrupt descriptor table (IDT)
+ */
+#define        ICU_OFFSET      32              /* 0-31 are processor exceptions */
+#define        ICU_LEN         16              /* 32-47 are ISA interrupts */
+
 #endif __ICU__
 #endif __ICU__
index 37dde52..42a1880 100644 (file)
@@ -7,7 +7,7 @@
  *
  * %sccs.include.386.c%
  *
  *
  * %sccs.include.386.c%
  *
- *     @(#)icu.s       5.3 (Berkeley) %G%
+ *     @(#)icu.s       5.4 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
        .globl  _cpl
 _cpl:  .long   0xffff                  # current priority level (all off)
 _imen: .long   0xffff                  # interrupt mask enable (all off)
        .globl  _cpl
 _cpl:  .long   0xffff                  # current priority level (all off)
 _imen: .long   0xffff                  # interrupt mask enable (all off)
+       .globl  _highmask
+_highmask:     .long   0xffff
        .globl  _ttymask
 _ttymask:      .long   0
        .globl  _biomask
 _biomask:      .long   0
        .globl  _netmask
 _netmask:      .long   0
        .globl  _ttymask
 _ttymask:      .long   0
        .globl  _biomask
 _biomask:      .long   0
        .globl  _netmask
 _netmask:      .long   0
+
        .text
        .text
+/*
+ * Handle return from interrupt after device handler finishes
+ */
+doreti:
+       cli
+       popl    %ebx                    # remove intr number
+       popl    %eax                    # get previous priority
+       # now interrupt frame is a trap frame!
+       movw    %ax,%cx
+       movw    %ax,_cpl
+       orw     _imen,%ax
+       NOP
+       outb    %al,$ IO_ICU1+1         # re-enable intr?
+       NOP
+       movb    %ah,%al
+       NOP
+       outb    %al,$ IO_ICU2+1
+       NOP
+
+       andw    $0xffff,%cx     
+       cmpw    $0,%cx                  # returning to zero?
+       je      1f
+
+       pop     %es                     # nope, going to non-zero level
+       pop     %ds
+       popa
+       addl    $8,%esp
+       iret
+
+1:     cmpl    $0,_netisr              # check for softint s/traps
+       jne     1f
+
+       pop     %es                     # none, going back to base pri
+       pop     %ds
+       popa
+       addl    $8,%esp
+       iret
+       
+#include "../net/netisr.h"
+
+1:
+
+#define DONET(s, c)    ; \
+       .globl  c ;  \
+       movl    $ s ,%eax ;     \
+       btrl    %eax,_netisr ;  \
+       jnb     1f ; \
+       call    c ; \
+1:
+
+       call    _splnet
+       pushl   %eax
+
+       DONET(NETISR_RAW,_rawintr)
+#ifdef INET
+       DONET(NETISR_IP,_ipintr)
+#endif
+#ifdef IMP
+       DONET(NETISR_IMP,_impintr)
+#endif
+#ifdef NS
+       DONET(NETISR_NS,_nsintr)
+#endif
+
+       popl    %eax
+       movw    %ax,_cpl
+       orw     _imen,%ax
+       NOP
+       outb    %al,$ IO_ICU1+1         # re-enable intr?
+       NOP
+       movb    %ah,%al
+       NOP
+       outb    %al,$ IO_ICU2+1
+       NOP
+
+       # btrl  $ NETISR_SCLK,_netisr
+       movl    $ NETISR_SCLK,%eax      # stupid assembler, as usual
+       btrl    %eax,_netisr
+       jnb     1f
+       # back to an interrupt frame for a moment
+       call    _splsoftclock
+       pushl   %eax
+       pushl   $0xff   # dummy intr
+       call    _softclock
+       popl    %eax
+       call    _splx
+       popl    %eax
+
+       jmp     2f
+
+       /* 1:   btrl    $NETISR_AST,_netisr*/
+1:
+       cmpw    $0x1f,13*4(%esp)        # to user?
+       jne     2f                      # nope, leave
+       movl    $ NETISR_AST,%eax       # stupid assembler, as usual
+       btrl    %eax,_netisr
+       jnb     2f
+       call    _trap
+
+2:     pop     %es
+       pop     %ds
+       popal
+       addl    $8,%esp
+       iret
+
+/*
+ * Interrupt priority mechanism
+ *
+ * Two flavors -- imlXX masks relative to ISA noemenclature (for PC compat sw)
+ *             -- splXX masks with group mechanism for BSD purposes
+ */
 
 
-       .globl  _iml0                   # masks off all interrupts
        .globl  _splhigh
        .globl  _splclock
        .globl  _splhigh
        .globl  _splclock
-       .globl  _spl6
-_iml0:
-_spl6:
 _splhigh:
 _splclock:
        cli                             # disable interrupts
 _splhigh:
 _splclock:
        cli                             # disable interrupts
@@ -43,20 +153,18 @@ _splclock:
        # orw   _imen,%ax               # mask off those not enabled yet
        movw    %ax,%cx
        NOP
        # orw   _imen,%ax               # mask off those not enabled yet
        movw    %ax,%cx
        NOP
-       outb    %al,$0x21               /* update icu's */
+       outb    %al,$ IO_ICU1+1         /* update icu's */
        NOP
        movb    %ah,%al
        NOP
        NOP
        movb    %ah,%al
        NOP
-       outb    %al,$0xA1
+       outb    %al,$ IO_ICU2+1
        NOP
        movzwl  _cpl,%eax               # return old priority
        movw    %dx,_cpl                # set new priority level
        sti                             # enable interrupts
        ret
 
        NOP
        movzwl  _cpl,%eax               # return old priority
        movw    %dx,_cpl                # set new priority level
        sti                             # enable interrupts
        ret
 
-       .globl  _iml1                   # mask off all but irq0
        .globl  _spltty                 # block clists
        .globl  _spltty                 # block clists
-_iml1:
 _spltty:
        cli                             # disable interrupts
        movw    _cpl,%ax
 _spltty:
        cli                             # disable interrupts
        movw    _cpl,%ax
@@ -65,338 +173,384 @@ _spltty:
        orw     _imen,%ax               # mask off those not enabled yet
        movw    %ax,%cx
        NOP
        orw     _imen,%ax               # mask off those not enabled yet
        movw    %ax,%cx
        NOP
-       outb    %al,$0x21               /* update icu's */
+       outb    %al,$ IO_ICU1+1         /* update icu's */
        NOP
        movb    %ah,%al
        NOP
        NOP
        movb    %ah,%al
        NOP
-       outb    %al,$0xA1
+       outb    %al,$ IO_ICU2+1
        NOP
        movzwl  _cpl,%eax               # return old priority
        movw    %dx,_cpl                # set new priority level
        sti                             # enable interrupts
        ret
 
        NOP
        movzwl  _cpl,%eax               # return old priority
        movw    %dx,_cpl                # set new priority level
        sti                             # enable interrupts
        ret
 
-       .globl  _iml8                   # mask off all but irq0-1
-_iml8:
+       .globl  _splimp
+       .globl  _splnet
+_splimp:
+_splnet:
        cli                             # disable interrupts
        cli                             # disable interrupts
-       movw    $0xfffc,%ax             # set new priority level
+       movw    _cpl,%ax
+       orw     _netmask,%ax
        movw    %ax,%dx
        orw     _imen,%ax               # mask off those not enabled yet
        movw    %ax,%cx
        NOP
        movw    %ax,%dx
        orw     _imen,%ax               # mask off those not enabled yet
        movw    %ax,%cx
        NOP
-       outb    %al,$0x21               /* update icu's */
+       outb    %al,$ IO_ICU1+1         /* update icu's */
        NOP
        movb    %ah,%al
        NOP
        NOP
        movb    %ah,%al
        NOP
-       outb    %al,$0xA1
+       outb    %al,$ IO_ICU2+1
        NOP
        movzwl  _cpl,%eax               # return old priority
        movw    %dx,_cpl                # set new priority level
        sti                             # enable interrupts
        ret
 
        NOP
        movzwl  _cpl,%eax               # return old priority
        movw    %dx,_cpl                # set new priority level
        sti                             # enable interrupts
        ret
 
-       .globl  _iml9                   # mask off all but irq0-1,8
-       .globl  _iml2                   # alias for PC hardware level 2
-       .globl  _splimp
-       .globl  _splnet
-_iml9:
-_iml2:
-_splimp:
-_splnet:
+       .globl  _splbio 
+_splbio:
        cli                             # disable interrupts
        movw    _cpl,%ax
        cli                             # disable interrupts
        movw    _cpl,%ax
-       orw     _netmask,%ax
+       orw     _biomask,%ax
        movw    %ax,%dx
        orw     _imen,%ax               # mask off those not enabled yet
        movw    %ax,%cx
        NOP
        movw    %ax,%dx
        orw     _imen,%ax               # mask off those not enabled yet
        movw    %ax,%cx
        NOP
-       outb    %al,$0x21               /* update icu's */
+       outb    %al,$ IO_ICU1+1         /* update icu's */
        NOP
        movb    %ah,%al
        NOP
        NOP
        movb    %ah,%al
        NOP
-       outb    %al,$0xA1
+       outb    %al,$ IO_ICU2+1
        NOP
        movzwl  _cpl,%eax               # return old priority
        movw    %dx,_cpl                # set new priority level
        sti                             # enable interrupts
        ret
 
        NOP
        movzwl  _cpl,%eax               # return old priority
        movw    %dx,_cpl                # set new priority level
        sti                             # enable interrupts
        ret
 
-       .globl  _iml10                  # mask off all but irq0-1,8-9
-_iml10:
+       .globl  _splsoftclock
+_splsoftclock:
        cli                             # disable interrupts
        cli                             # disable interrupts
-       movw    $0xfcf8,%ax             # set new priority level
+       movw    _cpl,%ax
+       orw     $0x8000,%ax             # set new priority level
        movw    %ax,%dx
        orw     _imen,%ax               # mask off those not enabled yet
        movw    %ax,%cx
        NOP
        movw    %ax,%dx
        orw     _imen,%ax               # mask off those not enabled yet
        movw    %ax,%cx
        NOP
-       outb    %al,$0x21               /* update icu's */
+       outb    %al,$ IO_ICU1+1         /* update icu's */
        NOP
        movb    %ah,%al
        NOP
        NOP
        movb    %ah,%al
        NOP
-       outb    %al,$0xA1
+       outb    %al,$ IO_ICU2+1
        NOP
        movzwl  _cpl,%eax               # return old priority
        movw    %dx,_cpl                # set new priority level
        sti                             # enable interrupts
        ret
 
        NOP
        movzwl  _cpl,%eax               # return old priority
        movw    %dx,_cpl                # set new priority level
        sti                             # enable interrupts
        ret
 
-       .globl  _iml11                  # mask off all but irq0-1,8-10
-_iml11:
+       .globl _splnone
+       .globl _spl0
+_splnone:
+_spl0:
        cli                             # disable interrupts
        cli                             # disable interrupts
-       movw    $0xf8f8,%ax             # set new priority level
-       movw    %ax,%dx
+       pushl   _cpl                    # save old priority
+       movw    _cpl,%ax
+       orw     _netmask,%ax            # mask off those network devices
+       movw    %ax,_cpl                # set new priority level
        orw     _imen,%ax               # mask off those not enabled yet
        orw     _imen,%ax               # mask off those not enabled yet
-       movw    %ax,%cx
        NOP
        NOP
-       outb    %al,$0x21               /* update icu's */
+       outb    %al,$ IO_ICU1+1         /* update icu's */
        NOP
        movb    %ah,%al
        NOP
        NOP
        movb    %ah,%al
        NOP
-       outb    %al,$0xA1
+       outb    %al,$ IO_ICU2+1
        NOP
        NOP
-       movzwl  _cpl,%eax               # return old priority
-       movw    %dx,_cpl                # set new priority level
        sti                             # enable interrupts
        sti                             # enable interrupts
-       ret
 
 
-       .globl  _iml12                  # mask off all but irq0-1,8-11
-_iml12:
+       DONET(NETISR_RAW,_rawintr)
+#ifdef INET
+       DONET(NETISR_IP,_ipintr)
+#endif
        cli                             # disable interrupts
        cli                             # disable interrupts
-       movw    $0xf0f8,%ax             # set new priority level
+       popl    _cpl                    # save old priority
+       movw    $0,%ax                  # set new priority level
        movw    %ax,%dx
        orw     _imen,%ax               # mask off those not enabled yet
        movw    %ax,%cx
        NOP
        movw    %ax,%dx
        orw     _imen,%ax               # mask off those not enabled yet
        movw    %ax,%cx
        NOP
-       outb    %al,$0x21               /* update icu's */
+       outb    %al,$ IO_ICU1+1         /* update icu's */
        NOP
        movb    %ah,%al
        NOP
        NOP
        movb    %ah,%al
        NOP
-       outb    %al,$0xA1
+       outb    %al,$ IO_ICU2+1
        NOP
        movzwl  _cpl,%eax               # return old priority
        movw    %dx,_cpl                # set new priority level
        sti                             # enable interrupts
        ret
 
        NOP
        movzwl  _cpl,%eax               # return old priority
        movw    %dx,_cpl                # set new priority level
        sti                             # enable interrupts
        ret
 
-       .globl  _iml13                  # mask off all but irq0-1,8-12
-_iml13:
+       .globl _splx
+_splx:
        cli                             # disable interrupts
        cli                             # disable interrupts
-       movw    $0xe0f8,%ax             # set new priority level
+       movw    4(%esp),%ax             # new priority level
        movw    %ax,%dx
        movw    %ax,%dx
+       cmpw    $0,%dx
+       je      _spl0                   # going to "zero level" is special
+
        orw     _imen,%ax               # mask off those not enabled yet
        movw    %ax,%cx
        NOP
        orw     _imen,%ax               # mask off those not enabled yet
        movw    %ax,%cx
        NOP
-       outb    %al,$0x21               /* update icu's */
+       outb    %al,$ IO_ICU1+1         /* update icu's */
        NOP
        movb    %ah,%al
        NOP
        NOP
        movb    %ah,%al
        NOP
-       outb    %al,$0xA1
+       outb    %al,$ IO_ICU2+1
        NOP
        movzwl  _cpl,%eax               # return old priority
        movw    %dx,_cpl                # set new priority level
        sti                             # enable interrupts
        ret
 
        NOP
        movzwl  _cpl,%eax               # return old priority
        movw    %dx,_cpl                # set new priority level
        sti                             # enable interrupts
        ret
 
-       .globl  _iml14                  # mask off all but irq0-1,8-13
-       .globl  _splbio 
-_iml14:
-_splbio:
+#ifdef notyet
+       .globl  _iml8                   # mask off all but irq0-1
+_iml8:
        cli                             # disable interrupts
        cli                             # disable interrupts
-       movw    _cpl,%ax
-       orw     _biomask,%ax
+       movw    $0xfffc,%ax             # set new priority level
        movw    %ax,%dx
        orw     _imen,%ax               # mask off those not enabled yet
        movw    %ax,%cx
        NOP
        movw    %ax,%dx
        orw     _imen,%ax               # mask off those not enabled yet
        movw    %ax,%cx
        NOP
-       outb    %al,$0x21               /* update icu's */
+       outb    %al,$ IO_ICU1+1         /* update icu's */
        NOP
        movb    %ah,%al
        NOP
        NOP
        movb    %ah,%al
        NOP
-       outb    %al,$0xA1
+       outb    %al,$ IO_ICU2+1
        NOP
        movzwl  _cpl,%eax               # return old priority
        movw    %dx,_cpl                # set new priority level
        sti                             # enable interrupts
        ret
 
        NOP
        movzwl  _cpl,%eax               # return old priority
        movw    %dx,_cpl                # set new priority level
        sti                             # enable interrupts
        ret
 
-       .globl  _iml15                  # mask off all but irq0-1,8-14
-_iml15:
+       .globl  _iml10                  # mask off all but irq0-1,8-9
+_iml10:
        cli                             # disable interrupts
        cli                             # disable interrupts
-       movw    $0x80f8,%ax             # set new priority level
+       movw    $0xfcf8,%ax             # set new priority level
        movw    %ax,%dx
        orw     _imen,%ax               # mask off those not enabled yet
        movw    %ax,%cx
        NOP
        movw    %ax,%dx
        orw     _imen,%ax               # mask off those not enabled yet
        movw    %ax,%cx
        NOP
-       outb    %al,$0x21               /* update icu's */
+       outb    %al,$ IO_ICU1+1         /* update icu's */
        NOP
        movb    %ah,%al
        NOP
        NOP
        movb    %ah,%al
        NOP
-       outb    %al,$0xA1
+       outb    %al,$ IO_ICU2+1
        NOP
        movzwl  _cpl,%eax               # return old priority
        movw    %dx,_cpl                # set new priority level
        sti                             # enable interrupts
        ret
 
        NOP
        movzwl  _cpl,%eax               # return old priority
        movw    %dx,_cpl                # set new priority level
        sti                             # enable interrupts
        ret
 
-       .globl  _iml3                   # mask off all but irq0-1,8-15
-_iml3:
+       .globl  _iml11                  # mask off all but irq0-1,8-10
+_iml11:
        cli                             # disable interrupts
        cli                             # disable interrupts
-       movw    $0x00f8,%ax             # set new priority level
+       movw    $0xf8f8,%ax             # set new priority level
        movw    %ax,%dx
        orw     _imen,%ax               # mask off those not enabled yet
        movw    %ax,%cx
        NOP
        movw    %ax,%dx
        orw     _imen,%ax               # mask off those not enabled yet
        movw    %ax,%cx
        NOP
-       outb    %al,$0x21               /* update icu's */
+       outb    %al,$ IO_ICU1+1         /* update icu's */
        NOP
        movb    %ah,%al
        NOP
        NOP
        movb    %ah,%al
        NOP
-       outb    %al,$0xA1
+       outb    %al,$ IO_ICU2+1
        NOP
        movzwl  _cpl,%eax               # return old priority
        movw    %dx,_cpl                # set new priority level
        sti                             # enable interrupts
        ret
 
        NOP
        movzwl  _cpl,%eax               # return old priority
        movw    %dx,_cpl                # set new priority level
        sti                             # enable interrupts
        ret
 
-       .globl  _iml4                   # mask off all but irq0-1,8-15,3
-_iml4:
+       .globl  _iml12                  # mask off all but irq0-1,8-11
+_iml12:
        cli                             # disable interrupts
        cli                             # disable interrupts
-       movw    $0x00f0,%ax             # set new priority level
+       movw    $0xf0f8,%ax             # set new priority level
        movw    %ax,%dx
        orw     _imen,%ax               # mask off those not enabled yet
        movw    %ax,%cx
        NOP
        movw    %ax,%dx
        orw     _imen,%ax               # mask off those not enabled yet
        movw    %ax,%cx
        NOP
-       outb    %al,$0x21               /* update icu's */
+       outb    %al,$ IO_ICU1+1         /* update icu's */
        NOP
        movb    %ah,%al
        NOP
        NOP
        movb    %ah,%al
        NOP
-       outb    %al,$0xA1
+       outb    %al,$ IO_ICU2+1
        NOP
        movzwl  _cpl,%eax               # return old priority
        movw    %dx,_cpl                # set new priority level
        sti                             # enable interrupts
        ret
 
        NOP
        movzwl  _cpl,%eax               # return old priority
        movw    %dx,_cpl                # set new priority level
        sti                             # enable interrupts
        ret
 
-       .globl  _iml5                   # mask off all but irq0-1,8-15,3-4
-_iml5:
+       .globl  _iml13                  # mask off all but irq0-1,8-12
+_iml13:
        cli                             # disable interrupts
        cli                             # disable interrupts
-       movw    $0x00e0,%ax             # set new priority level
+       movw    $0xe0f8,%ax             # set new priority level
        movw    %ax,%dx
        orw     _imen,%ax               # mask off those not enabled yet
        movw    %ax,%cx
        NOP
        movw    %ax,%dx
        orw     _imen,%ax               # mask off those not enabled yet
        movw    %ax,%cx
        NOP
-       outb    %al,$0x21               /* update icu's */
+       outb    %al,$ IO_ICU1+1         /* update icu's */
        NOP
        movb    %ah,%al
        NOP
        NOP
        movb    %ah,%al
        NOP
-       outb    %al,$0xA1
+       outb    %al,$ IO_ICU2+1
        NOP
        movzwl  _cpl,%eax               # return old priority
        movw    %dx,_cpl                # set new priority level
        sti                             # enable interrupts
        ret
 
        NOP
        movzwl  _cpl,%eax               # return old priority
        movw    %dx,_cpl                # set new priority level
        sti                             # enable interrupts
        ret
 
-       .globl  _iml6                   # mask off all but irq0-1,8-15,3-5
-_iml6:
+       .globl  _iml15                  # mask off all but irq0-1,8-14
+_iml15:
        cli                             # disable interrupts
        cli                             # disable interrupts
-       movw    $0x00c0,%ax             # set new priority level
+       movw    $0x80f8,%ax             # set new priority level
        movw    %ax,%dx
        orw     _imen,%ax               # mask off those not enabled yet
        movw    %ax,%cx
        NOP
        movw    %ax,%dx
        orw     _imen,%ax               # mask off those not enabled yet
        movw    %ax,%cx
        NOP
-       outb    %al,$0x21               /* update icu's */
+       outb    %al,$ IO_ICU1+1         /* update icu's */
        NOP
        movb    %ah,%al
        NOP
        NOP
        movb    %ah,%al
        NOP
-       outb    %al,$0xA1
+       outb    %al,$ IO_ICU2+1
        NOP
        movzwl  _cpl,%eax               # return old priority
        movw    %dx,_cpl                # set new priority level
        sti                             # enable interrupts
        ret
 
        NOP
        movzwl  _cpl,%eax               # return old priority
        movw    %dx,_cpl                # set new priority level
        sti                             # enable interrupts
        ret
 
-       .globl  _iml7,_splsoftclock     # mask off all but irq0-1,8-15,3-7
-_iml7:
-_splsoftclock:
+       .globl  _iml3                   # mask off all but irq0-1,8-15
+_iml3:
        cli                             # disable interrupts
        cli                             # disable interrupts
-       movw    _cpl,%ax
-       orw     $0x8000,%ax             # set new priority level
+       movw    $0x00f8,%ax             # set new priority level
        movw    %ax,%dx
        orw     _imen,%ax               # mask off those not enabled yet
        movw    %ax,%cx
        NOP
        movw    %ax,%dx
        orw     _imen,%ax               # mask off those not enabled yet
        movw    %ax,%cx
        NOP
-       outb    %al,$0x21               /* update icu's */
+       outb    %al,$ IO_ICU1+1         /* update icu's */
        NOP
        movb    %ah,%al
        NOP
        NOP
        movb    %ah,%al
        NOP
-       outb    %al,$0xA1
+       outb    %al,$ IO_ICU2+1
        NOP
        movzwl  _cpl,%eax               # return old priority
        movw    %dx,_cpl                # set new priority level
        sti                             # enable interrupts
        ret
 
        NOP
        movzwl  _cpl,%eax               # return old priority
        movw    %dx,_cpl                # set new priority level
        sti                             # enable interrupts
        ret
 
-       .globl _imlnone                 # masks off no interrupts
-       .globl _splnone
-       .globl _spl0
-_imlnone:
-_splnone:
-_spl0:
+       .globl  _iml4                   # mask off all but irq0-1,8-15,3
+_iml4:
        cli                             # disable interrupts
        cli                             # disable interrupts
-       pushl   _cpl                    # save old priority
-       movw    _cpl,%ax
-       orw     _netmask,%ax            # mask off those network devices
-       movw    %ax,_cpl                # set new priority level
+       movw    $0x00f0,%ax             # set new priority level
+       movw    %ax,%dx
        orw     _imen,%ax               # mask off those not enabled yet
        orw     _imen,%ax               # mask off those not enabled yet
+       movw    %ax,%cx
        NOP
        NOP
-       outb    %al,$0x21               /* update icu's */
+       outb    %al,$ IO_ICU1+1         /* update icu's */
        NOP
        movb    %ah,%al
        NOP
        NOP
        movb    %ah,%al
        NOP
-       outb    %al,$0xA1
+       outb    %al,$ IO_ICU2+1
        NOP
        NOP
+       movzwl  _cpl,%eax               # return old priority
+       movw    %dx,_cpl                # set new priority level
        sti                             # enable interrupts
        sti                             # enable interrupts
+       ret
 
 
-       DONET(NETISR_RAW,_rawintr)
-#ifdef INET
-       DONET(NETISR_IP,_ipintr)
-#endif
+       .globl  _iml5                   # mask off all but irq0-1,8-15,3-4
+_iml5:
        cli                             # disable interrupts
        cli                             # disable interrupts
-       popl    _cpl                    # save old priority
-       movw    $0,%ax                  # set new priority level
+       movw    $0x00e0,%ax             # set new priority level
        movw    %ax,%dx
        orw     _imen,%ax               # mask off those not enabled yet
        movw    %ax,%cx
        NOP
        movw    %ax,%dx
        orw     _imen,%ax               # mask off those not enabled yet
        movw    %ax,%cx
        NOP
-       outb    %al,$0x21               /* update icu's */
+       outb    %al,$ IO_ICU1+1         /* update icu's */
        NOP
        movb    %ah,%al
        NOP
        NOP
        movb    %ah,%al
        NOP
-       outb    %al,$0xA1
+       outb    %al,$ IO_ICU2+1
        NOP
        movzwl  _cpl,%eax               # return old priority
        movw    %dx,_cpl                # set new priority level
        sti                             # enable interrupts
        ret
 
        NOP
        movzwl  _cpl,%eax               # return old priority
        movw    %dx,_cpl                # set new priority level
        sti                             # enable interrupts
        ret
 
-       .globl _splx
-_splx:
+       .globl  _iml6                   # mask off all but irq0-1,8-15,3-5
+_iml6:
        cli                             # disable interrupts
        cli                             # disable interrupts
-       movw    4(%esp),%ax             # new priority level
+       movw    $0x00c0,%ax             # set new priority level
        movw    %ax,%dx
        movw    %ax,%dx
-       cmpw    $0,%dx
-       je      _spl0
-
        orw     _imen,%ax               # mask off those not enabled yet
        movw    %ax,%cx
        NOP
        orw     _imen,%ax               # mask off those not enabled yet
        movw    %ax,%cx
        NOP
-       outb    %al,$0x21               /* update icu's */
+       outb    %al,$ IO_ICU1+1         /* update icu's */
        NOP
        movb    %ah,%al
        NOP
        NOP
        movb    %ah,%al
        NOP
-       outb    %al,$0xA1
+       outb    %al,$ IO_ICU2+1
        NOP
        movzwl  _cpl,%eax               # return old priority
        movw    %dx,_cpl                # set new priority level
        sti                             # enable interrupts
        ret
 
        NOP
        movzwl  _cpl,%eax               # return old priority
        movw    %dx,_cpl                # set new priority level
        sti                             # enable interrupts
        ret
 
+#endif notyet
+
+       /* hardware interrupt catcher (IDT 32 - 47) */
+       .globl  _isa_strayintr
+
+IDTVEC(intr0)
+       INTR(0) ; call  _isa_strayintr ; INTREXT1
+
+IDTVEC(intr1)
+       INTR(1) ; call  _isa_strayintr ; INTREXT1
+
+IDTVEC(intr2)
+       INTR(2) ; call  _isa_strayintr ; INTREXT1
+
+IDTVEC(intr3)
+       INTR(3) ; call  _isa_strayintr ; INTREXT1
+
+IDTVEC(intr4)
+       INTR(4) ; call  _isa_strayintr ; INTREXT1
+
+IDTVEC(intr5)
+       INTR(5) ; call  _isa_strayintr ; INTREXT1
+
+IDTVEC(intr6)
+       INTR(6) ; call  _isa_strayintr ; INTREXT1
+
+IDTVEC(intr7)
+       INTR(7) ; call  _isa_strayintr ; INTREXT1
+
+
+IDTVEC(intr8)
+       INTR(8) ; call  _isa_strayintr ; INTREXT2
+
+IDTVEC(intr9)
+       INTR(9) ; call  _isa_strayintr ; INTREXT2
+
+IDTVEC(intr10)
+       INTR(10) ; call _isa_strayintr ; INTREXT2
+
+IDTVEC(intr11)
+       INTR(11) ; call _isa_strayintr ; INTREXT2
+
+IDTVEC(intr12)
+       INTR(12) ; call _isa_strayintr ; INTREXT2
+
+IDTVEC(intr13)
+       INTR(13) ; call _isa_strayintr ; INTREXT2
+
+IDTVEC(intr14)
+       INTR(14) ; call _isa_strayintr ; INTREXT2
+
+IDTVEC(intr15)
+       INTR(15) ; call _isa_strayintr ; INTREXT2
+
index c8c18e0..f3dbcb8 100644 (file)
@@ -3,7 +3,7 @@
 /*
  * NE2000 Ethernet driver
  * Copyright (C) 1990 W. Jolitz
 /*
  * NE2000 Ethernet driver
  * Copyright (C) 1990 W. Jolitz
- * @(#)if_ne.c 1.4 (Berkeley) %G%
+ * @(#)if_ne.c 1.5 (Berkeley) %G%
  *
  * Parts inspired from Tim Tucker's if_wd driver for the wd8003,
  * insight on the ne2000 gained from Robert Clements PC/FTP driver.
  *
  * Parts inspired from Tim Tucker's if_wd driver for the wd8003,
  * insight on the ne2000 gained from Robert Clements PC/FTP driver.
@@ -36,7 +36,7 @@
 #include "../netns/ns_if.h"
 #endif
 
 #include "../netns/ns_if.h"
 #endif
 
-#include "machine/isa/device.h"
+#include "machine/isa/isa_device.h"
 #include "if_nereg.h"
 #include "icu.h"
 
 #include "if_nereg.h"
 #include "icu.h"
 
index 4e0bb9e..1d02b02 100644 (file)
@@ -7,7 +7,7 @@
  *
  * %sccs.include.noredist.c%
  *
  *
  * %sccs.include.noredist.c%
  *
- *     @(#)if_we.c     5.3 (Berkeley) %G%
+ *     @(#)if_we.c     5.4 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
@@ -51,7 +51,7 @@
 #endif
 
 #include "machine/isa/if_wereg.h"
 #endif
 
 #include "machine/isa/if_wereg.h"
-#include "machine/isa/device.h"
+#include "machine/isa/isa_device.h"
  
 /*
  * This constant should really be 60 because the we adds 4 bytes of crc.
  
 /*
  * This constant should really be 60 because the we adds 4 bytes of crc.
index 4fd3099..315b306 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * code to manage AT bus
 /*
  * code to manage AT bus
- * @(#)isa.c   1.1 (Berkeley) %G%
+ * @(#)isa.c   1.2 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
 #include "buf.h"
 #include "vm.h"
 #include "uio.h"
 #include "buf.h"
 #include "vm.h"
 #include "uio.h"
+#include "syslog.h"
+#include "machine/segments.h"
 #include "machine/pte.h"
 #include "machine/pte.h"
+#include "machine/isa/isa_device.h"
+#include "machine/isa/icu.h"
+
+/*
+ * Configure all ISA devices
+ */
+isa_configure() {
+       struct isa_device *dvp;
+       struct isa_driver *dp;
+
+       splhigh();
+       INTREN(IRQ_SLAVE);
+       for (dvp = isa_devtab_bio; config_isadev(dvp,&biomask); dvp++);
+       for (dvp = isa_devtab_tty; config_isadev(dvp,&ttymask); dvp++);
+       for (dvp = isa_devtab_net; config_isadev(dvp,&netmask); dvp++);
+       for (dvp = isa_devtab_null; config_isadev(dvp,0); dvp++);
+#include "sl.h"
+#if NSL > 0
+       netmask |= ttymask;
+       ttymask |= netmask;
+#endif
+       /* biomask |= ttymask ;  can some tty devices use buffers? */
+       printf("biomask %x ttymask %x netmask %x\n", biomask, ttymask, netmask);
+       splnone();
+}
+
+/*
+ * Configure an ISA device.
+ */
+config_isadev(isdp, mp)
+       struct isa_device *isdp;
+       int *mp;
+{
+       struct isa_driver *dp;
+       if (dp = isdp->id_driver) {
+               if (isdp->id_maddr) {
+                       extern int atdevbase[];
+
+                       isdp->id_maddr -= 0xa0000;
+                       isdp->id_maddr += (int)&atdevbase;
+               }
+               isdp->id_alive = (*dp->probe)(isdp);
+               if (isdp->id_alive) {
+                       printf("%s%d", dp->name, isdp->id_unit);
+                       (*dp->attach)(isdp);
+                       printf(" at 0x%x ", isdp->id_iobase);
+                       if(isdp->id_irq) {
+                               int intrno;
+
+                               intrno = ffs(isdp->id_irq)-1;
+                               printf("irq %d ", intrno);
+                               INTREN(isdp->id_irq);
+                               if(mp)INTRMASK(*mp,isdp->id_irq);
+                               setidt(ICU_OFFSET+intrno, isdp->id_intr,
+                                        SDT_SYS386IGT, SEL_KPL);
+                       }
+                       if (isdp->id_drq != -1) printf("drq %d ", isdp->id_drq);
+                       printf("on isa\n");
+               }
+               return (1);
+       } else  return(0);
+}
+
+#define        IDTVEC(name)    X/**/name
+/* default interrupt vector table */
+extern IDTVEC(intr0), IDTVEC(intr1), IDTVEC(intr2), IDTVEC(intr3),
+       IDTVEC(intr4), IDTVEC(intr5), IDTVEC(intr6), IDTVEC(intr7),
+       IDTVEC(intr8), IDTVEC(intr9), IDTVEC(intr10), IDTVEC(intr11),
+       IDTVEC(intr12), IDTVEC(intr13), IDTVEC(intr14), IDTVEC(intr15);
+       
+/*
+ * Fill in default interrupt table (in case of spuruious interrupt
+ * during configuration of kernel, setup interrupt control unit
+ */
+isa_defaultirq() {
+
+/* first icu */
+       setidt(32, &IDTVEC(intr0),  SDT_SYS386IGT, SEL_KPL);
+       setidt(33, &IDTVEC(intr1),  SDT_SYS386IGT, SEL_KPL);
+       setidt(34, &IDTVEC(intr2),  SDT_SYS386IGT, SEL_KPL);
+       setidt(35, &IDTVEC(intr3),  SDT_SYS386IGT, SEL_KPL);
+       setidt(36, &IDTVEC(intr4),  SDT_SYS386IGT, SEL_KPL);
+       setidt(37, &IDTVEC(intr5),  SDT_SYS386IGT, SEL_KPL);
+       setidt(38, &IDTVEC(intr6),  SDT_SYS386IGT, SEL_KPL);
+       setidt(39, &IDTVEC(intr7),  SDT_SYS386IGT, SEL_KPL);
+
+/* second icu */
+       setidt(40, &IDTVEC(intr8),  SDT_SYS386IGT, SEL_KPL);
+       setidt(41, &IDTVEC(intr9),  SDT_SYS386IGT, SEL_KPL);
+       setidt(42, &IDTVEC(intr10),  SDT_SYS386IGT, SEL_KPL);
+       setidt(43, &IDTVEC(intr11),  SDT_SYS386IGT, SEL_KPL);
+       setidt(44, &IDTVEC(intr12),  SDT_SYS386IGT, SEL_KPL);
+       setidt(45, &IDTVEC(intr13),  SDT_SYS386IGT, SEL_KPL);
+       setidt(46, &IDTVEC(intr14),  SDT_SYS386IGT, SEL_KPL);
+       setidt(47, &IDTVEC(intr15),  SDT_SYS386IGT, SEL_KPL);
+
+       /* initialize 8259's */
+       outb(0xf1,0);
+       outb(0x20,0x11);
+       outb(0x21,32);
+       outb(0x21,4);
+       outb(0x21,1);
+       outb(0x21,0xff);
+
+       outb(0xa0,0x11);
+       outb(0xa1,40);
+       outb(0xa1,2);
+       outb(0xa1,1);
+       outb(0xa1,0xff);
+}
 
 /* stuff needed for virtual to physical calculations */
 extern char Sysbase;
 
 /* stuff needed for virtual to physical calculations */
 extern char Sysbase;
@@ -76,3 +189,22 @@ int nbytes;
        /* set channel 2 */
        outb(0x0A,chan);
 }
        /* set channel 2 */
        outb(0x0A,chan);
 }
+
+/*
+ * Handle a NMI, possibly a machine check.
+ * return true to panic system, false to ignore.
+ */
+isa_nmi(cd) {
+
+       log(LOG_CRIT, "\nNMI port 61 %x, port 70 %x\n", inb(0x61), inb(0x70));
+       return(0);
+}
+
+/*
+ * Caught a stray interrupt, notify
+ */
+isa_strayintr(d) {
+
+       /* for some reason, we get bursts of intr #7, even if not enabled! */
+       log(LOG_ERR,"ISA strayintr %d", ffs(d)-1);
+}
index 57e27b1..7c8b4fc 100644 (file)
@@ -7,7 +7,7 @@
  *
  * %sccs.include.noredist.c%
  *
  *
  * %sccs.include.noredist.c%
  *
- *     @(#)isa.h       5.4 (Berkeley) %G%
+ *     @(#)isa.h       5.5 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
@@ -28,52 +28,52 @@ void outb();
 #define        IO_ISABEGIN     0x000           /* 0x000 - Beginning of I/O Registers */
 
                /* CPU Board */
 #define        IO_ISABEGIN     0x000           /* 0x000 - Beginning of I/O Registers */
 
                /* CPU Board */
-#define IO_DMA0                0x000           /* 8237A DMA Controller #1 */
-#define IO_ICU0                0x020           /* 8259A Interrupt Controller #1 */
-#define IO_TIMER0      0x040           /* 8252 Timer #1 */
-#define IO_TIMER1      0x048           /* 8252 Timer #2 */
+#define IO_DMA1                0x000           /* 8237A DMA Controller #1 */
+#define IO_ICU1                0x020           /* 8259A Interrupt Controller #1 */
+#define IO_TIMER1      0x040           /* 8252 Timer #1 */
+#define IO_TIMER2      0x048           /* 8252 Timer #2 */
 #define IO_KBD         0x060           /* 8042 Keyboard */
 #define IO_RTC         0x070           /* RTC */
 #define IO_NMI         IO_RTC          /* NMI Control */
 #define IO_DMAPG       0x080           /* DMA Page Registers */
 #define IO_KBD         0x060           /* 8042 Keyboard */
 #define IO_RTC         0x070           /* RTC */
 #define IO_NMI         IO_RTC          /* NMI Control */
 #define IO_DMAPG       0x080           /* DMA Page Registers */
-#define IO_ICU1                0x0A0           /* 8259A Interrupt Controller #2 */
-#define IO_DMA1                0x0C0           /* 8237A DMA Controller #2 */
+#define IO_ICU2                0x0A0           /* 8259A Interrupt Controller #2 */
+#define IO_DMA2                0x0C0           /* 8237A DMA Controller #2 */
 #define IO_NPX         0x0F0           /* Numeric Coprocessor */
 
                /* Cards */
                                        /* 0x100 - 0x16F Open */
 
 #define IO_NPX         0x0F0           /* Numeric Coprocessor */
 
                /* Cards */
                                        /* 0x100 - 0x16F Open */
 
-#define IO_WD1         0x170           /* Secondary Fixed Disk Controller */
+#define IO_WD2         0x170           /* Secondary Fixed Disk Controller */
 
                                        /* 0x178 - 0x1EF Open */
 
 
                                        /* 0x178 - 0x1EF Open */
 
-#define IO_WD0         0x1f0           /* Primary Fixed Disk Controller */
+#define IO_WD1         0x1f0           /* Primary Fixed Disk Controller */
 #define IO_GAME                0x200           /* Game Controller */
 
                                        /* 0x208 - 0x277 Open */
 
 #define IO_GAME                0x200           /* Game Controller */
 
                                        /* 0x208 - 0x277 Open */
 
-#define IO_LPT1                0x278           /* Parallel Port #2 */
+#define IO_LPT2                0x278           /* Parallel Port #2 */
 
                                        /* 0x280 - 0x2F7 Open */
 
 
                                        /* 0x280 - 0x2F7 Open */
 
-#define IO_COM1                0x2f8           /* COM2 i/o address */
+#define IO_COM2                0x2f8           /* COM2 i/o address */
 
                                        /* 0x300 - 0x36F Open */
 
 
                                        /* 0x300 - 0x36F Open */
 
-#define IO_FD1         0x370           /* secondary base i/o address */
-#define IO_LPT0                0x378           /* Parallel Port #1 */
+#define IO_FD2         0x370           /* secondary base i/o address */
+#define IO_LPT1                0x378           /* Parallel Port #1 */
 
                                        /* 0x380 - 0x3AF Open */
 
 #define IO_MDA         0x3B0           /* Monochome Adapter */
 
                                        /* 0x380 - 0x3AF Open */
 
 #define IO_MDA         0x3B0           /* Monochome Adapter */
-#define IO_LPT2                0x3BC           /* Monochome Adapter Printer Port */
+#define IO_LPT3                0x3BC           /* Monochome Adapter Printer Port */
 #define IO_VGA         0x3C0           /* E/VGA Ports */
 #define IO_CGA         0x3D0           /* CGA Ports */
 
                                        /* 0x3E0 - 0x3EF Open */
 
 #define IO_VGA         0x3C0           /* E/VGA Ports */
 #define IO_CGA         0x3D0           /* CGA Ports */
 
                                        /* 0x3E0 - 0x3EF Open */
 
-#define IO_FD0         0x3f0           /* primary base i/o address */
-#define IO_COM0                0x3f8           /* COM1 i/o address */
+#define IO_FD1         0x3f0           /* primary base i/o address */
+#define IO_COM1                0x3f8           /* COM1 i/o address */
 
 #define        IO_ISAEND       0x3FF           /* - 0x3FF End of I/O Registers */
 #endif IO_ISABEGIN
 
 #define        IO_ISAEND       0x3FF           /* - 0x3FF End of I/O Registers */
 #endif IO_ISABEGIN
@@ -82,7 +82,7 @@ void outb();
  * Input / Output Memory Physical Addresses
  */
 
  * Input / Output Memory Physical Addresses
  */
 
-#ifdef IOM_BEGIN
+#ifndef        IOM_BEGIN
 #define        IOM_BEGIN       0xa0000         /* Start of I/O Memory "hole" */
 #define        IOM_END         0xFFFFF         /* End of I/O Memory "hole" */
 #endif IOM_BEGIN
 #define        IOM_BEGIN       0xa0000         /* Start of I/O Memory "hole" */
 #define        IOM_END         0xFFFFF         /* End of I/O Memory "hole" */
 #endif IOM_BEGIN
@@ -91,16 +91,17 @@ void outb();
  * RAM Physical Address Space (ignoring the above mentioned "hole")
  */
 
  * RAM Physical Address Space (ignoring the above mentioned "hole")
  */
 
-#ifdef RAM_BEGIN
+#ifndef        RAM_BEGIN
 #define        RAM_BEGIN       0x000000        /* Start of RAM Memory */
 #define        RAM_BEGIN       0x000000        /* Start of RAM Memory */
-#define        IOM_END         0xFFFFFF        /* End of RAM Memory */
+#define        RAM_END         0xFFFFFF        /* End of RAM Memory */
 #endif IOM_BEGIN
 
 /*
  * Oddball Physical Memory Addresses
  */
 #endif IOM_BEGIN
 
 /*
  * Oddball Physical Memory Addresses
  */
-
+#ifndef        COMPAQ_RAMRELOC
 #define        COMPAQ_RAMRELOC 0x80c00000      /* Compaq RAM relocation/diag */
 #define        COMPAQ_RAMSETUP 0x80c00002      /* Compaq RAM setup */
 #define        WEITEK_FPU      0xC0000000      /* WTL 2167 */
 #define        CYRIX_EMC       0xC0000000      /* Cyrix EMC */
 #define        COMPAQ_RAMRELOC 0x80c00000      /* Compaq RAM relocation/diag */
 #define        COMPAQ_RAMSETUP 0x80c00002      /* Compaq RAM setup */
 #define        WEITEK_FPU      0xC0000000      /* WTL 2167 */
 #define        CYRIX_EMC       0xC0000000      /* Cyrix EMC */
+#endif COMPAQ_RAMRELOC
index 8ad0283..3b56cd0 100644 (file)
@@ -1,45 +1,59 @@
+/*
+ * Copyright (c) 1990 W. Jolitz
+ * @(#)npx.c   1.2 (Berkeley) %G%
+ */
+#include "npx.h"
+#if    NNPX > 0
+
+#include "param.h"
+#include "systm.h"
+#include "conf.h"
+#include "file.h"
+#include "dir.h"
+#include "user.h"
+#include "ioctl.h"
+#include "vm.h"
+#include "machine/pte.h"
+#include "machine/isa/isa_device.h"
+#include "icu.h"
 /*
  * 387 and 287 Numeric Coprocessor Extension (NPX) Driver.
 /*
  * 387 and 287 Numeric Coprocessor Extension (NPX) Driver.
- * @(#)npx.c   1.1 (Berkeley) %G%
  */
 
 int    npxprobe(), npxattach(), npxintr();
  */
 
 int    npxprobe(), npxattach(), npxintr();
-struct driver npxdriver = {
+struct isa_driver npxdriver = {
        npxprobe, npxattach, "npx",
 };
 
 struct proc    *npxproc;       /* process who owns device, otherwise zero */
        npxprobe, npxattach, "npx",
 };
 
 struct proc    *npxproc;       /* process who owns device, otherwise zero */
-struct user    *npxutl;        /* owners user structure */
-struct pte     *Npxmap;        /* kernel ptes mapping owner's user structure */
+extern struct user npxutl;     /* owners user structure */
+extern struct pte Npxmap[];    /* kernel ptes mapping owner's user structure */
 
 /*
  * Probe routine - look device, otherwise set emulator bit
  */
 npxprobe(dvp)
 
 /*
  * Probe routine - look device, otherwise set emulator bit
  */
 npxprobe(dvp)
-       struct device *dvp;
-{
-       register status;
+       struct isa_device *dvp;
+{      static status, control;
 
 #ifdef lint
        npxintr();
 #endif
 
 #ifdef lint
        npxintr();
 #endif
-/* insure EM bit off */
-       asm("   fninit");       /* put device in known state */
+
+       /* insure EM bit off */
+       asm("   fninit ");      /* put device in known state */
 
        /* check for a proper status of zero */
        status = 0xa5a5;        
 
        /* check for a proper status of zero */
        status = 0xa5a5;        
-       asm("   movw    %1,%%ax ; fnstsw %%ax ;  movw %%ax, %0"
-               : "=g" (status) : "g" (status) : "ax");
+       asm ("  fnstsw  %0 " : "=m" (status) : "m" (status) );
 
        if (status == 0) {
 
        if (status == 0) {
-               register control;
 
                /* good, now check for a proper control word */
                control = 0xa5a5;       
 
                /* good, now check for a proper control word */
                control = 0xa5a5;       
-               asm("   movw    %1,%%ax ; fnstcw %%ax ;  movw %%ax, %0"
-                       : "=g" (control) : "g" (control) : "ax");
+               asm ("  fnstcw %0 " : "=m" (control) : "m" (control));
 
 
-               if (control&0x103f == 0x3f) {
+               if ((control&0x103f) == 0x3f) {
                        /* then we have a numeric coprocessor */
                /* XXX should force an exception here to generate an intr */
                        return (1);
                        /* then we have a numeric coprocessor */
                /* XXX should force an exception here to generate an intr */
                        return (1);
@@ -54,26 +68,21 @@ npxprobe(dvp)
  * Attach routine - announce which it is, and wire into system
  */
 npxattach(dvp)
  * Attach routine - announce which it is, and wire into system
  */
 npxattach(dvp)
-       struct device *dvp;
+       struct isa_device *dvp;
 {
 {
-       int unit = dvp->unit;
 
 
-       npxinit();
+       npxinit(0x262);
        /* check for ET bit to decide 387/287 */
        /* check for ET bit to decide 387/287 */
-       INTREN(IRQ13);
        /*outb(0xb1,0);         /* reset processor */
 }
 
 /*
  * Initialize floating point unit, usually after an error
  */
        /*outb(0xb1,0);         /* reset processor */
 }
 
 /*
  * Initialize floating point unit, usually after an error
  */
-npxinit() {
-       register control;
+npxinit(control) {
 
        asm ("  fninit");
 
        asm ("  fninit");
-       control = XXX;
-       asm("   movw    %0,%%ax ; fldcw %%ax "
-                       : "g" (control) : "ax");
+       asm("   fldcw %0" : : "g" (control));
 
 }
 
 
 }
 
@@ -85,7 +94,7 @@ npxload() {
        if (npxproc) panic ("npxload");
        npxproc = u.u_procp;
        uaccess(npxproc, Npxmap, &npxutl);
        if (npxproc) panic ("npxload");
        npxproc = u.u_procp;
        uaccess(npxproc, Npxmap, &npxutl);
-       asm("   frstor %0 " : "g" (u.u_pcb.pcb_savefpu) );
+       asm("   frstor %0 " : "g" (u.u_pcb.pcb_savefpu) );
 }
 
 /*
 }
 
 /*
@@ -94,7 +103,7 @@ npxload() {
 npxunload() {
 
        if (npxproc == 0) panic ("npxunload");
 npxunload() {
 
        if (npxproc == 0) panic ("npxunload");
-       asm("   fsave %0 " : "g" (npxutl.u_pcb.pcb_savefpu) );
+       asm("   fsave %0 " : "g" (npxutl.u_pcb.pcb_savefpu) );
        npxproc = 0 ;
 }
 
        npxproc = 0 ;
 }
 
@@ -105,7 +114,7 @@ npxexcept() {
 
        /* save state in appropriate user structure */
        if (npxproc == 0) panic ("npxexcept");
 
        /* save state in appropriate user structure */
        if (npxproc == 0) panic ("npxexcept");
-       asm ("  fsave %0 " : "g" (npxutl.u_pcb.pcb_savefpu) );
+       asm ("  fsave %0 " : "g" (npxutl.u_pcb.pcb_savefpu) );
 
        /*
         * encode the appropriate u_code for detailed information
 
        /*
         * encode the appropriate u_code for detailed information
@@ -132,3 +141,4 @@ npxintr() {
  */
 npxdna() {
 }
  */
 npxdna() {
 }
+#endif
index 674ba4e..f05781e 100644 (file)
@@ -9,7 +9,7 @@
  *
  * %sccs.include.386.c%
  *
  *
  * %sccs.include.386.c%
  *
- *     @(#)pccons.c    5.3 (Berkeley) %G%
+ *     @(#)pccons.c    5.4 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
@@ -23,7 +23,7 @@
 #include "proc.h"
 #include "tty.h"
 #include "uio.h"
 #include "proc.h"
 #include "tty.h"
 #include "uio.h"
-#include "machine/isa/device.h"
+#include "machine/isa/isa_device.h"
 #include "callout.h"
 #include "systm.h"
 #include "kernel.h"
 #include "callout.h"
 #include "systm.h"
 #include "kernel.h"
index aef8757..faece5e 100644 (file)
@@ -7,7 +7,7 @@
  *
  * %sccs.include.386.c%
  *
  *
  * %sccs.include.386.c%
  *
- *     @(#)wd.c        5.7 (Berkeley) %G%
+ *     @(#)wd.c        5.8 (Berkeley) %G%
  */
 
 #include "wd.h"
  */
 
 #include "wd.h"
@@ -26,7 +26,7 @@
 #include "vm.h"
 #include "uio.h"
 #include "machine/pte.h"
 #include "vm.h"
 #include "uio.h"
 #include "machine/pte.h"
-#include "machine/isa/device.h"
+#include "machine/isa/isa_device.h"
 #include "icu.h"
 #include "wdreg.h"
 #include "syslog.h"
 #include "icu.h"
 #include "wdreg.h"
 #include "syslog.h"
index 70ea0e8..70ec7fa 100644 (file)
@@ -5,7 +5,7 @@
  * Copyright (c) 1989 Carnegie-Mellon University
  * All rights reserved.  The CMU software License Agreement specifies
  * the terms and conditions for use and redistribution.
  * Copyright (c) 1989 Carnegie-Mellon University
  * All rights reserved.  The CMU software License Agreement specifies
  * the terms and conditions for use and redistribution.
- *     @(#)wt.c        1.1 (Berkeley) %G%
+ *     @(#)wt.c        1.2 (Berkeley) %G%
  */
 /* 
  * HISTORY
  */
 /* 
  * HISTORY
@@ -1109,7 +1109,7 @@ wtdump()
 {
 }
 
 {
 }
 
-#include "machine/isa/device.h"
+#include "machine/isa/isa_device.h"
 #include "machine/isa/icu.h"
 
 int    wtprobe(), wtattach();
 #include "machine/isa/icu.h"
 
 int    wtprobe(), wtattach();