📄 e1000_hw.h
字号:
int32_t e1000_init_eeprom_params(struct e1000_hw *hw);/* MNG HOST IF functions */uint32_t e1000_enable_mng_pass_thru(struct e1000_hw *hw);#define E1000_MNG_DHCP_TX_PAYLOAD_CMD 64#define E1000_HI_MAX_MNG_DATA_LENGTH 0x6F8 /* Host Interface data length */#define E1000_MNG_DHCP_COMMAND_TIMEOUT 10 /* Time in ms to process MNG command */#define E1000_MNG_DHCP_COOKIE_OFFSET 0x6F0 /* Cookie offset */#define E1000_MNG_DHCP_COOKIE_LENGTH 0x10 /* Cookie length */#define E1000_MNG_IAMT_MODE 0x3#define E1000_MNG_ICH_IAMT_MODE 0x2#define E1000_IAMT_SIGNATURE 0x544D4149 /* Intel(R) Active Management Technology signature */#define E1000_MNG_DHCP_COOKIE_STATUS_PARSING_SUPPORT 0x1 /* DHCP parsing enabled */#define E1000_MNG_DHCP_COOKIE_STATUS_VLAN_SUPPORT 0x2 /* DHCP parsing enabled */#define E1000_VFTA_ENTRY_SHIFT 0x5#define E1000_VFTA_ENTRY_MASK 0x7F#define E1000_VFTA_ENTRY_BIT_SHIFT_MASK 0x1Fstruct e1000_host_mng_command_header { uint8_t command_id; uint8_t checksum; uint16_t reserved1; uint16_t reserved2; uint16_t command_length;};struct e1000_host_mng_command_info { struct e1000_host_mng_command_header command_header; /* Command Head/Command Result Head has 4 bytes */ uint8_t command_data[E1000_HI_MAX_MNG_DATA_LENGTH]; /* Command data can length 0..0x658*/};#ifdef E1000_BIG_ENDIANstruct e1000_host_mng_dhcp_cookie{ uint32_t signature; uint16_t vlan_id; uint8_t reserved0; uint8_t status; uint32_t reserved1; uint8_t checksum; uint8_t reserved3; uint16_t reserved2;};#elsestruct e1000_host_mng_dhcp_cookie{ uint32_t signature; uint8_t status; uint8_t reserved0; uint16_t vlan_id; uint32_t reserved1; uint16_t reserved2; uint8_t reserved3; uint8_t checksum;};#endifint32_t e1000_mng_write_dhcp_info(struct e1000_hw *hw, uint8_t *buffer, uint16_t length);boolean_t e1000_check_mng_mode(struct e1000_hw *hw);boolean_t e1000_enable_tx_pkt_filtering(struct e1000_hw *hw);int32_t e1000_read_eeprom(struct e1000_hw *hw, uint16_t reg, uint16_t words, uint16_t *data);int32_t e1000_validate_eeprom_checksum(struct e1000_hw *hw);int32_t e1000_update_eeprom_checksum(struct e1000_hw *hw);int32_t e1000_write_eeprom(struct e1000_hw *hw, uint16_t reg, uint16_t words, uint16_t *data);int32_t e1000_read_mac_addr(struct e1000_hw * hw);/* Filters (multicast, vlan, receive) */void e1000_mc_addr_list_update(struct e1000_hw *hw, uint8_t * mc_addr_list, uint32_t mc_addr_count, uint32_t pad, uint32_t rar_used_count);uint32_t e1000_hash_mc_addr(struct e1000_hw *hw, uint8_t * mc_addr);void e1000_mta_set(struct e1000_hw *hw, uint32_t hash_value);void e1000_rar_set(struct e1000_hw *hw, uint8_t * mc_addr, uint32_t rar_index);void e1000_write_vfta(struct e1000_hw *hw, uint32_t offset, uint32_t value);/* LED functions */int32_t e1000_setup_led(struct e1000_hw *hw);int32_t e1000_cleanup_led(struct e1000_hw *hw);int32_t e1000_led_on(struct e1000_hw *hw);int32_t e1000_led_off(struct e1000_hw *hw);int32_t e1000_blink_led_start(struct e1000_hw *hw);/* Adaptive IFS Functions *//* Everything else */void e1000_reset_adaptive(struct e1000_hw *hw);void e1000_update_adaptive(struct e1000_hw *hw);void e1000_tbi_adjust_stats(struct e1000_hw *hw, struct e1000_hw_stats *stats, uint32_t frame_len, uint8_t * mac_addr);void e1000_get_bus_info(struct e1000_hw *hw);void e1000_pci_set_mwi(struct e1000_hw *hw);void e1000_pci_clear_mwi(struct e1000_hw *hw);void e1000_read_pci_cfg(struct e1000_hw *hw, uint32_t reg, uint16_t * value);void e1000_write_pci_cfg(struct e1000_hw *hw, uint32_t reg, uint16_t * value);int32_t e1000_read_pcie_cap_reg(struct e1000_hw *hw, uint32_t reg, uint16_t *value);/* Port I/O is only supported on 82544 and newer */uint32_t e1000_io_read(struct e1000_hw *hw, unsigned long port);void e1000_io_write(struct e1000_hw *hw, unsigned long port, uint32_t value);int32_t e1000_disable_pciex_master(struct e1000_hw *hw);int32_t e1000_check_phy_reset_block(struct e1000_hw *hw);#define E1000_READ_REG_IO(a, reg) \ e1000_read_reg_io((a), E1000_##reg)#define E1000_WRITE_REG_IO(a, reg, val) \ e1000_write_reg_io((a), E1000_##reg, val)/* PCI Device IDs */#define E1000_DEV_ID_82542 0x1000#define E1000_DEV_ID_82543GC_FIBER 0x1001#define E1000_DEV_ID_82543GC_COPPER 0x1004#define E1000_DEV_ID_82544EI_COPPER 0x1008#define E1000_DEV_ID_82544EI_FIBER 0x1009#define E1000_DEV_ID_82544GC_COPPER 0x100C#define E1000_DEV_ID_82544GC_LOM 0x100D#define E1000_DEV_ID_82540EM 0x100E#define E1000_DEV_ID_82540EM_LOM 0x1015#define E1000_DEV_ID_82540EP_LOM 0x1016#define E1000_DEV_ID_82540EP 0x1017#define E1000_DEV_ID_82540EP_LP 0x101E#define E1000_DEV_ID_82545EM_COPPER 0x100F#define E1000_DEV_ID_82545EM_FIBER 0x1011#define E1000_DEV_ID_82545GM_COPPER 0x1026#define E1000_DEV_ID_82545GM_FIBER 0x1027#define E1000_DEV_ID_82545GM_SERDES 0x1028#define E1000_DEV_ID_82546EB_COPPER 0x1010#define E1000_DEV_ID_82546EB_FIBER 0x1012#define E1000_DEV_ID_82546EB_QUAD_COPPER 0x101D#define E1000_DEV_ID_82541EI 0x1013#define E1000_DEV_ID_82541EI_MOBILE 0x1018#define E1000_DEV_ID_82541ER_LOM 0x1014#define E1000_DEV_ID_82541ER 0x1078#define E1000_DEV_ID_82547GI 0x1075#define E1000_DEV_ID_82541GI 0x1076#define E1000_DEV_ID_82541GI_MOBILE 0x1077#define E1000_DEV_ID_82541GI_LF 0x107C#define E1000_DEV_ID_82546GB_COPPER 0x1079#define E1000_DEV_ID_82546GB_FIBER 0x107A#define E1000_DEV_ID_82546GB_SERDES 0x107B#define E1000_DEV_ID_82546GB_PCIE 0x108A#define E1000_DEV_ID_82546GB_QUAD_COPPER 0x1099#define E1000_DEV_ID_82547EI 0x1019#define E1000_DEV_ID_82547EI_MOBILE 0x101A#define E1000_DEV_ID_82571EB_COPPER 0x105E#define E1000_DEV_ID_82571EB_FIBER 0x105F#define E1000_DEV_ID_82571EB_SERDES 0x1060#define E1000_DEV_ID_82571EB_QUAD_COPPER 0x10A4#define E1000_DEV_ID_82572EI_COPPER 0x107D#define E1000_DEV_ID_82572EI_FIBER 0x107E#define E1000_DEV_ID_82572EI_SERDES 0x107F#define E1000_DEV_ID_82572EI 0x10B9#define E1000_DEV_ID_82573E 0x108B#define E1000_DEV_ID_82573E_IAMT 0x108C#define E1000_DEV_ID_82573L 0x109A#define E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3 0x10B5#define E1000_DEV_ID_80003ES2LAN_COPPER_DPT 0x1096#define E1000_DEV_ID_80003ES2LAN_SERDES_DPT 0x1098#define E1000_DEV_ID_80003ES2LAN_COPPER_SPT 0x10BA#define E1000_DEV_ID_80003ES2LAN_SERDES_SPT 0x10BB#define E1000_DEV_ID_ICH8_IGP_M_AMT 0x1049#define E1000_DEV_ID_ICH8_IGP_AMT 0x104A#define E1000_DEV_ID_ICH8_IGP_C 0x104B#define E1000_DEV_ID_ICH8_IFE 0x104C#define E1000_DEV_ID_ICH8_IGP_M 0x104D#define NODE_ADDRESS_SIZE 6#define ETH_LENGTH_OF_ADDRESS 6/* MAC decode size is 128K - This is the size of BAR0 */#define MAC_DECODE_SIZE (128 * 1024)#define E1000_82542_2_0_REV_ID 2#define E1000_82542_2_1_REV_ID 3#define E1000_REVISION_0 0#define E1000_REVISION_1 1#define E1000_REVISION_2 2#define E1000_REVISION_3 3#define SPEED_10 10#define SPEED_100 100#define SPEED_1000 1000#define HALF_DUPLEX 1#define FULL_DUPLEX 2/* The sizes (in bytes) of a ethernet packet */#define ENET_HEADER_SIZE 14#define MAXIMUM_ETHERNET_FRAME_SIZE 1518 /* With FCS */#define MINIMUM_ETHERNET_FRAME_SIZE 64 /* With FCS */#define ETHERNET_FCS_SIZE 4#define MAXIMUM_ETHERNET_PACKET_SIZE \ (MAXIMUM_ETHERNET_FRAME_SIZE - ETHERNET_FCS_SIZE)#define MINIMUM_ETHERNET_PACKET_SIZE \ (MINIMUM_ETHERNET_FRAME_SIZE - ETHERNET_FCS_SIZE)#define CRC_LENGTH ETHERNET_FCS_SIZE#define MAX_JUMBO_FRAME_SIZE 0x3F00/* 802.1q VLAN Packet Sizes */#define VLAN_TAG_SIZE 4 /* 802.3ac tag (not DMAed) *//* Ethertype field values */#define ETHERNET_IEEE_VLAN_TYPE 0x8100 /* 802.3ac packet */#define ETHERNET_IP_TYPE 0x0800 /* IP packets */#define ETHERNET_ARP_TYPE 0x0806 /* Address Resolution Protocol (ARP) *//* Packet Header defines */#define IP_PROTOCOL_TCP 6#define IP_PROTOCOL_UDP 0x11/* This defines the bits that are set in the Interrupt Mask * Set/Read Register. Each bit is documented below: * o RXDMT0 = Receive Descriptor Minimum Threshold hit (ring 0) * o RXSEQ = Receive Sequence Error */#define POLL_IMS_ENABLE_MASK ( \ E1000_IMS_RXDMT0 | \ E1000_IMS_RXSEQ)/* This defines the bits that are set in the Interrupt Mask * Set/Read Register. Each bit is documented below: * o RXT0 = Receiver Timer Interrupt (ring 0) * o TXDW = Transmit Descriptor Written Back * o RXDMT0 = Receive Descriptor Minimum Threshold hit (ring 0) * o RXSEQ = Receive Sequence Error * o LSC = Link Status Change */#define IMS_ENABLE_MASK ( \ E1000_IMS_RXT0 | \ E1000_IMS_TXDW | \ E1000_IMS_RXDMT0 | \ E1000_IMS_RXSEQ | \ E1000_IMS_LSC)/* Additional interrupts need to be handled for e1000_ich8lan: DSW = The FW changed the status of the DISSW bit in FWSM PHYINT = The LAN connected device generates an interrupt EPRST = Manageability reset event */#define IMS_ICH8LAN_ENABLE_MASK (\ E1000_IMS_DSW | \ E1000_IMS_PHYINT | \ E1000_IMS_EPRST)/* Number of high/low register pairs in the RAR. The RAR (Receive Address * Registers) holds the directed and multicast addresses that we monitor. We * reserve one of these spots for our directed address, allowing us room for * E1000_RAR_ENTRIES - 1 multicast addresses. */#define E1000_RAR_ENTRIES 15#define E1000_RAR_ENTRIES_ICH8LAN 6#define MIN_NUMBER_OF_DESCRIPTORS 8#define MAX_NUMBER_OF_DESCRIPTORS 0xFFF8/* Receive Descriptor */struct e1000_rx_desc { uint64_t buffer_addr; /* Address of the descriptor's data buffer */ uint16_t length; /* Length of data DMAed into data buffer */ uint16_t csum; /* Packet checksum */ uint8_t status; /* Descriptor status */ uint8_t errors; /* Descriptor Errors */ uint16_t special;};/* Receive Descriptor - Extended */union e1000_rx_desc_extended { struct { uint64_t buffer_addr; uint64_t reserved; } read; struct { struct { uint32_t mrq; /* Multiple Rx Queues */ union { uint32_t rss; /* RSS Hash */ struct { uint16_t ip_id; /* IP id */ uint16_t csum; /* Packet Checksum */ } csum_ip; } hi_dword; } lower; struct { uint32_t status_error; /* ext status/error */ uint16_t length; uint16_t vlan; /* VLAN tag */ } upper; } wb; /* writeback */};#define MAX_PS_BUFFERS 4/* Receive Descriptor - Packet Split */union e1000_rx_desc_packet_split { struct { /* one buffer for protocol header(s), three data buffers */ uint64_t buffer_addr[MAX_PS_BUFFERS]; } read; struct { struct { uint32_t mrq; /* Multiple Rx Queues */ union { uint32_t rss; /* RSS Hash */ struct { uint16_t ip_id; /* IP id */ uint16_t csum; /* Packet Checksum */ } csum_ip; } hi_dword; } lower; struct { uint32_t status_error; /* ext status/error */ uint16_t length0; /* length of buffer 0 */ uint16_t vlan; /* VLAN tag */ } middle; struct { uint16_t header_status; uint16_t length[3]; /* length of buffers 1-3 */ } upper; uint64_t reserved; } wb; /* writeback */};/* Receive Decriptor bit definitions */#define E1000_RXD_STAT_DD 0x01 /* Descriptor Done */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -