1744Sgs150176 /* 2744Sgs150176 * CDDL HEADER START 3744Sgs150176 * 4744Sgs150176 * The contents of this file are subject to the terms of the 52544Sgs150176 * Common Development and Distribution License (the "License"). 62544Sgs150176 * You may not use this file except in compliance with the License. 7744Sgs150176 * 8744Sgs150176 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9744Sgs150176 * or http://www.opensolaris.org/os/licensing. 10744Sgs150176 * See the License for the specific language governing permissions 11744Sgs150176 * and limitations under the License. 12744Sgs150176 * 13744Sgs150176 * When distributing Covered Code, include this CDDL HEADER in each 14744Sgs150176 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15744Sgs150176 * If applicable, add the following below this CDDL HEADER, with the 16744Sgs150176 * fields enclosed by brackets "[]" replaced with your own identifying 17744Sgs150176 * information: Portions Copyright [yyyy] [name of copyright owner] 18744Sgs150176 * 19744Sgs150176 * CDDL HEADER END 20744Sgs150176 */ 21744Sgs150176 /* 229860Sgdamore@opensolaris.org * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 23744Sgs150176 * Use is subject to license terms. 24744Sgs150176 */ 25744Sgs150176 26744Sgs150176 #ifndef _RGE_HW_H 27744Sgs150176 #define _RGE_HW_H 28744Sgs150176 29744Sgs150176 #ifdef __cplusplus 30744Sgs150176 extern "C" { 31744Sgs150176 #endif 32744Sgs150176 33744Sgs150176 #include <sys/types.h> 34744Sgs150176 35744Sgs150176 36744Sgs150176 /* 37744Sgs150176 * First section: 38744Sgs150176 * Identification of the various Realtek GigE chips 39744Sgs150176 */ 40744Sgs150176 41744Sgs150176 /* 42744Sgs150176 * Driver support device 43744Sgs150176 */ 44744Sgs150176 #define VENDOR_ID_REALTECK 0x10EC 454533Sgs150176 #define DEVICE_ID_8169 0x8169 /* PCI */ 464533Sgs150176 #define DEVICE_ID_8110 0x8169 /* PCI */ 474533Sgs150176 #define DEVICE_ID_8168 0x8168 /* PCI-E */ 484533Sgs150176 #define DEVICE_ID_8111 0x8168 /* PCI-E */ 494533Sgs150176 #define DEVICE_ID_8169SC 0x8167 /* PCI */ 504533Sgs150176 #define DEVICE_ID_8110SC 0x8167 /* PCI */ 515735Smx205022 #define DEVICE_ID_8101E 0x8136 /* 10/100M PCI-E */ 52744Sgs150176 53744Sgs150176 #define RGE_REGISTER_MAX 0x0100 54744Sgs150176 55744Sgs150176 56744Sgs150176 /* 57744Sgs150176 * Second section: 58744Sgs150176 * Offsets of important registers & definitions for bits therein 59744Sgs150176 */ 60744Sgs150176 /* 61744Sgs150176 * MAC address register, initial value is autoloaded from the 62744Sgs150176 * EEPROM EthernetID field 63744Sgs150176 */ 64744Sgs150176 #define ID_0_REG 0x0000 65744Sgs150176 #define ID_1_REG 0x0001 66744Sgs150176 #define ID_2_REG 0x0002 67744Sgs150176 #define ID_3_REG 0x0003 68744Sgs150176 #define ID_4_REG 0x0004 69744Sgs150176 #define ID_5_REG 0x0005 70744Sgs150176 71744Sgs150176 /* 72744Sgs150176 * Multicast register 73744Sgs150176 */ 74744Sgs150176 #define MULTICAST_0_REG 0x0008 75744Sgs150176 #define MULTICAST_1_REG 0x0009 76744Sgs150176 #define MULTICAST_2_REG 0x000a 77744Sgs150176 #define MULTICAST_3_REG 0x000b 78744Sgs150176 #define MULTICAST_4_REG 0x000c 79744Sgs150176 #define MULTICAST_5_REG 0x000d 80744Sgs150176 #define MULTICAST_6_REG 0x000e 81744Sgs150176 #define MULTICAST_7_REG 0x000f 822544Sgs150176 #define RGE_MCAST_NUM 8 /* total 8 registers: MAR0 - MAR7 */ 83744Sgs150176 84744Sgs150176 /* 85744Sgs150176 * Dump Tally Counter Command register 86744Sgs150176 */ 87744Sgs150176 #define DUMP_COUNTER_REG_0 0x0010 88744Sgs150176 #define DUMP_COUNTER_REG_RESV 0x00000037 89744Sgs150176 #define DUMP_START 0x00000008 90744Sgs150176 #define DUMP_COUNTER_REG_1 0x0014 91744Sgs150176 92744Sgs150176 /* 93744Sgs150176 * Register for start address of transmit descriptors 94744Sgs150176 */ 95744Sgs150176 #define NORMAL_TX_RING_ADDR_LO_REG 0x0020 96744Sgs150176 #define NORMAL_TX_RING_ADDR_HI_REG 0x0024 97744Sgs150176 #define HIGH_TX_RING_ADDR_LO_REG 0x0028 98744Sgs150176 #define HIGH_TX_RING_ADDR_HI_REG 0x002c 99744Sgs150176 100744Sgs150176 /* 101744Sgs150176 * Commond register 102744Sgs150176 */ 103744Sgs150176 #define RT_COMMAND_REG 0x0037 104744Sgs150176 #define RT_COMMAND_RESV 0xe3 105744Sgs150176 #define RT_COMMAND_RESET 0x10 106744Sgs150176 #define RT_COMMAND_RX_ENABLE 0x08 107744Sgs150176 #define RT_COMMAND_TX_ENABLE 0x04 108744Sgs150176 109744Sgs150176 /* 110744Sgs150176 * Transmit priority polling register 111744Sgs150176 */ 112744Sgs150176 #define TX_RINGS_POLL_REG 0x0038 113744Sgs150176 #define HIGH_TX_RING_POLL 0x80 114744Sgs150176 #define NORMAL_TX_RING_POLL 0x40 115744Sgs150176 #define FORCE_SW_INT 0x01 116744Sgs150176 117744Sgs150176 /* 118744Sgs150176 * Interrupt mask & status register 119744Sgs150176 */ 120744Sgs150176 #define INT_MASK_REG 0x003c 121744Sgs150176 #define INT_STATUS_REG 0x003e 122744Sgs150176 #define SYS_ERR_INT 0x8000 123744Sgs150176 #define TIME_OUT_INT 0x4000 124744Sgs150176 #define SW_INT 0x0100 125744Sgs150176 #define NO_TXDESC_INT 0x0080 126744Sgs150176 #define RX_FIFO_OVERFLOW_INT 0x0040 127744Sgs150176 #define LINK_CHANGE_INT 0x0020 128744Sgs150176 #define NO_RXDESC_INT 0x0010 129744Sgs150176 #define TX_ERR_INT 0x0008 130744Sgs150176 #define TX_OK_INT 0x0004 131744Sgs150176 #define RX_ERR_INT 0x0002 132744Sgs150176 #define RX_OK_INT 0x0001 133744Sgs150176 134744Sgs150176 #define INT_REG_RESV 0x3e00 135744Sgs150176 #define INT_MASK_ALL 0xffff 136744Sgs150176 #define INT_MASK_NONE 0x0000 137744Sgs150176 #define RGE_RX_INT (RX_OK_INT | RX_ERR_INT | \ 1382544Sgs150176 NO_RXDESC_INT) 13911365SZhen.W@Sun.COM #define RGE_INT_MASK (TX_OK_INT | TX_ERR_INT | \ 14011365SZhen.W@Sun.COM RGE_RX_INT | LINK_CHANGE_INT | \ 141*11410SLi-Zhen.You@Sun.COM TIME_OUT_INT | SYS_ERR_INT) 142744Sgs150176 143744Sgs150176 /* 144744Sgs150176 * Transmit configuration register 145744Sgs150176 */ 146744Sgs150176 #define TX_CONFIG_REG 0x0040 147744Sgs150176 #define TX_CONFIG_REG_RESV 0x8070f8ff 148744Sgs150176 #define HW_VERSION_ID_0 0x7c000000 149744Sgs150176 #define INTER_FRAME_GAP_BITS 0x03080000 150744Sgs150176 #define TX_INTERFRAME_GAP_802_3 0x03000000 151744Sgs150176 #define HW_VERSION_ID_1 0x00800000 152744Sgs150176 #define MAC_LOOPBACK_ENABLE 0x00060000 153744Sgs150176 #define CRC_APPEND_ENABLE 0x00010000 154744Sgs150176 #define TX_DMA_BURST_BITS 0x00000700 155744Sgs150176 156744Sgs150176 #define TX_DMA_BURST_UNLIMIT 0x00000700 157744Sgs150176 #define TX_DMA_BURST_1024B 0x00000600 158744Sgs150176 #define TX_DMA_BURST_512B 0x00000500 159744Sgs150176 #define TX_DMA_BURST_256B 0x00000400 160744Sgs150176 #define TX_DMA_BURST_128B 0x00000300 161744Sgs150176 #define TX_DMA_BURST_64B 0x00000200 162744Sgs150176 #define TX_DMA_BURST_32B 0x00000100 163744Sgs150176 #define TX_DMA_BURST_16B 0x00000000 164744Sgs150176 1652544Sgs150176 #define MAC_VER_8169 0x00000000 1662544Sgs150176 #define MAC_VER_8169S_D 0x00800000 1672544Sgs150176 #define MAC_VER_8169S_E 0x04000000 1682544Sgs150176 #define MAC_VER_8169SB 0x10000000 1694533Sgs150176 #define MAC_VER_8169SC 0x18000000 1702544Sgs150176 #define MAC_VER_8168 0x20000000 1712544Sgs150176 #define MAC_VER_8168B_B 0x30000000 1722544Sgs150176 #define MAC_VER_8168B_C 0x38000000 17310814SKHF04453@nifty.ne.jp #define MAC_VER_8168C 0x3c000000 1745735Smx205022 #define MAC_VER_8101E 0x34000000 1757516SYong.Tan@Sun.COM #define MAC_VER_8101E_B 0x24800000 1767516SYong.Tan@Sun.COM #define MAC_VER_8101E_C 0x34800000 177744Sgs150176 178744Sgs150176 #define TX_CONFIG_DEFAULT (TX_INTERFRAME_GAP_802_3 | \ 179744Sgs150176 TX_DMA_BURST_1024B) 180744Sgs150176 /* 181744Sgs150176 * Receive configuration register 182744Sgs150176 */ 183744Sgs150176 #define RX_CONFIG_REG 0x0044 184744Sgs150176 #define RX_CONFIG_REG_RESV 0xfffe1880 185744Sgs150176 #define RX_RER8_ENABLE 0x00010000 186744Sgs150176 #define RX_FIFO_THRESHOLD_BITS 0x0000e000 187744Sgs150176 #define RX_FIFO_THRESHOLD_NONE 0x0000e000 188744Sgs150176 #define RX_FIFO_THRESHOLD_1024B 0x0000c000 189744Sgs150176 #define RX_FIFO_THRESHOLD_512B 0x0000a000 190744Sgs150176 #define RX_FIFO_THRESHOLD_256B 0x00008000 191744Sgs150176 #define RX_FIFO_THRESHOLD_128B 0x00006000 192744Sgs150176 #define RX_FIFO_THRESHOLD_64B 0x00004000 193744Sgs150176 #define RX_DMA_BURST_BITS 0x00000700 194744Sgs150176 #define RX_DMA_BURST_UNLIMITED 0x00000700 195744Sgs150176 #define RX_DMA_BURST_1024B 0x00000600 196744Sgs150176 #define RX_DMA_BURST_512B 0x00000500 197744Sgs150176 #define RX_DMA_BURST_256B 0x00000400 198744Sgs150176 #define RX_DMA_BURST_128B 0x00000300 199744Sgs150176 #define RX_DMA_BURST_64B 0x00000200 200744Sgs150176 #define RX_EEPROM_9356 0x00000040 201744Sgs150176 #define RX_ACCEPT_ERR_PKT 0x00000020 202744Sgs150176 #define RX_ACCEPT_RUNT_PKT 0x00000010 203744Sgs150176 #define RX_ACCEPT_BROADCAST_PKT 0x000000008 204744Sgs150176 #define RX_ACCEPT_MULTICAST_PKT 0x000000004 205744Sgs150176 #define RX_ACCEPT_MAC_MATCH_PKT 0x000000002 206744Sgs150176 #define RX_ACCEPT_ALL_PKT 0x000000001 207744Sgs150176 208744Sgs150176 #define RX_CONFIG_DEFAULT (RX_FIFO_THRESHOLD_NONE | \ 209744Sgs150176 RX_DMA_BURST_1024B | \ 210744Sgs150176 RX_ACCEPT_BROADCAST_PKT | \ 211744Sgs150176 RX_ACCEPT_MULTICAST_PKT | \ 212744Sgs150176 RX_ACCEPT_MAC_MATCH_PKT) 213744Sgs150176 214744Sgs150176 /* 215744Sgs150176 * Timer count register 216744Sgs150176 */ 217744Sgs150176 #define TIMER_COUNT_REG 0x0048 21811365SZhen.W@Sun.COM #define TIMER_CLK_PCIE (125*1000*1000) 21911365SZhen.W@Sun.COM #define TIMER_CLK_PCI (33*1000*1000) 220744Sgs150176 221744Sgs150176 /* 222744Sgs150176 * Missed packet counter: indicates the number of packets 223744Sgs150176 * discarded due to Rx FIFO overflow 224744Sgs150176 */ 225744Sgs150176 #define RX_PKT_MISS_COUNT_REG 0x004c 226744Sgs150176 227744Sgs150176 /* 228744Sgs150176 * 93c46(93c56) commond register: 229744Sgs150176 */ 230744Sgs150176 #define RT_93c46_COMMOND_REG 0x0050 231744Sgs150176 #define RT_93c46_MODE_BITS 0xc0 232744Sgs150176 #define RT_93c46_MODE_NORMAL 0x00 233744Sgs150176 #define RT_93c46_MODE_AUTOLOAD 0x40 234744Sgs150176 #define RT_93c46_MODE_PROGRAM 0x80 235744Sgs150176 #define RT_93c46_MODE_CONFIG 0xc0 236744Sgs150176 237744Sgs150176 #define RT_93c46_EECS 0x08 238744Sgs150176 #define RT_93c46_EESK 0x04 239744Sgs150176 #define RT_93c46_EEDI 0x02 240744Sgs150176 #define RT_93c46_EEDO 0x01 241744Sgs150176 242744Sgs150176 /* 243744Sgs150176 * Configuration registers 244744Sgs150176 */ 245744Sgs150176 #define RT_CONFIG_0_REG 0x0051 246744Sgs150176 #define RT_CONFIG_1_REG 0x0052 247744Sgs150176 #define RT_CONFIG_2_REG 0x0053 248744Sgs150176 #define RT_CONFIG_3_REG 0x0054 249744Sgs150176 #define RT_CONFIG_4_REG 0x0055 250744Sgs150176 #define RT_CONFIG_5_REG 0x0056 251744Sgs150176 252744Sgs150176 /* 2537825SMin.Xu@Sun.COM * Config 5 Register Bits 2547825SMin.Xu@Sun.COM */ 2557825SMin.Xu@Sun.COM #define RT_UNI_WAKE_FRAME 0x10 2567825SMin.Xu@Sun.COM #define RT_MUL_WAKE_FRAME 0x20 2577825SMin.Xu@Sun.COM #define RT_BRO_WAKE_FRAME 0x40 2587825SMin.Xu@Sun.COM 2597825SMin.Xu@Sun.COM /* 260744Sgs150176 * Timer interrupt register 261744Sgs150176 */ 262744Sgs150176 #define TIMER_INT_REG 0x0058 263744Sgs150176 #define TIMER_INT_NONE 0x00000000 264744Sgs150176 265744Sgs150176 /* 266744Sgs150176 * PHY access register 267744Sgs150176 */ 268744Sgs150176 #define PHY_ACCESS_REG 0x0060 269744Sgs150176 #define PHY_ACCESS_WR_FLAG 0x80000000 270744Sgs150176 #define PHY_ACCESS_REG_BITS 0x001f0000 271744Sgs150176 #define PHY_ACCESS_DATA_BITS 0x0000ffff 272744Sgs150176 #define PHY_DATA_MASK 0xffff 273744Sgs150176 #define PHY_REG_MASK 0x1f 274744Sgs150176 #define PHY_REG_SHIFT 16 275744Sgs150176 276744Sgs150176 /* 2772544Sgs150176 * CSI data register (for PCIE chipset) 2782544Sgs150176 */ 2792544Sgs150176 #define RT_CSI_DATA_REG 0x0064 2802544Sgs150176 2812544Sgs150176 /* 2822544Sgs150176 * CSI access register (for PCIE chipset) 2832544Sgs150176 */ 2842544Sgs150176 #define RT_CSI_ACCESS_REG 0x0068 2852544Sgs150176 2862544Sgs150176 /* 287744Sgs150176 * PHY status register 288744Sgs150176 */ 289744Sgs150176 #define PHY_STATUS_REG 0x006c 290744Sgs150176 #define PHY_STATUS_TBI 0x80 291744Sgs150176 #define PHY_STATUS_TX_FLOW 0x40 292744Sgs150176 #define PHY_STATUS_RX_FLOW 0x20 293744Sgs150176 #define PHY_STATUS_1000MF 0x10 294744Sgs150176 #define PHY_STATUS_100M 0x08 295744Sgs150176 #define PHY_STATUS_10M 0x04 296744Sgs150176 #define PHY_STATUS_LINK_UP 0x02 297744Sgs150176 #define PHY_STATUS_DUPLEX_FULL 0x01 298744Sgs150176 299744Sgs150176 #define RGE_SPEED_1000M 1000 300744Sgs150176 #define RGE_SPEED_100M 100 301744Sgs150176 #define RGE_SPEED_10M 10 302744Sgs150176 #define RGE_SPEED_UNKNOWN 0 303744Sgs150176 304744Sgs150176 /* 3052544Sgs150176 * EPHY access register (for PCIE chipset) 3062544Sgs150176 */ 3072544Sgs150176 #define EPHY_ACCESS_REG 0x0080 3082544Sgs150176 #define EPHY_ACCESS_WR_FLAG 0x80000000 3092544Sgs150176 #define EPHY_ACCESS_REG_BITS 0x001f0000 3102544Sgs150176 #define EPHY_ACCESS_DATA_BITS 0x0000ffff 3112544Sgs150176 #define EPHY_DATA_MASK 0xffff 3122544Sgs150176 #define EPHY_REG_MASK 0x1f 3132544Sgs150176 #define EPHY_REG_SHIFT 16 3142544Sgs150176 3152544Sgs150176 /* 316744Sgs150176 * Receive packet maximum size register 317744Sgs150176 * -- the maximum rx size supported is (16K - 1) bytes 318744Sgs150176 */ 319744Sgs150176 #define RX_MAX_PKTSIZE_REG 0x00da 320744Sgs150176 #define RX_PKTSIZE_JUMBO 0x1bfa /* 7K bytes */ 321744Sgs150176 #define RX_PKTSIZE_STD 0x05fa /* 1530 bytes */ 3225735Smx205022 #define RX_PKTSIZE_STD_8101E 0x3fff 323744Sgs150176 324744Sgs150176 /* 325744Sgs150176 * C+ command register 326744Sgs150176 */ 327744Sgs150176 #define CPLUS_COMMAND_REG 0x00e0 328744Sgs150176 #define CPLUS_RESERVE 0xfd87 329744Sgs150176 #define CPLUS_BIT14 0x4000 330744Sgs150176 #define CPLUS_BIG_ENDIAN 0x0400 331744Sgs150176 #define RX_VLAN_DETAG 0x0040 332744Sgs150176 #define RX_CKSM_OFFLOAD 0x0020 333744Sgs150176 #define DUAL_PCI_CYCLE 0x0010 334744Sgs150176 #define MUL_PCI_RW_ENABLE 0x0008 335744Sgs150176 336744Sgs150176 /* 337744Sgs150176 * Receive descriptor start address 338744Sgs150176 */ 339744Sgs150176 #define RX_RING_ADDR_LO_REG 0x00e4 340744Sgs150176 #define RX_RING_ADDR_HI_REG 0x00e8 341744Sgs150176 342744Sgs150176 /* 343744Sgs150176 * Max transmit packet size register 344744Sgs150176 */ 345744Sgs150176 #define TX_MAX_PKTSIZE_REG 0x00ec 346744Sgs150176 #define TX_MAX_PKTSIZE_REG_RESV 0xc0 347744Sgs150176 #define TX_PKTSIZE_JUMBO 0x3b /* Realtek suggested value */ 348744Sgs150176 #define TX_PKTSIZE_STD 0x32 /* document suggested value */ 3495735Smx205022 #define TX_PKTSIZE_STD_8101E 0x3f 350744Sgs150176 351744Sgs150176 #define RESV_82_REG 0x0082 352744Sgs150176 #define RESV_E2_REG 0x00e2 353744Sgs150176 354744Sgs150176 /* 355744Sgs150176 * PHY registers 356744Sgs150176 */ 357744Sgs150176 /* 358744Sgs150176 * Basic mode control register 359744Sgs150176 */ 360744Sgs150176 #define PHY_BMCR_REG 0x00 361744Sgs150176 #define PHY_RESET 0x8000 362744Sgs150176 #define PHY_LOOPBACK 0x4000 363744Sgs150176 #define PHY_SPEED_0 0x2000 364744Sgs150176 #define PHY_SPEED_1 0x0040 365744Sgs150176 #define PHY_SPEED_BITS (PHY_SPEED_0 | PHY_SPEED_1) 366744Sgs150176 #define PHY_SPEED_1000M PHY_SPEED_1 367744Sgs150176 #define PHY_SPEED_100M PHY_SPEED_0 368744Sgs150176 #define PHY_SPEED_10M 0x0000 369744Sgs150176 #define PHY_SPEED_RES (PHY_SPEED_0 | PHY_SPEED_1) 370744Sgs150176 #define PHY_AUTO_NEGO 0x1000 371744Sgs150176 #define PHY_RESTART_ANTO_NEGO 0x0200 372744Sgs150176 #define PHY_DUPLEX_FULL 0x0100 373744Sgs150176 #define PHY_BMCR_CLEAR 0xff40 374744Sgs150176 375744Sgs150176 /* 376744Sgs150176 * Basic mode status register 377744Sgs150176 */ 378744Sgs150176 #define PHY_BMSR_REG 0x01 379744Sgs150176 #define PHY_100BASE_T4 0x8000 380744Sgs150176 #define PHY_100BASE_TX_FULL 0x4000 381744Sgs150176 #define PHY_100BASE_TX_HALF 0x2000 382744Sgs150176 #define PHY_10BASE_T_FULL 0x1000 383744Sgs150176 #define PHY_10BASE_T_HALF 0x0800 384744Sgs150176 #define PHY_100BASE_T2_FULL 0x0400 385744Sgs150176 #define PHY_100BASE_T2_HALF 0x0200 386744Sgs150176 #define PHY_1000BASE_T_EXT 0x0100 387744Sgs150176 #define PHY_AUTO_NEGO_END 0x0020 388744Sgs150176 #define PHY_REMOTE_FAULT 0x0010 389744Sgs150176 #define PHY_AUTO_NEGO_ABLE 0x0008 390744Sgs150176 #define PHY_LINK_UP 0x0004 391744Sgs150176 #define PHY_JABBER_DETECT 0x0002 392744Sgs150176 #define PHY_EXT_ABLE 0x0001 393744Sgs150176 394744Sgs150176 /* 395744Sgs150176 * PHY identifier register 396744Sgs150176 */ 397744Sgs150176 #define PHY_ID_REG_1 0x02 398744Sgs150176 #define PHY_ID_REG_2 0x03 399744Sgs150176 #define PHY_VER_MASK 0x000f 400744Sgs150176 #define PHY_VER_S 0x0000 401744Sgs150176 #define PHY_VER_SB 0x0010 402744Sgs150176 403744Sgs150176 /* 404744Sgs150176 * Auto-negotiation advertising register 405744Sgs150176 */ 406744Sgs150176 #define PHY_ANAR_REG 0x04 407744Sgs150176 #define ANAR_NEXT_PAGE 0x8000 408744Sgs150176 #define ANAR_REMOTE_FAULT 0x2000 409744Sgs150176 #define ANAR_ASY_PAUSE 0x0800 410744Sgs150176 #define ANAR_PAUSE 0x0400 411744Sgs150176 #define ANAR_100BASE_T4 0x0200 412744Sgs150176 #define ANAR_100BASE_TX_FULL 0x0100 413744Sgs150176 #define ANAR_100BASE_TX_HALF 0x0080 414744Sgs150176 #define ANAR_10BASE_T_FULL 0x0040 415744Sgs150176 #define ANAR_10BASE_T_HALF 0x0020 416744Sgs150176 #define ANAR_RESV_BITS 0x501f 417744Sgs150176 418744Sgs150176 /* 419744Sgs150176 * Auto-negotiation link partner ability register 420744Sgs150176 */ 421744Sgs150176 #define PHY_ANLPAR_REG 0x05 422744Sgs150176 423744Sgs150176 /* 424744Sgs150176 * Auto-negotiation expansion register 425744Sgs150176 */ 426744Sgs150176 #define PHY_ANER_REG 0x06 427744Sgs150176 428744Sgs150176 /* 429744Sgs150176 * Auto-negotiation next page transmit register 430744Sgs150176 */ 431744Sgs150176 #define PHY_ANNPTR_REG 0x07 432744Sgs150176 433744Sgs150176 /* 434744Sgs150176 * Auto-negotiation next page receive register 435744Sgs150176 */ 436744Sgs150176 #define PHY_ANNPRR_REG 0x08 437744Sgs150176 438744Sgs150176 /* 439744Sgs150176 * 1000Base-T control register 440744Sgs150176 */ 441744Sgs150176 #define PHY_GBCR_REG 0x09 442744Sgs150176 #define GBCR_MODE_JITTER 0x2000 443744Sgs150176 #define GBCR_MODE_MASTER 0x4000 444744Sgs150176 #define GBCR_MODE_SLAVE 0x6000 445744Sgs150176 #define GBCR_1000BASE_T_FULL 0x0200 446744Sgs150176 #define GBCR_1000BASE_T_HALF 0x0100 447744Sgs150176 #define GBCR_DEFAULT 0x273a 448744Sgs150176 449744Sgs150176 /* 450744Sgs150176 * 1000Base-T status register 451744Sgs150176 */ 452744Sgs150176 #define PHY_GBSR_REG 0x0a 453744Sgs150176 #define LP_1000BASE_T_FULL 0x0800 454744Sgs150176 #define LP_1000BASE_T_HALF 0x0400 455744Sgs150176 456744Sgs150176 /* 457744Sgs150176 * 1000Base-T extended status register 458744Sgs150176 */ 459744Sgs150176 #define PHY_GBESR_REG 0x0f 460744Sgs150176 461744Sgs150176 #define PHY_1F_REG 0x1f 4624533Sgs150176 #define PHY_1D_REG 0x1d 4632544Sgs150176 #define PHY_1C_REG 0x1c 464744Sgs150176 #define PHY_1B_REG 0x1b 465744Sgs150176 #define PHY_18_REG 0x18 4662544Sgs150176 #define PHY_15_REG 0x15 4674533Sgs150176 #define PHY_13_REG 0x13 4682544Sgs150176 #define PHY_12_REG 0x12 4692544Sgs150176 #define PHY_0E_REG 0x0e 4704533Sgs150176 #define PHY_0C_REG 0x0c 471744Sgs150176 #define PHY_0B_REG 0x0b 472744Sgs150176 473744Sgs150176 /* 474744Sgs150176 * MII (PHY) registers, beyond those already defined in <sys/miiregs.h> 475744Sgs150176 */ 476744Sgs150176 477744Sgs150176 #define MII_AN_LPNXTPG 8 478744Sgs150176 #define MII_1000BASE_T_CONTROL 9 479744Sgs150176 #define MII_1000BASE_T_STATUS 10 480744Sgs150176 #define MII_IEEE_EXT_STATUS 15 481744Sgs150176 482744Sgs150176 /* 483744Sgs150176 * Bits in the MII_1000BASE_T_CONTROL register 484744Sgs150176 * 485744Sgs150176 * The MASTER_CFG bit enables manual configuration of Master/Slave mode 486744Sgs150176 * (otherwise, roles are automatically negotiated). When this bit is set, 487744Sgs150176 * the MASTER_SEL bit forces Master mode, otherwise Slave mode is forced. 488744Sgs150176 */ 489744Sgs150176 #define MII_1000BT_CTL_MASTER_CFG 0x1000 /* enable role select */ 490744Sgs150176 #define MII_1000BT_CTL_MASTER_SEL 0x0800 /* role select bit */ 491744Sgs150176 #define MII_1000BT_CTL_ADV_FDX 0x0200 492744Sgs150176 #define MII_1000BT_CTL_ADV_HDX 0x0100 493744Sgs150176 494744Sgs150176 /* 495744Sgs150176 * Vendor-specific MII registers 496744Sgs150176 */ 497744Sgs150176 #define MII_EXT_CONTROL MII_VENDOR(0) 498744Sgs150176 #define MII_EXT_STATUS MII_VENDOR(1) 499744Sgs150176 #define MII_RCV_ERR_COUNT MII_VENDOR(2) 500744Sgs150176 #define MII_FALSE_CARR_COUNT MII_VENDOR(3) 501744Sgs150176 #define MII_RCV_NOT_OK_COUNT MII_VENDOR(4) 502744Sgs150176 #define MII_AUX_CONTROL MII_VENDOR(8) 503744Sgs150176 #define MII_AUX_STATUS MII_VENDOR(9) 504744Sgs150176 #define MII_INTR_STATUS MII_VENDOR(10) 505744Sgs150176 #define MII_INTR_MASK MII_VENDOR(11) 506744Sgs150176 #define MII_HCD_STATUS MII_VENDOR(13) 507744Sgs150176 508744Sgs150176 #define MII_MAXREG MII_VENDOR(15) /* 31, 0x1f */ 509744Sgs150176 510744Sgs150176 /* 511744Sgs150176 * Bits in the MII_AUX_STATUS register 512744Sgs150176 */ 513744Sgs150176 #define MII_AUX_STATUS_MODE_MASK 0x0700 514744Sgs150176 #define MII_AUX_STATUS_MODE_1000_F 0x0700 515744Sgs150176 #define MII_AUX_STATUS_MODE_1000_H 0x0600 516744Sgs150176 #define MII_AUX_STATUS_MODE_100_F 0x0500 517744Sgs150176 #define MII_AUX_STATUS_MODE_100_4 0x0400 518744Sgs150176 #define MII_AUX_STATUS_MODE_100_H 0x0300 519744Sgs150176 #define MII_AUX_STATUS_MODE_10_F 0x0200 520744Sgs150176 #define MII_AUX_STATUS_MODE_10_H 0x0100 521744Sgs150176 #define MII_AUX_STATUS_MODE_NONE 0x0000 522744Sgs150176 #define MII_AUX_STATUS_MODE_SHIFT 8 523744Sgs150176 524744Sgs150176 #define MII_AUX_STATUS_PAR_FAULT 0x0080 525744Sgs150176 #define MII_AUX_STATUS_REM_FAULT 0x0040 526744Sgs150176 #define MII_AUX_STATUS_LP_ANEG_ABLE 0x0010 527744Sgs150176 #define MII_AUX_STATUS_LP_NP_ABLE 0x0008 528744Sgs150176 529744Sgs150176 #define MII_AUX_STATUS_LINKUP 0x0004 530744Sgs150176 #define MII_AUX_STATUS_RX_PAUSE 0x0002 531744Sgs150176 #define MII_AUX_STATUS_TX_PAUSE 0x0001 532744Sgs150176 533744Sgs150176 /* 534744Sgs150176 * Third section: 535744Sgs150176 * Hardware-defined data structures 536744Sgs150176 * 537744Sgs150176 * Note that the chip is naturally little-endian, so, for a little-endian 538744Sgs150176 * host, the structures defined below match those descibed in the PRM. 539744Sgs150176 * For big-endian hosts, some structures have to be swapped around. 540744Sgs150176 */ 541744Sgs150176 542744Sgs150176 #if !defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN) 543744Sgs150176 #error Host endianness not defined 544744Sgs150176 #endif 545744Sgs150176 546744Sgs150176 /* 547744Sgs150176 * Architectural constants: absolute maximum numbers of each type of ring 548744Sgs150176 */ 549744Sgs150176 550744Sgs150176 #define RGE_SEND_SLOTS 1024 551744Sgs150176 #define RGE_RECV_SLOTS 1024 552744Sgs150176 #define RGE_BUFF_SIZE_STD 1536 /* 1536 bytes */ 553744Sgs150176 #define RGE_BUFF_SIZE_JUMBO 7168 /* maximum 7K */ 554744Sgs150176 #define RGE_JUMBO_SIZE 7014 5552544Sgs150176 #define RGE_JUMBO_MTU 7000 556744Sgs150176 #define RGE_STATS_DUMP_SIZE 64 557744Sgs150176 558744Sgs150176 typedef struct rge_bd { 559744Sgs150176 volatile uint32_t flags_len; 560744Sgs150176 volatile uint32_t vlan_tag; 561744Sgs150176 volatile uint32_t host_buf_addr; 562744Sgs150176 volatile uint32_t host_buf_addr_hi; 563744Sgs150176 } rge_bd_t; 564744Sgs150176 565744Sgs150176 #define BD_FLAG_HW_OWN 0x80000000 566744Sgs150176 #define BD_FLAG_EOR 0x40000000 567744Sgs150176 #define BD_FLAG_PKT_START 0x20000000 568744Sgs150176 #define BD_FLAG_PKT_END 0x10000000 569744Sgs150176 570744Sgs150176 #define RBD_FLAG_MULTICAST 0x08000000 571744Sgs150176 #define RBD_FLAG_UNICAST 0x04000000 572744Sgs150176 #define RBD_FLAG_BROADCAST 0x02000000 573744Sgs150176 #define RBD_FLAG_PKT_4096 0x00400000 574744Sgs150176 #define RBD_FLAG_ERROR 0x00200000 575744Sgs150176 #define RBD_FLAG_RUNT 0x00100000 576744Sgs150176 #define RBD_FLAG_CRC_ERR 0x00080000 577744Sgs150176 #define RBD_FLAG_PROTOCOL 0x00060000 578744Sgs150176 #define RBD_FLAG_IP 0x00060000 579744Sgs150176 #define RBD_FLAG_UDP 0x00040000 580744Sgs150176 #define RBD_FLAG_TCP 0x00020000 581744Sgs150176 #define RBD_FLAG_NONE_IP 0x00000000 582744Sgs150176 #define RBD_IP_CKSUM_ERR 0x00010000 583744Sgs150176 #define RBD_UDP_CKSUM_ERR 0x00008000 584744Sgs150176 #define RBD_TCP_CKSUM_ERR 0x00004000 585744Sgs150176 #define RBD_CKSUM_ERR 0x0001c000 586744Sgs150176 #define RBD_FLAGS_MASK 0xffffc000 587744Sgs150176 #define RBD_LEN_MASK 0x00003fff 588744Sgs150176 589744Sgs150176 #define RBD_VLAN_PKT 0x00010000 590744Sgs150176 #define RBD_VLAN_TAG 0x0000ffff 591744Sgs150176 592744Sgs150176 593744Sgs150176 #define SBD_FLAG_LARGE_SEND 0x08000000 594744Sgs150176 #define SBD_FLAG_SEG_MAX 0x07ff0000 595744Sgs150176 #define SBD_FLAG_IP_CKSUM 0x00040000 596744Sgs150176 #define SBD_FLAG_UDP_CKSUM 0x00020000 597744Sgs150176 #define SBD_FLAG_TCP_CKSUM 0x00010000 598744Sgs150176 #define SBD_FLAG_TCP_UDP_CKSUM 0x00030000 599744Sgs150176 #define SBD_LEN_MASK 0x0000ffff 600744Sgs150176 601744Sgs150176 #define SBD_VLAN_PKT 0x00020000 602744Sgs150176 #define SBD_VLAN_TAG 0x0000ffff 603744Sgs150176 604744Sgs150176 #define SBD_FLAG_TX_PKT (BD_FLAG_HW_OWN | BD_FLAG_PKT_START | \ 605744Sgs150176 BD_FLAG_PKT_END) 606744Sgs150176 607744Sgs150176 /* 608744Sgs150176 * Chip VLAN TCI format 609744Sgs150176 * bit0-3: VIDH The high 4 bits of a 12-bit VLAN ID 610744Sgs150176 * bit4: CFI Canonical format indicator 611744Sgs150176 * bit5-7: 3-bit 8-level priority 612744Sgs150176 * bit8-15: The low 8 bits of a 12-bit VLAN ID 613744Sgs150176 */ 614744Sgs150176 #define TCI_OS2CHIP(tci) (((tci & 0xff) << 8) | (tci >> 8)) 615744Sgs150176 #define TCI_CHIP2OS(tci) (((tci & 0xff00) >> 8) | (tci << 8)) 616744Sgs150176 617744Sgs150176 /* 618744Sgs150176 * Hardware-defined Status Block 619744Sgs150176 */ 620744Sgs150176 typedef struct rge_hw_stats { 621744Sgs150176 uint64_t xmt_ok; 622744Sgs150176 uint64_t rcv_ok; 623744Sgs150176 uint64_t xmt_err; 624744Sgs150176 uint32_t rcv_err; 625744Sgs150176 uint16_t in_discards; 626744Sgs150176 uint16_t frame_err; 627744Sgs150176 uint32_t xmt_1col; 628744Sgs150176 uint32_t xmt_mcol; 629744Sgs150176 uint64_t unicast_rcv; 630744Sgs150176 uint64_t brdcst_rcv; 631744Sgs150176 uint32_t multi_rcv; 632744Sgs150176 uint16_t xmt_abt; 633744Sgs150176 uint16_t xmt_undrn; 634744Sgs150176 } rge_hw_stats_t; /* total 64 bytes */ 635744Sgs150176 636744Sgs150176 #ifdef __cplusplus 637744Sgs150176 } 638744Sgs150176 #endif 639744Sgs150176 640744Sgs150176 #endif /* _RGE_HW_H */ 641