18cfa0ad2SJack F Vogel /****************************************************************************** 28cfa0ad2SJack F Vogel 3a69ed8dfSJack F Vogel Copyright (c) 2001-2010, Intel Corporation 48cfa0ad2SJack F Vogel All rights reserved. 58cfa0ad2SJack F Vogel 68cfa0ad2SJack F Vogel Redistribution and use in source and binary forms, with or without 78cfa0ad2SJack F Vogel modification, are permitted provided that the following conditions are met: 88cfa0ad2SJack F Vogel 98cfa0ad2SJack F Vogel 1. Redistributions of source code must retain the above copyright notice, 108cfa0ad2SJack F Vogel this list of conditions and the following disclaimer. 118cfa0ad2SJack F Vogel 128cfa0ad2SJack F Vogel 2. Redistributions in binary form must reproduce the above copyright 138cfa0ad2SJack F Vogel notice, this list of conditions and the following disclaimer in the 148cfa0ad2SJack F Vogel documentation and/or other materials provided with the distribution. 158cfa0ad2SJack F Vogel 168cfa0ad2SJack F Vogel 3. Neither the name of the Intel Corporation nor the names of its 178cfa0ad2SJack F Vogel contributors may be used to endorse or promote products derived from 188cfa0ad2SJack F Vogel this software without specific prior written permission. 198cfa0ad2SJack F Vogel 208cfa0ad2SJack F Vogel THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 218cfa0ad2SJack F Vogel AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 228cfa0ad2SJack F Vogel IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 238cfa0ad2SJack F Vogel ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 248cfa0ad2SJack F Vogel LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 258cfa0ad2SJack F Vogel CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 268cfa0ad2SJack F Vogel SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 278cfa0ad2SJack F Vogel INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 288cfa0ad2SJack F Vogel CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 298cfa0ad2SJack F Vogel ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 308cfa0ad2SJack F Vogel POSSIBILITY OF SUCH DAMAGE. 318cfa0ad2SJack F Vogel 328cfa0ad2SJack F Vogel ******************************************************************************/ 338cfa0ad2SJack F Vogel /*$FreeBSD$*/ 348cfa0ad2SJack F Vogel 358cfa0ad2SJack F Vogel #ifndef _E1000_API_H_ 368cfa0ad2SJack F Vogel #define _E1000_API_H_ 378cfa0ad2SJack F Vogel 388cfa0ad2SJack F Vogel #include "e1000_hw.h" 398cfa0ad2SJack F Vogel 408cfa0ad2SJack F Vogel extern void e1000_init_function_pointers_82542(struct e1000_hw *hw); 418cfa0ad2SJack F Vogel extern void e1000_init_function_pointers_82543(struct e1000_hw *hw); 428cfa0ad2SJack F Vogel extern void e1000_init_function_pointers_82540(struct e1000_hw *hw); 438cfa0ad2SJack F Vogel extern void e1000_init_function_pointers_82571(struct e1000_hw *hw); 448cfa0ad2SJack F Vogel extern void e1000_init_function_pointers_82541(struct e1000_hw *hw); 458cfa0ad2SJack F Vogel extern void e1000_init_function_pointers_80003es2lan(struct e1000_hw *hw); 468cfa0ad2SJack F Vogel extern void e1000_init_function_pointers_ich8lan(struct e1000_hw *hw); 478cfa0ad2SJack F Vogel extern void e1000_init_function_pointers_82575(struct e1000_hw *hw); 488cfa0ad2SJack F Vogel extern void e1000_rx_fifo_flush_82575(struct e1000_hw *hw); 498cfa0ad2SJack F Vogel extern void e1000_init_function_pointers_vf(struct e1000_hw *hw); 50a69ed8dfSJack F Vogel extern void e1000_power_up_fiber_serdes_link(struct e1000_hw *hw); 518cfa0ad2SJack F Vogel extern void e1000_shutdown_fiber_serdes_link(struct e1000_hw *hw); 528cfa0ad2SJack F Vogel 538cfa0ad2SJack F Vogel s32 e1000_set_mac_type(struct e1000_hw *hw); 548cfa0ad2SJack F Vogel s32 e1000_setup_init_funcs(struct e1000_hw *hw, bool init_device); 558cfa0ad2SJack F Vogel s32 e1000_init_mac_params(struct e1000_hw *hw); 568cfa0ad2SJack F Vogel s32 e1000_init_nvm_params(struct e1000_hw *hw); 578cfa0ad2SJack F Vogel s32 e1000_init_phy_params(struct e1000_hw *hw); 58b8270585SJack F Vogel s32 e1000_init_mbx_params(struct e1000_hw *hw); 598cfa0ad2SJack F Vogel s32 e1000_get_bus_info(struct e1000_hw *hw); 608cfa0ad2SJack F Vogel void e1000_clear_vfta(struct e1000_hw *hw); 618cfa0ad2SJack F Vogel void e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value); 628cfa0ad2SJack F Vogel s32 e1000_force_mac_fc(struct e1000_hw *hw); 638cfa0ad2SJack F Vogel s32 e1000_check_for_link(struct e1000_hw *hw); 648cfa0ad2SJack F Vogel s32 e1000_reset_hw(struct e1000_hw *hw); 658cfa0ad2SJack F Vogel s32 e1000_init_hw(struct e1000_hw *hw); 668cfa0ad2SJack F Vogel s32 e1000_setup_link(struct e1000_hw *hw); 678cfa0ad2SJack F Vogel s32 e1000_get_speed_and_duplex(struct e1000_hw *hw, u16 *speed, 688cfa0ad2SJack F Vogel u16 *duplex); 698cfa0ad2SJack F Vogel s32 e1000_disable_pcie_master(struct e1000_hw *hw); 708cfa0ad2SJack F Vogel void e1000_config_collision_dist(struct e1000_hw *hw); 718cfa0ad2SJack F Vogel void e1000_rar_set(struct e1000_hw *hw, u8 *addr, u32 index); 728cfa0ad2SJack F Vogel u32 e1000_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr); 738cfa0ad2SJack F Vogel void e1000_update_mc_addr_list(struct e1000_hw *hw, 74d035aa2dSJack F Vogel u8 *mc_addr_list, u32 mc_addr_count); 758cfa0ad2SJack F Vogel s32 e1000_setup_led(struct e1000_hw *hw); 768cfa0ad2SJack F Vogel s32 e1000_cleanup_led(struct e1000_hw *hw); 778cfa0ad2SJack F Vogel s32 e1000_check_reset_block(struct e1000_hw *hw); 788cfa0ad2SJack F Vogel s32 e1000_blink_led(struct e1000_hw *hw); 798cfa0ad2SJack F Vogel s32 e1000_led_on(struct e1000_hw *hw); 808cfa0ad2SJack F Vogel s32 e1000_led_off(struct e1000_hw *hw); 81d035aa2dSJack F Vogel s32 e1000_id_led_init(struct e1000_hw *hw); 828cfa0ad2SJack F Vogel void e1000_reset_adaptive(struct e1000_hw *hw); 838cfa0ad2SJack F Vogel void e1000_update_adaptive(struct e1000_hw *hw); 848cfa0ad2SJack F Vogel s32 e1000_get_cable_length(struct e1000_hw *hw); 858cfa0ad2SJack F Vogel s32 e1000_validate_mdi_setting(struct e1000_hw *hw); 868cfa0ad2SJack F Vogel s32 e1000_read_phy_reg(struct e1000_hw *hw, u32 offset, u16 *data); 878cfa0ad2SJack F Vogel s32 e1000_write_phy_reg(struct e1000_hw *hw, u32 offset, u16 data); 888cfa0ad2SJack F Vogel s32 e1000_write_8bit_ctrl_reg(struct e1000_hw *hw, u32 reg, 898cfa0ad2SJack F Vogel u32 offset, u8 data); 908cfa0ad2SJack F Vogel s32 e1000_get_phy_info(struct e1000_hw *hw); 918cfa0ad2SJack F Vogel void e1000_release_phy(struct e1000_hw *hw); 928cfa0ad2SJack F Vogel s32 e1000_acquire_phy(struct e1000_hw *hw); 93daf9197cSJack F Vogel s32 e1000_cfg_on_link_up(struct e1000_hw *hw); 948cfa0ad2SJack F Vogel s32 e1000_phy_hw_reset(struct e1000_hw *hw); 958cfa0ad2SJack F Vogel s32 e1000_phy_commit(struct e1000_hw *hw); 968cfa0ad2SJack F Vogel void e1000_power_up_phy(struct e1000_hw *hw); 978cfa0ad2SJack F Vogel void e1000_power_down_phy(struct e1000_hw *hw); 988cfa0ad2SJack F Vogel s32 e1000_read_mac_addr(struct e1000_hw *hw); 998cfa0ad2SJack F Vogel s32 e1000_read_pba_num(struct e1000_hw *hw, u32 *part_num); 100*7d9119bdSJack F Vogel s32 e1000_read_pba_string(struct e1000_hw *hw, u8 *pba_num, 101*7d9119bdSJack F Vogel u32 pba_num_size); 102*7d9119bdSJack F Vogel s32 e1000_read_pba_length(struct e1000_hw *hw, u32 *pba_num_size); 1038cfa0ad2SJack F Vogel void e1000_reload_nvm(struct e1000_hw *hw); 1048cfa0ad2SJack F Vogel s32 e1000_update_nvm_checksum(struct e1000_hw *hw); 1058cfa0ad2SJack F Vogel s32 e1000_validate_nvm_checksum(struct e1000_hw *hw); 1068cfa0ad2SJack F Vogel s32 e1000_read_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data); 1078cfa0ad2SJack F Vogel s32 e1000_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data); 1088cfa0ad2SJack F Vogel s32 e1000_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data); 1098cfa0ad2SJack F Vogel s32 e1000_write_nvm(struct e1000_hw *hw, u16 offset, u16 words, 1108cfa0ad2SJack F Vogel u16 *data); 1118cfa0ad2SJack F Vogel s32 e1000_wait_autoneg(struct e1000_hw *hw); 1128cfa0ad2SJack F Vogel s32 e1000_set_d3_lplu_state(struct e1000_hw *hw, bool active); 1138cfa0ad2SJack F Vogel s32 e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active); 1148cfa0ad2SJack F Vogel bool e1000_check_mng_mode(struct e1000_hw *hw); 1158cfa0ad2SJack F Vogel bool e1000_enable_tx_pkt_filtering(struct e1000_hw *hw); 1168cfa0ad2SJack F Vogel s32 e1000_mng_enable_host_if(struct e1000_hw *hw); 1178cfa0ad2SJack F Vogel s32 e1000_mng_host_if_write(struct e1000_hw *hw, 1188cfa0ad2SJack F Vogel u8 *buffer, u16 length, u16 offset, u8 *sum); 1198cfa0ad2SJack F Vogel s32 e1000_mng_write_cmd_header(struct e1000_hw *hw, 1208cfa0ad2SJack F Vogel struct e1000_host_mng_command_header *hdr); 1218cfa0ad2SJack F Vogel s32 e1000_mng_write_dhcp_info(struct e1000_hw * hw, 1228cfa0ad2SJack F Vogel u8 *buffer, u16 length); 1238cfa0ad2SJack F Vogel u32 e1000_translate_register_82542(u32 reg); 1248cfa0ad2SJack F Vogel 1258cfa0ad2SJack F Vogel /* 1268cfa0ad2SJack F Vogel * TBI_ACCEPT macro definition: 1278cfa0ad2SJack F Vogel * 1288cfa0ad2SJack F Vogel * This macro requires: 1298cfa0ad2SJack F Vogel * adapter = a pointer to struct e1000_hw 1308cfa0ad2SJack F Vogel * status = the 8 bit status field of the Rx descriptor with EOP set 1318cfa0ad2SJack F Vogel * error = the 8 bit error field of the Rx descriptor with EOP set 1328cfa0ad2SJack F Vogel * length = the sum of all the length fields of the Rx descriptors that 1338cfa0ad2SJack F Vogel * make up the current frame 1348cfa0ad2SJack F Vogel * last_byte = the last byte of the frame DMAed by the hardware 1358cfa0ad2SJack F Vogel * max_frame_length = the maximum frame length we want to accept. 1368cfa0ad2SJack F Vogel * min_frame_length = the minimum frame length we want to accept. 1378cfa0ad2SJack F Vogel * 1388cfa0ad2SJack F Vogel * This macro is a conditional that should be used in the interrupt 1398cfa0ad2SJack F Vogel * handler's Rx processing routine when RxErrors have been detected. 1408cfa0ad2SJack F Vogel * 1418cfa0ad2SJack F Vogel * Typical use: 1428cfa0ad2SJack F Vogel * ... 1438cfa0ad2SJack F Vogel * if (TBI_ACCEPT) { 1448cfa0ad2SJack F Vogel * accept_frame = TRUE; 1458cfa0ad2SJack F Vogel * e1000_tbi_adjust_stats(adapter, MacAddress); 1468cfa0ad2SJack F Vogel * frame_length--; 1478cfa0ad2SJack F Vogel * } else { 1488cfa0ad2SJack F Vogel * accept_frame = FALSE; 1498cfa0ad2SJack F Vogel * } 1508cfa0ad2SJack F Vogel * ... 1518cfa0ad2SJack F Vogel */ 1528cfa0ad2SJack F Vogel 1538cfa0ad2SJack F Vogel /* The carrier extension symbol, as received by the NIC. */ 1548cfa0ad2SJack F Vogel #define CARRIER_EXTENSION 0x0F 1558cfa0ad2SJack F Vogel 1568cfa0ad2SJack F Vogel #define TBI_ACCEPT(a, status, errors, length, last_byte, min_frame_size, max_frame_size) \ 1578cfa0ad2SJack F Vogel (e1000_tbi_sbp_enabled_82543(a) && \ 1588cfa0ad2SJack F Vogel (((errors) & E1000_RXD_ERR_FRAME_ERR_MASK) == E1000_RXD_ERR_CE) && \ 1598cfa0ad2SJack F Vogel ((last_byte) == CARRIER_EXTENSION) && \ 1608cfa0ad2SJack F Vogel (((status) & E1000_RXD_STAT_VP) ? \ 1618cfa0ad2SJack F Vogel (((length) > (min_frame_size - VLAN_TAG_SIZE)) && \ 1628cfa0ad2SJack F Vogel ((length) <= (max_frame_size + 1))) : \ 1638cfa0ad2SJack F Vogel (((length) > min_frame_size) && \ 1648cfa0ad2SJack F Vogel ((length) <= (max_frame_size + VLAN_TAG_SIZE + 1))))) 1658cfa0ad2SJack F Vogel 1668cfa0ad2SJack F Vogel #endif 167