11da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifndef _IBM_LANA_INCLUDE_
21da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define _IBM_LANA_INCLUDE_
31da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
41da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifdef _IBM_LANA_DRIVER_
51da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
61da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* maximum packet size */
71da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
81da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define PKTSIZE 1524
91da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* number of transmit buffers */
111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define TXBUFCNT 4
131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Adapter ID's */
151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define IBM_LANA_ID 0xffe0
161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* media enumeration - defined in a way that it fits onto the LAN/A's
181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds   POS registers... */
191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
20d7fbeba60b4021dfaf5d315884fbf7672b4ae87bJeff Garziktypedef enum {
211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	Media_10BaseT, Media_10Base5,
221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	Media_Unknown, Media_10Base2, Media_Count
231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds} ibmlana_medium;
241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
251da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* private structure */
261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldstypedef struct {
281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	unsigned int slot;		/* MCA-Slot-#                       */
29d7fbeba60b4021dfaf5d315884fbf7672b4ae87bJeff Garzik	int realirq;			/* memorizes actual IRQ, even when
301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds					   currently not allocated          */
311da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	ibmlana_medium medium;		/* physical cannector               */
321da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	u32 	tdastart, txbufstart,	/* addresses                        */
331da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		rrastart, rxbufstart, rdastart, rxbufcnt, txusedcnt;
341da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	int 	nextrxdescr,		/* next rx descriptor to be used    */
351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		lastrxdescr,		/* last free rx descriptor          */
361da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		nexttxdescr,		/* last tx descriptor to be used    */
371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		currtxdescr,		/* tx descriptor currently tx'ed    */
381da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds		txused[TXBUFCNT];	/* busy flags                       */
391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	void __iomem *base;
401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	spinlock_t lock;
411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds} ibmlana_priv;
421da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
43d7fbeba60b4021dfaf5d315884fbf7672b4ae87bJeff Garzik/* this card uses quite a lot of I/O ports...luckily the MCA bus decodes
441da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds   a full 64K I/O range... */
451da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
461da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define IBM_LANA_IORANGE 0xa0
471da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
481da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Command Register: */
491da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
501da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SONIC_CMDREG     0x00
511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define CMDREG_HTX       0x0001	/* halt transmission                */
521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define CMDREG_TXP       0x0002	/* start transmission               */
531da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define CMDREG_RXDIS     0x0004	/* disable receiver                 */
541da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define CMDREG_RXEN      0x0008	/* enable receiver                  */
551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define CMDREG_STP       0x0010	/* stop timer                       */
561da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define CMDREG_ST        0x0020	/* start timer                      */
571da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define CMDREG_RST       0x0080	/* software reset                   */
581da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define CMDREG_RRRA      0x0100	/* force SONIC to read first RRA    */
591da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define CMDREG_LCAM      0x0200	/* force SONIC to read CAM descrs   */
601da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
611da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Data Configuration Register */
621da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
631da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SONIC_DCREG      0x02
641da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DCREG_EXBUS      0x8000	/* Extended Bus Mode                */
651da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DCREG_LBR        0x2000	/* Latched Bus Retry                */
661da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DCREG_PO1        0x1000	/* Programmable Outputs             */
671da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DCREG_PO0        0x0800
681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DCREG_SBUS       0x0400	/* Synchronous Bus Mode             */
691da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DCREG_USR1       0x0200	/* User Definable Pins              */
701da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DCREG_USR0       0x0100
711da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DCREG_WC0        0x0000	/* 0..3 Wait States                 */
721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DCREG_WC1        0x0040
731da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DCREG_WC2        0x0080
741da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DCREG_WC3        0x00c0
751da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DCREG_DW16       0x0000	/* 16 bit Bus Mode                  */
761da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DCREG_DW32       0x0020	/* 32 bit Bus Mode                  */
771da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DCREG_BMS        0x0010	/* Block Mode Select                */
781da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DCREG_RFT4       0x0000	/* 4/8/16/24 bytes RX  Threshold    */
791da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DCREG_RFT8       0x0004
801da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DCREG_RFT16      0x0008
811da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DCREG_RFT24      0x000c
821da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DCREG_TFT8       0x0000	/* 8/16/24/28 bytes TX Threshold    */
831da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DCREG_TFT16      0x0001
841da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DCREG_TFT24      0x0002
851da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DCREG_TFT28      0x0003
861da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
871da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Receive Control Register */
881da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
891da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SONIC_RCREG      0x04
901da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RCREG_ERR        0x8000	/* accept damaged and collided pkts */
911da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RCREG_RNT        0x4000	/* accept packets that are < 64     */
921da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RCREG_BRD        0x2000	/* accept broadcasts                */
9325985edcedea6396277003854657b5f3cb31a628Lucas De Marchi#define RCREG_PRO        0x1000	/* promiscuous mode                  */
941da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RCREG_AMC        0x0800	/* accept all multicasts            */
951da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RCREG_LB_NONE    0x0000	/* no loopback                      */
961da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RCREG_LB_MAC     0x0200	/* MAC loopback                     */
971da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RCREG_LB_ENDEC   0x0400	/* ENDEC loopback                   */
981da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RCREG_LB_XVR     0x0600	/* Transceiver loopback             */
991da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RCREG_MC         0x0100	/* Multicast received               */
1001da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RCREG_BC         0x0080	/* Broadcast received               */
1011da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RCREG_LPKT       0x0040	/* last packet in RBA               */
1021da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RCREG_CRS        0x0020	/* carrier sense present            */
1031da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RCREG_COL        0x0010	/* recv'd packet with collision     */
1041da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RCREG_CRCR       0x0008	/* recv'd packet with CRC error     */
1051da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RCREG_FAER       0x0004	/* recv'd packet with inv. framing  */
1061da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RCREG_LBK        0x0002	/* recv'd loopback packet           */
1071da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define RCREG_PRX        0x0001	/* recv'd packet is OK              */
1081da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
1091da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Transmit Control Register */
1101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
1111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SONIC_TCREG      0x06
1121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define TCREG_PINT       0x8000	/* generate interrupt after TDA read */
1131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define TCREG_POWC       0x4000	/* timer start out of window detect */
1141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define TCREG_CRCI       0x2000	/* inhibit CRC generation           */
1151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define TCREG_EXDIS      0x1000	/* disable excessive deferral timer */
1161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define TCREG_EXD        0x0400	/* excessive deferral occurred       */
1171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define TCREG_DEF        0x0200	/* single deferral occurred          */
1181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define TCREG_NCRS       0x0100	/* no carrier detected              */
1191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define TCREG_CRSL       0x0080	/* carrier lost                     */
1201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define TCREG_EXC        0x0040	/* excessive collisions occurred     */
1211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define TCREG_OWC        0x0020	/* out of window collision occurred  */
1221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define TCREG_PMB        0x0008	/* packet monitored bad             */
1231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define TCREG_FU         0x0004	/* FIFO underrun                    */
1241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define TCREG_BCM        0x0002	/* byte count mismatch of fragments */
1251da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define TCREG_PTX        0x0001	/* packet transmitted OK            */
1261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
1271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Interrupt Mask Register */
1281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
1291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SONIC_IMREG      0x08
1301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define IMREG_BREN       0x4000	/* interrupt when bus retry occurred */
1311da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define IMREG_HBLEN      0x2000	/* interrupt when heartbeat lost    */
1321da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define IMREG_LCDEN      0x1000	/* interrupt when CAM loaded        */
1331da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define IMREG_PINTEN     0x0800	/* interrupt when PINT in TDA set   */
1341da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define IMREG_PRXEN      0x0400	/* interrupt when packet received   */
1351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define IMREG_PTXEN      0x0200	/* interrupt when packet was sent   */
1361da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define IMREG_TXEREN     0x0100	/* interrupt when send failed       */
1371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define IMREG_TCEN       0x0080	/* interrupt when timer completed   */
1381da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define IMREG_RDEEN      0x0040	/* interrupt when RDA exhausted     */
1391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define IMREG_RBEEN      0x0020	/* interrupt when RBA exhausted     */
1401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define IMREG_RBAEEN     0x0010	/* interrupt when RBA too short     */
1411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define IMREG_CRCEN      0x0008	/* interrupt when CRC counter rolls */
1421da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define IMREG_FAEEN      0x0004	/* interrupt when FAE counter rolls */
1431da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define IMREG_MPEN       0x0002	/* interrupt when MP counter rolls  */
1441da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define IMREG_RFOEN      0x0001	/* interrupt when Rx FIFO overflows */
1451da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
1461da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Interrupt Status Register */
1471da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
1481da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SONIC_ISREG      0x0a
1491da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define ISREG_BR         0x4000	/* bus retry occurred                */
1501da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define ISREG_HBL        0x2000	/* heartbeat lost                   */
1511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define ISREG_LCD        0x1000	/* CAM loaded                       */
1521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define ISREG_PINT       0x0800	/* PINT in TDA set                  */
1531da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define ISREG_PKTRX      0x0400	/* packet received                  */
1541da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define ISREG_TXDN       0x0200	/* packet was sent                  */
1551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define ISREG_TXER       0x0100	/* send failed                      */
1561da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define ISREG_TC         0x0080	/* timer completed                  */
1571da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define ISREG_RDE        0x0040	/* RDA exhausted                    */
1581da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define ISREG_RBE        0x0020	/* RBA exhausted                    */
1591da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define ISREG_RBAE       0x0010	/* RBA too short for received frame */
1601da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define ISREG_CRC        0x0008	/* CRC counter rolls over           */
1611da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define ISREG_FAE        0x0004	/* FAE counter rolls over           */
1621da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define ISREG_MP         0x0002	/* MP counter rolls  over           */
1631da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define ISREG_RFO        0x0001	/* Rx FIFO overflows                */
1641da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
1651da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SONIC_UTDA       0x0c	/* current transmit descr address   */
1661da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SONIC_CTDA       0x0e
1671da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
1681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SONIC_URDA       0x1a	/* current receive descr address    */
1691da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SONIC_CRDA       0x1c
1701da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
1711da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SONIC_CRBA0      0x1e	/* current receive buffer address   */
1721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SONIC_CRBA1      0x20
1731da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
1741da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SONIC_RBWC0      0x22	/* word count in receive buffer     */
1751da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SONIC_RBWC1      0x24
1761da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
1771da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SONIC_EOBC       0x26	/* minimum space to be free in RBA  */
1781da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
1791da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SONIC_URRA       0x28	/* upper address of CDA & Recv Area */
1801da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
1811da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SONIC_RSA        0x2a	/* start of receive resource area   */
1821da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
1831da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SONIC_REA        0x2c	/* end of receive resource area     */
1841da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
1851da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SONIC_RRP        0x2e	/* resource read pointer            */
1861da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
1871da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SONIC_RWP        0x30	/* resource write pointer           */
1881da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
1891da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SONIC_CAMEPTR    0x42	/* CAM entry pointer                */
1901da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
1911da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SONIC_CAMADDR2   0x44	/* CAM address ports                */
1921da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SONIC_CAMADDR1   0x46
1931da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SONIC_CAMADDR0   0x48
1941da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
1951da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SONIC_CAMPTR     0x4c	/* lower address of CDA             */
1961da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
1971da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SONIC_CAMCNT     0x4e	/* # of CAM descriptors to load     */
1981da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
1991da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Data Configuration Register 2    */
2001da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
2011da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define SONIC_DCREG2     0x7e
2021da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DCREG2_EXPO3     0x8000	/* extended programmable outputs    */
2031da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DCREG2_EXPO2     0x4000
2041da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DCREG2_EXPO1     0x2000
2051da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DCREG2_EXPO0     0x1000
2061da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DCREG2_HD        0x0800	/* heartbeat disable                */
2071da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DCREG2_JD        0x0200	/* jabber timer disable             */
2081da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DCREG2_AUTO      0x0100	/* enable AUI/TP auto selection     */
2091da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DCREG2_XWRAP     0x0040	/* TP transceiver loopback          */
2101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DCREG2_PH        0x0010	/* HOLD request timing              */
2111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DCREG2_PCM       0x0004	/* packet compress when matched     */
2121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DCREG2_PCNM      0x0002	/* packet compress when not matched */
2131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define DCREG2_RJCM      0x0001	/* inverse packet match via CAM     */
2141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
2151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Board Control Register: Enable RAM, Interrupts... */
2161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
2171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define BCMREG           0x80
2181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define BCMREG_RAMEN     0x80	/* switch over to RAM               */
2191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define BCMREG_IPEND     0x40	/* interrupt pending ?              */
2201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define BCMREG_RESET     0x08	/* reset board                      */
2211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define BCMREG_16BIT     0x04	/* adapter in 16-bit slot           */
2221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define BCMREG_RAMWIN    0x02	/* enable RAM window                */
2231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define BCMREG_IEN       0x01	/* interrupt enable                 */
2241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
2251da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* MAC Address PROM */
2261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
2271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define MACADDRPROM      0x92
2281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
2291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* structure of a CAM entry */
2301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
2311da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldstypedef struct {
2321da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	u32 index;		/* pointer into CAM area            */
2331da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	u32 addr0;		/* address part (bits 0..15 used)   */
2341da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	u32 addr1;
2351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	u32 addr2;
2361da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds} camentry_t;
2371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
2381da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* structure of a receive resource */
2391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
2401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldstypedef struct {
2411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	u32 startlo;		/* start address (bits 0..15 used)  */
2421da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	u32 starthi;
2431da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	u32 cntlo;		/* size in 16-bit quantities        */
2441da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	u32 cnthi;
2451da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds} rra_t;
2461da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
2471da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* structure of a receive descriptor */
2481da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
2491da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldstypedef struct {
2501da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	u32 status;		/* packet status                    */
2511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	u32 length;		/* length in bytes                  */
2521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	u32 startlo;		/* start address                    */
2531da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	u32 starthi;
2541da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	u32 seqno;		/* frame sequence                   */
2551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	u32 link;		/* pointer to next descriptor       */
2561da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	/* bit 0 = EOL                      */
2571da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	u32 inuse;		/* !=0 --> free for SONIC to write  */
2581da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds} rda_t;
2591da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
2601da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* structure of a transmit descriptor */
2611da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
2621da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldstypedef struct {
2631da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	u32 status;		/* transmit status                  */
2641da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	u32 config;		/* value for TCR                    */
2651da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	u32 length;		/* total length                     */
2661da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	u32 fragcount;		/* number of fragments              */
2671da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	u32 startlo;		/* start address of fragment        */
2681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	u32 starthi;
2691da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	u32 fraglength;		/* length of this fragment          */
2701da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	/* more address/length triplets may */
2711da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	/* follow here                      */
2721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	u32 link;		/* pointer to next descriptor       */
2731da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	/* bit 0 = EOL                      */
2741da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds} tda_t;
2751da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
2761da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif				/* _IBM_LANA_DRIVER_ */
2771da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
2781da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif	/* _IBM_LANA_INCLUDE_ */
279