1 /** 2 * @file e1000_reg.h 3 * 4 * @brief Hardware specific registers and flags of the Intel 5 * Pro/1000 Gigabit Ethernet card(s). 6 * 7 * Parts of this code is based on the DragonflyBSD (FreeBSD) 8 * implementation, and the fxp driver for Minix 3. 9 * 10 * @see http://svn.freebsd.org/viewvc/base/head/sys/dev/e1000/ 11 * @see fxp.c 12 * 13 * @author Niek Linnenbank <nieklinnenbank@gmail.com> 14 * @date September 2009 15 * 16 */ 17 18 #ifndef __E1000_REG_H 19 #define __E1000_REG_H 20 21 /** 22 * @name Controller Registers. 23 * @{ 24 */ 25 26 /** Device Control. */ 27 #define E1000_REG_CTRL 0x00000 28 29 /** Device Status. */ 30 #define E1000_REG_STATUS 0x00008 31 32 /** EEPROM Read. */ 33 #define E1000_REG_EERD 0x00014 34 35 /** Flow Control Address Low. */ 36 #define E1000_REG_FCAL 0x00028 37 38 /** Flow Control Address High. */ 39 #define E1000_REG_FCAH 0x0002c 40 41 /** Flow Control Type. */ 42 #define E1000_REG_FCT 0x00030 43 44 /** Interrupt Cause Read. */ 45 #define E1000_REG_ICR 0x000c0 46 47 /** Interrupt Mask Set/Read Register. */ 48 #define E1000_REG_IMS 0x000d0 49 50 /** Receive Control Register. */ 51 #define E1000_REG_RCTL 0x00100 52 53 /** Transmit Control Register. */ 54 #define E1000_REG_TCTL 0x00400 55 56 /** Flow Control Transmit Timer Value. */ 57 #define E1000_REG_FCTTV 0x00170 58 59 /** Receive Descriptor Base Address Low. */ 60 #define E1000_REG_RDBAL 0x02800 61 62 /** Receive Descriptor Base Address High. */ 63 #define E1000_REG_RDBAH 0x02804 64 65 /** Receive Descriptor Length. */ 66 #define E1000_REG_RDLEN 0x02808 67 68 /** Receive Descriptor Head. */ 69 #define E1000_REG_RDH 0x02810 70 71 /** Receive Descriptor Tail. */ 72 #define E1000_REG_RDT 0x02818 73 74 /** Transmit Descriptor Base Address Low. */ 75 #define E1000_REG_TDBAL 0x03800 76 77 /** Transmit Descriptor Base Address High. */ 78 #define E1000_REG_TDBAH 0x03804 79 80 /** Transmit Descriptor Length. */ 81 #define E1000_REG_TDLEN 0x03808 82 83 /** Transmit Descriptor Head. */ 84 #define E1000_REG_TDH 0x03810 85 86 /** Transmit Descriptor Tail. */ 87 #define E1000_REG_TDT 0x03818 88 89 /** CRC Error Count. */ 90 #define E1000_REG_CRCERRS 0x04000 91 92 /** RX Error Count. */ 93 #define E1000_REG_RXERRC 0x0400c 94 95 /** Missed Packets Count. */ 96 #define E1000_REG_MPC 0x04010 97 98 /** Collision Count. */ 99 #define E1000_REG_COLC 0x04028 100 101 /** Total Packets Received. */ 102 #define E1000_REG_TPR 0x040D0 103 104 /** Total Packets Transmitted. */ 105 #define E1000_REG_TPT 0x040D4 106 107 /** Receive Address Low. */ 108 #define E1000_REG_RAL 0x05400 109 110 /** Receive Address High. */ 111 #define E1000_REG_RAH 0x05404 112 113 /** Multicast Table Array. */ 114 #define E1000_REG_MTA 0x05200 115 116 /** 117 * @} 118 */ 119 120 /** 121 * @name Control Register Bits. 122 * @{ 123 */ 124 125 /** Auto-Speed Detection Enable. */ 126 #define E1000_REG_CTRL_ASDE (1 << 5) 127 128 /** Link Reset. */ 129 #define E1000_REG_CTRL_LRST (1 << 3) 130 131 /** Set Link Up. */ 132 #define E1000_REG_CTRL_SLU (1 << 6) 133 134 /** Invert Los Of Signal. */ 135 #define E1000_REG_CTRL_ILOS (1 << 7) 136 137 /** Device Reset. */ 138 #define E1000_REG_CTRL_RST (1 << 26) 139 140 /** VLAN Mode Enable. */ 141 #define E1000_REG_CTRL_VME (1 << 30) 142 143 /** PHY Reset. */ 144 #define E1000_REG_CTRL_PHY_RST (1 << 31) 145 146 /** 147 * @} 148 */ 149 150 /** 151 * @name Status Register Bits. 152 * @{ 153 */ 154 155 /** Link Full Duplex Configuration Indication. */ 156 #define E1000_REG_STATUS_FD (1 << 0) 157 158 /** Link Up Indication. */ 159 #define E1000_REG_STATUS_LU (1 << 1) 160 161 /** Transmission Paused. */ 162 #define E1000_REG_STATUS_TXOFF (1 << 4) 163 164 /** Link Speed Setting. */ 165 #define E1000_REG_STATUS_SPEED ((1 << 6) | (1 << 7)) 166 167 #define E1000_REG_STATUS_SPEED_10 (0 << 6) /* 10 Mb/s */ 168 #define E1000_REG_STATUS_SPEED_100 (1 << 6) /* 100 Mb/s */ 169 #define E1000_REG_STATUS_SPEED_1000_A (2 << 6) /* 1000 Mb/s */ 170 #define E1000_REG_STATUS_SPEED_1000_B (3 << 6) /* 1000 Mb/s */ 171 172 /** 173 * @} 174 */ 175 176 /** 177 * @name EEPROM Read Register Bits. 178 * @{ 179 */ 180 181 /** Start Read. */ 182 #define E1000_REG_EERD_START (1 << 0) 183 184 /** Read Done. */ 185 #define E1000_REG_EERD_DONE (1 << 4) 186 187 /** Read Address Bit Mask. */ 188 #define E1000_REG_EERD_ADDR (0xff << 8) 189 190 /** Read Data Bit Mask. */ 191 #define E1000_REG_EERD_DATA (0xffff << 16) 192 193 /** 194 * @} 195 */ 196 197 /** 198 * @name Interrupt Cause Read. 199 * @{ 200 */ 201 202 /** Transmit Descripts Written Back. */ 203 #define E1000_REG_ICR_TXDW (1 << 0) 204 205 /** Transmit Queue Empty. */ 206 #define E1000_REG_ICR_TXQE (1 << 1) 207 208 /** Link Status Change. */ 209 #define E1000_REG_ICR_LSC (1 << 2) 210 211 /** Receiver Overrun. */ 212 #define E1000_REG_ICR_RXO (1 << 6) 213 214 /** Receiver Timer Interrupt. */ 215 #define E1000_REG_ICR_RXT (1 << 7) 216 217 /** 218 * @} 219 */ 220 221 /** 222 * @name Interrupt Mask Set/Read Register Bits. 223 * @{ 224 */ 225 226 /** Transmit Descripts Written Back. */ 227 #define E1000_REG_IMS_TXDW (1 << 0) 228 229 /** Transmit Queue Empty. */ 230 #define E1000_REG_IMS_TXQE (1 << 1) 231 232 /** Link Status Change. */ 233 #define E1000_REG_IMS_LSC (1 << 2) 234 235 /** Receiver FIFO Overrun. */ 236 #define E1000_REG_IMS_RXO (1 << 6) 237 238 /** Receiver Timer Interrupt. */ 239 #define E1000_REG_IMS_RXT (1 << 7) 240 241 /** 242 * @} 243 */ 244 245 /** 246 * @name Receive Control Register Bits. 247 * @{ 248 */ 249 250 /** Receive Enable. */ 251 #define E1000_REG_RCTL_EN (1 << 1) 252 253 /** Unicast Promiscuous Enable. */ 254 #define E1000_REG_RCTL_UPE (1 << 3) 255 256 /** Multicast Promiscuous Enable. */ 257 #define E1000_REG_RCTL_MPE (1 << 4) 258 259 /** Broadcast Accept Mode. */ 260 #define E1000_REG_RCTL_BAM (1 << 15) 261 262 /** Receive Buffer Size. */ 263 #define E1000_REG_RCTL_BSIZE ((1 << 16) | (1 << 17)) 264 265 /** 266 * @} 267 */ 268 269 /** 270 * @name Transmit Control Register Bits. 271 * @{ 272 */ 273 274 /** Transmit Enable. */ 275 #define E1000_REG_TCTL_EN (1 << 1) 276 277 /** Pad Short Packets. */ 278 #define E1000_REG_TCTL_PSP (1 << 3) 279 280 /** 281 * @} 282 */ 283 284 /** 285 * @name Receive Address High Register Bits. 286 * @{ 287 */ 288 289 /** Receive Address Valid. */ 290 #define E1000_REG_RAH_AV (1 << 31) 291 292 /** 293 * @} 294 */ 295 296 /** 297 * @name ICH Flash Registers. 298 * @see http://gitweb.dragonflybsd.org 299 * @{ 300 */ 301 302 #define ICH_FLASH_GFPREG 0x0000 303 #define ICH_FLASH_HSFSTS 0x0004 304 #define ICH_FLASH_HSFCTL 0x0006 305 #define ICH_FLASH_FADDR 0x0008 306 #define ICH_FLASH_FDATA0 0x0010 307 #define FLASH_GFPREG_BASE_MASK 0x1FFF 308 #define FLASH_SECTOR_ADDR_SHIFT 12 309 #define ICH_FLASH_READ_COMMAND_TIMEOUT 500 310 #define ICH_FLASH_LINEAR_ADDR_MASK 0x00FFFFFF 311 #define ICH_CYCLE_READ 0 312 #define ICH_FLASH_CYCLE_REPEAT_COUNT 10 313 314 /** 315 * @} 316 */ 317 318 #endif /* __E1000_REG_H */ 319