ixgbe_api.c revision 172043
1171384Sjfv/******************************************************************************* 2171384Sjfv 3171384Sjfv Copyright (c) 2001-2007, Intel Corporation 4171384Sjfv All rights reserved. 5171384Sjfv 6171384Sjfv Redistribution and use in source and binary forms, with or without 7171384Sjfv modification, are permitted provided that the following conditions are met: 8171384Sjfv 9171384Sjfv 1. Redistributions of source code must retain the above copyright notice, 10171384Sjfv this list of conditions and the following disclaimer. 11171384Sjfv 12171384Sjfv 2. Redistributions in binary form must reproduce the above copyright 13171384Sjfv notice, this list of conditions and the following disclaimer in the 14171384Sjfv documentation and/or other materials provided with the distribution. 15171384Sjfv 16171384Sjfv 3. Neither the name of the Intel Corporation nor the names of its 17171384Sjfv contributors may be used to endorse or promote products derived from 18171384Sjfv this software without specific prior written permission. 19171384Sjfv 20171384Sjfv THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21171384Sjfv AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22171384Sjfv IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23171384Sjfv ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 24171384Sjfv LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25171384Sjfv CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26171384Sjfv SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27171384Sjfv INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28171384Sjfv CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29171384Sjfv ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30171384Sjfv POSSIBILITY OF SUCH DAMAGE. 31171384Sjfv 32171384Sjfv*******************************************************************************/ 33171384Sjfv/* $FreeBSD: head/sys/dev/ixgbe/ixgbe_api.c 172043 2007-09-04 02:31:35Z jfv $ */ 34171384Sjfv 35172043Sjfv 36171384Sjfv#include "ixgbe_api.h" 37171384Sjfv#include "ixgbe_common.h" 38171384Sjfv 39171384Sjfvextern s32 ixgbe_init_shared_code_82598(struct ixgbe_hw *hw); 40171384Sjfvextern s32 ixgbe_init_shared_code_phy(struct ixgbe_hw *hw); 41171384Sjfv 42171384Sjfv/** 43171384Sjfv * ixgbe_init_shared_code - Initialize the shared code 44171384Sjfv * @hw: pointer to hardware structure 45171384Sjfv * 46171384Sjfv * This will assign function pointers and assign the MAC type and PHY code. 47171384Sjfv * Does not touch the hardware. This function must be called prior to any 48171384Sjfv * other function in the shared code. The ixgbe_hw structure should be 49171384Sjfv * memset to 0 prior to calling this function. The following fields in 50171384Sjfv * hw structure should be filled in prior to calling this function: 51171384Sjfv * hw_addr, back, device_id, vendor_id, subsystem_device_id, 52171384Sjfv * subsystem_vendor_id, and revision_id 53171384Sjfv **/ 54171384Sjfvs32 ixgbe_init_shared_code(struct ixgbe_hw *hw) 55171384Sjfv{ 56172043Sjfv s32 status; 57171384Sjfv 58171384Sjfv /* 59171384Sjfv * Assign generic function pointers before entering adapter-specific 60171384Sjfv * init 61171384Sjfv */ 62171384Sjfv ixgbe_assign_func_pointers_generic(hw); 63171384Sjfv 64172043Sjfv /* 65172043Sjfv * Set the mac type 66172043Sjfv */ 67172043Sjfv ixgbe_set_mac_type(hw); 68172043Sjfv 69172043Sjfv switch (hw->mac.type) { 70172043Sjfv case ixgbe_mac_82598EB: 71172043Sjfv status = ixgbe_init_shared_code_82598(hw); 72172043Sjfv status = ixgbe_init_shared_code_phy(hw); 73172043Sjfv break; 74172043Sjfv default: 75172043Sjfv status = IXGBE_ERR_DEVICE_NOT_SUPPORTED; 76172043Sjfv break; 77172043Sjfv } 78172043Sjfv 79172043Sjfv return status; 80172043Sjfv} 81172043Sjfv 82172043Sjfv/** 83172043Sjfv * ixgbe_set_mac_type - Sets MAC type 84172043Sjfv * @hw: pointer to the HW structure 85172043Sjfv * 86172043Sjfv * This function sets the mac type of the adapter based on the 87172043Sjfv * vendor ID and device ID stored in the hw structure. 88172043Sjfv **/ 89172043Sjfvs32 ixgbe_set_mac_type(struct ixgbe_hw *hw) 90172043Sjfv{ 91172043Sjfv s32 ret_val = IXGBE_SUCCESS; 92172043Sjfv 93172043Sjfv DEBUGFUNC("ixgbe_set_mac_type"); 94172043Sjfv 95171384Sjfv if (hw->vendor_id == IXGBE_INTEL_VENDOR_ID) { 96171384Sjfv switch (hw->device_id) { 97171384Sjfv case IXGBE_DEV_ID_82598AF_SINGLE_PORT: 98171384Sjfv case IXGBE_DEV_ID_82598AF_DUAL_PORT: 99172043Sjfv case IXGBE_DEV_ID_82598EB_CX4: 100172043Sjfv hw->mac.type = ixgbe_mac_82598EB; 101171384Sjfv break; 102171384Sjfv default: 103172043Sjfv ret_val = IXGBE_ERR_DEVICE_NOT_SUPPORTED; 104171384Sjfv break; 105171384Sjfv } 106172043Sjfv } else { 107172043Sjfv ret_val = IXGBE_ERR_DEVICE_NOT_SUPPORTED; 108171384Sjfv } 109171384Sjfv 110172043Sjfv return ret_val; 111171384Sjfv} 112171384Sjfv 113171384Sjfv/** 114171384Sjfv * ixgbe_init_hw - Initialize the hardware 115171384Sjfv * @hw: pointer to hardware structure 116171384Sjfv * 117171384Sjfv * Initialize the hardware by resetting and then starting the hardware 118171384Sjfv **/ 119171384Sjfvs32 ixgbe_init_hw(struct ixgbe_hw *hw) 120171384Sjfv{ 121171384Sjfv return ixgbe_call_func(hw, ixgbe_func_init_hw, (hw), 122171384Sjfv IXGBE_NOT_IMPLEMENTED); 123171384Sjfv} 124171384Sjfv 125171384Sjfv/** 126171384Sjfv * ixgbe_reset_hw - Performs a hardware reset 127171384Sjfv * @hw: pointer to hardware structure 128171384Sjfv * 129171384Sjfv * Resets the hardware by resetting the transmit and receive units, masks and 130171384Sjfv * clears all interrupts, performs a PHY reset, and performs a MAC reset 131171384Sjfv **/ 132171384Sjfvs32 ixgbe_reset_hw(struct ixgbe_hw *hw) 133171384Sjfv{ 134171384Sjfv return ixgbe_call_func(hw, ixgbe_func_reset_hw, (hw), 135171384Sjfv IXGBE_NOT_IMPLEMENTED); 136171384Sjfv} 137171384Sjfv 138171384Sjfv/** 139171384Sjfv * ixgbe_start_hw - Prepares hardware for TX/TX 140171384Sjfv * @hw: pointer to hardware structure 141171384Sjfv * 142171384Sjfv * Starts the hardware by filling the bus info structure and media type, 143171384Sjfv * clears all on chip counters, initializes receive address registers, 144171384Sjfv * multicast table, VLAN filter table, calls routine to setup link and 145171384Sjfv * flow control settings, and leaves transmit and receive units disabled 146171384Sjfv * and uninitialized. 147171384Sjfv **/ 148171384Sjfvs32 ixgbe_start_hw(struct ixgbe_hw *hw) 149171384Sjfv{ 150171384Sjfv return ixgbe_call_func(hw, ixgbe_func_start_hw, (hw), 151171384Sjfv IXGBE_NOT_IMPLEMENTED); 152171384Sjfv} 153171384Sjfv 154171384Sjfv/** 155171384Sjfv * ixgbe_clear_hw_cntrs - Clear hardware counters 156171384Sjfv * @hw: pointer to hardware structure 157171384Sjfv * 158171384Sjfv * Clears all hardware statistics counters by reading them from the hardware 159171384Sjfv * Statistics counters are clear on read. 160171384Sjfv **/ 161171384Sjfvs32 ixgbe_clear_hw_cntrs(struct ixgbe_hw *hw) 162171384Sjfv{ 163171384Sjfv return ixgbe_call_func(hw, ixgbe_func_clear_hw_cntrs, (hw), 164171384Sjfv IXGBE_NOT_IMPLEMENTED); 165171384Sjfv} 166171384Sjfv 167171384Sjfv/** 168171384Sjfv * ixgbe_get_media_type - Get media type 169171384Sjfv * @hw: pointer to hardware structure 170171384Sjfv * 171171384Sjfv * Returns the media type (fiber, copper, backplane) 172171384Sjfv **/ 173171384Sjfvenum ixgbe_media_type ixgbe_get_media_type(struct ixgbe_hw *hw) 174171384Sjfv{ 175171384Sjfv return ixgbe_call_func(hw, ixgbe_func_get_media_type, (hw), 176171384Sjfv ixgbe_media_type_unknown); 177171384Sjfv} 178171384Sjfv 179171384Sjfv/** 180171384Sjfv * ixgbe_get_mac_addr - Get MAC address 181171384Sjfv * @hw: pointer to hardware structure 182171384Sjfv * @mac_addr: Adapter MAC address 183171384Sjfv * 184171384Sjfv * Reads the adapter's MAC address from the first Receive Address Register 185171384Sjfv * (RAR0) A reset of the adapter must have been performed prior to calling this 186171384Sjfv * function in order for the MAC address to have been loaded from the EEPROM 187171384Sjfv * into RAR0 188171384Sjfv **/ 189171384Sjfvs32 ixgbe_get_mac_addr(struct ixgbe_hw *hw, u8 *mac_addr) 190171384Sjfv{ 191171384Sjfv return ixgbe_call_func(hw, ixgbe_func_get_mac_addr, 192171384Sjfv (hw, mac_addr), IXGBE_NOT_IMPLEMENTED); 193171384Sjfv} 194171384Sjfv 195171384Sjfv/** 196171384Sjfv * ixgbe_get_bus_info - Set PCI bus info 197171384Sjfv * @hw: pointer to hardware structure 198171384Sjfv * 199171384Sjfv * Sets the PCI bus info (speed, width, type) within the ixgbe_hw structure 200171384Sjfv **/ 201171384Sjfvs32 ixgbe_get_bus_info(struct ixgbe_hw *hw) 202171384Sjfv{ 203171384Sjfv return ixgbe_call_func(hw, ixgbe_func_get_bus_info, (hw), 204171384Sjfv IXGBE_NOT_IMPLEMENTED); 205171384Sjfv} 206171384Sjfv 207171384Sjfv/** 208171384Sjfv * ixgbe_get_num_of_tx_queues - Get TX queues 209171384Sjfv * @hw: pointer to hardware structure 210171384Sjfv * 211171384Sjfv * Returns the number of transmit queues for the given adapter. 212171384Sjfv **/ 213171384Sjfvu32 ixgbe_get_num_of_tx_queues(struct ixgbe_hw *hw) 214171384Sjfv{ 215171384Sjfv return ixgbe_call_func(hw, ixgbe_func_get_num_of_tx_queues, 216171384Sjfv (hw), 0); 217171384Sjfv} 218171384Sjfv 219171384Sjfv/** 220171384Sjfv * ixgbe_get_num_of_rx_queues - Get RX queues 221171384Sjfv * @hw: pointer to hardware structure 222171384Sjfv * 223171384Sjfv * Returns the number of receive queues for the given adapter. 224171384Sjfv **/ 225171384Sjfvu32 ixgbe_get_num_of_rx_queues(struct ixgbe_hw *hw) 226171384Sjfv{ 227171384Sjfv return ixgbe_call_func(hw, ixgbe_func_get_num_of_rx_queues, 228171384Sjfv (hw), 0); 229171384Sjfv} 230171384Sjfv 231171384Sjfv/** 232171384Sjfv * ixgbe_stop_adapter - Disable TX/TX units 233171384Sjfv * @hw: pointer to hardware structure 234171384Sjfv * 235171384Sjfv * Sets the adapter_stopped flag within ixgbe_hw struct. Clears interrupts, 236171384Sjfv * disables transmit and receive units. The adapter_stopped flag is used by 237171384Sjfv * the shared code and drivers to determine if the adapter is in a stopped 238171384Sjfv * state and should not touch the hardware. 239171384Sjfv **/ 240171384Sjfvs32 ixgbe_stop_adapter(struct ixgbe_hw *hw) 241171384Sjfv{ 242171384Sjfv return ixgbe_call_func(hw, ixgbe_func_stop_adapter, (hw), 243171384Sjfv IXGBE_NOT_IMPLEMENTED); 244171384Sjfv} 245171384Sjfv 246171384Sjfv/** 247171384Sjfv * ixgbe_identify_phy - Get PHY type 248171384Sjfv * @hw: pointer to hardware structure 249171384Sjfv * 250171384Sjfv * Determines the physical layer module found on the current adapter. 251171384Sjfv **/ 252171384Sjfvs32 ixgbe_identify_phy(struct ixgbe_hw *hw) 253171384Sjfv{ 254171384Sjfv s32 status = IXGBE_SUCCESS; 255171384Sjfv 256171384Sjfv if (hw->phy.type == ixgbe_phy_unknown) { 257171384Sjfv status = ixgbe_call_func(hw, 258171384Sjfv ixgbe_func_identify_phy, 259171384Sjfv (hw), 260171384Sjfv IXGBE_NOT_IMPLEMENTED); 261171384Sjfv } 262171384Sjfv 263171384Sjfv return status; 264171384Sjfv} 265171384Sjfv 266171384Sjfv/** 267171384Sjfv * ixgbe_reset_phy - Perform a PHY reset 268171384Sjfv * @hw: pointer to hardware structure 269171384Sjfv **/ 270171384Sjfvs32 ixgbe_reset_phy(struct ixgbe_hw *hw) 271171384Sjfv{ 272171384Sjfv s32 status = IXGBE_SUCCESS; 273171384Sjfv 274171384Sjfv if (hw->phy.type == ixgbe_phy_unknown) { 275171384Sjfv if (ixgbe_identify_phy(hw) != IXGBE_SUCCESS) { 276171384Sjfv status = IXGBE_ERR_PHY; 277171384Sjfv } 278171384Sjfv } 279171384Sjfv 280171384Sjfv if (status == IXGBE_SUCCESS) { 281171384Sjfv status = ixgbe_call_func(hw, 282171384Sjfv ixgbe_func_reset_phy, 283171384Sjfv (hw), 284171384Sjfv IXGBE_NOT_IMPLEMENTED); 285171384Sjfv } 286171384Sjfv return status; 287171384Sjfv} 288171384Sjfv 289171384Sjfv/** 290171384Sjfv * ixgbe_read_phy_reg - Read PHY register 291171384Sjfv * @hw: pointer to hardware structure 292171384Sjfv * @reg_addr: 32 bit address of PHY register to read 293171384Sjfv * @phy_data: Pointer to read data from PHY register 294171384Sjfv * 295171384Sjfv * Reads a value from a specified PHY register 296171384Sjfv **/ 297171384Sjfvs32 ixgbe_read_phy_reg(struct ixgbe_hw *hw, u32 reg_addr, u32 device_type, 298171384Sjfv u16 *phy_data) 299171384Sjfv{ 300171384Sjfv s32 status = IXGBE_SUCCESS; 301171384Sjfv 302171384Sjfv if (hw->phy.type == ixgbe_phy_unknown) { 303171384Sjfv if (ixgbe_identify_phy(hw) != IXGBE_SUCCESS) { 304171384Sjfv status = IXGBE_ERR_PHY; 305171384Sjfv } 306171384Sjfv } 307171384Sjfv 308171384Sjfv if (status == IXGBE_SUCCESS) { 309171384Sjfv status = ixgbe_call_func(hw, 310171384Sjfv ixgbe_func_read_phy_reg, 311171384Sjfv (hw, reg_addr, device_type, phy_data), 312171384Sjfv IXGBE_NOT_IMPLEMENTED); 313171384Sjfv } 314171384Sjfv return status; 315171384Sjfv} 316171384Sjfv 317171384Sjfv/** 318171384Sjfv * ixgbe_write_phy_reg - Write PHY register 319171384Sjfv * @hw: pointer to hardware structure 320171384Sjfv * @reg_addr: 32 bit PHY register to write 321171384Sjfv * @phy_data: Data to write to the PHY register 322171384Sjfv * 323171384Sjfv * Writes a value to specified PHY register 324171384Sjfv **/ 325171384Sjfvs32 ixgbe_write_phy_reg(struct ixgbe_hw *hw, u32 reg_addr, u32 device_type, 326171384Sjfv u16 phy_data) 327171384Sjfv{ 328171384Sjfv s32 status = IXGBE_SUCCESS; 329171384Sjfv 330171384Sjfv if (hw->phy.type == ixgbe_phy_unknown) { 331171384Sjfv if (ixgbe_identify_phy(hw) != IXGBE_SUCCESS) { 332171384Sjfv status = IXGBE_ERR_PHY; 333171384Sjfv } 334171384Sjfv } 335171384Sjfv 336171384Sjfv if (status == IXGBE_SUCCESS) { 337171384Sjfv status = ixgbe_call_func(hw, 338171384Sjfv ixgbe_func_write_phy_reg, 339171384Sjfv (hw, reg_addr, device_type, phy_data), 340171384Sjfv IXGBE_NOT_IMPLEMENTED); 341171384Sjfv } 342171384Sjfv return status; 343171384Sjfv} 344171384Sjfv 345171384Sjfv/** 346171384Sjfv * ixgbe_setup_link - Configure link settings 347171384Sjfv * @hw: pointer to hardware structure 348171384Sjfv * 349171384Sjfv * Configures link settings based on values in the ixgbe_hw struct. 350171384Sjfv * Restarts the link. Performs autonegotiation if needed. 351171384Sjfv **/ 352171384Sjfvs32 ixgbe_setup_link(struct ixgbe_hw *hw) 353171384Sjfv{ 354171384Sjfv return ixgbe_call_func(hw, ixgbe_func_setup_link, (hw), 355171384Sjfv IXGBE_NOT_IMPLEMENTED); 356171384Sjfv} 357171384Sjfv 358171384Sjfv/** 359171384Sjfv * ixgbe_check_link - Get link and speed status 360171384Sjfv * @hw: pointer to hardware structure 361171384Sjfv * 362171384Sjfv * Reads the links register to determine if link is up and the current speed 363171384Sjfv **/ 364171384Sjfvs32 ixgbe_check_link(struct ixgbe_hw *hw, ixgbe_link_speed *speed, 365171384Sjfv bool *link_up) 366171384Sjfv{ 367171384Sjfv return ixgbe_call_func(hw, ixgbe_func_check_link, (hw, speed, link_up), 368171384Sjfv IXGBE_NOT_IMPLEMENTED); 369171384Sjfv} 370171384Sjfv 371171384Sjfv/** 372171384Sjfv * ixgbe_setup_link_speed - Set link speed 373171384Sjfv * @hw: pointer to hardware structure 374171384Sjfv * @speed: new link speed 375171384Sjfv * @autoneg: TRUE if autonegotiation enabled 376171384Sjfv * 377171384Sjfv * Set the link speed and restarts the link. 378171384Sjfv **/ 379171384Sjfvs32 ixgbe_setup_link_speed(struct ixgbe_hw *hw, ixgbe_link_speed speed, 380171384Sjfv bool autoneg, 381171384Sjfv bool autoneg_wait_to_complete) 382171384Sjfv{ 383171384Sjfv return ixgbe_call_func(hw, ixgbe_func_setup_link_speed, (hw, speed, 384171384Sjfv autoneg, autoneg_wait_to_complete), 385171384Sjfv IXGBE_NOT_IMPLEMENTED); 386171384Sjfv} 387171384Sjfv 388171384Sjfv/** 389171384Sjfv * ixgbe_get_link_settings - Set link settings to default 390171384Sjfv * @hw: pointer to hardware structure 391171384Sjfv * 392171384Sjfv * Sets the default link settings based on attach type in the hw struct. 393171384Sjfv **/ 394171384Sjfvs32 ixgbe_get_link_settings(struct ixgbe_hw *hw, ixgbe_link_speed *speed, 395171384Sjfv bool *autoneg) 396171384Sjfv{ 397171384Sjfv return ixgbe_call_func(hw, ixgbe_func_get_link_settings, (hw, speed, 398171384Sjfv autoneg), IXGBE_NOT_IMPLEMENTED); 399171384Sjfv} 400171384Sjfv 401171384Sjfv/** 402171384Sjfv * ixgbe_led_on - Turn on LED's 403171384Sjfv * @hw: pointer to hardware structure 404171384Sjfv * @index: led number to turn on 405171384Sjfv * 406171384Sjfv * Turns on the software controllable LEDs. 407171384Sjfv **/ 408171384Sjfvs32 ixgbe_led_on(struct ixgbe_hw *hw, u32 index) 409171384Sjfv{ 410171384Sjfv return ixgbe_call_func(hw, ixgbe_func_led_on, (hw, index), 411171384Sjfv IXGBE_NOT_IMPLEMENTED); 412171384Sjfv} 413171384Sjfv 414171384Sjfv/** 415171384Sjfv * ixgbe_led_off - Turn off LED's 416171384Sjfv * @hw: pointer to hardware structure 417171384Sjfv * @index: led number to turn off 418171384Sjfv * 419171384Sjfv * Turns off the software controllable LEDs. 420171384Sjfv **/ 421171384Sjfvs32 ixgbe_led_off(struct ixgbe_hw *hw, u32 index) 422171384Sjfv{ 423171384Sjfv return ixgbe_call_func(hw, ixgbe_func_led_off, (hw, index), 424171384Sjfv IXGBE_NOT_IMPLEMENTED); 425171384Sjfv} 426171384Sjfv 427171384Sjfv/** 428171384Sjfv * ixgbe_blink_led_start - Blink LED's 429171384Sjfv * @hw: pointer to hardware structure 430171384Sjfv * @index: led number to blink 431171384Sjfv * 432171384Sjfv * Blink LED based on index. 433171384Sjfv **/ 434171384Sjfvs32 ixgbe_blink_led_start(struct ixgbe_hw *hw, u32 index) 435171384Sjfv{ 436171384Sjfv return ixgbe_call_func(hw, ixgbe_func_blink_led_start, (hw, index), 437171384Sjfv IXGBE_NOT_IMPLEMENTED); 438171384Sjfv} 439171384Sjfv 440171384Sjfv/** 441171384Sjfv * ixgbe_blink_led_stop - Stop blinking LED's 442171384Sjfv * @hw: pointer to hardware structure 443171384Sjfv * 444171384Sjfv * Stop blinking LED based on index. 445171384Sjfv **/ 446171384Sjfvs32 ixgbe_blink_led_stop(struct ixgbe_hw *hw, u32 index) 447171384Sjfv{ 448171384Sjfv return ixgbe_call_func(hw, ixgbe_func_blink_led_stop, (hw, index), 449171384Sjfv IXGBE_NOT_IMPLEMENTED); 450171384Sjfv} 451171384Sjfv 452171384Sjfv/** 453171384Sjfv * ixgbe_init_eeprom_params - Initialiaze EEPROM parameters 454171384Sjfv * @hw: pointer to hardware structure 455171384Sjfv * 456171384Sjfv * Initializes the EEPROM parameters ixgbe_eeprom_info within the 457171384Sjfv * ixgbe_hw struct in order to set up EEPROM access. 458171384Sjfv **/ 459171384Sjfvs32 ixgbe_init_eeprom_params(struct ixgbe_hw *hw) 460171384Sjfv{ 461171384Sjfv return ixgbe_call_func(hw, ixgbe_func_init_eeprom_params, (hw), 462171384Sjfv IXGBE_NOT_IMPLEMENTED); 463171384Sjfv} 464171384Sjfv 465171384Sjfv 466171384Sjfv/** 467171384Sjfv * ixgbe_write_eeprom - Write word to EEPROM 468171384Sjfv * @hw: pointer to hardware structure 469171384Sjfv * @offset: offset within the EEPROM to be written to 470171384Sjfv * @data: 16 bit word to be written to the EEPROM 471171384Sjfv * 472171384Sjfv * Writes 16 bit value to EEPROM. If ixgbe_eeprom_update_checksum is not 473171384Sjfv * called after this function, the EEPROM will most likely contain an 474171384Sjfv * invalid checksum. 475171384Sjfv **/ 476171384Sjfvs32 ixgbe_write_eeprom(struct ixgbe_hw *hw, u16 offset, u16 data) 477171384Sjfv{ 478171384Sjfv s32 status; 479171384Sjfv 480171384Sjfv /* 481171384Sjfv * Initialize EEPROM parameters. This will not do anything if the 482171384Sjfv * EEPROM structure has already been initialized 483171384Sjfv */ 484171384Sjfv ixgbe_init_eeprom_params(hw); 485171384Sjfv 486171384Sjfv /* Check for invalid offset */ 487171384Sjfv if (offset >= hw->eeprom.word_size) { 488171384Sjfv status = IXGBE_ERR_EEPROM; 489171384Sjfv } else { 490171384Sjfv status = ixgbe_call_func(hw, 491171384Sjfv ixgbe_func_write_eeprom, 492171384Sjfv (hw, offset, data), 493171384Sjfv IXGBE_NOT_IMPLEMENTED); 494171384Sjfv } 495171384Sjfv 496171384Sjfv return status; 497171384Sjfv} 498171384Sjfv 499171384Sjfv/** 500171384Sjfv * ixgbe_read_eeprom - Read word from EEPROM 501171384Sjfv * @hw: pointer to hardware structure 502171384Sjfv * @offset: offset within the EEPROM to be read 503171384Sjfv * @data: read 16 bit value from EEPROM 504171384Sjfv * 505171384Sjfv * Reads 16 bit value from EEPROM 506171384Sjfv **/ 507171384Sjfvs32 ixgbe_read_eeprom(struct ixgbe_hw *hw, u16 offset, u16 *data) 508171384Sjfv{ 509171384Sjfv s32 status; 510171384Sjfv 511171384Sjfv /* 512171384Sjfv * Initialize EEPROM parameters. This will not do anything if the 513171384Sjfv * EEPROM structure has already been initialized 514171384Sjfv */ 515171384Sjfv ixgbe_init_eeprom_params(hw); 516171384Sjfv 517171384Sjfv /* Check for invalid offset */ 518171384Sjfv if (offset >= hw->eeprom.word_size) { 519171384Sjfv status = IXGBE_ERR_EEPROM; 520171384Sjfv } else { 521171384Sjfv status = ixgbe_call_func(hw, 522171384Sjfv ixgbe_func_read_eeprom, 523171384Sjfv (hw, offset, data), 524171384Sjfv IXGBE_NOT_IMPLEMENTED); 525171384Sjfv } 526171384Sjfv 527171384Sjfv return status; 528171384Sjfv} 529171384Sjfv 530171384Sjfv/** 531171384Sjfv * ixgbe_validate_eeprom_checksum - Validate EEPROM checksum 532171384Sjfv * @hw: pointer to hardware structure 533171384Sjfv * @checksum_val: calculated checksum 534171384Sjfv * 535171384Sjfv * Performs checksum calculation and validates the EEPROM checksum 536171384Sjfv **/ 537171384Sjfvs32 ixgbe_validate_eeprom_checksum(struct ixgbe_hw *hw, u16 *checksum_val) 538171384Sjfv{ 539171384Sjfv return ixgbe_call_func(hw, ixgbe_func_validate_eeprom_checksum, 540171384Sjfv (hw, checksum_val), IXGBE_NOT_IMPLEMENTED); 541171384Sjfv} 542171384Sjfv 543171384Sjfv/** 544171384Sjfv * ixgbe_eeprom_update_checksum - Updates the EEPROM checksum 545171384Sjfv * @hw: pointer to hardware structure 546171384Sjfv **/ 547171384Sjfvs32 ixgbe_update_eeprom_checksum(struct ixgbe_hw *hw) 548171384Sjfv{ 549171384Sjfv return ixgbe_call_func(hw, ixgbe_func_update_eeprom_checksum, (hw), 550171384Sjfv IXGBE_NOT_IMPLEMENTED); 551171384Sjfv} 552171384Sjfv 553171384Sjfv/** 554171384Sjfv * ixgbe_set_rar - Set RX address register 555171384Sjfv * @hw: pointer to hardware structure 556171384Sjfv * @addr: Address to put into receive address register 557171384Sjfv * @index: Receive address register to write 558171384Sjfv * @vind: Vind to set RAR to 559171384Sjfv * @enable_addr: set flag that address is active 560171384Sjfv * 561171384Sjfv * Puts an ethernet address into a receive address register. 562171384Sjfv **/ 563171384Sjfvs32 ixgbe_set_rar(struct ixgbe_hw *hw, u32 index, u8 *addr, u32 vind, 564171384Sjfv u32 enable_addr) 565171384Sjfv{ 566171384Sjfv return ixgbe_call_func(hw, ixgbe_func_set_rar, (hw, index, addr, vind, 567171384Sjfv enable_addr), IXGBE_NOT_IMPLEMENTED); 568171384Sjfv} 569171384Sjfv 570171384Sjfv/** 571171384Sjfv * ixgbe_init_rx_addrs - Initializes receive address filters. 572171384Sjfv * @hw: pointer to hardware structure 573171384Sjfv * 574171384Sjfv * Places the MAC address in receive address register 0 and clears the rest 575171384Sjfv * of the receive addresss registers. Clears the multicast table. Assumes 576171384Sjfv * the receiver is in reset when the routine is called. 577171384Sjfv **/ 578171384Sjfvs32 ixgbe_init_rx_addrs(struct ixgbe_hw *hw) 579171384Sjfv{ 580171384Sjfv return ixgbe_call_func(hw, ixgbe_func_init_rx_addrs, (hw), 581171384Sjfv IXGBE_NOT_IMPLEMENTED); 582171384Sjfv} 583171384Sjfv 584171384Sjfv/** 585171384Sjfv * ixgbe_get_num_rx_addrs - Returns the number of RAR entries. 586171384Sjfv * @hw: pointer to hardware structure 587171384Sjfv **/ 588171384Sjfvu32 ixgbe_get_num_rx_addrs(struct ixgbe_hw *hw) 589171384Sjfv{ 590171384Sjfv return ixgbe_call_func(hw, ixgbe_func_get_num_rx_addrs, (hw), 0); 591171384Sjfv} 592171384Sjfv 593171384Sjfv/** 594171384Sjfv * ixgbe_update_mc_addr_list - Updates the MAC's list of multicast addresses 595171384Sjfv * @hw: pointer to hardware structure 596171384Sjfv * @mc_addr_list: the list of new multicast addresses 597171384Sjfv * @mc_addr_count: number of addresses 598171384Sjfv * @pad: number of bytes between addresses in the list 599171384Sjfv * 600171384Sjfv * The given list replaces any existing list. Clears the MC addrs from receive 601171384Sjfv * address registers and the multicast table. Uses unsed receive address 602171384Sjfv * registers for the first multicast addresses, and hashes the rest into the 603171384Sjfv * multicast table. 604171384Sjfv **/ 605171384Sjfvs32 ixgbe_update_mc_addr_list(struct ixgbe_hw *hw, u8 *mc_addr_list, 606171384Sjfv u32 mc_addr_count, u32 pad) 607171384Sjfv{ 608171384Sjfv return ixgbe_call_func(hw, ixgbe_func_update_mc_addr_list, (hw, 609171384Sjfv mc_addr_list, mc_addr_count, pad), 610171384Sjfv IXGBE_NOT_IMPLEMENTED); 611171384Sjfv} 612171384Sjfv 613171384Sjfv/** 614171384Sjfv * ixgbe_enable_mc - Enable multicast address in RAR 615171384Sjfv * @hw: pointer to hardware structure 616171384Sjfv * 617171384Sjfv * Enables multicast address in RAR and the use of the multicast hash table. 618171384Sjfv **/ 619171384Sjfvs32 ixgbe_enable_mc(struct ixgbe_hw *hw) 620171384Sjfv{ 621171384Sjfv return ixgbe_call_func(hw, ixgbe_func_enable_mc, (hw), 622171384Sjfv IXGBE_NOT_IMPLEMENTED); 623171384Sjfv} 624171384Sjfv 625171384Sjfv/** 626171384Sjfv * ixgbe_disable_mc - Disable multicast address in RAR 627171384Sjfv * @hw: pointer to hardware structure 628171384Sjfv * 629171384Sjfv * Disables multicast address in RAR and the use of the multicast hash table. 630171384Sjfv **/ 631171384Sjfvs32 ixgbe_disable_mc(struct ixgbe_hw *hw) 632171384Sjfv{ 633171384Sjfv return ixgbe_call_func(hw, ixgbe_func_disable_mc, (hw), 634171384Sjfv IXGBE_NOT_IMPLEMENTED); 635171384Sjfv} 636171384Sjfv 637171384Sjfv/** 638171384Sjfv * ixgbe_clear_vfta - Clear VLAN filter table 639171384Sjfv * @hw: pointer to hardware structure 640171384Sjfv * 641171384Sjfv * Clears the VLAN filer table, and the VMDq index associated with the filter 642171384Sjfv **/ 643171384Sjfvs32 ixgbe_clear_vfta(struct ixgbe_hw *hw) 644171384Sjfv{ 645171384Sjfv return ixgbe_call_func(hw, ixgbe_func_clear_vfta, (hw), 646171384Sjfv IXGBE_NOT_IMPLEMENTED); 647171384Sjfv} 648171384Sjfv 649171384Sjfv/** 650171384Sjfv * ixgbe_set_vfta - Set VLAN filter table 651171384Sjfv * @hw: pointer to hardware structure 652171384Sjfv * @vlan: VLAN id to write to VLAN filter 653171384Sjfv * @vind: VMDq output index that maps queue to VLAN id in VFTA 654171384Sjfv * @vlan_on: boolean flag to turn on/off VLAN in VFTA 655171384Sjfv * 656171384Sjfv * Turn on/off specified VLAN in the VLAN filter table. 657171384Sjfv **/ 658171384Sjfvs32 ixgbe_set_vfta(struct ixgbe_hw *hw, u32 vlan, u32 vind, bool vlan_on) 659171384Sjfv{ 660171384Sjfv return ixgbe_call_func(hw, ixgbe_func_set_vfta, (hw, vlan, vind, 661171384Sjfv vlan_on), IXGBE_NOT_IMPLEMENTED); 662171384Sjfv} 663171384Sjfv 664171384Sjfv/** 665171384Sjfv * ixgbe_setup_fc - Set flow control 666171384Sjfv * @hw: pointer to hardware structure 667171384Sjfv * @packetbuf_num: packet buffer number (0-7) 668171384Sjfv * 669171384Sjfv * Configures the flow control settings based on SW configuration. 670171384Sjfv **/ 671171384Sjfvs32 ixgbe_setup_fc(struct ixgbe_hw *hw, s32 packetbuf_num) 672171384Sjfv{ 673171384Sjfv return ixgbe_call_func(hw, ixgbe_func_setup_fc, (hw, packetbuf_num), 674171384Sjfv IXGBE_NOT_IMPLEMENTED); 675171384Sjfv} 676171384Sjfv 677172043Sjfv 678172043Sjfv/** 679172043Sjfv * ixgbe_read_analog_reg8 - Reads 8 bit analog register 680172043Sjfv * @hw: pointer to hardware structure 681172043Sjfv * @reg: analog register to read 682172043Sjfv * @val: read value 683172043Sjfv * 684172043Sjfv * Performs write operation to analog register specified. 685172043Sjfv **/ 686172043Sjfvs32 ixgbe_read_analog_reg8(struct ixgbe_hw *hw, u32 reg, u8 *val) 687172043Sjfv{ 688172043Sjfv return ixgbe_call_func(hw, ixgbe_func_read_analog_reg8, (hw, reg, val), 689172043Sjfv IXGBE_NOT_IMPLEMENTED); 690172043Sjfv} 691172043Sjfv 692172043Sjfv/** 693172043Sjfv * ixgbe_write_analog_reg8 - Writes 8 bit analog register 694172043Sjfv * @hw: pointer to hardware structure 695172043Sjfv * @reg: analog register to write 696172043Sjfv * @val: value to write 697172043Sjfv * 698172043Sjfv * Performs write operation to Atlas analog register specified. 699172043Sjfv **/ 700172043Sjfvs32 ixgbe_write_analog_reg8(struct ixgbe_hw *hw, u32 reg, u8 val) 701172043Sjfv{ 702172043Sjfv return ixgbe_call_func(hw, ixgbe_func_write_analog_reg8, (hw, reg, val), 703172043Sjfv IXGBE_NOT_IMPLEMENTED); 704172043Sjfv} 705172043Sjfv 706