1 1.6 andvar /* $NetBSD: lemacreg.h,v 1.6 2021/07/24 21:31:37 andvar Exp $ */ 2 1.1 matt 3 1.1 matt /* 4 1.1 matt * Copyright (c) 1994, 1995, 1997 Matt Thomas <matt (at) 3am-software.com> 5 1.1 matt * All rights reserved. 6 1.1 matt * 7 1.1 matt * Redistribution and use in source and binary forms, with or without 8 1.1 matt * modification, are permitted provided that the following conditions 9 1.1 matt * are met: 10 1.1 matt * 1. Redistributions of source code must retain the above copyright 11 1.1 matt * notice, this list of conditions and the following disclaimer. 12 1.1 matt * 2. The name of the author may not be used to endorse or promote products 13 1.2 wiz * derived from this software without specific prior written permission 14 1.1 matt * 15 1.1 matt * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 1.1 matt * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 1.1 matt * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 1.1 matt * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 1.1 matt * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 1.1 matt * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 1.1 matt * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 1.1 matt * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 1.1 matt * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 1.1 matt * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 1.1 matt */ 26 1.1 matt #ifndef _LEMAC_H_ 27 1.1 matt #define _LEMAC_H_ 28 1.1 matt 29 1.1 matt #define LEMAC_IOBASE_LOW 0x200 30 1.1 matt #define LEMAC_IOBASE_HIGH 0x400 31 1.1 matt 32 1.1 matt /* 33 1.1 matt * This is list of registers used on a DEC EtherWORKS III card. 34 1.1 matt * Each board occupies a 32 byte register space. This can be 35 1.1 matt * in either EISA or ISA space. Currently we only support ISA 36 1.1 matt * space. 37 1.1 matt */ 38 1.1 matt 39 1.1 matt #define LEMAC_REG_CS 0x00 /* Control and Status */ 40 1.1 matt #define LEMAC_REG_CTL 0x01 /* Control */ 41 1.1 matt #define LEMAC_REG_IC 0x02 /* Interrupt Control */ 42 1.1 matt #define LEMAC_REG_TS 0x03 /* Transmit Status */ 43 1.1 matt #define LEMAC_REG_RSVD1 0x04 /* Reserved (not used) */ 44 1.1 matt #define LEMAC_REG_RSVD2 0x05 /* Reserved (not used) */ 45 1.1 matt #define LEMAC_REG_FMQ 0x06 /* Free Memory Queue */ 46 1.1 matt #define LEMAC_REG_FMC 0x07 /* Free Memory Queue Count */ 47 1.1 matt #define LEMAC_REG_RQ 0x08 /* Receive Queue */ 48 1.1 matt #define LEMAC_REG_RQC 0x09 /* Receive Queue Count */ 49 1.1 matt #define LEMAC_REG_TQ 0x0A /* Transmit Queue */ 50 1.1 matt #define LEMAC_REG_TQC 0x0B /* Transmit Queue Count */ 51 1.1 matt #define LEMAC_REG_TDQ 0x0C /* Transmit Done Queue */ 52 1.1 matt #define LEMAC_REG_TDC 0x0D /* Transmit Done Queue Count */ 53 1.1 matt #define LEMAC_REG_PI1 0x0E /* Page Index #1 */ 54 1.1 matt #define LEMAC_REG_PI2 0x0F /* Page Index #2 */ 55 1.1 matt #define LEMAC_REG_DAT 0x10 /* Data */ 56 1.1 matt #define LEMAC_REG_IOP 0x11 /* I/O Page */ 57 1.1 matt #define LEMAC_REG_IOB 0x12 /* I/O Base */ 58 1.1 matt #define LEMAC_REG_MPN 0x13 /* Memory Page */ 59 1.1 matt #define LEMAC_REG_MBR 0x14 /* Memory Base */ 60 1.1 matt #define LEMAC_REG_APD 0x15 /* Address PROM */ 61 1.1 matt #define LEMAC_REG_EE1 0x16 /* EEPROM Data #1 */ 62 1.1 matt #define LEMAC_REG_EE2 0x17 /* EEPROM Data #2 */ 63 1.1 matt #define LEMAC_REG_PA0 0x18 /* Physical Address (Byte 0) */ 64 1.1 matt #define LEMAC_REG_PA1 0x19 /* Physical Address (Byte 1) */ 65 1.1 matt #define LEMAC_REG_PA2 0x1A /* Physical Address (Byte 2) */ 66 1.1 matt #define LEMAC_REG_PA3 0x1B /* Physical Address (Byte 3) */ 67 1.1 matt #define LEMAC_REG_PA4 0x1C /* Physical Address (Byte 4) */ 68 1.1 matt #define LEMAC_REG_PA5 0x1D /* Physical Address (Byte 5) */ 69 1.1 matt #define LEMAC_REG_CNF 0x1E /* Configuration Management */ 70 1.1 matt #define LEMAC_IOSIZE 0x20 /* LEMAC uses 32 bytes of IOSPACE */ 71 1.1 matt 72 1.1 matt 73 1.1 matt #define LEMAC_REG_EID0 0x80 /* EISA Identification 0 */ 74 1.1 matt #define LEMAC_REG_EID1 0x81 /* EISA Identification 1 */ 75 1.1 matt #define LEMAC_REG_EID2 0x82 /* EISA Identification 2 */ 76 1.1 matt #define LEMAC_REG_EID3 0x83 /* EISA Identification 3 */ 77 1.1 matt #define LEMAC_REG_EIC 0x84 /* EISA Control */ 78 1.1 matt 79 1.1 matt /* Control Page (Page 0) Definitions */ 80 1.1 matt 81 1.1 matt #define LEMAC_MCTBL_BITS 9 82 1.1 matt #define LEMAC_MCTBL_OFF 512 83 1.1 matt #define LEMAC_MCTBL_SIZE (1 << (LEMAC_MCTBL_BITS - 3)) 84 1.1 matt #define LEMAC_CRC32_POLY 0xEDB88320UL /* CRC-32 Poly -- Little Endian) */ 85 1.1 matt 86 1.1 matt /* EEPROM Definitions */ 87 1.1 matt 88 1.1 matt #define LEMAC_EEP_CKSUM 0 /* The valid checksum is 0 */ 89 1.1 matt #define LEMAC_EEP_SIZE 32 /* EEPROM is 32 bytes */ 90 1.1 matt #define LEMAC_EEP_DELAY 2000 /* 2ms = 2000us */ 91 1.1 matt #define LEMAC_EEP_PRDNM 8 /* Product Name Offset */ 92 1.1 matt #define LEMAC_EEP_PRDNMSZ 8 /* Product Name Size */ 93 1.1 matt #define LEMAC_EEP_SWFLAGS 16 /* Software Options Offset */ 94 1.1 matt #define LEMAC_EEP_SETUP 23 /* Setup Options Offset */ 95 1.1 matt 96 1.1 matt #define LEMAC_EEP_SW_SQE 0x10 /* Enable TX_SQE on Transmits */ 97 1.1 matt #define LEMAC_EEP_SW_LAB 0x08 /* Enable TX_LAB on Transmits */ 98 1.1 matt #define LEMAC_EEP_ST_DRAM 0x02 /* Enable extra DRAM */ 99 1.1 matt 100 1.1 matt #define LEMAC_ADP_ROMSZ 32 /* Size of Address PROM */ 101 1.1 matt 102 1.1 matt /* Receive Status Definitions */ 103 1.1 matt 104 1.1 matt #define LEMAC_RX_PLL 0x01 /* Phase Lock Lost */ 105 1.1 matt #define LEMAC_RX_CRC 0x02 /* CRC Error */ 106 1.1 matt #define LEMAC_RX_DBE 0x04 /* Dribble Bit Error */ 107 1.1 matt #define LEMAC_RX_MCM 0x08 /* Multicast Match */ 108 1.1 matt #define LEMAC_RX_IAM 0x10 /* Individual Address Match */ 109 1.1 matt #define LEMAC_RX_OK 0x80 /* No Errors */ 110 1.1 matt 111 1.1 matt /* Transmit Status Definitions (not valid if TXD == 0) */ 112 1.1 matt 113 1.1 matt #define LEMAC_TS_RTRYMSK 0x0F /* Retries of last TX PDU */ 114 1.1 matt #define LEMAC_TS_ECL 0x10 /* Excessive collision of ... */ 115 1.1 matt #define LEMAC_TS_LCL 0x20 /* Late collision of ... */ 116 1.1 matt #define LEMAC_TS_ID 0x40 /* Initially Deferred ... */ 117 1.1 matt #define LEMAC_TS_NCL 0x08 /* No carrier loopback ... */ 118 1.1 matt 119 1.1 matt /* Transmit Control Definitions */ 120 1.1 matt 121 1.1 matt #define LEMAC_TX_ISA 0x01 /* Insert Source Address (no) */ 122 1.1 matt #define LEMAC_TX_IFC 0x02 /* Insert Frame Check (yes) */ 123 1.3 wiz #define LEMAC_TX_PAD 0x04 /* Zero PAD to minimum length (yes) */ 124 1.6 andvar #define LEMAC_TX_LAB 0x08 /* Less Aggressive Backoff (no) */ 125 1.1 matt #define LEMAC_TX_QMD 0x10 /* Q-Mode (yes) */ 126 1.1 matt #define LEMAC_TX_STP 0x20 /* Stop on Error (no) */ 127 1.1 matt #define LEMAC_TX_SQE 0x40 /* SQE Enable (yes) */ 128 1.1 matt 129 1.1 matt #define LEMAC_TX_FLAGS (LEMAC_TX_IFC|LEMAC_TX_PAD|LEMAC_TX_QMD|\ 130 1.1 matt LEMAC_TX_SQE) 131 1.1 matt #define LEMAC_TX_HDRSZ 4 /* Size of TX header */ 132 1.1 matt 133 1.1 matt /* Transmit Done Queue Status Definitions */ 134 1.1 matt 135 1.4 perry #define LEMAC_TDQ_COL 0x03 /* Collision Mask */ 136 1.1 matt #define LEMAC_TDQ_NOCOL 0x00 /* No Collisions */ 137 1.1 matt #define LEMAC_TDQ_ONECOL 0x01 /* One Collision */ 138 1.1 matt #define LEMAC_TDQ_MULCOL 0x02 /* Multiple Collisions */ 139 1.3 wiz #define LEMAC_TDQ_EXCCOL 0x03 /* Excessive Collisions */ 140 1.1 matt #define LEMAC_TDQ_ID 0x04 /* Initially Deferred */ 141 1.1 matt #define LEMAC_TDQ_LCL 0x08 /* Late Collision (will TX_STP) */ 142 1.1 matt #define LEMAC_TDQ_NCL 0x10 /* No carrier loopback */ 143 1.1 matt #define LEMAC_TDQ_SQE 0x20 /* SQE error */ 144 1.1 matt 145 1.1 matt /* Control / Status Definitions */ 146 1.1 matt 147 1.1 matt #define LEMAC_CS_RXD 0x01 /* Receiver Disabled */ 148 1.1 matt #define LEMAC_CS_TXD 0x02 /* Transmitter Disabled */ 149 1.1 matt #define LEMAC_CS_RNE 0x04 /* Receive Queue Not Empty */ 150 1.1 matt #define LEMAC_CS_TNE 0x08 /* Transmit Done Queue Not Empty */ 151 1.1 matt #define LEMAC_CS_MBZ4 0x10 /* MBZ */ 152 1.1 matt #define LEMAC_CS_MCE 0x20 /* Multicast Enable */ 153 1.1 matt #define LEMAC_CS_PME 0x40 /* Promiscuous Mode Enable */ 154 1.1 matt #define LEMAC_CS_RA 0x80 /* Runt Accept */ 155 1.1 matt 156 1.1 matt /* Control Definitions */ 157 1.1 matt 158 1.1 matt #define LEMAC_CTL_LED 0x02 /* LED state (inverted) */ 159 1.1 matt #define LEMAC_CTL_PSL 0x40 /* Port Select (1=AUI, 0=UTP) */ 160 1.1 matt #define LEMAC_CTL_APD 0x80 /* Auto Port Disable */ 161 1.1 matt 162 1.1 matt /* Interrupt Control Definitions */ 163 1.1 matt 164 1.1 matt #define LEMAC_IC_RXD 0x01 /* Enable RXD Interrupt */ 165 1.1 matt #define LEMAC_IC_TXD 0x02 /* Enable TXD Interrupt */ 166 1.1 matt #define LEMAC_IC_RNE 0x04 /* Enable RNE Interrupt */ 167 1.1 matt #define LEMAC_IC_TNE 0x08 /* Enable TNE Interrupt */ 168 1.1 matt #define LEMAC_IC_ALL 0x0F /* Enable RXD,TXD,RNE,TNE */ 169 1.1 matt #define LEMAC_IC_IRQMSK 0x60 /* Interrupt Select */ 170 1.1 matt #define LEMAC_IC_IRQ5 0x00 /* Select IRQ 5 */ 171 1.1 matt #define LEMAC_IC_IRQ10 0x20 /* Select IRQ 10 */ 172 1.1 matt #define LEMAC_IC_IRQ11 0x40 /* Select IRQ 11 */ 173 1.1 matt #define LEMAC_IC_IRQ15 0x60 /* Select IRQ 15 */ 174 1.1 matt #define LEMAC_IC_IE 0x80 /* Interrupt Enable */ 175 1.1 matt 176 1.1 matt /* I/O Page Definitions */ 177 1.1 matt 178 1.1 matt #define LEMAC_IOP_EEINIT 0xC0 /* Perform a board init/reset */ 179 1.1 matt #define LEMAC_IOP_EEREAD 0xE0 /* Start a read from EEPROM */ 180 1.1 matt 181 1.1 matt /* Configuration / Management Definitions */ 182 1.1 matt 183 1.1 matt #define LEMAC_CNF_DRAM 0x02 /* Extra on-board DRAM is available */ 184 1.1 matt #define LEMAC_CNF_NOLINK 0x20 /* UTP port is UP */ 185 1.1 matt 186 1.1 matt #endif /* _LEMAC_H_ */ 187