xref: /csrg-svn/sys/vax/uba/npreg.h (revision 49567)
1*49567Sbostic /*-
226267Ssklower  * Copyright (c) 1986 MICOM-Interlan, Inc., Boxborough Mass
3*49567Sbostic  * Copyright (c) 1991 The Regents of the University of California.
4*49567Sbostic  * All rights reserved.
526200Ssklower  *
6*49567Sbostic  * %sccs.include.redist.c%
730866Skarels  *
8*49567Sbostic  *	@(#)npreg.h	7.4 (Berkeley) 05/09/91
9*49567Sbostic  */
10*49567Sbostic 
11*49567Sbostic /*
1230866Skarels  * Merged header file for MICOM-Interlan NP100.
1326200Ssklower  */
1426200Ssklower 
1526200Ssklower /*
1630866Skarels  *	np100.h version 1.3
1726200Ssklower  *
1830866Skarels  *	This version retrieved: 8/18/86 @ 18:58:44
1930866Skarels  *	    This delta created: 8/18/86 @ 18:27:32
2026200Ssklower  */
2126200Ssklower /*
2226200Ssklower  * Typedefs for the VAX
2326200Ssklower  */
2426200Ssklower 
2526200Ssklower typedef short	sign16;			/* 16 bit signed value */
2626200Ssklower typedef unsigned short unsign16;	/* 16 bit unsigned value */
2726200Ssklower typedef unsigned unsign32;		/* 32 bit unsigned value */
2826200Ssklower typedef long paddr_t;			/* Physical addresses */
2926200Ssklower 
3026200Ssklower 
3126200Ssklower /*
3226200Ssklower  * Tunables
3326200Ssklower  */
3426200Ssklower 
3526200Ssklower 
3626200Ssklower #define NUMCQE		40		/* Number of CQE's per board */
3726200Ssklower 
3826200Ssklower /* Host configuration word in Status Block */
3926200Ssklower 
4026200Ssklower /*
4126200Ssklower  * To disable the lock/unlock internal function calls clear the 0x8000
4226200Ssklower  * bit in the host configuration word (HOSTCONF)
4326200Ssklower  */
4426200Ssklower 
4526200Ssklower #define	HOSTCONF	0x0109	/* See above */
4626200Ssklower #define	LOWBYTE		1
4726200Ssklower #define	HIGHBYTE	0
4826200Ssklower #define BUFFMAPPED	0
4926200Ssklower 
5026200Ssklower /*
5126200Ssklower  * Memory mapping definintions for PM68DUAL hardware.
5226200Ssklower  */
5326200Ssklower 
5426200Ssklower #ifdef PM68DUAL
5526200Ssklower #define	PISHMEM		0x200000
5626200Ssklower #define PISHMEMSIZE	2
5726200Ssklower #define PIOFF		0x8000		/* change this to unique mem add. */
5826200Ssklower #define PIWINDOW	MBUSBUFR + PIOFF
5926200Ssklower #define WINDOWSIZE	2
6026200Ssklower #endif
6126200Ssklower #define	NPMAXXFR	32768		/* Maximum number of bytes / read */
6226200Ssklower 
6326200Ssklower /*
6426200Ssklower  * Define the protocols supported by the NP Driver.
6526200Ssklower  */
6626200Ssklower 
6726200Ssklower #define NONE		0x00	/* No protocols active for a process */
6826200Ssklower #define NPMAINT		0x01	/* Maintenance protocol, superusers only */
6926200Ssklower #define NPNTS		0x02	/* NTS Terminal Server */
7030866Skarels #define NPIDP		0x04	/* Direct Datalink Access */
7126200Ssklower #define NPDLA		0x04	/* Direct Datalink Access */
7226200Ssklower #define NPXNS		0x06	/* Xerox NS ITP */
7326200Ssklower #define NPTCP		0x08	/* TCP/IP */
7426200Ssklower #define NPISO		0x0A	/* ISO */
7526200Ssklower #define NPCLCONN	0xFF	/* Closed connection, i.e. no protocol */
7626200Ssklower 
7726200Ssklower /*
7826200Ssklower  * Convert the protocol to a value used in the Device Protocol Mask field
7926200Ssklower  * of the Shared Memory Status Block.
8026200Ssklower  */
8126200Ssklower 
8226200Ssklower #define PROTOMASK(x)	( 1 << (x) )
8326200Ssklower 
8426200Ssklower /*
8526200Ssklower  * Special requests handled by the NP Driver
8626200Ssklower  */
8726200Ssklower 
8826200Ssklower #define OS_STP		03400	/* Shut down connection on I Board */
8926200Ssklower #define NPSTOP		3	/* Conversion from above (OS_STP) */
9026200Ssklower #define NPCHNGP		50	/* Change the protocol on a connection */
9126200Ssklower #define NPCHNGB		51	/* Change the Board number */
9226200Ssklower 
9326200Ssklower /*
9426200Ssklower  * Miscellaneous
9526200Ssklower  */
9626200Ssklower 
9726200Ssklower #define ON		0x8000  /* Used for Command Q's scan and change flag */
9826200Ssklower #define UBADDRMASK	0x3FFFF /* 18 bit UNIBUS address */
9926200Ssklower #define INTMASK		0xFFFFFFFC /* Used for address validation */
10026200Ssklower #define CMDMASK		0xFFFF	/* Mask ioctl cmd field (see ioctl.h) */
10126200Ssklower #define NPPSADDR	0x324	/* Pointer to addr of on-board panic string */
10226200Ssklower #define	PANLEN		133		/* length of the panic buffer */
10326200Ssklower 
10426200Ssklower /*
10526200Ssklower  * Map function code from user to I-Board format
10626200Ssklower  */
10726200Ssklower 
10826200Ssklower #define FUNCTMAP(x)	(((x) << 6) | 077) /* Maps user function to NP funcs */
10926200Ssklower 
11026200Ssklower /*
11126200Ssklower  * Round up to a 16 byte boundary
11226200Ssklower  */
11326200Ssklower 
11426200Ssklower #define ROUND16(x)	(((x) + 15) & (~0x0F)) /* Round to 16 byte boundary */
11526200Ssklower #define ADDR24		1 /* Used by iomalloc() to specify 24 bit address */
11626200Ssklower 
11726200Ssklower #define NPERRSHIFT	8	/* Used in function ReqDone() */
11826200Ssklower #define NPOK		0
11926200Ssklower 
12026200Ssklower #define LOWORD(X)	(((ushort *)&(X))[0])
12126200Ssklower #define HIWORD(X)	(((ushort *)&(X))[1])
12226200Ssklower 
12326200Ssklower /* Everyday flag settings */
12426200Ssklower 
12526200Ssklower #define NPSET		1
12626200Ssklower #define NPCLEAR		0
12726200Ssklower 
12826200Ssklower /*
12926200Ssklower  * Command Queue Elements are the primary data structure for passing data
13026200Ssklower  * between the driver and the device.
13126200Ssklower  */
13226200Ssklower 
13326200Ssklower struct CQE {
13426200Ssklower 
13526200Ssklower 	struct npreq *cqe_reqid;/* Address of asssociated npreq */
13630866Skarels 	union	{
13730866Skarels 		unsign32 cqe_Famid;	/* Family ID (Process ID) - wn */
13830866Skarels 		unsign16 cqe_PrtSig[2];	/* port and signal - tn */
13930866Skarels 	} u1;
14030866Skarels #define	cqe_famid	u1.cqe_Famid
14130866Skarels #define	cqe_port	u1.cqe_PrtSig[0]
14230866Skarels #define	cqe_signal	u1.cqe_PrtSig[1]
14326200Ssklower 	unsign16 cqe_func;	/* I/O function to be performed */
14426200Ssklower #ifdef mc68000
14526200Ssklower 	char cqe_prot;		/* Protocol type for I/O request */
14626200Ssklower 	char cqe_lenrpb;	/* Length of the RPB in bytes */
14726200Ssklower #else
14826200Ssklower 	char cqe_lenrpb;	/* Length of the RPB in bytes */
14926200Ssklower 	char cqe_prot;		/* Protocol type for I/O request */
15026200Ssklower #endif
15130866Skarels 	union	{
15230866Skarels 		unsign16 cqe_ustS[2];	/* Protocol status return */
15330866Skarels 		unsign32 cqe_ustL;	/* Protocol status return */
15430866Skarels 	} u2;
15530866Skarels #define	cqe_ust0	u2.cqe_ustS[0]
15630866Skarels #define	cqe_ust1	u2.cqe_ustS[1]
15730866Skarels #define	cqe_usts	u2.cqe_ustL
15826200Ssklower 	unsign16 cqe_devrsv;	/* Reserved for use by device only! */
15926200Ssklower #ifdef mc68000
16026200Ssklower 	char cqe_char;		/* CQE characteristics */
16126200Ssklower 	char cqe_sts;		/* Status return from device to user */
16226200Ssklower 	char cqe_wind;		/* Buffer mapping window size (page units) */
16326200Ssklower 	char cqe_nbuf;		/* Number of data buffers for I/O */
16426200Ssklower #else
16526200Ssklower 	char cqe_sts;		/* Status return from device to user */
16626200Ssklower 	char cqe_char;		/* CQE characteristics */
16726200Ssklower 	char cqe_nbuf;		/* Number of data buffers for I/O */
16826200Ssklower 	char cqe_wind;		/* Buffer mapping window size (page units) */
16926200Ssklower #endif
17026200Ssklower 	unsign16 cqe_bcnt;	/* Total number of bytes in the data buffer */
17130866Skarels 	union {
17230866Skarels 		unsign16 cqe_Unused;	/* Unused */
17330866Skarels 		struct {
17430866Skarels 			char cqe_Maxbcnt;	/* Maximum size of buffer */
17530866Skarels 			char cqe_Bflags;	/* Used by the SPI */
17630866Skarels 		} s;
17730866Skarels 	} u3;
17830866Skarels #define cqe_unused	u3.cqe_Unused
17930866Skarels #define cqe_maxbcnt	u3.s.cqe_Maxbcnt
18030866Skarels #define cqe_bflags	u3.s.cqe_Bflags
18126200Ssklower 	unsign16 cqe_dma[2];	/* Address of the MULTIBUS data buffer */
18226200Ssklower 	unsign16 rpb1;		/* Word 1 of protocol parameters */
18326200Ssklower 	unsign16 rpb2;		/* Word 2 of protocol parameters */
18426200Ssklower 	unsign16 rpb3;		/* Word 3 of protocol parameters */
18526200Ssklower 	unsign16 rpb4;		/* Word 4 of protocol parameters */
18626200Ssklower 	unsign16 rpb5;		/* Word 5 of protocol parameters */
18726200Ssklower 	unsign16 rpb6;		/* Word 6 of protocol parameters */
18826200Ssklower 	unsign16 rpb7;		/* Word 7 of protocol parameters */
18926200Ssklower 	unsign16 rpb8;		/* Word 8 of protocol parameters */
19026200Ssklower 	unsign16 rpb9;		/* Word 9 of protocol parameters */
19126200Ssklower 	unsign16 rpb10;		/* Word 10 of protocol parameters */
19226200Ssklower 	unsign16 rpb11;		/* Word 11 of protocol parameters */
19326200Ssklower 	unsign16 rpb12;		/* Word 12 of protocol parameters */
19426200Ssklower 
19526200Ssklower };
19626200Ssklower 
19726200Ssklower /*
19826200Ssklower  * NP Driver Request structure contains information about a request
19926200Ssklower  * maintained solely by the driver. One per CQE, plus a header.
20026200Ssklower  */
20126200Ssklower 
20230866Skarels  struct npreq {
20326200Ssklower 
20426200Ssklower 	struct npreq *forw;	/* Forward pointer for active list */
20526200Ssklower 	struct npreq *back;	/* Backward pointer for active list */
20626200Ssklower 	struct npreq *free;	/* Next member on free list */
20726200Ssklower 	struct CQE *element;	/* CQE associated with this request */
20826200Ssklower 	int flags;		/* Always useful */
20926200Ssklower 	int reqcnt;		/* Request count for reqtab */
21026200Ssklower 	int bufoffset;		/* Offset into buffer for turns */
21126200Ssklower 	int	bytecnt;	/* Number of bytes to transfer */
21226200Ssklower 	caddr_t	virtmem;	/* Virtual address of buffer */
21326200Ssklower 	int	mapbase;	/* Address of the mapping register */
21426200Ssklower 	int 	mapsize;	/* Size of mapped area */
21526200Ssklower 	caddr_t	bufaddr;	/* Address of the user buffer */
21626200Ssklower 	struct buf buf;		/* Buf structure needed for mem. mgmt */
21726200Ssklower 	struct proc *procp;	/* Pointer to process of requestor */
21826200Ssklower 	caddr_t user;		/* Structure passed by user from itpuser.h */
21926200Ssklower 	int	(*intr)();	/* Ptr to routine to call at interrupt time */
22030866Skarels 	int 	int_param;      /* Paramater to be used by above routine */
22126200Ssklower };
22226200Ssklower 
22326200Ssklower /*
22426200Ssklower  * Npmaster structure, one per device, is used for boardwise centralization
22526200Ssklower  * of relevant information including queues, I/O addresses and request pools.
22626200Ssklower  */
22726200Ssklower 
22826200Ssklower struct npmaster {
22926200Ssklower 
23026200Ssklower 	struct npmaster *next; 	/* Linked list of these, NULL terminator */
23126200Ssklower 	struct npspace *shmemp;	/* Shared memory address (driver <-> device) */
23226200Ssklower 	struct uba_device *devp; /* UBA Device for this unit */
23326200Ssklower 	struct NPREG   *iobase;	/* I/O base address for this board */
23426200Ssklower 	struct npreq   *reqtab;	/* Header for pool of CQE requests */
23526200Ssklower 	int	iomapbase;	/* Base index of I/O map reg's allocated */
23626200Ssklower 	int flags;		/* State of the Board */
23726200Ssklower 	int unit;		/* Unit number of this device */
23826200Ssklower 	int vector;		/* Interrupt vector for this unit */
23926200Ssklower };
24026200Ssklower 
24126200Ssklower struct NPREG {
24226200Ssklower 	unsign16 CSR0;		/* Control Status Register 0 */
24326200Ssklower 	unsign16 CSR1;		/* Control Status Register 1 */
24426200Ssklower 	unsign16 CSR2;		/* Control Status Register 2 */
24526200Ssklower 	unsign16 CSR3;		/* Control Status Register 3 */
24626200Ssklower 
24726200Ssklower };
24826200Ssklower 
24926200Ssklower /*
25026200Ssklower  * The following structures are used for communicating with the
25126200Ssklower  * Intelligent Board and are located in Shared Memory.
25226200Ssklower  */
25326200Ssklower 
25426200Ssklower /*
25526200Ssklower  * Status Block
25626200Ssklower  */
25726200Ssklower 
25826200Ssklower struct NpStat{
25926200Ssklower 
26026200Ssklower 	unsign16 sb_drw;	/* Device Request Word */
26126200Ssklower 	unsign16 sb_hcw;	/* Host Configuration Word */
26226200Ssklower 	unsign16 sb_dcw;	/* Device Configuration Word */
26326200Ssklower 	unsign16 sb_dpm;	/* Device Protocol Mask */
26426200Ssklower 	unsign16 sb_dcq;	/* Offset to Device CQ */
26526200Ssklower 	unsign16 sb_hcq;	/* Offset to Host CQ */
26626200Ssklower };
26726200Ssklower 
26826200Ssklower /*
26926200Ssklower  * Command Queue, two per device. One is owned by the driver and the other
27026200Ssklower  * is owned by the device.
27126200Ssklower  */
27226200Ssklower 
27326200Ssklower struct CmdQue {
27426200Ssklower 
27526200Ssklower 	unsign16 scanflag;	/* Scan Flag, MSB set if being scanned */
27626200Ssklower 	unsign16 chngflag;	/* Change Flag, MSB set by initiator */
27726200Ssklower 	unsign16 cq_wrap;	/* Offset to last CQE entry +2 */
27826200Ssklower 	unsign16 cq_add;	/* Offset to add a CQE to the queue */
27926200Ssklower 	unsign16 cq_rem;	/* Offset to remove a CQE from the queue */
28026200Ssklower 	unsign16 cq_cqe[NUMCQE]; /* Command Queue Element Offsets */
28126200Ssklower };
28226200Ssklower 
28326200Ssklower /*
28426200Ssklower  * Structure of the shared memory area per board. Declared this way to avoid
28526200Ssklower  * compiler word alignment vagaries when computing offsets.
28626200Ssklower  */
28726200Ssklower 
28826200Ssklower struct npspace {
28926200Ssklower 
29026200Ssklower 	struct NpStat statblock;	/* Status Block */
29126200Ssklower 	struct CmdQue devcq;		/* Device's Command Queue */
29226200Ssklower 	struct CmdQue hostcq;		/* Host's Command Queue */
29326200Ssklower 	struct CQE elements[NUMCQE];	/* Shared Command Queue Elements */
29426200Ssklower 	unsign16 filler[8];		/* Here for 16 byte alignment */
29526200Ssklower };
29626200Ssklower 
29726200Ssklower /*
29826200Ssklower  * Structure of array of base addresses of I-Board controllers
29926200Ssklower  * (See global data definitions in np.c)
30026200Ssklower  */
30126200Ssklower 
30226200Ssklower struct npbase {
30326200Ssklower 	caddr_t baseaddr;
30426200Ssklower };
30526200Ssklower 
30626200Ssklower /* State of the NP Driver as kept in NpState */
30726200Ssklower 
30826200Ssklower #define ICPAVAIL	0x01 	/* ICP is waiting for a request */
30926200Ssklower 
31026200Ssklower /* Tells ICP Process that there are no more requests for this board */
31126200Ssklower 
31226200Ssklower #define BRDDONE 1
31326200Ssklower 
31426200Ssklower /* Flags used by the driver (npreq structure) to monitor status of requests */
31526200Ssklower 
31626200Ssklower #define REQDONE 0x01		/* Request completed */
31726200Ssklower #define IOIFC   0x02		/* Internal Function Code Request */
31826200Ssklower #define IOERR	0x04		/* Error on Request */
31926200Ssklower #define NPPEND	0x08		/* Unused at this time */
32026200Ssklower #define IOABORT 0x10		/* Request aborted by ICP */
32126200Ssklower #define KERNREQ	0x20		/* Request was from the kernel */
32226200Ssklower #define WANTREQ 0x40		/* Process is waiting for a npreq structure */
32326200Ssklower #define NPUIO	0x80		/* Process doing physio */
32430866Skarels #define REQALOC 0x100           /* Request has been allocated */
32530866Skarels #define REQUSE  0x200           /* Request is in request queue */
32626200Ssklower 
32726200Ssklower /* Service Request Commands from the Intelligent Board */
32826200Ssklower 
32926200Ssklower #define NOREQ	0x00		/* No service requested */
33026200Ssklower #define NPLOAD  0x01		/* Dump request */
33126200Ssklower #define NPDUMP	0x02		/* Load request */
33226200Ssklower #define NPPANIC	0x100		/* Panic request */
33326200Ssklower 
33426200Ssklower /* Definitions of Status returned from the I-Board */
33526200Ssklower 
33626200Ssklower #define NPDONE	0x01		/* Normal completion */
33726200Ssklower #define NPIFC	0x00		/* Internal Function Code request */
33826200Ssklower #define NPPERR  0x80		/* Protocol error */
33926200Ssklower #define NPMERR	0x82		/* Memory allocation failure on I-Board */
34026200Ssklower 
34126200Ssklower /* Definitions of IFC type requests from I-Board */
34226200Ssklower 
34326200Ssklower #define NPLOCK	0x64		/* Lock the process's data area */
34426200Ssklower #define NPUNLOCK 0xA4		/* Unlock the process */
34526200Ssklower #define NPREMAP	0x124		/* Window turn */
34626200Ssklower 
34726200Ssklower /* Definition of flags for the Npmaster structure */
34826200Ssklower 
34926200Ssklower #define CSRPEND		0x01		/* CSR0 command pending */
35026200Ssklower #define PANICREQ	0x02		/* Panic request */
35126200Ssklower #define DUMPREQ		0x04		/* Dump request */
35226200Ssklower #define LOADREQ		0x08		/* Load request */
35326200Ssklower #define BOARDREQ	0x10		/* Any request by the board */
35426200Ssklower #define BADBOARD	0x20		/* Board disabled */
35526200Ssklower #define AVAILABLE	0x40		/* Board available */
35626200Ssklower #define BRDRESET	0x80		/* Board is being reset */
35726200Ssklower #define	PANIC1	 	0x100		/* Driver wants panic address */
35826200Ssklower #define	PANIC2		0x200		/* Driver wants panic string */
35926200Ssklower #define PANIC3		0x400		/* Clear first byte of panic string */
36030866Skarels #define LSTCMD          0x800           /* Clear last command during NPIO */
36130866Skarels #define SCANNING        0x1000          /* We are scanning for cqe's */
36226200Ssklower 
36326200Ssklower /*
36426200Ssklower  * Debugging Constants
36526200Ssklower  */
36626200Ssklower 
36726200Ssklower #define	DEBENTRY	0x0001		/* debug entry points */
36826200Ssklower #define	DEBMEM		0x0002		/* debug memory */
36926200Ssklower #define	DEBREQ		0x0004		/* debug requests */
37026200Ssklower #define	DEBCQE		0x0008		/* debug cqe's */
37126200Ssklower #define	DEBCQ		0x0010		/* debug cq's */
37226200Ssklower #define	DEBMAINT	0x0020		/* debug maintainance requests */
37326200Ssklower #define	DEBINTR		0x0040		/* debug interrupt routines */
37426200Ssklower #define	DEBINIT		0x0080		/* debug initialization routines */
37526200Ssklower #define	DEBIFC		0x0100		/* debug Internal function codes */
37626200Ssklower #define	DEBIOCTL	0x0200		/* debug ioctl calls */
37726200Ssklower #define	DEBOPEN		0x0400		/* debug open calls */
37826200Ssklower #define	DEBIO		0x0800		/* debug read & write calls */
37926200Ssklower #define	DEBCSR		0x1000		/* debug CSR commands */
38026200Ssklower #define	DEBLOCK		0x2000		/* debug lock / unlock calls */
38126200Ssklower #define NOBOARD		0x4000		/* debug user/host interface */
38230866Skarels #define DEBCANCEL       0x8000          /* debug cancel command */
38330866Skarels 
38430866Skarels /*
38530866Skarels  *	npreg.h version 1.3
38630866Skarels  *
38730866Skarels  *	This version retrieved: 8/18/86 @ 18:58:46
38830866Skarels  *	    This delta created: 8/18/86 @ 18:27:42
38930866Skarels  */
39030866Skarels 
39130866Skarels /*
39230866Skarels  *			NPREG.H
39330866Skarels  *
39430866Skarels  * This file contain definitions of specific hardware interest
39530866Skarels  * to be used when communicating with the NI1510 Network Processor
39630866Skarels  * Board. More complete information can be found in the NI1510
39730866Skarels  * Multibus compatible Ethernet Communications Processor Hardware
39830866Skarels  * Specification.
39930866Skarels  */
40030866Skarels 
40130866Skarels /*
40230866Skarels  *	npcmd.h version 1.3
40330866Skarels  *
40430866Skarels  *	This version retrieved: 8/18/86 @ 18:58:45
40530866Skarels  *	    This delta created: 8/18/86 @ 18:27:38
40630866Skarels  */
40730866Skarels #ifdef KERNEL
40830866Skarels #    define IoVOID 0
40930866Skarels #else
41030866Skarels #    define IoVOID IOC_VOID
41130866Skarels #endif
41230866Skarels 
41330866Skarels #define NPRESET		(IoVOID|0x01)	/* reset the board */
41430866Skarels #define	NPSTART		(IoVOID|0x04)	/* start board execution */
41530866Skarels #define	NPGPANIC	(IoVOID|0x05)	/* Get panic message */
41630866Skarels #define	NPINIT		(IoVOID|0x06)	/* initialize software on board */
41730866Skarels #define NPSTATS 	(IoVOID|0x07)
41830866Skarels #define	NPRCSR0		(IoVOID|0x08)	/* read CSR0 */
41930866Skarels #define	NPRCSR1		(IoVOID|0x09)	/* read CSR1 */
42030866Skarels #define	NPRCSR2		(IoVOID|0x0a)	/* read CSR2 */
42130866Skarels #define	NPRCSR3		(IoVOID|0x0b)	/* read CSR3 */
42230866Skarels #define	NPWCSR0		(IoVOID|0x0c)	/* write CSR0 */
42330866Skarels #define	NPWCSR1		(IoVOID|0x0d)	/* write CSR1 */
42430866Skarels #define	NPWCSR2		(IoVOID|0x0e)	/* write CSR2 */
42530866Skarels #define	NPWCSR3		(IoVOID|0x0f)	/* write CSR3 */
42630866Skarels #define NPPOLL  	(IoVOID|0x10)
42730866Skarels #define NPKILL  	(IoVOID|0x11)
42830866Skarels #define	NPSETPROT	(IoVOID|0x12)	/* set the protocol to use */
42930866Skarels #define	NPSETBOARD	(IoVOID|0x13)	/* set board to use */
43030866Skarels #define	NPSETNPDEB	(IoVOID|0x14)	/* set nc debuging level */
43130866Skarels #define	NPSETADDR	(IoVOID|0x15)	/* set host address */
43230866Skarels #define	NPNETBOOT	(IoVOID|0x16)	/* boot from the network */
43330866Skarels #define NPSETLAST       (IoVOID|0x17)   /* set last command flag in NPIO */
43430866Skarels #define NPCLRICNT       (IoVOID|0x18)   /* clear interupt count */
43530866Skarels #define NPGETICNT       (IoVOID|0x19)   /* get interupt count */
43630866Skarels #define NPGETIVEC       (IoVOID|0x1a)   /* get interupt vector */
43730866Skarels #define NPMAPMEM        (IoVOID|0x1b)   /* map user memory to shmem */
43830866Skarels 
43930866Skarels #define NP_SET          1031            /* set memory mapping */
44030866Skarels #define NP_USET         1032            /* unset memory mapping */
44130866Skarels 
44230866Skarels struct np_mem {
44330866Skarels 	long mem_type;
44430866Skarels 	char *mem_addr;
44530866Skarels         long mem_count;
44630866Skarels } ;
44730866Skarels 
44830866Skarels #define NNPCNN		4	/* Number of connections per board */
44930866Skarels #define NPUNIT(a)	((minor(a) >> 4) & 0x0F)
45030866Skarels #define NPCONN(a)	((minor(a)) & 0x03)
45130866Skarels 
45230866Skarels #define TRUE		1
45330866Skarels #define FALSE		0
45430866Skarels 
45530866Skarels #define IBOOTADDR	0xF8000l	/* Addr of 80186 Boot ROM */
45630866Skarels #define	INETBOOT	0xF8087l
45730866Skarels #define IXEQADDR	0x400		/* Where to begin Board image XEQ */
45830866Skarels #define DIAGTIME	1200		/* Time for timeout /HZ seconds */
45930866Skarels 
46030866Skarels #define	DELAYTIME	1000000L		/* delay count */
46130866Skarels #define NPDELAY(N)	{register int n = (N) >> 1; while(--n > 0); }
46230866Skarels 
46330866Skarels /* Handy macros for talking to the Board */
46430866Skarels 
46530866Skarels #define RESET(x) 	(WCSR3(x->iobase,0xff))
46630866Skarels #define CLEARINT(x)	{unsign16 y; y = RCSR2(x->iobase); }
46730866Skarels #define INTNI(x)	(WCSR1(x->iobase,0xFF))
46830866Skarels 
46930866Skarels /* Command and Status Register (CSR) Definitions */
47030866Skarels 
47130866Skarels /*
47230866Skarels  * CSR0 is the only direct means for data transfer between the host processor
47330866Skarels  * and the 3510. Access is controlled by the 80186 who sets the CSR1 Enable and
47430866Skarels  * Ready bits to allow writing here. Writing to this register will always
47530866Skarels  * result in an interrupt to the 80186.
47630866Skarels  */
47730866Skarels 
47830866Skarels /*
47930866Skarels  * Bit definitions for CSR1.
48030866Skarels  */
48130866Skarels 
48230866Skarels #define NPRFU	0x01		/* Reserved for Future Use */
48330866Skarels #define NPHOK	0x02		/* Hardware OK */
48430866Skarels #define NPLAN	0x04		/* Logic 0 indicates operational LAN exists */
48530866Skarels #define NP_IP	0x08		/* Interrupt pending from this board */
48630866Skarels #define NP_IE	0x10		/* Interrupts enabled for this board */
48730866Skarels #define NPRDR	0x20		/* Set when 80186 writes data into CSR0 */
48830866Skarels #define NPRDY	0x40		/* CSR0 ready to accept data */
48930866Skarels #define NPENB	0x80		/* CSR0 available for use by the host */
49030866Skarels 
49130866Skarels /*
49230866Skarels  * Bit defintions for CSR0 Command Block
49330866Skarels  */
49430866Skarels 
49530866Skarels #define NPLST	0x20		/* Last Command */
49630866Skarels #define NPCMD	0x80		/* Shared Memory Address */
49730866Skarels #define NPBGN	0x200		/* Begin Execution in On-Board Memory */
49830866Skarels #define NPCBI	0x800		/* Interrupt at completion of Command Block */
49930866Skarels #define NPDMP	0x2000		/* Dump 80186 On-Board Memory to Multibus */
50030866Skarels #define NPLD	0x8000		/* Load 80186 On-board Memory from Multibus */
50130866Skarels 
50230866Skarels /*
50330866Skarels  * CSR0 Count definitions. These are the lengths of the Command Blocks for the
50430866Skarels  * CSR0 commands above (not counting the Command Word itself).
50530866Skarels  */
50630866Skarels 
50730866Skarels #define LSTCNT	0
50830866Skarels #define CMDCNT	2
50930866Skarels #define BGNCNT	2
51030866Skarels #define CBICNT	1
51130866Skarels #define DMPCNT	5
51230866Skarels #define LDCNT	5
51330866Skarels #define IOCNT	5
51430866Skarels 
51530866Skarels /* Macros for reading and writing CSR's (Control and Status Registers) */
51630866Skarels 
51730866Skarels #define	WCSR0(x,y)	((x)->CSR0 = y)
51830866Skarels #define	WCSR1(x,y)	((x)->CSR1 = y)
51930866Skarels #define	WCSR2(x,y)	((x)->CSR2 = y)
52030866Skarels #define	WCSR3(x,y)	((x)->CSR3 = y)
52130866Skarels 
52230866Skarels #define	RCSR0(x)	((x)->CSR0)
52330866Skarels #define	RCSR1(x)	((x)->CSR1)
52430866Skarels #define	RCSR2(x)	((x)->CSR2)
52530866Skarels #define	RCSR3(x)	((x)->CSR3)
52630866Skarels 
52730866Skarels struct npconn {
52830866Skarels 
52930866Skarels 	struct npmaster *unit;	/* Unit number (board) of this connection */
53030866Skarels 	unsign16 protocol;	/* Protocol used on this connection */
53130866Skarels 	struct buf np_wbuf;	/* write buf structure for raw access */
53230866Skarels 	struct buf np_rbuf;	/* read buf structure for raw access */
53330866Skarels };
53430866Skarels 
53530866Skarels /* ICP Board Requests */
53630866Skarels 
53730866Skarels #define ICPLOAD  0x02
53830866Skarels #define ICPDUMP  0x03
53930866Skarels #define ICPPANIC 0x05
54030866Skarels #define ICPPOLL  0x10
54130866Skarels 
54230866Skarels /*
54330866Skarels  *	npdebug.h version 1.3
54430866Skarels  *
54530866Skarels  *	This version retrieved: 8/18/86 @ 18:58:46
54630866Skarels  *	    This delta created: 8/18/86 @ 18:27:39
54730866Skarels  */
54830866Skarels 
54930866Skarels /*
55030866Skarels  * Debugging Constants
55130866Skarels  */
55230866Skarels 
55330866Skarels #define	DEBENTRY	0x0001		/* debug entry points */
55430866Skarels #define	DEBMEM		0x0002		/* debug memory */
55530866Skarels #define	DEBREQ		0x0004		/* debug requests */
55630866Skarels #define	DEBCQE		0x0008		/* debug cqe's */
55730866Skarels #define	DEBCQ		0x0010		/* debug cq's */
55830866Skarels #define	DEBMAINT	0x0020		/* debug maintainance requests */
55930866Skarels #define	DEBINTR		0x0040		/* debug interrupt routines */
56030866Skarels #define	DEBINIT		0x0080		/* debug initialization routines */
56130866Skarels #define	DEBIFC		0x0100		/* debug Internal function codes */
56230866Skarels #define	DEBIOCTL	0x0200		/* debug ioctl calls */
56330866Skarels #define	DEBOPEN		0x0400		/* debug open calls */
56430866Skarels #define	DEBIO		0x0800		/* debug read & write calls */
56530866Skarels #define	DEBCSR		0x1000		/* debug CSR commands */
56630866Skarels #define	DEBLOCK		0x2000		/* debug lock / unlock calls */
567