1c7fd2ed0Sgs150176 /* 2c7fd2ed0Sgs150176 * CDDL HEADER START 3c7fd2ed0Sgs150176 * 4c7fd2ed0Sgs150176 * The contents of this file are subject to the terms of the 5aa817493Sgs150176 * Common Development and Distribution License (the "License"). 6aa817493Sgs150176 * You may not use this file except in compliance with the License. 7c7fd2ed0Sgs150176 * 8c7fd2ed0Sgs150176 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9c7fd2ed0Sgs150176 * or http://www.opensolaris.org/os/licensing. 10c7fd2ed0Sgs150176 * See the License for the specific language governing permissions 11c7fd2ed0Sgs150176 * and limitations under the License. 12c7fd2ed0Sgs150176 * 13c7fd2ed0Sgs150176 * When distributing Covered Code, include this CDDL HEADER in each 14c7fd2ed0Sgs150176 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15c7fd2ed0Sgs150176 * If applicable, add the following below this CDDL HEADER, with the 16c7fd2ed0Sgs150176 * fields enclosed by brackets "[]" replaced with your own identifying 17c7fd2ed0Sgs150176 * information: Portions Copyright [yyyy] [name of copyright owner] 18c7fd2ed0Sgs150176 * 19c7fd2ed0Sgs150176 * CDDL HEADER END 20c7fd2ed0Sgs150176 */ 21c7fd2ed0Sgs150176 /* 22bdb9230aSGarrett D'Amore * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 23c7fd2ed0Sgs150176 * Use is subject to license terms. 24c7fd2ed0Sgs150176 */ 25c7fd2ed0Sgs150176 26c7fd2ed0Sgs150176 #ifndef _RGE_HW_H 27c7fd2ed0Sgs150176 #define _RGE_HW_H 28c7fd2ed0Sgs150176 29c7fd2ed0Sgs150176 #ifdef __cplusplus 30c7fd2ed0Sgs150176 extern "C" { 31c7fd2ed0Sgs150176 #endif 32c7fd2ed0Sgs150176 33c7fd2ed0Sgs150176 #include <sys/types.h> 34c7fd2ed0Sgs150176 35c7fd2ed0Sgs150176 36c7fd2ed0Sgs150176 /* 37c7fd2ed0Sgs150176 * First section: 38c7fd2ed0Sgs150176 * Identification of the various Realtek GigE chips 39c7fd2ed0Sgs150176 */ 40c7fd2ed0Sgs150176 41c7fd2ed0Sgs150176 /* 42c7fd2ed0Sgs150176 * Driver support device 43c7fd2ed0Sgs150176 */ 44c7fd2ed0Sgs150176 #define VENDOR_ID_REALTECK 0x10EC 4552643194Sgs150176 #define DEVICE_ID_8169 0x8169 /* PCI */ 4652643194Sgs150176 #define DEVICE_ID_8110 0x8169 /* PCI */ 4752643194Sgs150176 #define DEVICE_ID_8168 0x8168 /* PCI-E */ 4852643194Sgs150176 #define DEVICE_ID_8111 0x8168 /* PCI-E */ 4952643194Sgs150176 #define DEVICE_ID_8169SC 0x8167 /* PCI */ 5052643194Sgs150176 #define DEVICE_ID_8110SC 0x8167 /* PCI */ 51dfc2d53eSmx205022 #define DEVICE_ID_8101E 0x8136 /* 10/100M PCI-E */ 52c7fd2ed0Sgs150176 53c7fd2ed0Sgs150176 #define RGE_REGISTER_MAX 0x0100 54c7fd2ed0Sgs150176 55c7fd2ed0Sgs150176 56c7fd2ed0Sgs150176 /* 57c7fd2ed0Sgs150176 * Second section: 58c7fd2ed0Sgs150176 * Offsets of important registers & definitions for bits therein 59c7fd2ed0Sgs150176 */ 60c7fd2ed0Sgs150176 /* 61c7fd2ed0Sgs150176 * MAC address register, initial value is autoloaded from the 62c7fd2ed0Sgs150176 * EEPROM EthernetID field 63c7fd2ed0Sgs150176 */ 64c7fd2ed0Sgs150176 #define ID_0_REG 0x0000 65c7fd2ed0Sgs150176 #define ID_1_REG 0x0001 66c7fd2ed0Sgs150176 #define ID_2_REG 0x0002 67c7fd2ed0Sgs150176 #define ID_3_REG 0x0003 68c7fd2ed0Sgs150176 #define ID_4_REG 0x0004 69c7fd2ed0Sgs150176 #define ID_5_REG 0x0005 70c7fd2ed0Sgs150176 71c7fd2ed0Sgs150176 /* 72c7fd2ed0Sgs150176 * Multicast register 73c7fd2ed0Sgs150176 */ 74c7fd2ed0Sgs150176 #define MULTICAST_0_REG 0x0008 75c7fd2ed0Sgs150176 #define MULTICAST_1_REG 0x0009 76c7fd2ed0Sgs150176 #define MULTICAST_2_REG 0x000a 77c7fd2ed0Sgs150176 #define MULTICAST_3_REG 0x000b 78c7fd2ed0Sgs150176 #define MULTICAST_4_REG 0x000c 79c7fd2ed0Sgs150176 #define MULTICAST_5_REG 0x000d 80c7fd2ed0Sgs150176 #define MULTICAST_6_REG 0x000e 81c7fd2ed0Sgs150176 #define MULTICAST_7_REG 0x000f 82aa817493Sgs150176 #define RGE_MCAST_NUM 8 /* total 8 registers: MAR0 - MAR7 */ 83c7fd2ed0Sgs150176 84c7fd2ed0Sgs150176 /* 85c7fd2ed0Sgs150176 * Dump Tally Counter Command register 86c7fd2ed0Sgs150176 */ 87c7fd2ed0Sgs150176 #define DUMP_COUNTER_REG_0 0x0010 88c7fd2ed0Sgs150176 #define DUMP_COUNTER_REG_RESV 0x00000037 89c7fd2ed0Sgs150176 #define DUMP_START 0x00000008 90c7fd2ed0Sgs150176 #define DUMP_COUNTER_REG_1 0x0014 91c7fd2ed0Sgs150176 92c7fd2ed0Sgs150176 /* 93c7fd2ed0Sgs150176 * Register for start address of transmit descriptors 94c7fd2ed0Sgs150176 */ 95c7fd2ed0Sgs150176 #define NORMAL_TX_RING_ADDR_LO_REG 0x0020 96c7fd2ed0Sgs150176 #define NORMAL_TX_RING_ADDR_HI_REG 0x0024 97c7fd2ed0Sgs150176 #define HIGH_TX_RING_ADDR_LO_REG 0x0028 98c7fd2ed0Sgs150176 #define HIGH_TX_RING_ADDR_HI_REG 0x002c 99c7fd2ed0Sgs150176 100c7fd2ed0Sgs150176 /* 101c7fd2ed0Sgs150176 * Commond register 102c7fd2ed0Sgs150176 */ 103c7fd2ed0Sgs150176 #define RT_COMMAND_REG 0x0037 104c7fd2ed0Sgs150176 #define RT_COMMAND_RESV 0xe3 105c7fd2ed0Sgs150176 #define RT_COMMAND_RESET 0x10 106c7fd2ed0Sgs150176 #define RT_COMMAND_RX_ENABLE 0x08 107c7fd2ed0Sgs150176 #define RT_COMMAND_TX_ENABLE 0x04 108c7fd2ed0Sgs150176 109c7fd2ed0Sgs150176 /* 110c7fd2ed0Sgs150176 * Transmit priority polling register 111c7fd2ed0Sgs150176 */ 112c7fd2ed0Sgs150176 #define TX_RINGS_POLL_REG 0x0038 113c7fd2ed0Sgs150176 #define HIGH_TX_RING_POLL 0x80 114c7fd2ed0Sgs150176 #define NORMAL_TX_RING_POLL 0x40 115c7fd2ed0Sgs150176 #define FORCE_SW_INT 0x01 116c7fd2ed0Sgs150176 117c7fd2ed0Sgs150176 /* 118c7fd2ed0Sgs150176 * Interrupt mask & status register 119c7fd2ed0Sgs150176 */ 120c7fd2ed0Sgs150176 #define INT_MASK_REG 0x003c 121c7fd2ed0Sgs150176 #define INT_STATUS_REG 0x003e 122c7fd2ed0Sgs150176 #define SYS_ERR_INT 0x8000 123c7fd2ed0Sgs150176 #define TIME_OUT_INT 0x4000 124c7fd2ed0Sgs150176 #define SW_INT 0x0100 125c7fd2ed0Sgs150176 #define NO_TXDESC_INT 0x0080 126c7fd2ed0Sgs150176 #define RX_FIFO_OVERFLOW_INT 0x0040 127c7fd2ed0Sgs150176 #define LINK_CHANGE_INT 0x0020 128c7fd2ed0Sgs150176 #define NO_RXDESC_INT 0x0010 129c7fd2ed0Sgs150176 #define TX_ERR_INT 0x0008 130c7fd2ed0Sgs150176 #define TX_OK_INT 0x0004 131c7fd2ed0Sgs150176 #define RX_ERR_INT 0x0002 132c7fd2ed0Sgs150176 #define RX_OK_INT 0x0001 133c7fd2ed0Sgs150176 134c7fd2ed0Sgs150176 #define INT_REG_RESV 0x3e00 135c7fd2ed0Sgs150176 #define INT_MASK_ALL 0xffff 136c7fd2ed0Sgs150176 #define INT_MASK_NONE 0x0000 137c7fd2ed0Sgs150176 #define RGE_RX_INT (RX_OK_INT | RX_ERR_INT | \ 138aa817493Sgs150176 NO_RXDESC_INT) 1393a84c50fSWinson Wang - Sun Microsystems - Beijing China #define RGE_INT_MASK (TX_OK_INT | TX_ERR_INT | \ 1403a84c50fSWinson Wang - Sun Microsystems - Beijing China RGE_RX_INT | LINK_CHANGE_INT | \ 141*9e1a9180SLi-Zhen You TIME_OUT_INT | SYS_ERR_INT) 142c7fd2ed0Sgs150176 143c7fd2ed0Sgs150176 /* 144c7fd2ed0Sgs150176 * Transmit configuration register 145c7fd2ed0Sgs150176 */ 146c7fd2ed0Sgs150176 #define TX_CONFIG_REG 0x0040 147c7fd2ed0Sgs150176 #define TX_CONFIG_REG_RESV 0x8070f8ff 148c7fd2ed0Sgs150176 #define HW_VERSION_ID_0 0x7c000000 149c7fd2ed0Sgs150176 #define INTER_FRAME_GAP_BITS 0x03080000 150c7fd2ed0Sgs150176 #define TX_INTERFRAME_GAP_802_3 0x03000000 151c7fd2ed0Sgs150176 #define HW_VERSION_ID_1 0x00800000 152c7fd2ed0Sgs150176 #define MAC_LOOPBACK_ENABLE 0x00060000 153c7fd2ed0Sgs150176 #define CRC_APPEND_ENABLE 0x00010000 154c7fd2ed0Sgs150176 #define TX_DMA_BURST_BITS 0x00000700 155c7fd2ed0Sgs150176 156c7fd2ed0Sgs150176 #define TX_DMA_BURST_UNLIMIT 0x00000700 157c7fd2ed0Sgs150176 #define TX_DMA_BURST_1024B 0x00000600 158c7fd2ed0Sgs150176 #define TX_DMA_BURST_512B 0x00000500 159c7fd2ed0Sgs150176 #define TX_DMA_BURST_256B 0x00000400 160c7fd2ed0Sgs150176 #define TX_DMA_BURST_128B 0x00000300 161c7fd2ed0Sgs150176 #define TX_DMA_BURST_64B 0x00000200 162c7fd2ed0Sgs150176 #define TX_DMA_BURST_32B 0x00000100 163c7fd2ed0Sgs150176 #define TX_DMA_BURST_16B 0x00000000 164c7fd2ed0Sgs150176 165aa817493Sgs150176 #define MAC_VER_8169 0x00000000 166aa817493Sgs150176 #define MAC_VER_8169S_D 0x00800000 167aa817493Sgs150176 #define MAC_VER_8169S_E 0x04000000 168aa817493Sgs150176 #define MAC_VER_8169SB 0x10000000 16952643194Sgs150176 #define MAC_VER_8169SC 0x18000000 170aa817493Sgs150176 #define MAC_VER_8168 0x20000000 171aa817493Sgs150176 #define MAC_VER_8168B_B 0x30000000 172aa817493Sgs150176 #define MAC_VER_8168B_C 0x38000000 1735927ab2bSKHF04453@nifty.ne.jp #define MAC_VER_8168C 0x3c000000 174dfc2d53eSmx205022 #define MAC_VER_8101E 0x34000000 175834a2629Syong tan - Sun Microsystems - Beijing China #define MAC_VER_8101E_B 0x24800000 176834a2629Syong tan - Sun Microsystems - Beijing China #define MAC_VER_8101E_C 0x34800000 177c7fd2ed0Sgs150176 178c7fd2ed0Sgs150176 #define TX_CONFIG_DEFAULT (TX_INTERFRAME_GAP_802_3 | \ 179c7fd2ed0Sgs150176 TX_DMA_BURST_1024B) 180c7fd2ed0Sgs150176 /* 181c7fd2ed0Sgs150176 * Receive configuration register 182c7fd2ed0Sgs150176 */ 183c7fd2ed0Sgs150176 #define RX_CONFIG_REG 0x0044 184c7fd2ed0Sgs150176 #define RX_CONFIG_REG_RESV 0xfffe1880 185c7fd2ed0Sgs150176 #define RX_RER8_ENABLE 0x00010000 186c7fd2ed0Sgs150176 #define RX_FIFO_THRESHOLD_BITS 0x0000e000 187c7fd2ed0Sgs150176 #define RX_FIFO_THRESHOLD_NONE 0x0000e000 188c7fd2ed0Sgs150176 #define RX_FIFO_THRESHOLD_1024B 0x0000c000 189c7fd2ed0Sgs150176 #define RX_FIFO_THRESHOLD_512B 0x0000a000 190c7fd2ed0Sgs150176 #define RX_FIFO_THRESHOLD_256B 0x00008000 191c7fd2ed0Sgs150176 #define RX_FIFO_THRESHOLD_128B 0x00006000 192c7fd2ed0Sgs150176 #define RX_FIFO_THRESHOLD_64B 0x00004000 193c7fd2ed0Sgs150176 #define RX_DMA_BURST_BITS 0x00000700 194c7fd2ed0Sgs150176 #define RX_DMA_BURST_UNLIMITED 0x00000700 195c7fd2ed0Sgs150176 #define RX_DMA_BURST_1024B 0x00000600 196c7fd2ed0Sgs150176 #define RX_DMA_BURST_512B 0x00000500 197c7fd2ed0Sgs150176 #define RX_DMA_BURST_256B 0x00000400 198c7fd2ed0Sgs150176 #define RX_DMA_BURST_128B 0x00000300 199c7fd2ed0Sgs150176 #define RX_DMA_BURST_64B 0x00000200 200c7fd2ed0Sgs150176 #define RX_EEPROM_9356 0x00000040 201c7fd2ed0Sgs150176 #define RX_ACCEPT_ERR_PKT 0x00000020 202c7fd2ed0Sgs150176 #define RX_ACCEPT_RUNT_PKT 0x00000010 203c7fd2ed0Sgs150176 #define RX_ACCEPT_BROADCAST_PKT 0x000000008 204c7fd2ed0Sgs150176 #define RX_ACCEPT_MULTICAST_PKT 0x000000004 205c7fd2ed0Sgs150176 #define RX_ACCEPT_MAC_MATCH_PKT 0x000000002 206c7fd2ed0Sgs150176 #define RX_ACCEPT_ALL_PKT 0x000000001 207c7fd2ed0Sgs150176 208c7fd2ed0Sgs150176 #define RX_CONFIG_DEFAULT (RX_FIFO_THRESHOLD_NONE | \ 209c7fd2ed0Sgs150176 RX_DMA_BURST_1024B | \ 210c7fd2ed0Sgs150176 RX_ACCEPT_BROADCAST_PKT | \ 211c7fd2ed0Sgs150176 RX_ACCEPT_MULTICAST_PKT | \ 212c7fd2ed0Sgs150176 RX_ACCEPT_MAC_MATCH_PKT) 213c7fd2ed0Sgs150176 214c7fd2ed0Sgs150176 /* 215c7fd2ed0Sgs150176 * Timer count register 216c7fd2ed0Sgs150176 */ 217c7fd2ed0Sgs150176 #define TIMER_COUNT_REG 0x0048 2183a84c50fSWinson Wang - Sun Microsystems - Beijing China #define TIMER_CLK_PCIE (125*1000*1000) 2193a84c50fSWinson Wang - Sun Microsystems - Beijing China #define TIMER_CLK_PCI (33*1000*1000) 220c7fd2ed0Sgs150176 221c7fd2ed0Sgs150176 /* 222c7fd2ed0Sgs150176 * Missed packet counter: indicates the number of packets 223c7fd2ed0Sgs150176 * discarded due to Rx FIFO overflow 224c7fd2ed0Sgs150176 */ 225c7fd2ed0Sgs150176 #define RX_PKT_MISS_COUNT_REG 0x004c 226c7fd2ed0Sgs150176 227c7fd2ed0Sgs150176 /* 228c7fd2ed0Sgs150176 * 93c46(93c56) commond register: 229c7fd2ed0Sgs150176 */ 230c7fd2ed0Sgs150176 #define RT_93c46_COMMOND_REG 0x0050 231c7fd2ed0Sgs150176 #define RT_93c46_MODE_BITS 0xc0 232c7fd2ed0Sgs150176 #define RT_93c46_MODE_NORMAL 0x00 233c7fd2ed0Sgs150176 #define RT_93c46_MODE_AUTOLOAD 0x40 234c7fd2ed0Sgs150176 #define RT_93c46_MODE_PROGRAM 0x80 235c7fd2ed0Sgs150176 #define RT_93c46_MODE_CONFIG 0xc0 236c7fd2ed0Sgs150176 237c7fd2ed0Sgs150176 #define RT_93c46_EECS 0x08 238c7fd2ed0Sgs150176 #define RT_93c46_EESK 0x04 239c7fd2ed0Sgs150176 #define RT_93c46_EEDI 0x02 240c7fd2ed0Sgs150176 #define RT_93c46_EEDO 0x01 241c7fd2ed0Sgs150176 242c7fd2ed0Sgs150176 /* 243c7fd2ed0Sgs150176 * Configuration registers 244c7fd2ed0Sgs150176 */ 245c7fd2ed0Sgs150176 #define RT_CONFIG_0_REG 0x0051 246c7fd2ed0Sgs150176 #define RT_CONFIG_1_REG 0x0052 247c7fd2ed0Sgs150176 #define RT_CONFIG_2_REG 0x0053 248c7fd2ed0Sgs150176 #define RT_CONFIG_3_REG 0x0054 249c7fd2ed0Sgs150176 #define RT_CONFIG_4_REG 0x0055 250c7fd2ed0Sgs150176 #define RT_CONFIG_5_REG 0x0056 251c7fd2ed0Sgs150176 252c7fd2ed0Sgs150176 /* 253368a5ef8SMiles Xu, Sun Microsystems * Config 5 Register Bits 254368a5ef8SMiles Xu, Sun Microsystems */ 255368a5ef8SMiles Xu, Sun Microsystems #define RT_UNI_WAKE_FRAME 0x10 256368a5ef8SMiles Xu, Sun Microsystems #define RT_MUL_WAKE_FRAME 0x20 257368a5ef8SMiles Xu, Sun Microsystems #define RT_BRO_WAKE_FRAME 0x40 258368a5ef8SMiles Xu, Sun Microsystems 259368a5ef8SMiles Xu, Sun Microsystems /* 260c7fd2ed0Sgs150176 * Timer interrupt register 261c7fd2ed0Sgs150176 */ 262c7fd2ed0Sgs150176 #define TIMER_INT_REG 0x0058 263c7fd2ed0Sgs150176 #define TIMER_INT_NONE 0x00000000 264c7fd2ed0Sgs150176 265c7fd2ed0Sgs150176 /* 266c7fd2ed0Sgs150176 * PHY access register 267c7fd2ed0Sgs150176 */ 268c7fd2ed0Sgs150176 #define PHY_ACCESS_REG 0x0060 269c7fd2ed0Sgs150176 #define PHY_ACCESS_WR_FLAG 0x80000000 270c7fd2ed0Sgs150176 #define PHY_ACCESS_REG_BITS 0x001f0000 271c7fd2ed0Sgs150176 #define PHY_ACCESS_DATA_BITS 0x0000ffff 272c7fd2ed0Sgs150176 #define PHY_DATA_MASK 0xffff 273c7fd2ed0Sgs150176 #define PHY_REG_MASK 0x1f 274c7fd2ed0Sgs150176 #define PHY_REG_SHIFT 16 275c7fd2ed0Sgs150176 276c7fd2ed0Sgs150176 /* 277aa817493Sgs150176 * CSI data register (for PCIE chipset) 278aa817493Sgs150176 */ 279aa817493Sgs150176 #define RT_CSI_DATA_REG 0x0064 280aa817493Sgs150176 281aa817493Sgs150176 /* 282aa817493Sgs150176 * CSI access register (for PCIE chipset) 283aa817493Sgs150176 */ 284aa817493Sgs150176 #define RT_CSI_ACCESS_REG 0x0068 285aa817493Sgs150176 286aa817493Sgs150176 /* 287c7fd2ed0Sgs150176 * PHY status register 288c7fd2ed0Sgs150176 */ 289c7fd2ed0Sgs150176 #define PHY_STATUS_REG 0x006c 290c7fd2ed0Sgs150176 #define PHY_STATUS_TBI 0x80 291c7fd2ed0Sgs150176 #define PHY_STATUS_TX_FLOW 0x40 292c7fd2ed0Sgs150176 #define PHY_STATUS_RX_FLOW 0x20 293c7fd2ed0Sgs150176 #define PHY_STATUS_1000MF 0x10 294c7fd2ed0Sgs150176 #define PHY_STATUS_100M 0x08 295c7fd2ed0Sgs150176 #define PHY_STATUS_10M 0x04 296c7fd2ed0Sgs150176 #define PHY_STATUS_LINK_UP 0x02 297c7fd2ed0Sgs150176 #define PHY_STATUS_DUPLEX_FULL 0x01 298c7fd2ed0Sgs150176 299c7fd2ed0Sgs150176 #define RGE_SPEED_1000M 1000 300c7fd2ed0Sgs150176 #define RGE_SPEED_100M 100 301c7fd2ed0Sgs150176 #define RGE_SPEED_10M 10 302c7fd2ed0Sgs150176 #define RGE_SPEED_UNKNOWN 0 303c7fd2ed0Sgs150176 304c7fd2ed0Sgs150176 /* 305aa817493Sgs150176 * EPHY access register (for PCIE chipset) 306aa817493Sgs150176 */ 307aa817493Sgs150176 #define EPHY_ACCESS_REG 0x0080 308aa817493Sgs150176 #define EPHY_ACCESS_WR_FLAG 0x80000000 309aa817493Sgs150176 #define EPHY_ACCESS_REG_BITS 0x001f0000 310aa817493Sgs150176 #define EPHY_ACCESS_DATA_BITS 0x0000ffff 311aa817493Sgs150176 #define EPHY_DATA_MASK 0xffff 312aa817493Sgs150176 #define EPHY_REG_MASK 0x1f 313aa817493Sgs150176 #define EPHY_REG_SHIFT 16 314aa817493Sgs150176 315aa817493Sgs150176 /* 316c7fd2ed0Sgs150176 * Receive packet maximum size register 317c7fd2ed0Sgs150176 * -- the maximum rx size supported is (16K - 1) bytes 318c7fd2ed0Sgs150176 */ 319c7fd2ed0Sgs150176 #define RX_MAX_PKTSIZE_REG 0x00da 320c7fd2ed0Sgs150176 #define RX_PKTSIZE_JUMBO 0x1bfa /* 7K bytes */ 321c7fd2ed0Sgs150176 #define RX_PKTSIZE_STD 0x05fa /* 1530 bytes */ 322dfc2d53eSmx205022 #define RX_PKTSIZE_STD_8101E 0x3fff 323c7fd2ed0Sgs150176 324c7fd2ed0Sgs150176 /* 325c7fd2ed0Sgs150176 * C+ command register 326c7fd2ed0Sgs150176 */ 327c7fd2ed0Sgs150176 #define CPLUS_COMMAND_REG 0x00e0 328c7fd2ed0Sgs150176 #define CPLUS_RESERVE 0xfd87 329c7fd2ed0Sgs150176 #define CPLUS_BIT14 0x4000 330c7fd2ed0Sgs150176 #define CPLUS_BIG_ENDIAN 0x0400 331c7fd2ed0Sgs150176 #define RX_VLAN_DETAG 0x0040 332c7fd2ed0Sgs150176 #define RX_CKSM_OFFLOAD 0x0020 333c7fd2ed0Sgs150176 #define DUAL_PCI_CYCLE 0x0010 334c7fd2ed0Sgs150176 #define MUL_PCI_RW_ENABLE 0x0008 335c7fd2ed0Sgs150176 336c7fd2ed0Sgs150176 /* 337c7fd2ed0Sgs150176 * Receive descriptor start address 338c7fd2ed0Sgs150176 */ 339c7fd2ed0Sgs150176 #define RX_RING_ADDR_LO_REG 0x00e4 340c7fd2ed0Sgs150176 #define RX_RING_ADDR_HI_REG 0x00e8 341c7fd2ed0Sgs150176 342c7fd2ed0Sgs150176 /* 343c7fd2ed0Sgs150176 * Max transmit packet size register 344c7fd2ed0Sgs150176 */ 345c7fd2ed0Sgs150176 #define TX_MAX_PKTSIZE_REG 0x00ec 346c7fd2ed0Sgs150176 #define TX_MAX_PKTSIZE_REG_RESV 0xc0 347c7fd2ed0Sgs150176 #define TX_PKTSIZE_JUMBO 0x3b /* Realtek suggested value */ 348c7fd2ed0Sgs150176 #define TX_PKTSIZE_STD 0x32 /* document suggested value */ 349dfc2d53eSmx205022 #define TX_PKTSIZE_STD_8101E 0x3f 350c7fd2ed0Sgs150176 351c7fd2ed0Sgs150176 #define RESV_82_REG 0x0082 352c7fd2ed0Sgs150176 #define RESV_E2_REG 0x00e2 353c7fd2ed0Sgs150176 354c7fd2ed0Sgs150176 /* 355c7fd2ed0Sgs150176 * PHY registers 356c7fd2ed0Sgs150176 */ 357c7fd2ed0Sgs150176 /* 358c7fd2ed0Sgs150176 * Basic mode control register 359c7fd2ed0Sgs150176 */ 360c7fd2ed0Sgs150176 #define PHY_BMCR_REG 0x00 361c7fd2ed0Sgs150176 #define PHY_RESET 0x8000 362c7fd2ed0Sgs150176 #define PHY_LOOPBACK 0x4000 363c7fd2ed0Sgs150176 #define PHY_SPEED_0 0x2000 364c7fd2ed0Sgs150176 #define PHY_SPEED_1 0x0040 365c7fd2ed0Sgs150176 #define PHY_SPEED_BITS (PHY_SPEED_0 | PHY_SPEED_1) 366c7fd2ed0Sgs150176 #define PHY_SPEED_1000M PHY_SPEED_1 367c7fd2ed0Sgs150176 #define PHY_SPEED_100M PHY_SPEED_0 368c7fd2ed0Sgs150176 #define PHY_SPEED_10M 0x0000 369c7fd2ed0Sgs150176 #define PHY_SPEED_RES (PHY_SPEED_0 | PHY_SPEED_1) 370c7fd2ed0Sgs150176 #define PHY_AUTO_NEGO 0x1000 371c7fd2ed0Sgs150176 #define PHY_RESTART_ANTO_NEGO 0x0200 372c7fd2ed0Sgs150176 #define PHY_DUPLEX_FULL 0x0100 373c7fd2ed0Sgs150176 #define PHY_BMCR_CLEAR 0xff40 374c7fd2ed0Sgs150176 375c7fd2ed0Sgs150176 /* 376c7fd2ed0Sgs150176 * Basic mode status register 377c7fd2ed0Sgs150176 */ 378c7fd2ed0Sgs150176 #define PHY_BMSR_REG 0x01 379c7fd2ed0Sgs150176 #define PHY_100BASE_T4 0x8000 380c7fd2ed0Sgs150176 #define PHY_100BASE_TX_FULL 0x4000 381c7fd2ed0Sgs150176 #define PHY_100BASE_TX_HALF 0x2000 382c7fd2ed0Sgs150176 #define PHY_10BASE_T_FULL 0x1000 383c7fd2ed0Sgs150176 #define PHY_10BASE_T_HALF 0x0800 384c7fd2ed0Sgs150176 #define PHY_100BASE_T2_FULL 0x0400 385c7fd2ed0Sgs150176 #define PHY_100BASE_T2_HALF 0x0200 386c7fd2ed0Sgs150176 #define PHY_1000BASE_T_EXT 0x0100 387c7fd2ed0Sgs150176 #define PHY_AUTO_NEGO_END 0x0020 388c7fd2ed0Sgs150176 #define PHY_REMOTE_FAULT 0x0010 389c7fd2ed0Sgs150176 #define PHY_AUTO_NEGO_ABLE 0x0008 390c7fd2ed0Sgs150176 #define PHY_LINK_UP 0x0004 391c7fd2ed0Sgs150176 #define PHY_JABBER_DETECT 0x0002 392c7fd2ed0Sgs150176 #define PHY_EXT_ABLE 0x0001 393c7fd2ed0Sgs150176 394c7fd2ed0Sgs150176 /* 395c7fd2ed0Sgs150176 * PHY identifier register 396c7fd2ed0Sgs150176 */ 397c7fd2ed0Sgs150176 #define PHY_ID_REG_1 0x02 398c7fd2ed0Sgs150176 #define PHY_ID_REG_2 0x03 399c7fd2ed0Sgs150176 #define PHY_VER_MASK 0x000f 400c7fd2ed0Sgs150176 #define PHY_VER_S 0x0000 401c7fd2ed0Sgs150176 #define PHY_VER_SB 0x0010 402c7fd2ed0Sgs150176 403c7fd2ed0Sgs150176 /* 404c7fd2ed0Sgs150176 * Auto-negotiation advertising register 405c7fd2ed0Sgs150176 */ 406c7fd2ed0Sgs150176 #define PHY_ANAR_REG 0x04 407c7fd2ed0Sgs150176 #define ANAR_NEXT_PAGE 0x8000 408c7fd2ed0Sgs150176 #define ANAR_REMOTE_FAULT 0x2000 409c7fd2ed0Sgs150176 #define ANAR_ASY_PAUSE 0x0800 410c7fd2ed0Sgs150176 #define ANAR_PAUSE 0x0400 411c7fd2ed0Sgs150176 #define ANAR_100BASE_T4 0x0200 412c7fd2ed0Sgs150176 #define ANAR_100BASE_TX_FULL 0x0100 413c7fd2ed0Sgs150176 #define ANAR_100BASE_TX_HALF 0x0080 414c7fd2ed0Sgs150176 #define ANAR_10BASE_T_FULL 0x0040 415c7fd2ed0Sgs150176 #define ANAR_10BASE_T_HALF 0x0020 416c7fd2ed0Sgs150176 #define ANAR_RESV_BITS 0x501f 417c7fd2ed0Sgs150176 418c7fd2ed0Sgs150176 /* 419c7fd2ed0Sgs150176 * Auto-negotiation link partner ability register 420c7fd2ed0Sgs150176 */ 421c7fd2ed0Sgs150176 #define PHY_ANLPAR_REG 0x05 422c7fd2ed0Sgs150176 423c7fd2ed0Sgs150176 /* 424c7fd2ed0Sgs150176 * Auto-negotiation expansion register 425c7fd2ed0Sgs150176 */ 426c7fd2ed0Sgs150176 #define PHY_ANER_REG 0x06 427c7fd2ed0Sgs150176 428c7fd2ed0Sgs150176 /* 429c7fd2ed0Sgs150176 * Auto-negotiation next page transmit register 430c7fd2ed0Sgs150176 */ 431c7fd2ed0Sgs150176 #define PHY_ANNPTR_REG 0x07 432c7fd2ed0Sgs150176 433c7fd2ed0Sgs150176 /* 434c7fd2ed0Sgs150176 * Auto-negotiation next page receive register 435c7fd2ed0Sgs150176 */ 436c7fd2ed0Sgs150176 #define PHY_ANNPRR_REG 0x08 437c7fd2ed0Sgs150176 438c7fd2ed0Sgs150176 /* 439c7fd2ed0Sgs150176 * 1000Base-T control register 440c7fd2ed0Sgs150176 */ 441c7fd2ed0Sgs150176 #define PHY_GBCR_REG 0x09 442c7fd2ed0Sgs150176 #define GBCR_MODE_JITTER 0x2000 443c7fd2ed0Sgs150176 #define GBCR_MODE_MASTER 0x4000 444c7fd2ed0Sgs150176 #define GBCR_MODE_SLAVE 0x6000 445c7fd2ed0Sgs150176 #define GBCR_1000BASE_T_FULL 0x0200 446c7fd2ed0Sgs150176 #define GBCR_1000BASE_T_HALF 0x0100 447c7fd2ed0Sgs150176 #define GBCR_DEFAULT 0x273a 448c7fd2ed0Sgs150176 449c7fd2ed0Sgs150176 /* 450c7fd2ed0Sgs150176 * 1000Base-T status register 451c7fd2ed0Sgs150176 */ 452c7fd2ed0Sgs150176 #define PHY_GBSR_REG 0x0a 453c7fd2ed0Sgs150176 #define LP_1000BASE_T_FULL 0x0800 454c7fd2ed0Sgs150176 #define LP_1000BASE_T_HALF 0x0400 455c7fd2ed0Sgs150176 456c7fd2ed0Sgs150176 /* 457c7fd2ed0Sgs150176 * 1000Base-T extended status register 458c7fd2ed0Sgs150176 */ 459c7fd2ed0Sgs150176 #define PHY_GBESR_REG 0x0f 460c7fd2ed0Sgs150176 461c7fd2ed0Sgs150176 #define PHY_1F_REG 0x1f 46252643194Sgs150176 #define PHY_1D_REG 0x1d 463aa817493Sgs150176 #define PHY_1C_REG 0x1c 464c7fd2ed0Sgs150176 #define PHY_1B_REG 0x1b 465c7fd2ed0Sgs150176 #define PHY_18_REG 0x18 466aa817493Sgs150176 #define PHY_15_REG 0x15 46752643194Sgs150176 #define PHY_13_REG 0x13 468aa817493Sgs150176 #define PHY_12_REG 0x12 469c7fd2ed0Sgs150176 #define PHY_0E_REG 0x0e 47052643194Sgs150176 #define PHY_0C_REG 0x0c 471aa817493Sgs150176 #define PHY_0B_REG 0x0b 472c7fd2ed0Sgs150176 473c7fd2ed0Sgs150176 /* 474c7fd2ed0Sgs150176 * MII (PHY) registers, beyond those already defined in <sys/miiregs.h> 475c7fd2ed0Sgs150176 */ 476c7fd2ed0Sgs150176 477c7fd2ed0Sgs150176 #define MII_AN_LPNXTPG 8 478c7fd2ed0Sgs150176 #define MII_1000BASE_T_CONTROL 9 479c7fd2ed0Sgs150176 #define MII_1000BASE_T_STATUS 10 480c7fd2ed0Sgs150176 #define MII_IEEE_EXT_STATUS 15 481c7fd2ed0Sgs150176 482c7fd2ed0Sgs150176 /* 483c7fd2ed0Sgs150176 * Bits in the MII_1000BASE_T_CONTROL register 484c7fd2ed0Sgs150176 * 485c7fd2ed0Sgs150176 * The MASTER_CFG bit enables manual configuration of Master/Slave mode 486c7fd2ed0Sgs150176 * (otherwise, roles are automatically negotiated). When this bit is set, 487c7fd2ed0Sgs150176 * the MASTER_SEL bit forces Master mode, otherwise Slave mode is forced. 488c7fd2ed0Sgs150176 */ 489c7fd2ed0Sgs150176 #define MII_1000BT_CTL_MASTER_CFG 0x1000 /* enable role select */ 490c7fd2ed0Sgs150176 #define MII_1000BT_CTL_MASTER_SEL 0x0800 /* role select bit */ 491c7fd2ed0Sgs150176 #define MII_1000BT_CTL_ADV_FDX 0x0200 492c7fd2ed0Sgs150176 #define MII_1000BT_CTL_ADV_HDX 0x0100 493c7fd2ed0Sgs150176 494c7fd2ed0Sgs150176 /* 495c7fd2ed0Sgs150176 * Vendor-specific MII registers 496c7fd2ed0Sgs150176 */ 497c7fd2ed0Sgs150176 #define MII_EXT_CONTROL MII_VENDOR(0) 498c7fd2ed0Sgs150176 #define MII_EXT_STATUS MII_VENDOR(1) 499c7fd2ed0Sgs150176 #define MII_RCV_ERR_COUNT MII_VENDOR(2) 500c7fd2ed0Sgs150176 #define MII_FALSE_CARR_COUNT MII_VENDOR(3) 501c7fd2ed0Sgs150176 #define MII_RCV_NOT_OK_COUNT MII_VENDOR(4) 502c7fd2ed0Sgs150176 #define MII_AUX_CONTROL MII_VENDOR(8) 503c7fd2ed0Sgs150176 #define MII_AUX_STATUS MII_VENDOR(9) 504c7fd2ed0Sgs150176 #define MII_INTR_STATUS MII_VENDOR(10) 505c7fd2ed0Sgs150176 #define MII_INTR_MASK MII_VENDOR(11) 506c7fd2ed0Sgs150176 #define MII_HCD_STATUS MII_VENDOR(13) 507c7fd2ed0Sgs150176 508c7fd2ed0Sgs150176 #define MII_MAXREG MII_VENDOR(15) /* 31, 0x1f */ 509c7fd2ed0Sgs150176 510c7fd2ed0Sgs150176 /* 511c7fd2ed0Sgs150176 * Bits in the MII_AUX_STATUS register 512c7fd2ed0Sgs150176 */ 513c7fd2ed0Sgs150176 #define MII_AUX_STATUS_MODE_MASK 0x0700 514c7fd2ed0Sgs150176 #define MII_AUX_STATUS_MODE_1000_F 0x0700 515c7fd2ed0Sgs150176 #define MII_AUX_STATUS_MODE_1000_H 0x0600 516c7fd2ed0Sgs150176 #define MII_AUX_STATUS_MODE_100_F 0x0500 517c7fd2ed0Sgs150176 #define MII_AUX_STATUS_MODE_100_4 0x0400 518c7fd2ed0Sgs150176 #define MII_AUX_STATUS_MODE_100_H 0x0300 519c7fd2ed0Sgs150176 #define MII_AUX_STATUS_MODE_10_F 0x0200 520c7fd2ed0Sgs150176 #define MII_AUX_STATUS_MODE_10_H 0x0100 521c7fd2ed0Sgs150176 #define MII_AUX_STATUS_MODE_NONE 0x0000 522c7fd2ed0Sgs150176 #define MII_AUX_STATUS_MODE_SHIFT 8 523c7fd2ed0Sgs150176 524c7fd2ed0Sgs150176 #define MII_AUX_STATUS_PAR_FAULT 0x0080 525c7fd2ed0Sgs150176 #define MII_AUX_STATUS_REM_FAULT 0x0040 526c7fd2ed0Sgs150176 #define MII_AUX_STATUS_LP_ANEG_ABLE 0x0010 527c7fd2ed0Sgs150176 #define MII_AUX_STATUS_LP_NP_ABLE 0x0008 528c7fd2ed0Sgs150176 529c7fd2ed0Sgs150176 #define MII_AUX_STATUS_LINKUP 0x0004 530c7fd2ed0Sgs150176 #define MII_AUX_STATUS_RX_PAUSE 0x0002 531c7fd2ed0Sgs150176 #define MII_AUX_STATUS_TX_PAUSE 0x0001 532c7fd2ed0Sgs150176 533c7fd2ed0Sgs150176 /* 534c7fd2ed0Sgs150176 * Third section: 535c7fd2ed0Sgs150176 * Hardware-defined data structures 536c7fd2ed0Sgs150176 * 537c7fd2ed0Sgs150176 * Note that the chip is naturally little-endian, so, for a little-endian 538c7fd2ed0Sgs150176 * host, the structures defined below match those descibed in the PRM. 539c7fd2ed0Sgs150176 * For big-endian hosts, some structures have to be swapped around. 540c7fd2ed0Sgs150176 */ 541c7fd2ed0Sgs150176 542c7fd2ed0Sgs150176 #if !defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN) 543c7fd2ed0Sgs150176 #error Host endianness not defined 544c7fd2ed0Sgs150176 #endif 545c7fd2ed0Sgs150176 546c7fd2ed0Sgs150176 /* 547c7fd2ed0Sgs150176 * Architectural constants: absolute maximum numbers of each type of ring 548c7fd2ed0Sgs150176 */ 549c7fd2ed0Sgs150176 550c7fd2ed0Sgs150176 #define RGE_SEND_SLOTS 1024 551c7fd2ed0Sgs150176 #define RGE_RECV_SLOTS 1024 552c7fd2ed0Sgs150176 #define RGE_BUFF_SIZE_STD 1536 /* 1536 bytes */ 553c7fd2ed0Sgs150176 #define RGE_BUFF_SIZE_JUMBO 7168 /* maximum 7K */ 554c7fd2ed0Sgs150176 #define RGE_JUMBO_SIZE 7014 555aa817493Sgs150176 #define RGE_JUMBO_MTU 7000 556c7fd2ed0Sgs150176 #define RGE_STATS_DUMP_SIZE 64 557c7fd2ed0Sgs150176 558c7fd2ed0Sgs150176 typedef struct rge_bd { 559c7fd2ed0Sgs150176 volatile uint32_t flags_len; 560c7fd2ed0Sgs150176 volatile uint32_t vlan_tag; 561c7fd2ed0Sgs150176 volatile uint32_t host_buf_addr; 562c7fd2ed0Sgs150176 volatile uint32_t host_buf_addr_hi; 563c7fd2ed0Sgs150176 } rge_bd_t; 564c7fd2ed0Sgs150176 565c7fd2ed0Sgs150176 #define BD_FLAG_HW_OWN 0x80000000 566c7fd2ed0Sgs150176 #define BD_FLAG_EOR 0x40000000 567c7fd2ed0Sgs150176 #define BD_FLAG_PKT_START 0x20000000 568c7fd2ed0Sgs150176 #define BD_FLAG_PKT_END 0x10000000 569c7fd2ed0Sgs150176 570c7fd2ed0Sgs150176 #define RBD_FLAG_MULTICAST 0x08000000 571c7fd2ed0Sgs150176 #define RBD_FLAG_UNICAST 0x04000000 572c7fd2ed0Sgs150176 #define RBD_FLAG_BROADCAST 0x02000000 573c7fd2ed0Sgs150176 #define RBD_FLAG_PKT_4096 0x00400000 574c7fd2ed0Sgs150176 #define RBD_FLAG_ERROR 0x00200000 575c7fd2ed0Sgs150176 #define RBD_FLAG_RUNT 0x00100000 576c7fd2ed0Sgs150176 #define RBD_FLAG_CRC_ERR 0x00080000 577c7fd2ed0Sgs150176 #define RBD_FLAG_PROTOCOL 0x00060000 578c7fd2ed0Sgs150176 #define RBD_FLAG_IP 0x00060000 579c7fd2ed0Sgs150176 #define RBD_FLAG_UDP 0x00040000 580c7fd2ed0Sgs150176 #define RBD_FLAG_TCP 0x00020000 581c7fd2ed0Sgs150176 #define RBD_FLAG_NONE_IP 0x00000000 582c7fd2ed0Sgs150176 #define RBD_IP_CKSUM_ERR 0x00010000 583c7fd2ed0Sgs150176 #define RBD_UDP_CKSUM_ERR 0x00008000 584c7fd2ed0Sgs150176 #define RBD_TCP_CKSUM_ERR 0x00004000 585c7fd2ed0Sgs150176 #define RBD_CKSUM_ERR 0x0001c000 586c7fd2ed0Sgs150176 #define RBD_FLAGS_MASK 0xffffc000 587c7fd2ed0Sgs150176 #define RBD_LEN_MASK 0x00003fff 588c7fd2ed0Sgs150176 589c7fd2ed0Sgs150176 #define RBD_VLAN_PKT 0x00010000 590c7fd2ed0Sgs150176 #define RBD_VLAN_TAG 0x0000ffff 591c7fd2ed0Sgs150176 592c7fd2ed0Sgs150176 593c7fd2ed0Sgs150176 #define SBD_FLAG_LARGE_SEND 0x08000000 594c7fd2ed0Sgs150176 #define SBD_FLAG_SEG_MAX 0x07ff0000 595c7fd2ed0Sgs150176 #define SBD_FLAG_IP_CKSUM 0x00040000 596c7fd2ed0Sgs150176 #define SBD_FLAG_UDP_CKSUM 0x00020000 597c7fd2ed0Sgs150176 #define SBD_FLAG_TCP_CKSUM 0x00010000 598c7fd2ed0Sgs150176 #define SBD_FLAG_TCP_UDP_CKSUM 0x00030000 599c7fd2ed0Sgs150176 #define SBD_LEN_MASK 0x0000ffff 600c7fd2ed0Sgs150176 601c7fd2ed0Sgs150176 #define SBD_VLAN_PKT 0x00020000 602c7fd2ed0Sgs150176 #define SBD_VLAN_TAG 0x0000ffff 603c7fd2ed0Sgs150176 604c7fd2ed0Sgs150176 #define SBD_FLAG_TX_PKT (BD_FLAG_HW_OWN | BD_FLAG_PKT_START | \ 605c7fd2ed0Sgs150176 BD_FLAG_PKT_END) 606c7fd2ed0Sgs150176 607c7fd2ed0Sgs150176 /* 608c7fd2ed0Sgs150176 * Chip VLAN TCI format 609c7fd2ed0Sgs150176 * bit0-3: VIDH The high 4 bits of a 12-bit VLAN ID 610c7fd2ed0Sgs150176 * bit4: CFI Canonical format indicator 611c7fd2ed0Sgs150176 * bit5-7: 3-bit 8-level priority 612c7fd2ed0Sgs150176 * bit8-15: The low 8 bits of a 12-bit VLAN ID 613c7fd2ed0Sgs150176 */ 614c7fd2ed0Sgs150176 #define TCI_OS2CHIP(tci) (((tci & 0xff) << 8) | (tci >> 8)) 615c7fd2ed0Sgs150176 #define TCI_CHIP2OS(tci) (((tci & 0xff00) >> 8) | (tci << 8)) 616c7fd2ed0Sgs150176 617c7fd2ed0Sgs150176 /* 618c7fd2ed0Sgs150176 * Hardware-defined Status Block 619c7fd2ed0Sgs150176 */ 620c7fd2ed0Sgs150176 typedef struct rge_hw_stats { 621c7fd2ed0Sgs150176 uint64_t xmt_ok; 622c7fd2ed0Sgs150176 uint64_t rcv_ok; 623c7fd2ed0Sgs150176 uint64_t xmt_err; 624c7fd2ed0Sgs150176 uint32_t rcv_err; 625c7fd2ed0Sgs150176 uint16_t in_discards; 626c7fd2ed0Sgs150176 uint16_t frame_err; 627c7fd2ed0Sgs150176 uint32_t xmt_1col; 628c7fd2ed0Sgs150176 uint32_t xmt_mcol; 629c7fd2ed0Sgs150176 uint64_t unicast_rcv; 630c7fd2ed0Sgs150176 uint64_t brdcst_rcv; 631c7fd2ed0Sgs150176 uint32_t multi_rcv; 632c7fd2ed0Sgs150176 uint16_t xmt_abt; 633c7fd2ed0Sgs150176 uint16_t xmt_undrn; 634c7fd2ed0Sgs150176 } rge_hw_stats_t; /* total 64 bytes */ 635c7fd2ed0Sgs150176 636c7fd2ed0Sgs150176 #ifdef __cplusplus 637c7fd2ed0Sgs150176 } 638c7fd2ed0Sgs150176 #endif 639c7fd2ed0Sgs150176 640c7fd2ed0Sgs150176 #endif /* _RGE_HW_H */ 641