BSD 4_3_Net_2 release
[unix-history] / usr / src / sys / vax / uba / npreg.h
index 45cbd67..6ccb18f 100644 (file)
-/*
- * Copyright (c) 1986 MICOM-Interlan, Inc., Foxborough Mass
+/*-
+ * Copyright (c) 1986 MICOM-Interlan, Inc., Boxborough Mass
+ * Copyright (c) 1991 The Regents of the University of California.
+ * All rights reserved.
  *
  *
- * This software is furnished under a license and may only be used
- * or copied in accordance with the terms of that license.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
  *
  *
- *     @(#)npreg.h     6.1 (Berkeley) %G%
- */
-
-/*
- *                     NPREG.H
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
  *
  *
- * This file contain definitions of specific hardware interest
- * to be used when communicating with the NI1510 Network Processor
- * Board. More complete information can be found in the NI1510
- * Multibus compatible Ethernet Communications Processor Hardware 
- * Specification.
- */
-
-
-#define NNPCNN         4       /* Number of connections per board */
-#define NPUNIT(a)      ((minor(a) >> 4) & 0x0F)
-#define NPCONN(a)      ((minor(a)) & 0x03)
-
-#define TRUE           1
-#define FALSE          0
-
-#define IBOOTADDR      0xF8000l        /* Addr of 80186 Boot ROM */
-#define        INETBOOT        0xF8087l
-#define IXEQADDR       0x400           /* Where to begin Board image XEQ */
-#define DIAGTIME       1200            /* Time for timeout /HZ seconds */
-
-#define        DELAYTIME       1000000L                /* delay count */
-#define NPDELAY(N)     {register int n = (N) >> 1; while(--n > 0); }
-
-/* Handy macros for talking to the Board */
-
-#define RESET(x)       (WCSR3(x->iobase,0xff))
-#define CLEARINT(x)    {unsign16 y; y = RCSR2(x->iobase); }
-#define INTNI(x)       (WCSR1(x->iobase,0xFF))
-
-/* Command and Status Register (CSR) Definitions */
-
-/*
- * CSR0 is the only direct means for data transfer between the host processor
- * and the 3510. Access is controlled by the 80186 who sets the CSR1 Enable and
- * Ready bits to allow writing here. Writing to this register will always
- * result in an interrupt to the 80186.
- */
-
-/* 
- * Bit definitions for CSR1.
+ *     @(#)npreg.h     7.4 (Berkeley) 5/9/91
  */
 
  */
 
-#define NPRFU  0x01            /* Reserved for Future Use */
-#define NPHOK  0x02            /* Hardware OK */
-#define NPLAN  0x04            /* Logic 0 indicates operational LAN exists */
-#define NP_IP  0x08            /* Interrupt pending from this board */
-#define NP_IE  0x10            /* Interrupts enabled for this board */
-#define NPRDR  0x20            /* Set when 80186 writes data into CSR0 */
-#define NPRDY  0x40            /* CSR0 ready to accept data */
-#define NPENB  0x80            /* CSR0 available for use by the host */
-
 /*
 /*
- * Bit defintions for CSR0 Command Block
+ * Merged header file for MICOM-Interlan NP100.
  */
 
  */
 
-#define NPLST  0x20            /* Last Command */
-#define NPCMD  0x80            /* Shared Memory Address */
-#define NPBGN  0x200           /* Begin Execution in On-Board Memory */
-#define NPCBI  0x800           /* Interrupt at completion of Command Block */
-#define NPDMP  0x2000          /* Dump 80186 On-Board Memory to Multibus */
-#define NPLD   0x8000          /* Load 80186 On-board Memory from Multibus */
-
 /*
 /*
- * CSR0 Count definitions. These are the lengths of the Command Blocks for the
- * CSR0 commands above (not counting the Command Word itself).
+ *     np100.h version 1.3
+ *
+ *     This version retrieved: 8/18/86 @ 18:58:44
+ *         This delta created: 8/18/86 @ 18:27:32
  */
  */
-
-#define LSTCNT 0
-#define CMDCNT 2
-#define BGNCNT 2
-#define CBICNT 1
-#define DMPCNT 5
-#define LDCNT  5
-#define IOCNT  5
-
-/* Macros for reading and writing CSR's (Control and Status Registers) */
-
-#define        WCSR0(x,y)      ((x)->CSR0 = y)
-#define        WCSR1(x,y)      ((x)->CSR1 = y)
-#define        WCSR2(x,y)      ((x)->CSR2 = y)
-#define        WCSR3(x,y)      ((x)->CSR3 = y)
-
-#define        RCSR0(x)        ((x)->CSR0)
-#define        RCSR1(x)        ((x)->CSR1)
-#define        RCSR2(x)        ((x)->CSR2)
-#define        RCSR3(x)        ((x)->CSR3)
-
-#define NPRESET                0x01            /* reset the board */
-#define        NPSTART         0x04            /* start board execution */
-#define        NPGPANIC        0x05            /* Get panic message */
-#define        NPINIT          0x06            /* initialize software on board */
-#define NPSTATS        0x07
-#define        NPRCSR0         0x08            /* read CSR0 */
-#define        NPRCSR1         0x09            /* read CSR1 */
-#define        NPRCSR2         0x0a            /* read CSR2 */
-#define        NPRCSR3         0x0b            /* read CSR3 */
-#define        NPWCSR0         0x0c            /* write CSR0 */
-#define        NPWCSR1         0x0d            /* write CSR1 */
-#define        NPWCSR2         0x0e            /* write CSR2 */
-#define        NPWCSR3         0x0f            /* write CSR3 */
-#define NPPOLL         0x10
-#define NPKILL         0x11
-#define        NPSETPROT       0x12            /* set the protocol to use */
-#define        NPSETBOARD      0x13            /* set board to use */
-#define        NPSETNPDEB      0x14            /* set nc debuging level */
-#define        NPSETADDR       0x15            /* set host address */
-#define        NPNETBOOT       0x16            /* boot from the network */
-
-/* ICP Board Requests */
-
-#define ICPLOAD  0x02
-#define ICPDUMP  0x03
-#define ICPPANIC 0x05
-#define ICPPOLL  0x10
-
 /*
  * Typedefs for the VAX 
  */
 /*
  * Typedefs for the VAX 
  */
@@ -174,6 +93,7 @@ typedef long paddr_t;                        /* Physical addresses */
 #define NONE           0x00    /* No protocols active for a process */
 #define NPMAINT                0x01    /* Maintenance protocol, superusers only */
 #define NPNTS          0x02    /* NTS Terminal Server */
 #define NONE           0x00    /* No protocols active for a process */
 #define NPMAINT                0x01    /* Maintenance protocol, superusers only */
 #define NPNTS          0x02    /* NTS Terminal Server */
+#define NPIDP          0x04    /* Direct Datalink Access */
 #define NPDLA          0x04    /* Direct Datalink Access */
 #define NPXNS          0x06    /* Xerox NS ITP */
 #define NPTCP          0x08    /* TCP/IP */
 #define NPDLA          0x04    /* Direct Datalink Access */
 #define NPXNS          0x06    /* Xerox NS ITP */
 #define NPTCP          0x08    /* TCP/IP */
@@ -239,7 +159,13 @@ typedef long paddr_t;                      /* Physical addresses */
 struct CQE {
 
        struct npreq *cqe_reqid;/* Address of asssociated npreq */
 struct CQE {
 
        struct npreq *cqe_reqid;/* Address of asssociated npreq */
-       unsign32 cqe_famid;     /* Family ID (Process ID) */
+       union   {
+               unsign32 cqe_Famid;     /* Family ID (Process ID) - wn */
+               unsign16 cqe_PrtSig[2]; /* port and signal - tn */
+       } u1;
+#define        cqe_famid       u1.cqe_Famid
+#define        cqe_port        u1.cqe_PrtSig[0]
+#define        cqe_signal      u1.cqe_PrtSig[1]
        unsign16 cqe_func;      /* I/O function to be performed */
 #ifdef mc68000
        char cqe_prot;          /* Protocol type for I/O request */
        unsign16 cqe_func;      /* I/O function to be performed */
 #ifdef mc68000
        char cqe_prot;          /* Protocol type for I/O request */
@@ -248,8 +174,13 @@ struct CQE {
        char cqe_lenrpb;        /* Length of the RPB in bytes */
        char cqe_prot;          /* Protocol type for I/O request */
 #endif
        char cqe_lenrpb;        /* Length of the RPB in bytes */
        char cqe_prot;          /* Protocol type for I/O request */
 #endif
-       unsign16 cqe_ust0;      /* Protocol status return */
-       unsign16 cqe_ust1;      /* Protocol status return */
+       union   {
+               unsign16 cqe_ustS[2];   /* Protocol status return */
+               unsign32 cqe_ustL;      /* Protocol status return */
+       } u2;
+#define        cqe_ust0        u2.cqe_ustS[0]
+#define        cqe_ust1        u2.cqe_ustS[1]
+#define        cqe_usts        u2.cqe_ustL
        unsign16 cqe_devrsv;    /* Reserved for use by device only! */
 #ifdef mc68000
        char cqe_char;          /* CQE characteristics */
        unsign16 cqe_devrsv;    /* Reserved for use by device only! */
 #ifdef mc68000
        char cqe_char;          /* CQE characteristics */
@@ -263,7 +194,16 @@ struct CQE {
        char cqe_wind;          /* Buffer mapping window size (page units) */
 #endif
        unsign16 cqe_bcnt;      /* Total number of bytes in the data buffer */
        char cqe_wind;          /* Buffer mapping window size (page units) */
 #endif
        unsign16 cqe_bcnt;      /* Total number of bytes in the data buffer */
-       unsign16 cqe_unused;    /* Unused */
+       union {
+               unsign16 cqe_Unused;    /* Unused */
+               struct {
+                       char cqe_Maxbcnt;       /* Maximum size of buffer */
+                       char cqe_Bflags;        /* Used by the SPI */
+               } s;
+       } u3;
+#define cqe_unused     u3.cqe_Unused
+#define cqe_maxbcnt    u3.s.cqe_Maxbcnt
+#define cqe_bflags     u3.s.cqe_Bflags
        unsign16 cqe_dma[2];    /* Address of the MULTIBUS data buffer */
        unsign16 rpb1;          /* Word 1 of protocol parameters */
        unsign16 rpb2;          /* Word 2 of protocol parameters */
        unsign16 cqe_dma[2];    /* Address of the MULTIBUS data buffer */
        unsign16 rpb1;          /* Word 1 of protocol parameters */
        unsign16 rpb2;          /* Word 2 of protocol parameters */
@@ -285,7 +225,7 @@ struct CQE {
  * maintained solely by the driver. One per CQE, plus a header.
  */
 
  * maintained solely by the driver. One per CQE, plus a header.
  */
 
-struct npreq {
+ struct npreq {
 
        struct npreq *forw;     /* Forward pointer for active list */
        struct npreq *back;     /* Backward pointer for active list */
 
        struct npreq *forw;     /* Forward pointer for active list */
        struct npreq *back;     /* Backward pointer for active list */
@@ -303,6 +243,7 @@ struct npreq {
        struct proc *procp;     /* Pointer to process of requestor */
        caddr_t user;           /* Structure passed by user from itpuser.h */
        int     (*intr)();      /* Ptr to routine to call at interrupt time */
        struct proc *procp;     /* Pointer to process of requestor */
        caddr_t user;           /* Structure passed by user from itpuser.h */
        int     (*intr)();      /* Ptr to routine to call at interrupt time */
+       int     int_param;      /* Paramater to be used by above routine */
 };
 
 /*
 };
 
 /*
@@ -323,14 +264,6 @@ struct npmaster {
        int vector;             /* Interrupt vector for this unit */
 };
 
        int vector;             /* Interrupt vector for this unit */
 };
 
-struct npconn {
-
-       struct npmaster *unit;  /* Unit number (board) of this connection */
-       unsign16 protocol;      /* Protocol used on this connection */
-       struct buf np_wbuf;     /* write buf structure for raw access */
-       struct buf np_rbuf;     /* read buf structure for raw access */
-};
-
 struct NPREG {
        unsign16 CSR0;          /* Control Status Register 0 */
        unsign16 CSR1;          /* Control Status Register 1 */
 struct NPREG {
        unsign16 CSR0;          /* Control Status Register 0 */
        unsign16 CSR1;          /* Control Status Register 1 */
@@ -414,6 +347,8 @@ struct npbase {
 #define KERNREQ        0x20            /* Request was from the kernel */
 #define WANTREQ 0x40           /* Process is waiting for a npreq structure */
 #define NPUIO  0x80            /* Process doing physio */
 #define KERNREQ        0x20            /* Request was from the kernel */
 #define WANTREQ 0x40           /* Process is waiting for a npreq structure */
 #define NPUIO  0x80            /* Process doing physio */
+#define REQALOC 0x100           /* Request has been allocated */
+#define REQUSE  0x200           /* Request is in request queue */
 
 /* Service Request Commands from the Intelligent Board */
 
 
 /* Service Request Commands from the Intelligent Board */
 
@@ -448,6 +383,8 @@ struct npbase {
 #define        PANIC1          0x100           /* Driver wants panic address */
 #define        PANIC2          0x200           /* Driver wants panic string */
 #define PANIC3         0x400           /* Clear first byte of panic string */
 #define        PANIC1          0x100           /* Driver wants panic address */
 #define        PANIC2          0x200           /* Driver wants panic string */
 #define PANIC3         0x400           /* Clear first byte of panic string */
+#define LSTCMD          0x800           /* Clear last command during NPIO */
+#define SCANNING        0x1000          /* We are scanning for cqe's */
 
 /*
  * Debugging Constants
 
 /*
  * Debugging Constants
@@ -468,3 +405,188 @@ struct npbase {
 #define        DEBCSR          0x1000          /* debug CSR commands */
 #define        DEBLOCK         0x2000          /* debug lock / unlock calls */
 #define NOBOARD                0x4000          /* debug user/host interface */
 #define        DEBCSR          0x1000          /* debug CSR commands */
 #define        DEBLOCK         0x2000          /* debug lock / unlock calls */
 #define NOBOARD                0x4000          /* debug user/host interface */
+#define DEBCANCEL       0x8000          /* debug cancel command */
+
+/*
+ *     npreg.h version 1.3
+ *
+ *     This version retrieved: 8/18/86 @ 18:58:46
+ *         This delta created: 8/18/86 @ 18:27:42
+ */
+
+/*
+ *                     NPREG.H
+ *
+ * This file contain definitions of specific hardware interest
+ * to be used when communicating with the NI1510 Network Processor
+ * Board. More complete information can be found in the NI1510
+ * Multibus compatible Ethernet Communications Processor Hardware 
+ * Specification.
+ */
+
+/*
+ *     npcmd.h version 1.3
+ *
+ *     This version retrieved: 8/18/86 @ 18:58:45
+ *         This delta created: 8/18/86 @ 18:27:38
+ */
+#ifdef KERNEL
+#    define IoVOID 0
+#else
+#    define IoVOID IOC_VOID
+#endif
+
+#define NPRESET                (IoVOID|0x01)   /* reset the board */
+#define        NPSTART         (IoVOID|0x04)   /* start board execution */
+#define        NPGPANIC        (IoVOID|0x05)   /* Get panic message */
+#define        NPINIT          (IoVOID|0x06)   /* initialize software on board */
+#define NPSTATS        (IoVOID|0x07)
+#define        NPRCSR0         (IoVOID|0x08)   /* read CSR0 */
+#define        NPRCSR1         (IoVOID|0x09)   /* read CSR1 */
+#define        NPRCSR2         (IoVOID|0x0a)   /* read CSR2 */
+#define        NPRCSR3         (IoVOID|0x0b)   /* read CSR3 */
+#define        NPWCSR0         (IoVOID|0x0c)   /* write CSR0 */
+#define        NPWCSR1         (IoVOID|0x0d)   /* write CSR1 */
+#define        NPWCSR2         (IoVOID|0x0e)   /* write CSR2 */
+#define        NPWCSR3         (IoVOID|0x0f)   /* write CSR3 */
+#define NPPOLL         (IoVOID|0x10)
+#define NPKILL         (IoVOID|0x11)
+#define        NPSETPROT       (IoVOID|0x12)   /* set the protocol to use */
+#define        NPSETBOARD      (IoVOID|0x13)   /* set board to use */
+#define        NPSETNPDEB      (IoVOID|0x14)   /* set nc debuging level */
+#define        NPSETADDR       (IoVOID|0x15)   /* set host address */
+#define        NPNETBOOT       (IoVOID|0x16)   /* boot from the network */
+#define NPSETLAST       (IoVOID|0x17)   /* set last command flag in NPIO */
+#define NPCLRICNT       (IoVOID|0x18)   /* clear interupt count */
+#define NPGETICNT       (IoVOID|0x19)   /* get interupt count */
+#define NPGETIVEC       (IoVOID|0x1a)   /* get interupt vector */
+#define NPMAPMEM        (IoVOID|0x1b)   /* map user memory to shmem */
+
+#define NP_SET          1031            /* set memory mapping */
+#define NP_USET         1032            /* unset memory mapping */
+
+struct np_mem {
+       long mem_type;
+       char *mem_addr;
+        long mem_count;
+} ;
+
+#define NNPCNN         4       /* Number of connections per board */
+#define NPUNIT(a)      ((minor(a) >> 4) & 0x0F)
+#define NPCONN(a)      ((minor(a)) & 0x03)
+
+#define TRUE           1
+#define FALSE          0
+
+#define IBOOTADDR      0xF8000l        /* Addr of 80186 Boot ROM */
+#define        INETBOOT        0xF8087l
+#define IXEQADDR       0x400           /* Where to begin Board image XEQ */
+#define DIAGTIME       1200            /* Time for timeout /HZ seconds */
+
+#define        DELAYTIME       1000000L                /* delay count */
+#define NPDELAY(N)     {register int n = (N) >> 1; while(--n > 0); }
+
+/* Handy macros for talking to the Board */
+
+#define RESET(x)       (WCSR3(x->iobase,0xff))
+#define CLEARINT(x)    {unsign16 y; y = RCSR2(x->iobase); }
+#define INTNI(x)       (WCSR1(x->iobase,0xFF))
+
+/* Command and Status Register (CSR) Definitions */
+
+/*
+ * CSR0 is the only direct means for data transfer between the host processor
+ * and the 3510. Access is controlled by the 80186 who sets the CSR1 Enable and
+ * Ready bits to allow writing here. Writing to this register will always
+ * result in an interrupt to the 80186.
+ */
+
+/* 
+ * Bit definitions for CSR1.
+ */
+
+#define NPRFU  0x01            /* Reserved for Future Use */
+#define NPHOK  0x02            /* Hardware OK */
+#define NPLAN  0x04            /* Logic 0 indicates operational LAN exists */
+#define NP_IP  0x08            /* Interrupt pending from this board */
+#define NP_IE  0x10            /* Interrupts enabled for this board */
+#define NPRDR  0x20            /* Set when 80186 writes data into CSR0 */
+#define NPRDY  0x40            /* CSR0 ready to accept data */
+#define NPENB  0x80            /* CSR0 available for use by the host */
+
+/*
+ * Bit defintions for CSR0 Command Block
+ */
+
+#define NPLST  0x20            /* Last Command */
+#define NPCMD  0x80            /* Shared Memory Address */
+#define NPBGN  0x200           /* Begin Execution in On-Board Memory */
+#define NPCBI  0x800           /* Interrupt at completion of Command Block */
+#define NPDMP  0x2000          /* Dump 80186 On-Board Memory to Multibus */
+#define NPLD   0x8000          /* Load 80186 On-board Memory from Multibus */
+
+/*
+ * CSR0 Count definitions. These are the lengths of the Command Blocks for the
+ * CSR0 commands above (not counting the Command Word itself).
+ */
+
+#define LSTCNT 0
+#define CMDCNT 2
+#define BGNCNT 2
+#define CBICNT 1
+#define DMPCNT 5
+#define LDCNT  5
+#define IOCNT  5
+
+/* Macros for reading and writing CSR's (Control and Status Registers) */
+
+#define        WCSR0(x,y)      ((x)->CSR0 = y)
+#define        WCSR1(x,y)      ((x)->CSR1 = y)
+#define        WCSR2(x,y)      ((x)->CSR2 = y)
+#define        WCSR3(x,y)      ((x)->CSR3 = y)
+
+#define        RCSR0(x)        ((x)->CSR0)
+#define        RCSR1(x)        ((x)->CSR1)
+#define        RCSR2(x)        ((x)->CSR2)
+#define        RCSR3(x)        ((x)->CSR3)
+
+struct npconn {
+
+       struct npmaster *unit;  /* Unit number (board) of this connection */
+       unsign16 protocol;      /* Protocol used on this connection */
+       struct buf np_wbuf;     /* write buf structure for raw access */
+       struct buf np_rbuf;     /* read buf structure for raw access */
+};
+
+/* ICP Board Requests */
+
+#define ICPLOAD  0x02
+#define ICPDUMP  0x03
+#define ICPPANIC 0x05
+#define ICPPOLL  0x10
+
+/*
+ *     npdebug.h version 1.3
+ *
+ *     This version retrieved: 8/18/86 @ 18:58:46
+ *         This delta created: 8/18/86 @ 18:27:39
+ */
+
+/*
+ * Debugging Constants
+ */
+
+#define        DEBENTRY        0x0001          /* debug entry points */
+#define        DEBMEM          0x0002          /* debug memory */
+#define        DEBREQ          0x0004          /* debug requests */
+#define        DEBCQE          0x0008          /* debug cqe's */
+#define        DEBCQ           0x0010          /* debug cq's */
+#define        DEBMAINT        0x0020          /* debug maintainance requests */
+#define        DEBINTR         0x0040          /* debug interrupt routines */
+#define        DEBINIT         0x0080          /* debug initialization routines */
+#define        DEBIFC          0x0100          /* debug Internal function codes */
+#define        DEBIOCTL        0x0200          /* debug ioctl calls */
+#define        DEBOPEN         0x0400          /* debug open calls */
+#define        DEBIO           0x0800          /* debug read & write calls */
+#define        DEBCSR          0x1000          /* debug CSR commands */
+#define        DEBLOCK         0x2000          /* debug lock / unlock calls */