e1000_api.h revision 181027
186144Stmm/****************************************************************************** 286144Stmm 386144Stmm Copyright (c) 2001-2008, Intel Corporation 486144Stmm All rights reserved. 586144Stmm 686144Stmm Redistribution and use in source and binary forms, with or without 786144Stmm modification, are permitted provided that the following conditions are met: 886144Stmm 986144Stmm 1. Redistributions of source code must retain the above copyright notice, 1086144Stmm this list of conditions and the following disclaimer. 1186144Stmm 1286144Stmm 2. Redistributions in binary form must reproduce the above copyright 1386144Stmm notice, this list of conditions and the following disclaimer in the 1486144Stmm documentation and/or other materials provided with the distribution. 1586144Stmm 1686144Stmm 3. Neither the name of the Intel Corporation nor the names of its 1786144Stmm contributors may be used to endorse or promote products derived from 1886144Stmm this software without specific prior written permission. 1986144Stmm 2086144Stmm THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 2186144Stmm AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2286144Stmm IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2386144Stmm ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 2486144Stmm LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2586144Stmm CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2686144Stmm SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2786144Stmm INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2886144Stmm CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2986144Stmm ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 3086144Stmm POSSIBILITY OF SUCH DAMAGE. 3186144Stmm 3286144Stmm******************************************************************************/ 3386144Stmm/*$FreeBSD: head/sys/dev/e1000/e1000_api.h 181027 2008-07-30 21:56:53Z jfv $*/ 3486144Stmm 3586144Stmm#ifndef _E1000_API_H_ 3686144Stmm#define _E1000_API_H_ 3786144Stmm 3886144Stmm#include "e1000_hw.h" 3986144Stmm 4086144Stmmextern void e1000_init_function_pointers_82542(struct e1000_hw *hw); 4186144Stmmextern void e1000_init_function_pointers_82543(struct e1000_hw *hw); 4286144Stmmextern void e1000_init_function_pointers_82540(struct e1000_hw *hw); 4386144Stmmextern void e1000_init_function_pointers_82571(struct e1000_hw *hw); 4486144Stmmextern void e1000_init_function_pointers_82541(struct e1000_hw *hw); 4586144Stmmextern void e1000_init_function_pointers_80003es2lan(struct e1000_hw *hw); 4686144Stmmextern void e1000_init_function_pointers_ich8lan(struct e1000_hw *hw); 4786144Stmmextern void e1000_init_function_pointers_82575(struct e1000_hw *hw); 4886144Stmmextern void e1000_rx_fifo_flush_82575(struct e1000_hw *hw); 4986144Stmmextern void e1000_init_function_pointers_vf(struct e1000_hw *hw); 5086144Stmmextern void e1000_shutdown_fiber_serdes_link(struct e1000_hw *hw); 5186144Stmm 5286144Stmms32 e1000_set_mac_type(struct e1000_hw *hw); 5386144Stmms32 e1000_setup_init_funcs(struct e1000_hw *hw, bool init_device); 5486144Stmms32 e1000_init_mac_params(struct e1000_hw *hw); 5586144Stmms32 e1000_init_nvm_params(struct e1000_hw *hw); 5686144Stmms32 e1000_init_phy_params(struct e1000_hw *hw); 5786144Stmmvoid e1000_remove_device(struct e1000_hw *hw); 5886144Stmms32 e1000_get_bus_info(struct e1000_hw *hw); 5986144Stmmvoid e1000_clear_vfta(struct e1000_hw *hw); 6086144Stmmvoid e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value); 6186144Stmms32 e1000_force_mac_fc(struct e1000_hw *hw); 6286144Stmms32 e1000_check_for_link(struct e1000_hw *hw); 6386144Stmms32 e1000_reset_hw(struct e1000_hw *hw); 6486144Stmms32 e1000_init_hw(struct e1000_hw *hw); 6586144Stmms32 e1000_setup_link(struct e1000_hw *hw); 66180011Smariuss32 e1000_get_speed_and_duplex(struct e1000_hw *hw, u16 *speed, 6786144Stmm u16 *duplex); 6886144Stmms32 e1000_disable_pcie_master(struct e1000_hw *hw); 6986144Stmmvoid e1000_config_collision_dist(struct e1000_hw *hw); 7086144Stmmvoid e1000_rar_set(struct e1000_hw *hw, u8 *addr, u32 index); 7186144Stmmvoid e1000_mta_set(struct e1000_hw *hw, u32 hash_value); 7286144Stmmu32 e1000_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr); 7386144Stmmvoid e1000_update_mc_addr_list(struct e1000_hw *hw, 7486144Stmm u8 *mc_addr_list, u32 mc_addr_count, 7586144Stmm u32 rar_used_count, u32 rar_count); 7686144Stmms32 e1000_setup_led(struct e1000_hw *hw); 7786144Stmms32 e1000_cleanup_led(struct e1000_hw *hw); 7886144Stmms32 e1000_check_reset_block(struct e1000_hw *hw); 7986144Stmms32 e1000_blink_led(struct e1000_hw *hw); 8086144Stmms32 e1000_led_on(struct e1000_hw *hw); 8186144Stmms32 e1000_led_off(struct e1000_hw *hw); 82180011Smariusvoid e1000_reset_adaptive(struct e1000_hw *hw); 8386144Stmmvoid e1000_update_adaptive(struct e1000_hw *hw); 8486144Stmms32 e1000_get_cable_length(struct e1000_hw *hw); 8586144Stmms32 e1000_validate_mdi_setting(struct e1000_hw *hw); 8686144Stmms32 e1000_read_phy_reg(struct e1000_hw *hw, u32 offset, u16 *data); 8786144Stmms32 e1000_write_phy_reg(struct e1000_hw *hw, u32 offset, u16 data); 88180073Smariuss32 e1000_write_8bit_ctrl_reg(struct e1000_hw *hw, u32 reg, 8986144Stmm u32 offset, u8 data); 9086144Stmms32 e1000_get_phy_info(struct e1000_hw *hw); 9186144Stmmvoid e1000_release_phy(struct e1000_hw *hw); 9286144Stmms32 e1000_acquire_phy(struct e1000_hw *hw); 9386144Stmms32 e1000_phy_hw_reset(struct e1000_hw *hw); 9486144Stmms32 e1000_phy_commit(struct e1000_hw *hw); 9586144Stmmvoid e1000_power_up_phy(struct e1000_hw *hw); 96180011Smariusvoid e1000_power_down_phy(struct e1000_hw *hw); 97180011Smariuss32 e1000_read_mac_addr(struct e1000_hw *hw); 9886144Stmms32 e1000_read_pba_num(struct e1000_hw *hw, u32 *part_num); 9986144Stmmvoid e1000_reload_nvm(struct e1000_hw *hw); 10086144Stmms32 e1000_update_nvm_checksum(struct e1000_hw *hw); 10186144Stmms32 e1000_validate_nvm_checksum(struct e1000_hw *hw); 10286144Stmms32 e1000_read_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data); 10386144Stmms32 e1000_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data); 10486144Stmms32 e1000_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data); 105180073Smariuss32 e1000_write_nvm(struct e1000_hw *hw, u16 offset, u16 words, 10686144Stmm u16 *data); 10786144Stmms32 e1000_wait_autoneg(struct e1000_hw *hw); 10886144Stmms32 e1000_set_d3_lplu_state(struct e1000_hw *hw, bool active); 10986144Stmms32 e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active); 11086144Stmmbool e1000_check_mng_mode(struct e1000_hw *hw); 11186144Stmmbool e1000_enable_tx_pkt_filtering(struct e1000_hw *hw); 11286144Stmms32 e1000_mng_enable_host_if(struct e1000_hw *hw); 11386144Stmms32 e1000_mng_host_if_write(struct e1000_hw *hw, 11486144Stmm u8 *buffer, u16 length, u16 offset, u8 *sum); 11586144Stmms32 e1000_mng_write_cmd_header(struct e1000_hw *hw, 116154256Smarius struct e1000_host_mng_command_header *hdr); 11786144Stmms32 e1000_mng_write_dhcp_info(struct e1000_hw * hw, 11886144Stmm u8 *buffer, u16 length); 11986144Stmmu32 e1000_translate_register_82542(u32 reg); 12086144Stmm 12186144Stmm/* 12286144Stmm * TBI_ACCEPT macro definition: 12386144Stmm * 124180011Smarius * This macro requires: 125180011Smarius * adapter = a pointer to struct e1000_hw 12686144Stmm * status = the 8 bit status field of the Rx descriptor with EOP set 12786144Stmm * error = the 8 bit error field of the Rx descriptor with EOP set 128180011Smarius * length = the sum of all the length fields of the Rx descriptors that 12986144Stmm * make up the current frame 13086144Stmm * last_byte = the last byte of the frame DMAed by the hardware 13186144Stmm * max_frame_length = the maximum frame length we want to accept. 13286144Stmm * min_frame_length = the minimum frame length we want to accept. 13386144Stmm * 13486144Stmm * This macro is a conditional that should be used in the interrupt 13586144Stmm * handler's Rx processing routine when RxErrors have been detected. 13686144Stmm * 13786144Stmm * Typical use: 13886144Stmm * ... 13986144Stmm * if (TBI_ACCEPT) { 14086144Stmm * accept_frame = TRUE; 14186144Stmm * e1000_tbi_adjust_stats(adapter, MacAddress); 14286144Stmm * frame_length--; 14386144Stmm * } else { 14486144Stmm * accept_frame = FALSE; 14586144Stmm * } 14686144Stmm * ... 14786144Stmm */ 14886144Stmm 14986144Stmm/* The carrier extension symbol, as received by the NIC. */ 15086144Stmm#define CARRIER_EXTENSION 0x0F 15186144Stmm 15286144Stmm#define TBI_ACCEPT(a, status, errors, length, last_byte, min_frame_size, max_frame_size) \ 15386144Stmm (e1000_tbi_sbp_enabled_82543(a) && \ 15486144Stmm (((errors) & E1000_RXD_ERR_FRAME_ERR_MASK) == E1000_RXD_ERR_CE) && \ 15586144Stmm ((last_byte) == CARRIER_EXTENSION) && \ 15686144Stmm (((status) & E1000_RXD_STAT_VP) ? \ 15786144Stmm (((length) > (min_frame_size - VLAN_TAG_SIZE)) && \ 15886144Stmm ((length) <= (max_frame_size + 1))) : \ 15986144Stmm (((length) > min_frame_size) && \ 16086144Stmm ((length) <= (max_frame_size + VLAN_TAG_SIZE + 1))))) 161154256Smarius 162180073Smarius#endif 16386144Stmm