if_iereg.h revision 1.2
11.2Sandvar/*	$NetBSD: if_iereg.h,v 1.2 2021/10/24 20:00:11 andvar Exp $	*/
21.1Schuck
31.1Schuck/*
41.1Schuck * if_sunie.h
51.1Schuck *
61.1Schuck * sun's ie interface
71.1Schuck */
81.1Schuck
91.1Schuck/*
101.1Schuck * programming notes:
111.1Schuck *
121.1Schuck * the ie chip operates in a 24 bit address space.
131.1Schuck *
141.1Schuck * most ie interfaces appear to be divided into two parts:
151.1Schuck *	 - generic 586 stuff
161.1Schuck *	 - board specific
171.1Schuck *
181.1Schuck * generic:
191.1Schuck *	the generic stuff of the ie chip is all done with data structures
201.1Schuck * 	that live in the chip's memory address space.   the chip expects
211.1Schuck * 	its main data structure (the sys conf ptr -- SCP) to be at a fixed
221.1Schuck * 	address in its 24 bit space: 0xfffff4
231.1Schuck *
241.1Schuck *      the SCP points to another structure called the ISCP.
251.1Schuck *      the ISCP points to another structure called the SCB.
261.1Schuck * 	the SCB has a status field, a linked list of "commands", and
271.1Schuck * 	a linked list of "receive buffers".   these are data structures that
281.1Schuck * 	live in memory, not registers.
291.1Schuck *
301.1Schuck * board:
311.1Schuck * 	to get the chip to do anything, you first put a command in the
321.1Schuck * 	command data structure list.   then you have to signal "attention"
331.1Schuck * 	to the chip to get it to look at the command.   how you
341.1Schuck * 	signal attention depends on what board you have... on PC's
351.1Schuck * 	there is an i/o port number to do this, on sun's there is a
361.1Schuck * 	register bit you toggle.
371.1Schuck *
381.1Schuck * 	to get data from the chip you program it to interrupt...
391.1Schuck *
401.1Schuck *
411.1Schuck * sun issues:
421.1Schuck *
431.1Schuck *      there are 3 kinds of sun "ie" interfaces:
441.1Schuck *        1 - a VME/multibus card
451.1Schuck *        2 - an on-board interface (sun3's, sun-4/100's, and sun-4/200's)
461.1Schuck *        3 - another VME board called the 3E
471.1Schuck *
481.1Schuck * 	the VME boards lives in vme16 space.   only 16 and 8 bit accesses
491.1Schuck * 	are allowed, so functions that copy data must be aware of this.
501.1Schuck *
511.1Schuck * 	the chip is an intel chip.  this means that the byte order
521.1Schuck * 	on all the "short"s in the chip's data structures is wrong.
531.1Schuck * 	so, constants described in the intel docs are swapped for the sun.
541.1Schuck * 	that means that any buffer pointers you give the chip must be
551.1Schuck * 	swapped to intel format.   yuck.
561.1Schuck *
571.1Schuck *   VME/multibus interface:
581.1Schuck * 	for the multibus interface the board ignores the top 4 bits
591.1Schuck * 	of the chip address.   the multibus interface seems to have its
601.1Schuck * 	own MMU like page map (without protections or valid bits, etc).
611.1Schuck * 	there are 256 pages of physical memory on the board (each page
621.1Schuck * 	is 1024 bytes).   there are 1024 slots in the page map.  so,
631.1Schuck * 	a 1024 byte page takes up 10 bits of address for the offset,
641.1Schuck * 	and if there are 1024 slots in the page that is another 10 bits
651.1Schuck * 	of the address.   that makes a 20 bit address, and as stated
661.1Schuck * 	earlier the board ignores the top 4 bits, so that accounts
671.1Schuck * 	for all 24 bits of address.
681.1Schuck *
691.1Schuck * 	note that the last entry of the page map maps the top of the
701.1Schuck * 	24 bit address space and that the SCP is supposed to be at
711.2Sandvar * 	0xfffff4 (taking into account alignment).   so,
721.1Schuck *	for multibus, that entry in the page map has to be used for the SCP.
731.1Schuck *
741.1Schuck * 	the page map effects BOTH how the ie chip sees the
751.1Schuck * 	memory, and how the host sees it.
761.1Schuck *
771.1Schuck * 	the page map is part of the "register" area of the board
781.1Schuck *
791.1Schuck *   on-board interface:
801.1Schuck *
811.1Schuck *	<fill in useful info later>
821.1Schuck *
831.1Schuck *
841.1Schuck *   VME3E interface:
851.1Schuck *
861.1Schuck *	<fill in useful info later>
871.1Schuck *
881.1Schuck */
891.1Schuck
901.1Schuck/*
911.1Schuck * PART 1: VME/multibus defs
921.1Schuck */
931.1Schuck#define IEVME_PAGESIZE 1024	/* bytes */
941.1Schuck#define IEVME_PAGSHIFT 10	/* bits */
951.1Schuck#define IEVME_NPAGES   256	/* number of pages on chip */
961.1Schuck#define IEVME_MAPSZ    1024	/* number of entries in the map */
971.1Schuck
981.1Schuck/*
991.1Schuck * PTE for the page map
1001.1Schuck */
1011.1Schuck#define IEVME_SBORDR 0x8000	/* sun byte order */
1021.2Sandvar#define IEVME_IBORDR 0x0000	/* intel byte order */
1031.1Schuck
1041.1Schuck#define IEVME_P2MEM  0x2000	/* memory is on P2 */
1051.1Schuck#define IEVME_OBMEM  0x0000	/* memory is on board */
1061.1Schuck
1071.1Schuck#define IEVME_PGMASK 0x0fff	/* gives the physical page frame number */
1081.1Schuck
1091.1Schuckstruct ievme {
1101.1Schuck	u_short pgmap[IEVME_MAPSZ];
1111.1Schuck	u_short xxx[32];	/* prom */
1121.1Schuck	u_short status;		/* see below for bits */
1131.1Schuck	u_short xxx2;		/* filler */
1141.1Schuck	u_short pectrl;		/* parity control (see below) */
1151.1Schuck	u_short peaddr;		/* low 16 bits of address */
1161.1Schuck};
1171.1Schuck/*
1181.1Schuck * status bits
1191.1Schuck */
1201.1Schuck#define IEVME_RESET 0x8000	/* reset board */
1211.1Schuck#define IEVME_ONAIR 0x4000	/* go out of loopback 'on-air' */
1221.1Schuck#define IEVME_ATTEN 0x2000	/* attention */
1231.1Schuck#define IEVME_IENAB 0x1000	/* interrupt enable */
1241.1Schuck#define IEVME_PEINT 0x0800	/* parity error interrupt enable */
1251.1Schuck#define IEVME_PERR  0x0200	/* parity error flag */
1261.1Schuck#define IEVME_INT   0x0100	/* interrupt flag */
1271.1Schuck#define IEVME_P2EN  0x0020	/* enable p2 bus */
1281.1Schuck#define IEVME_256K  0x0010	/* 256kb rams */
1291.1Schuck#define IEVME_HADDR 0x000f	/* mask for bits 17-20 of address */
1301.1Schuck
1311.1Schuck/*
1321.1Schuck * parity control
1331.1Schuck */
1341.1Schuck#define IEVME_PARACK 0x0100	/* parity error ack */
1351.1Schuck#define IEVME_PARSRC 0x0080	/* parity error source */
1361.1Schuck#define IEVME_PAREND 0x0040	/* which end of the data got the error */
1371.1Schuck#define IEVME_PARADR 0x000f	/* mask to get bits 17-20 of parity address */
1381.1Schuck
1391.1Schuck
1401.1Schuck/*
1411.1Schuck * PART 2: the on-board interface
1421.1Schuck */
1431.1Schuckstruct ieob {
1441.1Schuck	u_char  obctrl;
1451.1Schuck};
1461.1Schuck#define IEOB_NORSET 0x80	/* don't reset the board */
1471.1Schuck#define IEOB_ONAIR  0x40	/* put us on the air */
1481.1Schuck#define IEOB_ATTEN  0x20	/* attention! */
1491.1Schuck#define IEOB_IENAB  0x10	/* interrupt enable */
1501.1Schuck#define IEOB_XXXXX  0x08	/* free bit */
1511.1Schuck#define IEOB_XCVRL2 0x04	/* level 2 transceiver? */
1521.1Schuck#define IEOB_BUSERR 0x02	/* bus error */
1531.1Schuck#define IEOB_INT    0x01	/* interrupt */
1541.1Schuck
1551.1Schuck#define IEOB_ADBASE 0xff000000	/* KVA base addr of 24 bit address space */
1561.1Schuck
1571.1Schuck/*
1581.1Schuck * PART 3: the 3E board
1591.1Schuck */
1601.1Schuck
1611.1Schuck/*
1621.1Schuck * not supported (yet?)
1631.1Schuck */
164