1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 /* 3 * hp100.h: Hewlett Packard HP10/100VG ANY LAN ethernet driver for Linux. 4 * 5 * $Id: hp100.h,v 1.51 1997/04/08 14:26:42 floeff Exp floeff $ 6 * 7 * Authors: Jaroslav Kysela, <perex@pf.jcu.cz> 8 * Siegfried Loeffler <floeff@tunix.mathematik.uni-stuttgart.de> 9 * 10 * This driver is based on the 'hpfepkt' crynwr packet driver. 11 */ 12 13 /**************************************************************************** 14 * Hardware Constants 15 ****************************************************************************/ 16 17 /* 18 * Page Identifiers 19 * (Swap Paging Register, PAGING, bits 3:0, Offset 0x02) 20 */ 21 22 #define HP100_PAGE_PERFORMANCE 0x0 /* Page 0 */ 23 #define HP100_PAGE_MAC_ADDRESS 0x1 /* Page 1 */ 24 #define HP100_PAGE_HW_MAP 0x2 /* Page 2 */ 25 #define HP100_PAGE_EEPROM_CTRL 0x3 /* Page 3 */ 26 #define HP100_PAGE_MAC_CTRL 0x4 /* Page 4 */ 27 #define HP100_PAGE_MMU_CFG 0x5 /* Page 5 */ 28 #define HP100_PAGE_ID_MAC_ADDR 0x6 /* Page 6 */ 29 #define HP100_PAGE_MMU_POINTER 0x7 /* Page 7 */ 30 31 32 /* Registers that are present on all pages */ 33 34 #define HP100_REG_HW_ID 0x00 /* R: (16) Unique card ID */ 35 #define HP100_REG_TRACE 0x00 /* W: (16) Used for debug output */ 36 #define HP100_REG_PAGING 0x02 /* R: (16),15:4 Card ID */ 37 /* W: (16),3:0 Switch pages */ 38 #define HP100_REG_OPTION_LSW 0x04 /* RW: (16) Select card functions */ 39 #define HP100_REG_OPTION_MSW 0x06 /* RW: (16) Select card functions */ 40 41 /* Page 0 - Performance */ 42 43 #define HP100_REG_IRQ_STATUS 0x08 /* RW: (16) Which ints are pending */ 44 #define HP100_REG_IRQ_MASK 0x0a /* RW: (16) Select ints to allow */ 45 #define HP100_REG_FRAGMENT_LEN 0x0c /* W: (16)12:0 Current fragment len */ 46 /* Note: For 32 bit systems, fragment len and offset registers are available */ 47 /* at offset 0x28 and 0x2c, where they can be written as 32bit values. */ 48 #define HP100_REG_OFFSET 0x0e /* RW: (16)12:0 Offset to start read */ 49 #define HP100_REG_DATA32 0x10 /* RW: (32) I/O mode data port */ 50 #define HP100_REG_DATA16 0x12 /* RW: WORDs must be read from here */ 51 #define HP100_REG_TX_MEM_FREE 0x14 /* RD: (32) Amount of free Tx mem */ 52 #define HP100_REG_TX_PDA_L 0x14 /* W: (32) BM: Ptr to PDL, Low Pri */ 53 #define HP100_REG_TX_PDA_H 0x1c /* W: (32) BM: Ptr to PDL, High Pri */ 54 #define HP100_REG_RX_PKT_CNT 0x18 /* RD: (8) Rx count of pkts on card */ 55 #define HP100_REG_TX_PKT_CNT 0x19 /* RD: (8) Tx count of pkts on card */ 56 #define HP100_REG_RX_PDL 0x1a /* R: (8) BM: # rx pdl not executed */ 57 #define HP100_REG_TX_PDL 0x1b /* R: (8) BM: # tx pdl not executed */ 58 #define HP100_REG_RX_PDA 0x18 /* W: (32) BM: Up to 31 addresses */ 59 /* which point to a PDL */ 60 #define HP100_REG_SL_EARLY 0x1c /* (32) Enhanced Slave Early Rx */ 61 #define HP100_REG_STAT_DROPPED 0x20 /* R (12) Dropped Packet Counter */ 62 #define HP100_REG_STAT_ERRORED 0x22 /* R (8) Errored Packet Counter */ 63 #define HP100_REG_STAT_ABORT 0x23 /* R (8) Abort Counter/OW Coll. Flag */ 64 #define HP100_REG_RX_RING 0x24 /* W (32) Slave: RX Ring Pointers */ 65 #define HP100_REG_32_FRAGMENT_LEN 0x28 /* W (13) Slave: Fragment Length Reg */ 66 #define HP100_REG_32_OFFSET 0x2c /* W (16) Slave: Offset Register */ 67 68 /* Page 1 - MAC Address/Hash Table */ 69 70 #define HP100_REG_MAC_ADDR 0x08 /* RW: (8) Cards MAC address */ 71 #define HP100_REG_HASH_BYTE0 0x10 /* RW: (8) Cards multicast filter */ 72 73 /* Page 2 - Hardware Mapping */ 74 75 #define HP100_REG_MEM_MAP_LSW 0x08 /* RW: (16) LSW of cards mem addr */ 76 #define HP100_REG_MEM_MAP_MSW 0x0a /* RW: (16) MSW of cards mem addr */ 77 #define HP100_REG_IO_MAP 0x0c /* RW: (8) Cards I/O address */ 78 #define HP100_REG_IRQ_CHANNEL 0x0d /* RW: (8) IRQ and edge/level int */ 79 #define HP100_REG_SRAM 0x0e /* RW: (8) How much RAM on card */ 80 #define HP100_REG_BM 0x0f /* RW: (8) Controls BM functions */ 81 82 /* New on Page 2 for ETR chips: */ 83 #define HP100_REG_MODECTRL1 0x10 /* RW: (8) Mode Control 1 */ 84 #define HP100_REG_MODECTRL2 0x11 /* RW: (8) Mode Control 2 */ 85 #define HP100_REG_PCICTRL1 0x12 /* RW: (8) PCI Cfg 1 */ 86 #define HP100_REG_PCICTRL2 0x13 /* RW: (8) PCI Cfg 2 */ 87 #define HP100_REG_PCIBUSMLAT 0x15 /* RW: (8) PCI Bus Master Latency */ 88 #define HP100_REG_EARLYTXCFG 0x16 /* RW: (16) Early TX Cfg/Cntrl Reg */ 89 #define HP100_REG_EARLYRXCFG 0x18 /* RW: (8) Early RX Cfg/Cntrl Reg */ 90 #define HP100_REG_ISAPNPCFG1 0x1a /* RW: (8) ISA PnP Cfg/Cntrl Reg 1 */ 91 #define HP100_REG_ISAPNPCFG2 0x1b /* RW: (8) ISA PnP Cfg/Cntrl Reg 2 */ 92 93 /* Page 3 - EEPROM/Boot ROM */ 94 95 #define HP100_REG_EEPROM_CTRL 0x08 /* RW: (16) Used to load EEPROM */ 96 #define HP100_REG_BOOTROM_CTRL 0x0a 97 98 /* Page 4 - LAN Configuration (MAC_CTRL) */ 99 100 #define HP100_REG_10_LAN_CFG_1 0x08 /* RW: (8) Set 10M XCVR functions */ 101 #define HP100_REG_10_LAN_CFG_2 0x09 /* RW: (8) 10M XCVR functions */ 102 #define HP100_REG_VG_LAN_CFG_1 0x0a /* RW: (8) Set 100M XCVR functions */ 103 #define HP100_REG_VG_LAN_CFG_2 0x0b /* RW: (8) 100M LAN Training cfgregs */ 104 #define HP100_REG_MAC_CFG_1 0x0c /* RW: (8) Types of pkts to accept */ 105 #define HP100_REG_MAC_CFG_2 0x0d /* RW: (8) Misc MAC functions */ 106 #define HP100_REG_MAC_CFG_3 0x0e /* RW: (8) Misc MAC functions */ 107 #define HP100_REG_MAC_CFG_4 0x0f /* R: (8) Misc MAC states */ 108 #define HP100_REG_DROPPED 0x10 /* R: (16),11:0 Pkts can't fit in mem */ 109 #define HP100_REG_CRC 0x12 /* R: (8) Pkts with CRC */ 110 #define HP100_REG_ABORT 0x13 /* R: (8) Aborted Tx pkts */ 111 #define HP100_REG_TRAIN_REQUEST 0x14 /* RW: (16) Endnode MAC register. */ 112 #define HP100_REG_TRAIN_ALLOW 0x16 /* R: (16) Hub allowed register */ 113 114 /* Page 5 - MMU */ 115 116 #define HP100_REG_RX_MEM_STOP 0x0c /* RW: (16) End of Rx ring addr */ 117 #define HP100_REG_TX_MEM_STOP 0x0e /* RW: (16) End of Tx ring addr */ 118 #define HP100_REG_PDL_MEM_STOP 0x10 /* Not used by 802.12 devices */ 119 #define HP100_REG_ECB_MEM_STOP 0x14 /* I've no idea what this is */ 120 121 /* Page 6 - Card ID/Physical LAN Address */ 122 123 #define HP100_REG_BOARD_ID 0x08 /* R: (8) EISA/ISA card ID */ 124 #define HP100_REG_BOARD_IO_CHCK 0x0c /* R: (8) Added to ID to get FFh */ 125 #define HP100_REG_SOFT_MODEL 0x0d /* R: (8) Config program defined */ 126 #define HP100_REG_LAN_ADDR 0x10 /* R: (8) MAC addr of card */ 127 #define HP100_REG_LAN_ADDR_CHCK 0x16 /* R: (8) Added to addr to get FFh */ 128 129 /* Page 7 - MMU Current Pointers */ 130 131 #define HP100_REG_PTR_RXSTART 0x08 /* R: (16) Current begin of Rx ring */ 132 #define HP100_REG_PTR_RXEND 0x0a /* R: (16) Current end of Rx ring */ 133 #define HP100_REG_PTR_TXSTART 0x0c /* R: (16) Current begin of Tx ring */ 134 #define HP100_REG_PTR_TXEND 0x0e /* R: (16) Current end of Rx ring */ 135 #define HP100_REG_PTR_RPDLSTART 0x10 136 #define HP100_REG_PTR_RPDLEND 0x12 137 #define HP100_REG_PTR_RINGPTRS 0x14 138 #define HP100_REG_PTR_MEMDEBUG 0x1a 139 /* ------------------------------------------------------------------------ */ 140 141 142 /* 143 * Hardware ID Register I (Always available, HW_ID, Offset 0x00) 144 */ 145 #define HP100_HW_ID_CASCADE 0x4850 /* Identifies Cascade Chip */ 146 147 /* 148 * Hardware ID Register 2 & Paging Register 149 * (Always available, PAGING, Offset 0x02) 150 * Bits 15:4 are for the Chip ID 151 */ 152 #define HP100_CHIPID_MASK 0xFFF0 153 #define HP100_CHIPID_SHASTA 0x5350 /* Not 802.12 compliant */ 154 /* EISA BM/SL, MCA16/32 SL, ISA SL */ 155 #define HP100_CHIPID_RAINIER 0x5360 /* Not 802.12 compliant EISA BM, */ 156 /* PCI SL, MCA16/32 SL, ISA SL */ 157 #define HP100_CHIPID_LASSEN 0x5370 /* 802.12 compliant PCI BM, PCI SL */ 158 /* LRF supported */ 159 160 /* 161 * Option Registers I and II 162 * (Always available, OPTION_LSW, Offset 0x04-0x05) 163 */ 164 #define HP100_DEBUG_EN 0x8000 /* 0:Dis., 1:Enable Debug Dump Ptr. */ 165 #define HP100_RX_HDR 0x4000 /* 0:Dis., 1:Enable putting pkt into */ 166 /* system mem. before Rx interrupt */ 167 #define HP100_MMAP_DIS 0x2000 /* 0:Enable, 1:Disable mem.mapping. */ 168 /* MMAP_DIS must be 0 and MEM_EN */ 169 /* must be 1 for memory-mapped */ 170 /* mode to be enabled */ 171 #define HP100_EE_EN 0x1000 /* 0:Disable,1:Enable EEPROM writing */ 172 #define HP100_BM_WRITE 0x0800 /* 0:Slave, 1:Bus Master for Tx data */ 173 #define HP100_BM_READ 0x0400 /* 0:Slave, 1:Bus Master for Rx data */ 174 #define HP100_TRI_INT 0x0200 /* 0:Don't, 1:Do tri-state the int */ 175 #define HP100_MEM_EN 0x0040 /* Config program set this to */ 176 /* 0:Disable, 1:Enable mem map. */ 177 /* See MMAP_DIS. */ 178 #define HP100_IO_EN 0x0020 /* 1:Enable I/O transfers */ 179 #define HP100_BOOT_EN 0x0010 /* 1:Enable boot ROM access */ 180 #define HP100_FAKE_INT 0x0008 /* 1:int */ 181 #define HP100_INT_EN 0x0004 /* 1:Enable ints from card */ 182 #define HP100_HW_RST 0x0002 /* 0:Reset, 1:Out of reset */ 183 /* NIC reset on 0 to 1 transition */ 184 185 /* 186 * Option Register III 187 * (Always available, OPTION_MSW, Offset 0x06) 188 */ 189 #define HP100_PRIORITY_TX 0x0080 /* 1:Do all Tx pkts as priority */ 190 #define HP100_EE_LOAD 0x0040 /* 1:EEPROM loading, 0 when done */ 191 #define HP100_ADV_NXT_PKT 0x0004 /* 1:Advance to next pkt in Rx queue */ 192 /* h/w will set to 0 when done */ 193 #define HP100_TX_CMD 0x0002 /* 1:Tell h/w download done, h/w */ 194 /* will set to 0 when done */ 195 196 /* 197 * Interrupt Status Registers I and II 198 * (Page PERFORMANCE, IRQ_STATUS, Offset 0x08-0x09) 199 * Note: With old chips, these Registers will clear when 1 is written to them 200 * with new chips this depends on setting of CLR_ISMODE 201 */ 202 #define HP100_RX_EARLY_INT 0x2000 203 #define HP100_RX_PDA_ZERO 0x1000 204 #define HP100_RX_PDL_FILL_COMPL 0x0800 205 #define HP100_RX_PACKET 0x0400 /* 0:No, 1:Yes pkt has been Rx */ 206 #define HP100_RX_ERROR 0x0200 /* 0:No, 1:Yes Rx pkt had error */ 207 #define HP100_TX_PDA_ZERO 0x0020 /* 1 when PDA count goes to zero */ 208 #define HP100_TX_SPACE_AVAIL 0x0010 /* 0:<8192, 1:>=8192 Tx free bytes */ 209 #define HP100_TX_COMPLETE 0x0008 /* 0:No, 1:Yes a Tx has completed */ 210 #define HP100_MISC_ERROR 0x0004 /* 0:No, 1:Lan Link down or bus error */ 211 #define HP100_TX_ERROR 0x0002 /* 0:No, 1:Yes Tx pkt had error */ 212 213 /* 214 * Xmit Memory Free Count 215 * (Page PERFORMANCE, TX_MEM_FREE, Offset 0x14) (Read only, 32bit) 216 */ 217 #define HP100_AUTO_COMPARE 0x80000000 /* Tx Space avail & pkts<255 */ 218 #define HP100_FREE_SPACE 0x7fffffe0 /* Tx free memory */ 219 220 /* 221 * IRQ Channel 222 * (Page HW_MAP, IRQ_CHANNEL, Offset 0x0d) 223 */ 224 #define HP100_ZERO_WAIT_EN 0x80 /* 0:No, 1:Yes asserts NOWS signal */ 225 #define HP100_IRQ_SCRAMBLE 0x40 226 #define HP100_BOND_HP 0x20 227 #define HP100_LEVEL_IRQ 0x10 /* 0:Edge, 1:Level type interrupts. */ 228 /* (Only valid on EISA cards) */ 229 #define HP100_IRQMASK 0x0F /* Isolate the IRQ bits */ 230 231 /* 232 * SRAM Parameters 233 * (Page HW_MAP, SRAM, Offset 0x0e) 234 */ 235 #define HP100_RAM_SIZE_MASK 0xe0 /* AND to get SRAM size index */ 236 #define HP100_RAM_SIZE_SHIFT 0x05 /* Shift count(put index in lwr bits) */ 237 238 /* 239 * Bus Master Register 240 * (Page HW_MAP, BM, Offset 0x0f) 241 */ 242 #define HP100_BM_BURST_RD 0x01 /* EISA only: 1=Use burst trans. fm system */ 243 /* memory to chip (tx) */ 244 #define HP100_BM_BURST_WR 0x02 /* EISA only: 1=Use burst trans. fm system */ 245 /* memory to chip (rx) */ 246 #define HP100_BM_MASTER 0x04 /* 0:Slave, 1:BM mode */ 247 #define HP100_BM_PAGE_CK 0x08 /* This bit should be set whenever in */ 248 /* an EISA system */ 249 #define HP100_BM_PCI_8CLK 0x40 /* ... cycles 8 clocks apart */ 250 251 252 /* 253 * Mode Control Register I 254 * (Page HW_MAP, MODECTRL1, Offset0x10) 255 */ 256 #define HP100_TX_DUALQ 0x10 257 /* If set and BM -> dual tx pda queues */ 258 #define HP100_ISR_CLRMODE 0x02 /* If set ISR will clear all pending */ 259 /* interrupts on read (etr only?) */ 260 #define HP100_EE_NOLOAD 0x04 /* Status whether res will be loaded */ 261 /* from the eeprom */ 262 #define HP100_TX_CNT_FLG 0x08 /* Controls Early TX Reg Cnt Field */ 263 #define HP100_PDL_USE3 0x10 /* If set BM engine will read only */ 264 /* first three data elements of a PDL */ 265 /* on the first access. */ 266 #define HP100_BUSTYPE_MASK 0xe0 /* Three bit bus type info */ 267 268 /* 269 * Mode Control Register II 270 * (Page HW_MAP, MODECTRL2, Offset0x11) 271 */ 272 #define HP100_EE_MASK 0x0f /* Tell EEPROM circuit not to load */ 273 /* certain resources */ 274 #define HP100_DIS_CANCEL 0x20 /* For tx dualq mode operation */ 275 #define HP100_EN_PDL_WB 0x40 /* 1: Status of PDL completion may be */ 276 /* written back to system mem */ 277 #define HP100_EN_BUS_FAIL 0x80 /* Enables bus-fail portion of misc */ 278 /* interrupt */ 279 280 /* 281 * PCI Configuration and Control Register I 282 * (Page HW_MAP, PCICTRL1, Offset 0x12) 283 */ 284 #define HP100_LO_MEM 0x01 /* 1: Mapped Mem requested below 1MB */ 285 #define HP100_NO_MEM 0x02 /* 1: Disables Req for sysmem to PCI */ 286 /* bios */ 287 #define HP100_USE_ISA 0x04 /* 1: isa type decodes will occur */ 288 /* simultaneously with PCI decodes */ 289 #define HP100_IRQ_HI_MASK 0xf0 /* pgmed by pci bios */ 290 #define HP100_PCI_IRQ_HI_MASK 0x78 /* Isolate 4 bits for PCI IRQ */ 291 292 /* 293 * PCI Configuration and Control Register II 294 * (Page HW_MAP, PCICTRL2, Offset 0x13) 295 */ 296 #define HP100_RD_LINE_PDL 0x01 /* 1: PCI command Memory Read Line en */ 297 #define HP100_RD_TX_DATA_MASK 0x06 /* choose PCI memread cmds for TX */ 298 #define HP100_MWI 0x08 /* 1: en. PCI memory write invalidate */ 299 #define HP100_ARB_MODE 0x10 /* Select PCI arbitor type */ 300 #define HP100_STOP_EN 0x20 /* Enables PCI state machine to issue */ 301 /* pci stop if cascade not ready */ 302 #define HP100_IGNORE_PAR 0x40 /* 1: PCI state machine ignores parity */ 303 #define HP100_PCI_RESET 0x80 /* 0->1: Reset PCI block */ 304 305 /* 306 * Early TX Configuration and Control Register 307 * (Page HW_MAP, EARLYTXCFG, Offset 0x16) 308 */ 309 #define HP100_EN_EARLY_TX 0x8000 /* 1=Enable Early TX */ 310 #define HP100_EN_ADAPTIVE 0x4000 /* 1=Enable adaptive mode */ 311 #define HP100_EN_TX_UR_IRQ 0x2000 /* reserved, must be 0 */ 312 #define HP100_EN_LOW_TX 0x1000 /* reserved, must be 0 */ 313 #define HP100_ET_CNT_MASK 0x0fff /* bits 11..0: ET counters */ 314 315 /* 316 * Early RX Configuration and Control Register 317 * (Page HW_MAP, EARLYRXCFG, Offset 0x18) 318 */ 319 #define HP100_EN_EARLY_RX 0x80 /* 1=Enable Early RX */ 320 #define HP100_EN_LOW_RX 0x40 /* reserved, must be 0 */ 321 #define HP100_RX_TRIP_MASK 0x1f /* bits 4..0: threshold at which the 322 * early rx circuit will start the 323 * dma of received packet into system 324 * memory for BM */ 325 326 /* 327 * Serial Devices Control Register 328 * (Page EEPROM_CTRL, EEPROM_CTRL, Offset 0x08) 329 */ 330 #define HP100_EEPROM_LOAD 0x0001 /* 0->1 loads EEPROM into registers. */ 331 /* When it goes back to 0, load is */ 332 /* complete. This should take ~600us. */ 333 334 /* 335 * 10MB LAN Control and Configuration Register I 336 * (Page MAC_CTRL, 10_LAN_CFG_1, Offset 0x08) 337 */ 338 #define HP100_MAC10_SEL 0xc0 /* Get bits to indicate MAC */ 339 #define HP100_AUI_SEL 0x20 /* Status of AUI selection */ 340 #define HP100_LOW_TH 0x10 /* 0:No, 1:Yes allow better cabling */ 341 #define HP100_LINK_BEAT_DIS 0x08 /* 0:Enable, 1:Disable link beat */ 342 #define HP100_LINK_BEAT_ST 0x04 /* 0:No, 1:Yes link beat being Rx */ 343 #define HP100_R_ROL_ST 0x02 /* 0:No, 1:Yes Rx twisted pair has */ 344 /* been reversed */ 345 #define HP100_AUI_ST 0x01 /* 0:No, 1:Yes use AUI on TP card */ 346 347 /* 348 * 10 MB LAN Control and Configuration Register II 349 * (Page MAC_CTRL, 10_LAN_CFG_2, Offset 0x09) 350 */ 351 #define HP100_SQU_ST 0x01 /* 0:No, 1:Yes collision signal sent */ 352 /* after Tx.Only used for AUI. */ 353 #define HP100_FULLDUP 0x02 /* 1: LXT901 XCVR fullduplx enabled */ 354 #define HP100_DOT3_MAC 0x04 /* 1: DOT 3 Mac sel. unless Autosel */ 355 356 /* 357 * MAC Selection, use with MAC10_SEL bits 358 */ 359 #define HP100_AUTO_SEL_10 0x0 /* Auto select */ 360 #define HP100_XCVR_LXT901_10 0x1 /* LXT901 10BaseT transceiver */ 361 #define HP100_XCVR_7213 0x2 /* 7213 transceiver */ 362 #define HP100_XCVR_82503 0x3 /* 82503 transceiver */ 363 364 /* 365 * 100MB LAN Training Register 366 * (Page MAC_CTRL, VG_LAN_CFG_2, Offset 0x0b) (old, pre 802.12) 367 */ 368 #define HP100_FRAME_FORMAT 0x08 /* 0:802.3, 1:802.5 frames */ 369 #define HP100_BRIDGE 0x04 /* 0:No, 1:Yes tell hub i am a bridge */ 370 #define HP100_PROM_MODE 0x02 /* 0:No, 1:Yes tell hub card is */ 371 /* promiscuous */ 372 #define HP100_REPEATER 0x01 /* 0:No, 1:Yes tell hub MAC wants to */ 373 /* be a cascaded repeater */ 374 375 /* 376 * 100MB LAN Control and Configuration Register 377 * (Page MAC_CTRL, VG_LAN_CFG_1, Offset 0x0a) 378 */ 379 #define HP100_VG_SEL 0x80 /* 0:No, 1:Yes use 100 Mbit MAC */ 380 #define HP100_LINK_UP_ST 0x40 /* 0:No, 1:Yes endnode logged in */ 381 #define HP100_LINK_CABLE_ST 0x20 /* 0:No, 1:Yes cable can hear tones */ 382 /* from hub */ 383 #define HP100_LOAD_ADDR 0x10 /* 0->1 card addr will be sent */ 384 /* 100ms later the link status */ 385 /* bits are valid */ 386 #define HP100_LINK_CMD 0x08 /* 0->1 link will attempt to log in. */ 387 /* 100ms later the link status */ 388 /* bits are valid */ 389 #define HP100_TRN_DONE 0x04 /* NEW ETR-Chips only: Will be reset */ 390 /* after LinkUp Cmd is given and set */ 391 /* when training has completed. */ 392 #define HP100_LINK_GOOD_ST 0x02 /* 0:No, 1:Yes cable passed training */ 393 #define HP100_VG_RESET 0x01 /* 0:Yes, 1:No reset the 100VG MAC */ 394 395 396 /* 397 * MAC Configuration Register I 398 * (Page MAC_CTRL, MAC_CFG_1, Offset 0x0c) 399 */ 400 #define HP100_RX_IDLE 0x80 /* 0:Yes, 1:No currently receiving pkts */ 401 #define HP100_TX_IDLE 0x40 /* 0:Yes, 1:No currently Txing pkts */ 402 #define HP100_RX_EN 0x20 /* 1: allow receiving of pkts */ 403 #define HP100_TX_EN 0x10 /* 1: allow transmitting of pkts */ 404 #define HP100_ACC_ERRORED 0x08 /* 0:No, 1:Yes allow Rx of errored pkts */ 405 #define HP100_ACC_MC 0x04 /* 0:No, 1:Yes allow Rx of multicast pkts */ 406 #define HP100_ACC_BC 0x02 /* 0:No, 1:Yes allow Rx of broadcast pkts */ 407 #define HP100_ACC_PHY 0x01 /* 0:No, 1:Yes allow Rx of ALL phys. pkts */ 408 #define HP100_MAC1MODEMASK 0xf0 /* Hide ACC bits */ 409 #define HP100_MAC1MODE1 0x00 /* Receive nothing, must also disable RX */ 410 #define HP100_MAC1MODE2 0x00 411 #define HP100_MAC1MODE3 HP100_MAC1MODE2 | HP100_ACC_BC 412 #define HP100_MAC1MODE4 HP100_MAC1MODE3 | HP100_ACC_MC 413 #define HP100_MAC1MODE5 HP100_MAC1MODE4 /* set mc hash to all ones also */ 414 #define HP100_MAC1MODE6 HP100_MAC1MODE5 | HP100_ACC_PHY /* Promiscuous */ 415 /* Note MODE6 will receive all GOOD packets on the LAN. This really needs 416 a mode 7 defined to be LAN Analyzer mode, which will receive errored and 417 runt packets, and keep the CRC bytes. */ 418 #define HP100_MAC1MODE7 HP100_MAC1MODE6 | HP100_ACC_ERRORED 419 420 /* 421 * MAC Configuration Register II 422 * (Page MAC_CTRL, MAC_CFG_2, Offset 0x0d) 423 */ 424 #define HP100_TR_MODE 0x80 /* 0:No, 1:Yes support Token Ring formats */ 425 #define HP100_TX_SAME 0x40 /* 0:No, 1:Yes Tx same packet continuous */ 426 #define HP100_LBK_XCVR 0x20 /* 0:No, 1:Yes loopback through MAC & */ 427 /* transceiver */ 428 #define HP100_LBK_MAC 0x10 /* 0:No, 1:Yes loopback through MAC */ 429 #define HP100_CRC_I 0x08 /* 0:No, 1:Yes inhibit CRC on Tx packets */ 430 #define HP100_ACCNA 0x04 /* 1: For 802.5: Accept only token ring 431 * group addr that maches NA mask */ 432 #define HP100_KEEP_CRC 0x02 /* 0:No, 1:Yes keep CRC on Rx packets. */ 433 /* The length will reflect this. */ 434 #define HP100_ACCFA 0x01 /* 1: For 802.5: Accept only functional 435 * addrs that match FA mask (page1) */ 436 #define HP100_MAC2MODEMASK 0x02 437 #define HP100_MAC2MODE1 0x00 438 #define HP100_MAC2MODE2 0x00 439 #define HP100_MAC2MODE3 0x00 440 #define HP100_MAC2MODE4 0x00 441 #define HP100_MAC2MODE5 0x00 442 #define HP100_MAC2MODE6 0x00 443 #define HP100_MAC2MODE7 KEEP_CRC 444 445 /* 446 * MAC Configuration Register III 447 * (Page MAC_CTRL, MAC_CFG_3, Offset 0x0e) 448 */ 449 #define HP100_PACKET_PACE 0x03 /* Packet Pacing: 450 * 00: No packet pacing 451 * 01: 8 to 16 uS delay 452 * 10: 16 to 32 uS delay 453 * 11: 32 to 64 uS delay 454 */ 455 #define HP100_LRF_EN 0x04 /* 1: External LAN Rcv Filter and 456 * TCP/IP Checksumming enabled. */ 457 #define HP100_AUTO_MODE 0x10 /* 1: AutoSelect between 10/100 */ 458 459 /* 460 * MAC Configuration Register IV 461 * (Page MAC_CTRL, MAC_CFG_4, Offset 0x0f) 462 */ 463 #define HP100_MAC_SEL_ST 0x01 /* (R): Status of external VGSEL 464 * Signal, 1=100VG, 0=10Mbit sel. */ 465 #define HP100_LINK_FAIL_ST 0x02 /* (R): Status of Link Fail portion 466 * of the Misc. Interrupt */ 467 468 /* 469 * 100 MB LAN Training Request/Allowed Registers 470 * (Page MAC_CTRL, TRAIN_REQUEST and TRAIN_ALLOW, Offset 0x14-0x16)(ETR parts only) 471 */ 472 #define HP100_MACRQ_REPEATER 0x0001 /* 1: MAC tells HUB it wants to be 473 * a cascaded repeater 474 * 0: ... wants to be a DTE */ 475 #define HP100_MACRQ_PROMSC 0x0006 /* 2 bits: Promiscious mode 476 * 00: Rcv only unicast packets 477 * specifically addr to this 478 * endnode 479 * 10: Rcv all pckts fwded by 480 * the local repeater */ 481 #define HP100_MACRQ_FRAMEFMT_EITHER 0x0018 /* 11: either format allowed */ 482 #define HP100_MACRQ_FRAMEFMT_802_3 0x0000 /* 00: 802.3 is requested */ 483 #define HP100_MACRQ_FRAMEFMT_802_5 0x0010 /* 10: 802.5 format is requested */ 484 #define HP100_CARD_MACVER 0xe000 /* R: 3 bit Cards 100VG MAC version */ 485 #define HP100_MALLOW_REPEATER 0x0001 /* If reset, requested access as an 486 * end node is allowed */ 487 #define HP100_MALLOW_PROMSC 0x0004 /* 2 bits: Promiscious mode 488 * 00: Rcv only unicast packets 489 * specifically addr to this 490 * endnode 491 * 10: Rcv all pckts fwded by 492 * the local repeater */ 493 #define HP100_MALLOW_FRAMEFMT 0x00e0 /* 2 bits: Frame Format 494 * 00: 802.3 format will be used 495 * 10: 802.5 format will be used */ 496 #define HP100_MALLOW_ACCDENIED 0x0400 /* N bit */ 497 #define HP100_MALLOW_CONFIGURE 0x0f00 /* C bit */ 498 #define HP100_MALLOW_DUPADDR 0x1000 /* D bit */ 499 #define HP100_HUB_MACVER 0xe000 /* R: 3 bit 802.12 MAC/RMAC training */ 500 /* protocol of repeater */ 501 502 /* ****************************************************************************** */ 503 504 /* 505 * Set/Reset bits 506 */ 507 #define HP100_SET_HB 0x0100 /* 0:Set fields to 0 whose mask is 1 */ 508 #define HP100_SET_LB 0x0001 /* HB sets upper byte, LB sets lower byte */ 509 #define HP100_RESET_HB 0x0000 /* For readability when resetting bits */ 510 #define HP100_RESET_LB 0x0000 /* For readability when resetting bits */ 511 512 /* 513 * Misc. Constants 514 */ 515 #define HP100_LAN_100 100 /* lan_type value for VG */ 516 #define HP100_LAN_10 10 /* lan_type value for 10BaseT */ 517 #define HP100_LAN_COAX 9 /* lan_type value for Coax */ 518 #define HP100_LAN_ERR (-1) /* lan_type value for link down */ 519 520 /* 521 * Bus Master Data Structures ---------------------------------------------- 522 */ 523 524 #define MAX_RX_PDL 30 /* Card limit = 31 */ 525 #define MAX_RX_FRAG 2 /* Don't need more... */ 526 #define MAX_TX_PDL 29 527 #define MAX_TX_FRAG 2 /* Limit = 31 */ 528 529 /* Define total PDL area size in bytes (should be 4096) */ 530 /* This is the size of kernel (dma) memory that will be allocated. */ 531 #define MAX_RINGSIZE ((MAX_RX_FRAG*8+4+4)*MAX_RX_PDL+(MAX_TX_FRAG*8+4+4)*MAX_TX_PDL)+16 532 533 /* Ethernet Packet Sizes */ 534 #define MIN_ETHER_SIZE 60 535 #define MAX_ETHER_SIZE 1514 /* Needed for preallocation of */ 536 /* skb buffer when busmastering */ 537 538 /* Tx or Rx Ring Entry */ 539 typedef struct hp100_ring { 540 u_int *pdl; /* Address of PDLs PDH, dword before 541 * this address is used for rx hdr */ 542 u_int pdl_paddr; /* Physical address of PDL */ 543 struct sk_buff *skb; 544 struct hp100_ring *next; 545 } hp100_ring_t; 546 547 548 549 /* Mask for Header Descriptor */ 550 #define HP100_PKT_LEN_MASK 0x1FFF /* AND with RxLength to get length */ 551 552 553 /* Receive Packet Status. Note, the error bits are only valid if ACC_ERRORED 554 bit in the MAC Configuration Register 1 is set. */ 555 #define HP100_RX_PRI 0x8000 /* 0:No, 1:Yes packet is priority */ 556 #define HP100_SDF_ERR 0x4000 /* 0:No, 1:Yes start of frame error */ 557 #define HP100_SKEW_ERR 0x2000 /* 0:No, 1:Yes skew out of range */ 558 #define HP100_BAD_SYMBOL_ERR 0x1000 /* 0:No, 1:Yes invalid symbol received */ 559 #define HP100_RCV_IPM_ERR 0x0800 /* 0:No, 1:Yes pkt had an invalid packet */ 560 /* marker */ 561 #define HP100_SYMBOL_BAL_ERR 0x0400 /* 0:No, 1:Yes symbol balance error */ 562 #define HP100_VG_ALN_ERR 0x0200 /* 0:No, 1:Yes non-octet received */ 563 #define HP100_TRUNC_ERR 0x0100 /* 0:No, 1:Yes the packet was truncated */ 564 #define HP100_RUNT_ERR 0x0040 /* 0:No, 1:Yes pkt length < Min Pkt */ 565 /* Length Reg. */ 566 #define HP100_ALN_ERR 0x0010 /* 0:No, 1:Yes align error. */ 567 #define HP100_CRC_ERR 0x0008 /* 0:No, 1:Yes CRC occurred. */ 568 569 /* The last three bits indicate the type of destination address */ 570 571 #define HP100_MULTI_ADDR_HASH 0x0006 /* 110: Addr multicast, matched hash */ 572 #define HP100_BROADCAST_ADDR 0x0003 /* x11: Addr broadcast */ 573 #define HP100_MULTI_ADDR_NO_HASH 0x0002 /* 010: Addr multicast, didn't match hash */ 574 #define HP100_PHYS_ADDR_MATCH 0x0001 /* x01: Addr was physical and mine */ 575 #define HP100_PHYS_ADDR_NO_MATCH 0x0000 /* x00: Addr was physical but not mine */ 576 577 /* 578 * macros 579 */ 580 581 #define hp100_inb( reg ) \ 582 inb( ioaddr + HP100_REG_##reg ) 583 #define hp100_inw( reg ) \ 584 inw( ioaddr + HP100_REG_##reg ) 585 #define hp100_inl( reg ) \ 586 inl( ioaddr + HP100_REG_##reg ) 587 #define hp100_outb( data, reg ) \ 588 outb( data, ioaddr + HP100_REG_##reg ) 589 #define hp100_outw( data, reg ) \ 590 outw( data, ioaddr + HP100_REG_##reg ) 591 #define hp100_outl( data, reg ) \ 592 outl( data, ioaddr + HP100_REG_##reg ) 593 #define hp100_orb( data, reg ) \ 594 outb( inb( ioaddr + HP100_REG_##reg ) | (data), ioaddr + HP100_REG_##reg ) 595 #define hp100_orw( data, reg ) \ 596 outw( inw( ioaddr + HP100_REG_##reg ) | (data), ioaddr + HP100_REG_##reg ) 597 #define hp100_andb( data, reg ) \ 598 outb( inb( ioaddr + HP100_REG_##reg ) & (data), ioaddr + HP100_REG_##reg ) 599 #define hp100_andw( data, reg ) \ 600 outw( inw( ioaddr + HP100_REG_##reg ) & (data), ioaddr + HP100_REG_##reg ) 601 602 #define hp100_page( page ) \ 603 outw( HP100_PAGE_##page, ioaddr + HP100_REG_PAGING ) 604 #define hp100_ints_off() \ 605 outw( HP100_INT_EN | HP100_RESET_LB, ioaddr + HP100_REG_OPTION_LSW ) 606 #define hp100_ints_on() \ 607 outw( HP100_INT_EN | HP100_SET_LB, ioaddr + HP100_REG_OPTION_LSW ) 608 #define hp100_mem_map_enable() \ 609 outw( HP100_MMAP_DIS | HP100_RESET_HB, ioaddr + HP100_REG_OPTION_LSW ) 610 #define hp100_mem_map_disable() \ 611 outw( HP100_MMAP_DIS | HP100_SET_HB, ioaddr + HP100_REG_OPTION_LSW )