e1000_api.h revision 49b7860084dbba18bc00b29413d6182197f9fe93
fa9e4066f08beec538e775443c5be79dd423fcabahrens/******************************************************************************
fa9e4066f08beec538e775443c5be79dd423fcabahrens Copyright (c) 2001-2015, Intel Corporation
fa9e4066f08beec538e775443c5be79dd423fcabahrens All rights reserved.
f65e61c04bc28ffd6bda04619c84330b420450b5ahrens Redistribution and use in source and binary forms, with or without
fa9e4066f08beec538e775443c5be79dd423fcabahrens modification, are permitted provided that the following conditions are met:
fa9e4066f08beec538e775443c5be79dd423fcabahrens 1. Redistributions of source code must retain the above copyright notice,
fa9e4066f08beec538e775443c5be79dd423fcabahrens this list of conditions and the following disclaimer.
fa9e4066f08beec538e775443c5be79dd423fcabahrens 2. Redistributions in binary form must reproduce the above copyright
fa9e4066f08beec538e775443c5be79dd423fcabahrens notice, this list of conditions and the following disclaimer in the
fa9e4066f08beec538e775443c5be79dd423fcabahrens documentation and/or other materials provided with the distribution.
fa9e4066f08beec538e775443c5be79dd423fcabahrens 3. Neither the name of the Intel Corporation nor the names of its
fa9e4066f08beec538e775443c5be79dd423fcabahrens contributors may be used to endorse or promote products derived from
fa9e4066f08beec538e775443c5be79dd423fcabahrens this software without specific prior written permission.
fa9e4066f08beec538e775443c5be79dd423fcabahrens THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
fa9e4066f08beec538e775443c5be79dd423fcabahrens AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
d05ba1e6d821a370b97d38899e74cd824e81ab9cTim Haley IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
fa9e4066f08beec538e775443c5be79dd423fcabahrens ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
fa9e4066f08beec538e775443c5be79dd423fcabahrens LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
fa9e4066f08beec538e775443c5be79dd423fcabahrens CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwick SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
fa9e4066f08beec538e775443c5be79dd423fcabahrens INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
fa9e4066f08beec538e775443c5be79dd423fcabahrens CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
fa9e4066f08beec538e775443c5be79dd423fcabahrens ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
fa9e4066f08beec538e775443c5be79dd423fcabahrens POSSIBILITY OF SUCH DAMAGE.
fa9e4066f08beec538e775443c5be79dd423fcabahrens******************************************************************************/
87e5029a3226958edab1512d6182bc74d8d80c9aahrens/*$FreeBSD$*/
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwickextern void e1000_init_function_pointers_82542(struct e1000_hw *hw);
fa9e4066f08beec538e775443c5be79dd423fcabahrensextern void e1000_init_function_pointers_82543(struct e1000_hw *hw);
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwickextern void e1000_init_function_pointers_82540(struct e1000_hw *hw);
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwickextern void e1000_init_function_pointers_82571(struct e1000_hw *hw);
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwickextern void e1000_init_function_pointers_82541(struct e1000_hw *hw);
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwickextern void e1000_init_function_pointers_80003es2lan(struct e1000_hw *hw);
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwickextern void e1000_init_function_pointers_ich8lan(struct e1000_hw *hw);
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwickextern void e1000_init_function_pointers_82575(struct e1000_hw *hw);
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwickextern void e1000_rx_fifo_flush_82575(struct e1000_hw *hw);
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwickextern void e1000_init_function_pointers_vf(struct e1000_hw *hw);
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwickextern void e1000_power_up_fiber_serdes_link(struct e1000_hw *hw);
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwickextern void e1000_shutdown_fiber_serdes_link(struct e1000_hw *hw);
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwickextern void e1000_init_function_pointers_i210(struct e1000_hw *hw);
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwicks32 e1000_set_obff_timer(struct e1000_hw *hw, u32 itr);
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwicks32 e1000_setup_init_funcs(struct e1000_hw *hw, bool init_device);
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwickvoid e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value);
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwicks32 e1000_get_speed_and_duplex(struct e1000_hw *hw, u16 *speed, u16 *duplex);
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwickvoid e1000_config_collision_dist(struct e1000_hw *hw);
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwickint e1000_rar_set(struct e1000_hw *hw, u8 *addr, u32 index);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwu32 e1000_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr);
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwickvoid e1000_update_mc_addr_list(struct e1000_hw *hw, u8 *mc_addr_list,
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwicks32 e1000_check_reset_block(struct e1000_hw *hw);
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwickvoid e1000_update_adaptive(struct e1000_hw *hw);
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwicks32 e1000_validate_mdi_setting(struct e1000_hw *hw);
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwicks32 e1000_read_phy_reg(struct e1000_hw *hw, u32 offset, u16 *data);
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwicks32 e1000_write_phy_reg(struct e1000_hw *hw, u32 offset, u16 data);
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwicks32 e1000_write_8bit_ctrl_reg(struct e1000_hw *hw, u32 reg, u32 offset,
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwicks32 e1000_read_pba_string(struct e1000_hw *hw, u8 *pba_num, u32 pba_num_size);
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwicks32 e1000_read_pba_length(struct e1000_hw *hw, u32 *pba_num_size);
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwicks32 e1000_read_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amws32 e1000_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data);
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwicks32 e1000_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amws32 e1000_write_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amws32 e1000_set_d3_lplu_state(struct e1000_hw *hw, bool active);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amws32 e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amws32 e1000_mng_host_if_write(struct e1000_hw *hw, u8 *buffer, u16 length,
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwicks32 e1000_mng_write_cmd_header(struct e1000_hw *hw,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amws32 e1000_mng_write_dhcp_info(struct e1000_hw *hw, u8 *buffer, u16 length);
d05ba1e6d821a370b97d38899e74cd824e81ab9cTim Haley * TBI_ACCEPT macro definition:
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * This macro requires:
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * a = a pointer to struct e1000_hw
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * status = the 8 bit status field of the Rx descriptor with EOP set
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * errors = the 8 bit error field of the Rx descriptor with EOP set
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * length = the sum of all the length fields of the Rx descriptors that
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * make up the current frame
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwick * last_byte = the last byte of the frame DMAed by the hardware
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwick * min_frame_size = the minimum frame length we want to accept.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * max_frame_size = the maximum frame length we want to accept.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * This macro is a conditional that should be used in the interrupt
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * handler's Rx processing routine when RxErrors have been detected.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Typical use:
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * if (TBI_ACCEPT) {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * accept_frame = TRUE;
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwick * e1000_tbi_adjust_stats(adapter, MacAddress);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * frame_length--;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * } else {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * accept_frame = FALSE;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw/* The carrier extension symbol, as received by the NIC. */
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwick#define TBI_ACCEPT(a, status, errors, length, last_byte, \
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw (((errors) & E1000_RXD_ERR_FRAME_ERR_MASK) == E1000_RXD_ERR_CE) && \
b24ab6762772a3f6a89393947930c7fa61306783Jeff Bonwick (((length) > ((min_frame_size) - VLAN_TAG_SIZE)) && \
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#define E1000_MAX(a, b) ((a) > (b) ? (a) : (b))
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#define E1000_DIVIDE_ROUND_UP(a, b) (((a) + (b) - 1) / (b)) /* ceil(a/b) */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw#endif /* _E1000_API_H_ */