diff options
30 files changed, 863 insertions, 989 deletions
diff --git a/sys/dev/em/e1000_80003es2lan.c b/sys/dev/em/e1000_80003es2lan.c index 4eedc52..56c1235 100644 --- a/sys/dev/em/e1000_80003es2lan.c +++ b/sys/dev/em/e1000_80003es2lan.c @@ -30,13 +30,12 @@ POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); +/*$FreeBSD$*/ /* e1000_80003es2lan */ +#include "e1000_api.h" #include "e1000_80003es2lan.h" void e1000_init_function_pointers_80003es2lan(struct e1000_hw *hw); @@ -69,9 +68,7 @@ static s32 e1000_acquire_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask); static s32 e1000_cfg_kmrn_10_100_80003es2lan(struct e1000_hw *hw, u16 duplex); static s32 e1000_cfg_kmrn_1000_80003es2lan(struct e1000_hw *hw); static s32 e1000_copper_link_setup_gg82563_80003es2lan(struct e1000_hw *hw); -static s32 e1000_get_hw_semaphore_80003es2lan(struct e1000_hw *hw); static void e1000_initialize_hw_bits_80003es2lan(struct e1000_hw *hw); -static void e1000_put_hw_semaphore_80003es2lan(struct e1000_hw *hw); static void e1000_release_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask); /* A table for the GG82563 cable length where the range is defined @@ -87,7 +84,7 @@ u16 e1000_gg82563_cable_length_table[] = /** * e1000_init_phy_params_80003es2lan - Init ESB2 PHY func ptrs. - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This is a function pointer entry point called by the api module. **/ @@ -140,7 +137,7 @@ out: /** * e1000_init_nvm_params_80003es2lan - Init ESB2 NVM func ptrs. - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This is a function pointer entry point called by the api module. **/ @@ -196,7 +193,7 @@ e1000_init_nvm_params_80003es2lan(struct e1000_hw *hw) /** * e1000_init_mac_params_80003es2lan - Init ESB2 MAC func ptrs. - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This is a function pointer entry point called by the api module. **/ @@ -293,7 +290,7 @@ out: /** * e1000_init_function_pointers_80003es2lan - Init ESB2 func ptrs. - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * The only function explicitly called by the api module to initialize * all function pointers and parameters. @@ -310,7 +307,7 @@ e1000_init_function_pointers_80003es2lan(struct e1000_hw *hw) /** * e1000_acquire_phy_80003es2lan - Acquire rights to access PHY - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * A wrapper to acquire access rights to the correct PHY. This is a * function pointer entry point called by the api module. @@ -329,7 +326,7 @@ e1000_acquire_phy_80003es2lan(struct e1000_hw *hw) /** * e1000_release_phy_80003es2lan - Release rights to access PHY - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * A wrapper to release access rights to the correct PHY. This is a * function pointer entry point called by the api module. @@ -347,7 +344,7 @@ e1000_release_phy_80003es2lan(struct e1000_hw *hw) /** * e1000_acquire_nvm_80003es2lan - Acquire rights to access NVM - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Acquire the semaphore to access the EEPROM. This is a function * pointer entry point called by the api module. @@ -374,7 +371,7 @@ out: /** * e1000_release_nvm_80003es2lan - Relinquish rights to access NVM - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Release the semaphore used to access the EEPROM. This is a * function pointer entry point called by the api module. @@ -389,74 +386,9 @@ e1000_release_nvm_80003es2lan(struct e1000_hw *hw) } /** - * e1000_get_hw_semaphore_80003es2lan - Acquire HW semaphore for PHY/NVM access - * @hw - pointer to the HW structure - * - * Acquire the HW semaphore to access the PHY or NVM - **/ -static s32 -e1000_get_hw_semaphore_80003es2lan(struct e1000_hw *hw) -{ - u32 swsm; - s32 ret_val = E1000_SUCCESS; - s32 timeout = hw->nvm.word_size + 1; - s32 i = 0; - - DEBUGFUNC("e1000_get_hw_semaphore_80003es2lan"); - - /* Get the SW semaphore. */ - while (i < timeout) { - swsm = E1000_READ_REG(hw, E1000_SWSM); - if (!(swsm & E1000_SWSM_SMBI)) - break; - - msec_delay_irq(1); - i++; - } - - if (i == timeout) { - DEBUGOUT("Driver can't access device " - "- SMBI bit is set.\n"); - ret_val = -E1000_ERR_NVM; - goto out; - } - - /* Get the FW semaphore. */ - ret_val = e1000_get_hw_semaphore_generic(hw); - if (ret_val) { - /* Release 80003es2lan semaphores */ - e1000_put_hw_semaphore_80003es2lan(hw); - goto out; - } - -out: - return ret_val; -} - -/** - * e1000_put_hw_semaphore_80003es2lan - Release HW semaphore for PHY/NVM access - * @hw - pointer to the HW structure - * - * Release the HW semaphore used to access the PHY or NVM - **/ -static void -e1000_put_hw_semaphore_80003es2lan(struct e1000_hw *hw) -{ - u32 swsm; - - DEBUGFUNC("e1000_put_hw_semaphore_80003es2lan"); - - swsm = E1000_READ_REG(hw, E1000_SWSM); - - swsm &= ~(E1000_SWSM_SMBI | E1000_SWSM_SWESMBI); - - E1000_WRITE_REG(hw, E1000_SWSM, swsm); -} - -/** * e1000_acquire_swfw_sync_80003es2lan - Acquire SW/FW semaphore - * @hw - pointer to the HW structure - * @mask - specifies which semaphore to acquire + * @hw: pointer to the HW structure + * @mask: specifies which semaphore to acquire * * Acquire the SW/FW semaphore to access the PHY or NVM. The mask * will also specify which port we're acquiring the lock for. @@ -473,7 +405,7 @@ e1000_acquire_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask) DEBUGFUNC("e1000_acquire_swfw_sync_80003es2lan"); while (i < timeout) { - if (e1000_get_hw_semaphore_80003es2lan(hw)) { + if (e1000_get_hw_semaphore_generic(hw)) { ret_val = -E1000_ERR_SWFW_SYNC; goto out; } @@ -484,7 +416,7 @@ e1000_acquire_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask) /* Firmware currently using resource (fwmask) * or other software thread using resource (swmask) */ - e1000_put_hw_semaphore_80003es2lan(hw); + e1000_put_hw_semaphore_generic(hw); msec_delay_irq(5); i++; } @@ -498,7 +430,7 @@ e1000_acquire_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask) swfw_sync |= swmask; E1000_WRITE_REG(hw, E1000_SW_FW_SYNC, swfw_sync); - e1000_put_hw_semaphore_80003es2lan(hw); + e1000_put_hw_semaphore_generic(hw); out: return ret_val; @@ -506,8 +438,8 @@ out: /** * e1000_release_swfw_sync_80003es2lan - Release SW/FW semaphore - * @hw - pointer to the HW structure - * @mask - specifies which semaphore to acquire + * @hw: pointer to the HW structure + * @mask: specifies which semaphore to acquire * * Release the SW/FW semaphore used to access the PHY or NVM. The mask * will also specify which port we're releasing the lock for. @@ -519,21 +451,21 @@ e1000_release_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask) DEBUGFUNC("e1000_release_swfw_sync_80003es2lan"); - while (e1000_get_hw_semaphore_80003es2lan(hw) != E1000_SUCCESS); + while (e1000_get_hw_semaphore_generic(hw) != E1000_SUCCESS); /* Empty */ swfw_sync = E1000_READ_REG(hw, E1000_SW_FW_SYNC); swfw_sync &= ~mask; E1000_WRITE_REG(hw, E1000_SW_FW_SYNC, swfw_sync); - e1000_put_hw_semaphore_80003es2lan(hw); + e1000_put_hw_semaphore_generic(hw); } /** * e1000_read_phy_reg_gg82563_80003es2lan - Read GG82563 PHY register - * @hw - pointer to the HW structure - * @offset - offset of the register to read - * @data - pointer to the data returned from the operation + * @hw: pointer to the HW structure + * @offset: offset of the register to read + * @data: pointer to the data returned from the operation * * Read the GG82563 PHY register. This is a function pointer entry * point called by the api module. @@ -591,9 +523,9 @@ out: /** * e1000_write_phy_reg_gg82563_80003es2lan - Write GG82563 PHY register - * @hw - pointer to the HW structure - * @offset - offset of the register to read - * @data - value to write to the register + * @hw: pointer to the HW structure + * @offset: offset of the register to read + * @data: value to write to the register * * Write to the GG82563 PHY register. This is a function pointer entry * point called by the api module. @@ -652,10 +584,10 @@ out: /** * e1000_write_nvm_80003es2lan - Write to ESB2 NVM - * @hw - pointer to the HW structure - * @offset - offset of the register to read - * @words - number of words to write - * @data - buffer of data to write to the NVM + * @hw: pointer to the HW structure + * @offset: offset of the register to read + * @words: number of words to write + * @data: buffer of data to write to the NVM * * Write "words" of data to the ESB2 NVM. This is a function * pointer entry point called by the api module. @@ -671,7 +603,7 @@ e1000_write_nvm_80003es2lan(struct e1000_hw *hw, u16 offset, /** * e1000_get_cfg_done_80003es2lan - Wait for configuration to complete - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Wait a specific amount of time for manageability processes to complete. * This is a function pointer entry point called by the phy module. @@ -706,7 +638,7 @@ out: /** * e1000_phy_force_speed_duplex_80003es2lan - Force PHY speed and duplex - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Force the speed and duplex settings onto the PHY. This is a * function pointer entry point called by the phy module. @@ -799,7 +731,7 @@ out: /** * e1000_get_cable_length_80003es2lan - Set approximate cable length - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Find the approximate cable length as measured by the GG82563 PHY. * This is a function pointer entry point called by the phy module. @@ -829,9 +761,9 @@ out: /** * e1000_get_link_up_info_80003es2lan - Report speed and duplex - * @hw - pointer to the HW structure - * @speed - pointer to speed buffer - * @duplex - pointer to duplex buffer + * @hw: pointer to the HW structure + * @speed: pointer to speed buffer + * @duplex: pointer to duplex buffer * * Retrieve the current speed and duplex configuration. * This is a function pointer entry point called by the api module. @@ -865,7 +797,7 @@ out: /** * e1000_reset_hw_80003es2lan - Reset the ESB2 controller - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Perform a global reset to the ESB2 controller. * This is a function pointer entry point called by the api module. @@ -915,7 +847,7 @@ out: /** * e1000_init_hw_80003es2lan - Initialize the ESB2 controller - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Initialize the hw bits, LED, VFTA, MTA, link and hw counters. * This is a function pointer entry point called by the api module. @@ -1000,7 +932,7 @@ out: /** * e1000_initialize_hw_bits_80003es2lan - Init hw bits of ESB2 - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Initializes required hardware-dependent bits needed for normal operation. **/ @@ -1045,7 +977,7 @@ out: /** * e1000_copper_link_setup_gg82563_80003es2lan - Configure GG82563 Link - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Setup some GG82563 PHY registers for obtaining link **/ @@ -1194,7 +1126,7 @@ out: /** * e1000_setup_copper_link_80003es2lan - Setup Copper Link for ESB2 - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Essentially a wrapper for setting up all things "copper" related. * This is a function pointer entry point called by the mac module. @@ -1250,8 +1182,8 @@ out: /** * e1000_cfg_kmrn_10_100_80003es2lan - Apply "quirks" for 10/100 operation - * @hw - pointer to the HW structure - * @duplex - current duplex setting + * @hw: pointer to the HW structure + * @duplex: current duplex setting * * Configure the KMRN interface by applying last minute quirks for * 10/100 operation. @@ -1261,7 +1193,8 @@ e1000_cfg_kmrn_10_100_80003es2lan(struct e1000_hw *hw, u16 duplex) { s32 ret_val = E1000_SUCCESS; u32 tipg; - u16 reg_data; + u32 i = 0; + u16 reg_data, reg_data2; DEBUGFUNC("e1000_configure_kmrn_for_10_100"); @@ -1278,9 +1211,19 @@ e1000_cfg_kmrn_10_100_80003es2lan(struct e1000_hw *hw, u16 duplex) tipg |= DEFAULT_TIPG_IPGT_10_100_80003ES2LAN; E1000_WRITE_REG(hw, E1000_TIPG, tipg); - ret_val = e1000_read_phy_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, ®_data); - if (ret_val) - goto out; + + do { + ret_val = e1000_read_phy_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, + ®_data); + if (ret_val) + goto out; + + ret_val = e1000_read_phy_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, + ®_data2); + if (ret_val) + goto out; + i++; + } while ((reg_data != reg_data2) && (i < GG82563_MAX_KMRN_RETRY)); if (duplex == HALF_DUPLEX) reg_data |= GG82563_KMCR_PASS_FALSE_CARRIER; @@ -1295,7 +1238,7 @@ out: /** * e1000_cfg_kmrn_1000_80003es2lan - Apply "quirks" for gigabit operation - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Configure the KMRN interface by applying last minute quirks for * gigabit operation. @@ -1304,8 +1247,9 @@ static s32 e1000_cfg_kmrn_1000_80003es2lan(struct e1000_hw *hw) { s32 ret_val = E1000_SUCCESS; - u16 reg_data; + u16 reg_data, reg_data2; u32 tipg; + u32 i = 0; DEBUGFUNC("e1000_configure_kmrn_for_1000"); @@ -1322,9 +1266,19 @@ e1000_cfg_kmrn_1000_80003es2lan(struct e1000_hw *hw) tipg |= DEFAULT_TIPG_IPGT_1000_80003ES2LAN; E1000_WRITE_REG(hw, E1000_TIPG, tipg); - ret_val = e1000_read_phy_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, ®_data); - if (ret_val) - goto out; + + do { + ret_val = e1000_read_phy_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, + ®_data); + if (ret_val) + goto out; + + ret_val = e1000_read_phy_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, + ®_data2); + if (ret_val) + goto out; + i++; + } while ((reg_data != reg_data2) && (i < GG82563_MAX_KMRN_RETRY)); reg_data &= ~GG82563_KMCR_PASS_FALSE_CARRIER; ret_val = e1000_write_phy_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, reg_data); @@ -1335,7 +1289,7 @@ out: /** * e1000_clear_hw_cntrs_80003es2lan - Clear device specific hardware counters - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Clears the hardware counters by reading the counter registers. **/ diff --git a/sys/dev/em/e1000_80003es2lan.h b/sys/dev/em/e1000_80003es2lan.h index 2b219ca..e574f6d 100644 --- a/sys/dev/em/e1000_80003es2lan.h +++ b/sys/dev/em/e1000_80003es2lan.h @@ -30,17 +30,12 @@ POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ - -/* - * $FreeBSD$ - */ +/*$FreeBSD$*/ #ifndef _E1000_80003ES2LAN_H_ #define _E1000_80003ES2LAN_H_ -#include "e1000_api.h" - #define E1000_KMRNCTRLSTA_OFFSET_FIFO_CTRL 0x00 #define E1000_KMRNCTRLSTA_OFFSET_INB_CTRL 0x02 #define E1000_KMRNCTRLSTA_OFFSET_HD_CTRL 0x10 @@ -89,6 +84,9 @@ /* Kumeran Mode Control Register (Page 193, Register 16) */ #define GG82563_KMCR_PASS_FALSE_CARRIER 0x0800 +/* Max number of times Kumeran read/write should be validated */ +#define GG82563_MAX_KMRN_RETRY 0x5 + /* Power Management Control Register (Page 193, Register 20) */ #define GG82563_PMCR_ENABLE_ELECTRICAL_IDLE 0x0001 /* 1=Enable SERDES Electrical Idle */ diff --git a/sys/dev/em/e1000_82540.c b/sys/dev/em/e1000_82540.c index 7867b2f..7fdc664 100644 --- a/sys/dev/em/e1000_82540.c +++ b/sys/dev/em/e1000_82540.c @@ -30,9 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); +/*$FreeBSD$*/ /* e1000_82540 @@ -60,7 +58,7 @@ STATIC s32 e1000_setup_fiber_serdes_link_82540(struct e1000_hw *hw); /** * e1000_init_phy_params_82540 - Init PHY func ptrs. - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This is a function pointer entry point called by the api module. **/ @@ -113,7 +111,7 @@ out: /** * e1000_init_nvm_params_82540 - Init NVM func ptrs. - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This is a function pointer entry point called by the api module. **/ @@ -158,7 +156,7 @@ e1000_init_nvm_params_82540(struct e1000_hw *hw) /** * e1000_init_mac_params_82540 - Init MAC func ptrs. - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This is a function pointer entry point called by the api module. **/ @@ -253,7 +251,7 @@ out: /** * e1000_init_function_pointers_82540 - Init func ptrs. - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * The only function explicitly called by the api module to initialize * all function pointers and parameters. @@ -270,7 +268,7 @@ e1000_init_function_pointers_82540(struct e1000_hw *hw) /** * e1000_reset_hw_82540 - Reset hardware - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This resets the hardware into a known state. This is a * function pointer entry point called by the api module. @@ -328,7 +326,7 @@ e1000_reset_hw_82540(struct e1000_hw *hw) /** * e1000_init_hw_82540 - Initialize hardware - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This inits the hardware readying it for operation. This is a * function pointer entry point called by the api module. @@ -407,7 +405,7 @@ out: /** * e1000_setup_copper_link_82540 - Configure copper link settings - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Calls the appropriate function to configure the link for auto-neg or forced * speed and duplex. Then we check for link, once link is established calls @@ -456,7 +454,7 @@ out: /** * e1000_setup_fiber_serdes_link_82540 - Setup link for fiber/serdes - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Set the output amplitude to the value in the EEPROM and adjust the VCO * speed to improve Bit Error Rate (BER) performance. Configures collision @@ -499,7 +497,7 @@ out: /** * e1000_adjust_serdes_amplitude_82540 - Adjust amplitude based on EEPROM - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Adjust the SERDES ouput amplitude based on the EEPROM settings. **/ @@ -532,7 +530,7 @@ out: /** * e1000_set_vco_speed_82540 - Set VCO speed for better performance - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Set the VCO speed to improve Bit Error Rate (BER) performance. **/ @@ -590,7 +588,7 @@ out: /** * e1000_set_phy_mode_82540 - Set PHY to class A mode - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Sets the PHY to class A mode and assumes the following operations will * follow to enable the new class mode: @@ -639,7 +637,7 @@ out: /** * e1000_clear_hw_cntrs_82540 - Clear device specific hardware counters - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Clears the hardware counters by reading the counter registers. **/ diff --git a/sys/dev/em/e1000_82541.c b/sys/dev/em/e1000_82541.c index 25481de..3bc6483 100644 --- a/sys/dev/em/e1000_82541.c +++ b/sys/dev/em/e1000_82541.c @@ -30,9 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); +/*$FreeBSD$*/ /* e1000_82541 @@ -41,6 +39,7 @@ __FBSDID("$FreeBSD$"); * e1000_82547_rev_2 */ +#include "e1000_api.h" #include "e1000_82541.h" void e1000_init_function_pointers_82541(struct e1000_hw *hw); @@ -88,7 +87,7 @@ struct e1000_dev_spec_82541 { /** * e1000_init_phy_params_82541 - Init PHY func ptrs. - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This is a function pointer entry point called by the api module. **/ @@ -133,7 +132,7 @@ out: /** * e1000_init_nvm_params_82541 - Init NVM func ptrs. - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This is a function pointer entry point called by the api module. **/ @@ -231,7 +230,7 @@ out: /** * e1000_init_mac_params_82541 - Init MAC func ptrs. - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This is a function pointer entry point called by the api module. **/ @@ -299,7 +298,7 @@ e1000_init_mac_params_82541(struct e1000_hw *hw) /** * e1000_init_function_pointers_82541 - Init func ptrs. - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * The only function explicitly called by the api module to initialize * all function pointers and parameters. @@ -316,7 +315,7 @@ e1000_init_function_pointers_82541(struct e1000_hw *hw) /** * e1000_reset_hw_82541 - Reset hardware - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This resets the hardware into a known state. This is a * function pointer entry point called by the api module. @@ -393,7 +392,7 @@ e1000_reset_hw_82541(struct e1000_hw *hw) /** * e1000_init_hw_82541 - Initialize hardware - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This inits the hardware readying it for operation. This is a * function pointer entry point called by the api module. @@ -454,9 +453,9 @@ out: /** * e1000_get_link_up_info_82541 - Report speed and duplex - * @hw - pointer to the HW structure - * @speed - pointer to speed buffer - * @duplex - pointer to duplex buffer + * @hw: pointer to the HW structure + * @speed: pointer to speed buffer + * @duplex: pointer to duplex buffer * * Retrieve the current speed and duplex configuration. * This is a function pointer entry point called by the api module. @@ -508,7 +507,7 @@ out: /** * e1000_phy_hw_reset_82541 - PHY hardware reset - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Verify the reset block is not blocking us from resetting. Acquire * semaphore (if necessary) and read/set/write the device control reset @@ -544,7 +543,7 @@ out: /** * e1000_setup_copper_link_82541 - Configure copper link settings - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Calls the appropriate function to configure the link for auto-neg or forced * speed and duplex. Then we check for link, once link is established calls @@ -601,7 +600,7 @@ out: /** * e1000_check_for_link_82541 - Check/Store link connection - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This checks the link condition of the adapter and stores the * results in the hw->mac structure. This is a function pointer entry @@ -677,8 +676,8 @@ out: /** * e1000_config_dsp_after_link_change_82541 - Config DSP after link - * @hw - pointer to the HW structure - * @link_up - boolean flag for link up status + * @hw: pointer to the HW structure + * @link_up: boolean flag for link up status * * Return E1000_ERR_PHY when failing to read/write the PHY, else E1000_SUCCESS * at any other case. @@ -888,7 +887,7 @@ out: /** * e1000_get_cable_length_igp_82541 - Determine cable length for igp PHY - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * The automatic gain control (agc) normalizes the amplitude of the * received signal, adjusting for the attenuation produced by the @@ -961,8 +960,8 @@ out: /** * e1000_set_d3_lplu_state_82541 - Sets low power link up state for D3 - * @hw - pointer to the HW structure - * @active boolean used to enable/disable lplu + * @hw: pointer to the HW structure + * @active: boolean used to enable/disable lplu * * Success returns 0, Failure returns 1 * @@ -1061,7 +1060,7 @@ out: /** * e1000_setup_led_82541 - Configures SW controllable LED - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This prepares the SW controllable LED for use and saves the current state * of the LED so it can be later restored. This is a function pointer entry @@ -1098,7 +1097,7 @@ out: /** * e1000_cleanup_led_82541 - Set LED config to default operation - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Remove the current LED configuration and set the LED configuration * to the default value, saved from the EEPROM. This is a function pointer @@ -1128,7 +1127,7 @@ out: /** * e1000_phy_init_script_82541 - Initialize GbE PHY - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Initializes the IGP PHY. **/ @@ -1242,8 +1241,8 @@ out: /** * e1000_init_script_state_82541 - Enable/Disable PHY init script - * @hw - pointer to the HW structure - * @state - boolean value used to enable/disable PHY init script + * @hw: pointer to the HW structure + * @state: boolean value used to enable/disable PHY init script * * Allows the driver to enable/disable the PHY init script, if the PHY is an * IGP PHY. This is a function pointer entry point called by the api module. @@ -1275,7 +1274,7 @@ out: /** * e1000_clear_hw_cntrs_82541 - Clear device specific hardware counters - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Clears the hardware counters by reading the counter registers. **/ diff --git a/sys/dev/em/e1000_82541.h b/sys/dev/em/e1000_82541.h index 166a7c3..1b1735b 100644 --- a/sys/dev/em/e1000_82541.h +++ b/sys/dev/em/e1000_82541.h @@ -30,17 +30,12 @@ POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ - -/* - * $FreeBSD$ - */ +/*$FreeBSD$*/ #ifndef _E1000_82541_H_ #define _E1000_82541_H_ -#include "e1000_api.h" - #define NVM_WORD_SIZE_BASE_SHIFT_82541 (NVM_WORD_SIZE_BASE_SHIFT + 1) #define IGP01E1000_PHY_CHANNEL_NUM 4 diff --git a/sys/dev/em/e1000_82542.c b/sys/dev/em/e1000_82542.c index 56cfdd2..c03dbde 100644 --- a/sys/dev/em/e1000_82542.c +++ b/sys/dev/em/e1000_82542.c @@ -30,9 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); +/*$FreeBSD$*/ /* e1000_82542 (rev 1 & 2) @@ -59,7 +57,7 @@ struct e1000_dev_spec_82542 { /** * e1000_init_phy_params_82542 - Init PHY func ptrs. - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This is a function pointer entry point called by the api module. **/ @@ -78,7 +76,7 @@ e1000_init_phy_params_82542(struct e1000_hw *hw) /** * e1000_init_nvm_params_82542 - Init NVM func ptrs. - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This is a function pointer entry point called by the api module. **/ @@ -108,7 +106,7 @@ e1000_init_nvm_params_82542(struct e1000_hw *hw) /** * e1000_init_mac_params_82542 - Init MAC func ptrs. - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This is a function pointer entry point called by the api module. **/ @@ -171,7 +169,7 @@ e1000_init_mac_params_82542(struct e1000_hw *hw) /** * e1000_init_function_pointers_82542 - Init func ptrs. - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * The only function explicitly called by the api module to initialize * all function pointers and parameters. @@ -188,7 +186,7 @@ e1000_init_function_pointers_82542(struct e1000_hw *hw) /** * e1000_get_bus_info_82542 - Obtain bus information for adapter - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This will obtain information about the HW bus for which the * adaper is attached and stores it in the hw structure. This is a function @@ -208,7 +206,7 @@ e1000_get_bus_info_82542(struct e1000_hw *hw) /** * e1000_reset_hw_82542 - Reset hardware - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This resets the hardware into a known state. This is a * function pointer entry point called by the api module. @@ -260,7 +258,7 @@ e1000_reset_hw_82542(struct e1000_hw *hw) /** * e1000_init_hw_82542 - Initialize hardware - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This inits the hardware readying it for operation. This is a * function pointer entry point called by the api module. @@ -332,7 +330,7 @@ e1000_init_hw_82542(struct e1000_hw *hw) /** * e1000_setup_link_82542 - Setup flow control and link settings - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Determines which flow control settings to use, then configures flow * control. Calls the appropriate media-specific link configuration @@ -393,7 +391,7 @@ out: /** * e1000_led_on_82542 - Turn on SW controllable LED - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Turns the SW defined LED on. This is a function pointer entry point * called by the api module. @@ -414,7 +412,7 @@ e1000_led_on_82542(struct e1000_hw *hw) /** * e1000_led_off_82542 - Turn off SW controllable LED - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Turns the SW defined LED off. This is a function pointer entry point * called by the api module. @@ -435,7 +433,7 @@ e1000_led_off_82542(struct e1000_hw *hw) /** * e1000_translate_register_82542 - Translate the proper regiser offset - * @reg - e1000 register to be read + * @reg: e1000 register to be read * * Registers in 82542 are located in different offsets than other adapters * even though they function in the same manner. This function takes in @@ -532,7 +530,7 @@ e1000_translate_register_82542(u32 reg) /** * e1000_clear_hw_cntrs_82542 - Clear device specific hardware counters - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Clears the hardware counters by reading the counter registers. **/ diff --git a/sys/dev/em/e1000_82543.c b/sys/dev/em/e1000_82543.c index 34efae5..f820568 100644 --- a/sys/dev/em/e1000_82543.c +++ b/sys/dev/em/e1000_82543.c @@ -30,15 +30,14 @@ POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); +/*$FreeBSD$*/ /* e1000_82543 * e1000_82544 */ +#include "e1000_api.h" #include "e1000_82543.h" void e1000_init_function_pointers_82543(struct e1000_hw *hw); @@ -84,7 +83,7 @@ struct e1000_dev_spec_82543 { /** * e1000_init_phy_params_82543 - Init PHY func ptrs. - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This is a function pointer entry point called by the api module. **/ @@ -167,7 +166,7 @@ out: /** * e1000_init_nvm_params_82543 - Init NVM func ptrs. - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This is a function pointer entry point called by the api module. **/ @@ -197,7 +196,7 @@ e1000_init_nvm_params_82543(struct e1000_hw *hw) /** * e1000_init_mac_params_82543 - Init MAC func ptrs. - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This is a function pointer entry point called by the api module. **/ @@ -285,7 +284,7 @@ out: /** * e1000_init_function_pointers_82543 - Init func ptrs. - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * The only function explicitly called by the api module to initialize * all function pointers and parameters. @@ -302,7 +301,7 @@ e1000_init_function_pointers_82543(struct e1000_hw *hw) /** * e1000_tbi_compatibility_enabled_82543 - Returns TBI compat status - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Returns the curent status of 10-bit Interface (TBI) compatibility * (enabled/disabled). @@ -336,8 +335,8 @@ out: /** * e1000_set_tbi_compatibility_82543 - Set TBI compatibility - * @hw - pointer to the HW structure - * @state - enable/disable TBI compatibility + * @hw: pointer to the HW structure + * @state: enable/disable TBI compatibility * * Enables or disabled 10-bit Interface (TBI) compatibility. **/ @@ -371,7 +370,7 @@ out: /** * e1000_tbi_sbp_enabled_82543 - Returns TBI SBP status - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Returns the curent status of 10-bit Interface (TBI) store bad packet (SBP) * (enabled/disabled). @@ -405,8 +404,8 @@ out: /** * e1000_set_tbi_sbp_82543 - Set TBI SBP - * @hw - pointer to the HW structure - * @state - enable/disable TBI store bad packet + * @hw: pointer to the HW structure + * @state: enable/disable TBI store bad packet * * Enables or disabled 10-bit Interface (TBI) store bad packet (SBP). **/ @@ -429,7 +428,7 @@ e1000_set_tbi_sbp_82543(struct e1000_hw *hw, boolean_t state) /** * e1000_init_phy_disabled_82543 - Returns init PHY status - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Returns the current status of whether PHY initialization is disabled. * True if PHY initialization is disabled else false. @@ -463,10 +462,10 @@ out: /** * e1000_tbi_adjust_stats_82543 - Adjust stats when TBI enabled - * @hw - pointer to the HW structure - * @stats - Struct containing statistic register values - * @frame_len - The length of the frame in question - * @mac_addr - The Ethernet destination address of the frame in question + * @hw: pointer to the HW structure + * @stats: Struct containing statistic register values + * @frame_len: The length of the frame in question + * @mac_addr: The Ethernet destination address of the frame in question * * Adjusts the statistic counters when a frame is accepted by TBI_ACCEPT **/ @@ -547,9 +546,9 @@ out: /** * e1000_read_phy_reg_82543 - Read PHY register - * @hw - pointer to the HW structure - * @offset - register offset to be read - * @data - pointer to the read data + * @hw: pointer to the HW structure + * @offset: register offset to be read + * @data: pointer to the read data * * Reads the PHY at offset and stores the information read to data. **/ @@ -601,9 +600,9 @@ out: /** * e1000_write_phy_reg_82543 - Write PHY register - * @hw - pointer to the HW structure - * @offset - register offset to be written - * @data - pointer to the data to be written at offset + * @hw: pointer to the HW structure + * @offset: register offset to be written + * @data: pointer to the data to be written at offset * * Writes data to the PHY at offset. **/ @@ -647,8 +646,8 @@ out: /** * e1000_raise_mdi_clk_82543 - Raise Management Data Input clock - * @hw - pointer to the HW structure - * @ctrl - pointer to the control register + * @hw: pointer to the HW structure + * @ctrl: pointer to the control register * * Raise the management data input clock by setting the MDC bit in the control * register. @@ -666,8 +665,8 @@ e1000_raise_mdi_clk_82543(struct e1000_hw *hw, u32 *ctrl) /** * e1000_lower_mdi_clk_82543 - Lower Management Data Input clock - * @hw - pointer to the HW structure - * @ctrl - pointer to the control register + * @hw: pointer to the HW structure + * @ctrl: pointer to the control register * * Lower the management data input clock by clearing the MDC bit in the control * register. @@ -685,9 +684,9 @@ e1000_lower_mdi_clk_82543(struct e1000_hw *hw, u32 *ctrl) /** * e1000_shift_out_mdi_bits_82543 - Shift data bits our to the PHY - * @hw - pointer to the HW structure - * @data - data to send to the PHY - * @count - number of bits to shift out + * @hw: pointer to the HW structure + * @data: data to send to the PHY + * @count: number of bits to shift out * * We need to shift 'count' bits out to the PHY. So, the value in the * "data" parameter will be shifted out to the PHY one bit at a time. @@ -734,7 +733,7 @@ e1000_shift_out_mdi_bits_82543(struct e1000_hw *hw, u32 data, u16 count) /** * e1000_shift_in_mdi_bits_82543 - Shift data bits in from the PHY - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * In order to read a register from the PHY, we need to shift 18 bits * in from the PHY. Bits are "shifted in" by raising the clock input to @@ -792,7 +791,7 @@ e1000_shift_in_mdi_bits_82543(struct e1000_hw *hw) /** * e1000_phy_force_speed_duplex_82543 - Force speed/duplex for PHY - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Calls the function to force speed and duplex for the m88 PHY, and * if the PHY is not auto-negotiating and the speed is forced to 10Mbit, @@ -819,7 +818,7 @@ out: /** * e1000_polarity_reversal_workaround_82543 - Workaround polarity reversal - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * When forcing link to 10 Full or 10 Half, the PHY can reverse the polarity * inadvertantly. To workaround the issue, we disable the transmitter on @@ -907,7 +906,7 @@ out: /** * e1000_phy_hw_reset_82543 - PHY hardware reset - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Sets the PHY_RESET_DIR bit in the extended device control register * to put the PHY into a reset and waits for completion. Once the reset @@ -948,7 +947,7 @@ e1000_phy_hw_reset_82543(struct e1000_hw *hw) /** * e1000_reset_hw_82543 - Reset hardware - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This resets the hardware into a known state. This is a * function pointer entry point called by the api module. @@ -1002,7 +1001,7 @@ e1000_reset_hw_82543(struct e1000_hw *hw) /** * e1000_init_hw_82543 - Initialize hardware - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This inits the hardware readying it for operation. **/ @@ -1066,7 +1065,7 @@ out: /** * e1000_setup_link_82543 - Setup flow control and link settings - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Read the EEPROM to determine the initial polarity value and write the * extended device control register with the information before calling @@ -1112,7 +1111,7 @@ out: /** * e1000_setup_copper_link_82543 - Configure copper link settings - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Configures the link for auto-neg or forced speed and duplex. Then we check * for link, once link is established calls to configure collision distance @@ -1199,7 +1198,7 @@ out: /** * e1000_setup_fiber_link_82543 - Setup link for fiber - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Configures collision distance and flow control for fiber links. Upon * successful setup, poll for link. @@ -1245,7 +1244,7 @@ out: /** * e1000_check_for_copper_link_82543 - Check for link (Copper) - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Checks the phy for link, if link exists, do the following: * - check for downshift @@ -1379,7 +1378,7 @@ out: /** * e1000_check_for_fiber_link_82543 - Check for link (Fiber) - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Checks for link up on the hardware. If link is not up and we have * a signal, then we need to force link up. @@ -1448,7 +1447,7 @@ out: /** * e1000_config_mac_to_phy_82543 - Configure MAC to PHY settings - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * For the 82543 silicon, we need to set the MAC to match the settings * of the PHY, even if the PHY is auto-negotiating. @@ -1496,9 +1495,9 @@ out: /** * e1000_write_vfta_82543 - Write value to VLAN filter table - * @hw - pointer to the HW structure - * @offset - the 32-bit offset in which to write the value to. - * @value - the 32-bit value to write at location offset. + * @hw: pointer to the HW structure + * @offset: the 32-bit offset in which to write the value to. + * @value: the 32-bit value to write at location offset. * * This writes a 32-bit value to a 32-bit offset in the VLAN filter * table. @@ -1522,8 +1521,8 @@ e1000_write_vfta_82543(struct e1000_hw *hw, u32 offset, u32 value) /** * e1000_mta_set_82543 - Set multicast filter table address - * @hw - pointer to the HW structure - * @hash_value - determines the MTA register and bit to set + * @hw: pointer to the HW structure + * @hash_value: determines the MTA register and bit to set * * The multicast table address is a register array of 32-bit registers. * The hash_value is used to determine what register the bit is in, the @@ -1560,7 +1559,7 @@ e1000_mta_set_82543(struct e1000_hw *hw, u32 hash_value) /** * e1000_led_on_82543 - Turn on SW controllable LED - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Turns the SW defined LED on. This is a function pointer entry point * called by the api module. @@ -1589,7 +1588,7 @@ e1000_led_on_82543(struct e1000_hw *hw) /** * e1000_led_off_82543 - Turn off SW controllable LED - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Turns the SW defined LED off. This is a function pointer entry point * called by the api module. @@ -1617,7 +1616,7 @@ e1000_led_off_82543(struct e1000_hw *hw) /** * e1000_clear_hw_cntrs_82543 - Clear device specific hardware counters - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Clears the hardware counters by reading the counter registers. **/ diff --git a/sys/dev/em/e1000_82543.h b/sys/dev/em/e1000_82543.h index 53a946e..b27d1b5 100644 --- a/sys/dev/em/e1000_82543.h +++ b/sys/dev/em/e1000_82543.h @@ -30,17 +30,12 @@ POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ - -/* - * $FreeBSD$ - */ +/*$FreeBSD$*/ #ifndef _E1000_82543_H_ #define _E1000_82543_H_ -#include "e1000_api.h" - #define PHY_PREAMBLE 0xFFFFFFFF #define PHY_PREAMBLE_SIZE 32 #define PHY_SOF 0x1 diff --git a/sys/dev/em/e1000_82571.c b/sys/dev/em/e1000_82571.c index 959027e..8617e62 100644 --- a/sys/dev/em/e1000_82571.c +++ b/sys/dev/em/e1000_82571.c @@ -30,9 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); +/*$FreeBSD$*/ /* e1000_82571 @@ -40,6 +38,7 @@ __FBSDID("$FreeBSD$"); * e1000_82573 */ +#include "e1000_api.h" #include "e1000_82571.h" void e1000_init_function_pointers_82571(struct e1000_hw *hw); @@ -67,8 +66,10 @@ STATIC s32 e1000_setup_copper_link_82571(struct e1000_hw *hw); STATIC s32 e1000_setup_fiber_serdes_link_82571(struct e1000_hw *hw); STATIC s32 e1000_valid_led_default_82571(struct e1000_hw *hw, u16 *data); STATIC void e1000_clear_hw_cntrs_82571(struct e1000_hw *hw); +static s32 e1000_get_hw_semaphore_82571(struct e1000_hw *hw); static s32 e1000_fix_nvm_checksum_82571(struct e1000_hw *hw); static s32 e1000_get_phy_id_82571(struct e1000_hw *hw); +static void e1000_put_hw_semaphore_82571(struct e1000_hw *hw); static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw); static s32 e1000_write_nvm_eewr_82571(struct e1000_hw *hw, u16 offset, u16 words, u16 *data); @@ -79,7 +80,7 @@ struct e1000_dev_spec_82571 { /** * e1000_init_phy_params_82571 - Init PHY func ptrs. - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This is a function pointer entry point called by the api module. **/ @@ -101,10 +102,10 @@ e1000_init_phy_params_82571(struct e1000_hw *hw) phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; phy->reset_delay_us = 100; - func->acquire_phy = e1000_get_hw_semaphore_generic; + func->acquire_phy = e1000_get_hw_semaphore_82571; func->check_polarity = e1000_check_polarity_igp; func->check_reset_block = e1000_check_reset_block_generic; - func->release_phy = e1000_put_hw_semaphore_generic; + func->release_phy = e1000_put_hw_semaphore_82571; func->reset_phy = e1000_phy_hw_reset_generic; func->set_d0_lplu_state = e1000_set_d0_lplu_state_82571; func->set_d3_lplu_state = e1000_set_d3_lplu_state_generic; @@ -166,7 +167,7 @@ out: /** * e1000_init_nvm_params_82571 - Init NVM func ptrs. - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This is a function pointer entry point called by the api module. **/ @@ -238,7 +239,7 @@ e1000_init_nvm_params_82571(struct e1000_hw *hw) /** * e1000_init_mac_params_82571 - Init MAC func ptrs. - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This is a function pointer entry point called by the api module. **/ @@ -259,6 +260,8 @@ e1000_init_mac_params_82571(struct e1000_hw *hw) hw->media_type = e1000_media_type_fiber; break; case E1000_DEV_ID_82571EB_SERDES: + case E1000_DEV_ID_82571EB_SERDES_DUAL: + case E1000_DEV_ID_82571EB_SERDES_QUAD: case E1000_DEV_ID_82572EI_SERDES: hw->media_type = e1000_media_type_internal_serdes; break; @@ -349,7 +352,7 @@ out: /** * e1000_init_function_pointers_82571 - Init func ptrs. - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * The only function explicitly called by the api module to initialize * all function pointers and parameters. @@ -366,7 +369,7 @@ e1000_init_function_pointers_82571(struct e1000_hw *hw) /** * e1000_get_phy_id_82571 - Retrieve the PHY ID and revision - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Reads the PHY registers and stores the PHY ID and possibly the PHY * revision in the hardware structure. @@ -400,8 +403,68 @@ e1000_get_phy_id_82571(struct e1000_hw *hw) } /** + * e1000_get_hw_semaphore_82571 - Acquire hardware semaphore + * @hw: pointer to the HW structure + * + * Acquire the HW semaphore to access the PHY or NVM + **/ +s32 +e1000_get_hw_semaphore_82571(struct e1000_hw *hw) +{ + u32 swsm; + s32 ret_val = E1000_SUCCESS; + s32 timeout = hw->nvm.word_size + 1; + s32 i = 0; + + DEBUGFUNC("e1000_get_hw_semaphore_82571"); + + /* Get the FW semaphore. */ + for (i = 0; i < timeout; i++) { + swsm = E1000_READ_REG(hw, E1000_SWSM); + E1000_WRITE_REG(hw, E1000_SWSM, swsm | E1000_SWSM_SWESMBI); + + /* Semaphore acquired if bit latched */ + if (E1000_READ_REG(hw, E1000_SWSM) & E1000_SWSM_SWESMBI) + break; + + usec_delay(50); + } + + if (i == timeout) { + /* Release semaphores */ + e1000_put_hw_semaphore_generic(hw); + DEBUGOUT("Driver can't access the NVM\n"); + ret_val = -E1000_ERR_NVM; + goto out; + } + +out: + return ret_val; +} + +/** + * e1000_put_hw_semaphore_82571 - Release hardware semaphore + * @hw: pointer to the HW structure + * + * Release hardware semaphore used to access the PHY or NVM + **/ +void +e1000_put_hw_semaphore_82571(struct e1000_hw *hw) +{ + u32 swsm; + + DEBUGFUNC("e1000_put_hw_semaphore_82571"); + + swsm = E1000_READ_REG(hw, E1000_SWSM); + + swsm &= ~E1000_SWSM_SWESMBI; + + E1000_WRITE_REG(hw, E1000_SWSM, swsm); +} + +/** * e1000_acquire_nvm_82571 - Request for access to the EEPROM - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * To gain access to the EEPROM, first we must obtain a hardware semaphore. * Then for non-82573 hardware, set the EEPROM access request bit and wait @@ -415,7 +478,7 @@ e1000_acquire_nvm_82571(struct e1000_hw *hw) DEBUGFUNC("e1000_acquire_nvm_82571"); - ret_val = e1000_get_hw_semaphore_generic(hw); + ret_val = e1000_get_hw_semaphore_82571(hw); if (ret_val) goto out; @@ -423,7 +486,7 @@ e1000_acquire_nvm_82571(struct e1000_hw *hw) ret_val = e1000_acquire_nvm_generic(hw); if (ret_val) - e1000_put_hw_semaphore_generic(hw); + e1000_put_hw_semaphore_82571(hw); out: return ret_val; @@ -431,7 +494,7 @@ out: /** * e1000_release_nvm_82571 - Release exclusive access to EEPROM - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Stop any current commands to the EEPROM and clear the EEPROM request bit. **/ @@ -441,15 +504,15 @@ e1000_release_nvm_82571(struct e1000_hw *hw) DEBUGFUNC("e1000_release_nvm_82571"); e1000_release_nvm_generic(hw); - e1000_put_hw_semaphore_generic(hw); + e1000_put_hw_semaphore_82571(hw); } /** * e1000_write_nvm_82571 - Write to EEPROM using appropriate interface - * @hw - pointer to the HW structure - * @offset - offset within the EEPROM to be written to - * @words - number of words to write - * @data - 16 bit word(s) to be written to the EEPROM + * @hw: pointer to the HW structure + * @offset: offset within the EEPROM to be written to + * @words: number of words to write + * @data: 16 bit word(s) to be written to the EEPROM * * For non-82573 silicon, write data to EEPROM at offset using SPI interface. * @@ -481,7 +544,7 @@ e1000_write_nvm_82571(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) /** * e1000_update_nvm_checksum_82571 - Update EEPROM checksum - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Updates the EEPROM checksum by reading/adding each word of the EEPROM * up to the checksum. Then calculates the EEPROM checksum and writes the @@ -548,7 +611,7 @@ out: /** * e1000_validate_nvm_checksum_82571 - Validate EEPROM checksum - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Calculates the EEPROM checksum by reading/adding each word of the EEPROM * and then verifies that the sum of the EEPROM is equal to 0xBABA. @@ -566,10 +629,10 @@ e1000_validate_nvm_checksum_82571(struct e1000_hw *hw) /** * e1000_write_nvm_eewr_82571 - Write to EEPROM for 82573 silicon - * @hw - pointer to the HW structure - * @offset - offset within the EEPROM to be written to - * @words - number of words to write - * @data - 16 bit word(s) to be written to the EEPROM + * @hw: pointer to the HW structure + * @offset: offset within the EEPROM to be written to + * @words: number of words to write + * @data: 16 bit word(s) to be written to the EEPROM * * After checking for invalid values, poll the EEPROM to ensure the previous * command has completed before trying to write the next word. After write @@ -619,7 +682,7 @@ out: /** * e1000_get_cfg_done_82571 - Poll for configuration done - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Reads the management control register for the config done bit to be set. **/ @@ -649,8 +712,8 @@ out: /** * e1000_set_d0_lplu_state_82571 - Set Low Power Linkup D0 state - * @hw - pointer to the HW structure - * @active - TRUE to enable LPLU, FALSE to disable + * @hw: pointer to the HW structure + * @active: TRUE to enable LPLU, FALSE to disable * * Sets the LPLU D0 state according to the active flag. When activating LPLU * this function also disables smart speed and vice versa. LPLU will not be @@ -733,7 +796,7 @@ out: /** * e1000_reset_hw_82571 - Reset hardware - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This resets the hardware into a known state. This is a * function pointer entry point called by the api module. @@ -819,7 +882,7 @@ out: /** * e1000_init_hw_82571 - Initialize hardware - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This inits the hardware readying it for operation. **/ @@ -897,7 +960,7 @@ out: /** * e1000_initialize_hw_bits_82571 - Initialize hardware-dependent bits - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Initializes required hardware-dependent bits needed for normal operation. **/ @@ -940,7 +1003,7 @@ e1000_initialize_hw_bits_82571(struct e1000_hw *hw) case e1000_82571: case e1000_82572: reg &= ~((1 << 29) | (1 << 30)); - reg |= (1 << 24) | (1 << 25) | (1 << 26); + reg |= (1 << 22) | (1 << 24) | (1 << 25) | (1 << 26); if (E1000_READ_REG(hw, E1000_TCTL) & E1000_TCTL_MULR) reg &= ~(1 << 28); else @@ -972,7 +1035,7 @@ out: /** * e1000_clear_vfta_82571 - Clear VLAN filter table - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Clears the register array which contains the VLAN filter table by * setting all the values to 0. @@ -1015,11 +1078,11 @@ e1000_clear_vfta_82571(struct e1000_hw *hw) /** * e1000_mc_addr_list_update_82571 - Update Multicast addresses - * @hw - pointer to the HW structure - * @mc_addr_list - array of multicast addresses to program - * @mc_addr_count - number of multicast addresses to program - * @rar_used_count - the first RAR register free to program - * @rar_count - total number of supported Receive Address Registers + * @hw: pointer to the HW structure + * @mc_addr_list: array of multicast addresses to program + * @mc_addr_count: number of multicast addresses to program + * @rar_used_count: the first RAR register free to program + * @rar_count: total number of supported Receive Address Registers * * Updates the Receive Address Registers and Multicast Table Array. * The caller must have a packed mc_addr_list of multicast addresses. @@ -1042,7 +1105,7 @@ e1000_mc_addr_list_update_82571(struct e1000_hw *hw, /** * e1000_setup_link_82571 - Setup flow control and link settings - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Determines which flow control settings to use, then configures flow * control. Calls the appropriate media-specific link configuration @@ -1067,7 +1130,7 @@ e1000_setup_link_82571(struct e1000_hw *hw) /** * e1000_setup_copper_link_82571 - Configure copper link settings - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Configures the link for auto-neg or forced speed and duplex. Then we check * for link, once link is established calls to configure collision distance @@ -1114,7 +1177,7 @@ out: /** * e1000_setup_fiber_serdes_link_82571 - Setup link for fiber/serdes - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Configures collision distance and flow control for fiber and serdes links. * Upon successful setup, poll for link. @@ -1144,8 +1207,8 @@ e1000_setup_fiber_serdes_link_82571(struct e1000_hw *hw) /** * e1000_valid_led_default_82571 - Verify a valid default LED config - * @hw - pointer to the HW structure - * @data - pointer to the NVM (EEPROM) + * @hw: pointer to the HW structure + * @data: pointer to the NVM (EEPROM) * * Read the EEPROM for the current default LED configuration. If the * LED configuration is not valid, set to a valid LED configuration. @@ -1176,7 +1239,7 @@ out: /** * e1000_get_laa_state_82571 - Get locally administered address state - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Retrieve and return the current locally administed address state. **/ @@ -1201,8 +1264,8 @@ out: /** * e1000_set_laa_state_82571 - Set locally administered address state - * @hw - pointer to the HW structure - * @state - enable/disable locally administered address + * @hw: pointer to the HW structure + * @state: enable/disable locally administered address * * Enable/Disable the current locally administed address state. **/ @@ -1238,7 +1301,7 @@ out: /** * e1000_fix_nvm_checksum_82571 - Fix EEPROM checksum - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Verifies that the EEPROM has completed the update. After updating the * EEPROM, we need to check bit 15 in work 0x23 for the checksum fix. If @@ -1292,7 +1355,7 @@ out: /** * e1000_clear_hw_cntrs_82571 - Clear device specific hardware counters - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Clears the hardware counters by reading the counter registers. **/ diff --git a/sys/dev/em/e1000_82571.h b/sys/dev/em/e1000_82571.h index b36c3fa..992518e 100644 --- a/sys/dev/em/e1000_82571.h +++ b/sys/dev/em/e1000_82571.h @@ -30,17 +30,12 @@ POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ - -/* - * $FreeBSD$ - */ +/*$FreeBSD$*/ #ifndef _E1000_82571_H_ #define _E1000_82571_H_ -#include "e1000_api.h" - #define ID_LED_RESERVED_F746 0xF746 #define ID_LED_DEFAULT_82573 ((ID_LED_DEF1_DEF2 << 12) | \ (ID_LED_OFF1_ON2 << 8) | \ diff --git a/sys/dev/em/e1000_82575.c b/sys/dev/em/e1000_82575.c index 65eeb12..5e37829 100644 --- a/sys/dev/em/e1000_82575.c +++ b/sys/dev/em/e1000_82575.c @@ -30,15 +30,13 @@ POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); +/*$FreeBSD$*/ /* e1000_82575 - * e1000_adoram */ +#include "e1000_api.h" #include "e1000_82575.h" void e1000_init_function_pointers_82575(struct e1000_hw *hw); @@ -69,11 +67,9 @@ STATIC s32 e1000_write_phy_reg_sgmii_82575(struct e1000_hw *hw, STATIC void e1000_clear_hw_cntrs_82575(struct e1000_hw *hw); static s32 e1000_acquire_swfw_sync_82575(struct e1000_hw *hw, u16 mask); static s32 e1000_configure_pcs_link_82575(struct e1000_hw *hw); -static s32 e1000_get_hw_semaphore_82575(struct e1000_hw *hw); static s32 e1000_get_pcs_speed_and_duplex_82575(struct e1000_hw *hw, u16 *speed, u16 *duplex); static s32 e1000_get_phy_id_82575(struct e1000_hw *hw); -static void e1000_put_hw_semaphore_82575(struct e1000_hw *hw); static void e1000_release_swfw_sync_82575(struct e1000_hw *hw, u16 mask); static boolean_t e1000_sgmii_active_82575(struct e1000_hw *hw); STATIC s32 e1000_reset_init_script_82575(struct e1000_hw* hw); @@ -84,7 +80,7 @@ struct e1000_dev_spec_82575 { /** * e1000_init_phy_params_82575 - Init PHY func ptrs. - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This is a function pointer entry point called by the api module. **/ @@ -153,7 +149,7 @@ out: /** * e1000_init_nvm_params_82575 - Init NVM func ptrs. - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This is a function pointer entry point called by the api module. **/ @@ -209,7 +205,7 @@ e1000_init_nvm_params_82575(struct e1000_hw *hw) /** * e1000_init_mac_params_82575 - Init MAC func ptrs. - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This is a function pointer entry point called by the api module. **/ @@ -313,7 +309,7 @@ out: /** * e1000_init_function_pointers_82575 - Init func ptrs. - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * The only function explicitly called by the api module to initialize * all function pointers and parameters. @@ -330,7 +326,7 @@ e1000_init_function_pointers_82575(struct e1000_hw *hw) /** * e1000_acquire_phy_82575 - Acquire rights to access PHY - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Acquire access rights to the correct PHY. This is a * function pointer entry point called by the api module. @@ -349,7 +345,7 @@ e1000_acquire_phy_82575(struct e1000_hw *hw) /** * e1000_release_phy_82575 - Release rights to access PHY - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * A wrapper to release access rights to the correct PHY. This is a * function pointer entry point called by the api module. @@ -367,9 +363,9 @@ e1000_release_phy_82575(struct e1000_hw *hw) /** * e1000_read_phy_reg_sgmii_82575 - Read PHY register using sgmii - * @hw - pointer to the HW structure - * @offset - register offset to be read - * @data - pointer to the read data + * @hw: pointer to the HW structure + * @offset: register offset to be read + * @data: pointer to the read data * * Reads the PHY register at offset using the serial gigabit media independent * interface and stores the retrieved information in data. @@ -421,9 +417,9 @@ e1000_read_phy_reg_sgmii_82575(struct e1000_hw *hw, u32 offset, u16 *data) /** * e1000_write_phy_reg_sgmii_82575 - Write PHY register using sgmii - * @hw - pointer to the HW structure - * @offset - register offset to write to - * @data - data to write at register offset + * @hw: pointer to the HW structure + * @offset: register offset to write to + * @data: data to write at register offset * * Writes the data to PHY register at the offset using the serial gigabit * media independent interface. @@ -477,7 +473,7 @@ e1000_write_phy_reg_sgmii_82575(struct e1000_hw *hw, u32 offset, u16 data) /** * e1000_get_phy_id_82575 - Retreive PHY addr and id - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Retreives the PHY address and ID for both PHY's which do and do not use * sgmi interface. @@ -537,7 +533,7 @@ out: /** * e1000_phy_hw_reset_sgmii_82575 - Performs a PHY reset - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Resets the PHY using the serial gigabit media independent interface. **/ @@ -569,8 +565,8 @@ out: /** * e1000_set_d0_lplu_state_82575 - Set Low Power Linkup D0 state - * @hw - pointer to the HW structure - * @active - TRUE to enable LPLU, FALSE to disable + * @hw: pointer to the HW structure + * @active: TRUE to enable LPLU, FALSE to disable * * Sets the LPLU D0 state according to the active flag. When * activating LPLU this function also disables smart speed @@ -655,7 +651,7 @@ out: /** * e1000_acquire_nvm_82575 - Request for access to EEPROM - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Acquire the necessary semaphores for exclussive access to the EEPROM. * Set the EEPROM access request bit and wait for EEPROM access grant bit. @@ -684,7 +680,7 @@ out: /** * e1000_release_nvm_82575 - Release exclusive access to EEPROM - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Stop any current commands to the EEPROM and clear the EEPROM request bit, * then release the semaphores acquired. @@ -699,74 +695,9 @@ e1000_release_nvm_82575(struct e1000_hw *hw) } /** - * e1000_get_hw_semaphore_82575 - Acquire HW semaphore for PHY/NVM access - * @hw - pointer to the HW structure - * - * Acquire the HW semaphore to access the PHY or NVM - **/ -static s32 -e1000_get_hw_semaphore_82575(struct e1000_hw *hw) -{ - u32 swsm; - s32 ret_val = E1000_SUCCESS; - s32 timeout = hw->nvm.word_size + 1; - s32 i = 0; - - DEBUGFUNC("e1000_get_hw_semaphore_82575"); - - /* Get the SW semaphore. */ - while (i < timeout) { - swsm = E1000_READ_REG(hw, E1000_SWSM); - if (!(swsm & E1000_SWSM_SMBI)) - break; - - usec_delay(50); - i++; - } - - if (i == timeout) { - DEBUGOUT("Driver can't access device " - "- SMBI bit is set.\n"); - ret_val = -E1000_ERR_NVM; - goto out; - } - - /* Get the FW semaphore. */ - ret_val = e1000_get_hw_semaphore_generic(hw); - if (ret_val) { - /* Release 82575 semaphores */ - e1000_put_hw_semaphore_82575(hw); - goto out; - } - -out: - return ret_val; -} - -/** - * e1000_put_hw_semaphore_82575 - Release HW semaphore for PHY/NVM access - * @hw - pointer to the HW structure - * - * Release the HW semaphore used to access the PHY or NVM - **/ -static void -e1000_put_hw_semaphore_82575(struct e1000_hw *hw) -{ - u32 swsm; - - DEBUGFUNC("e1000_put_hw_semaphore_82575"); - - swsm = E1000_READ_REG(hw, E1000_SWSM); - - swsm &= ~(E1000_SWSM_SMBI | E1000_SWSM_SWESMBI); - - E1000_WRITE_REG(hw, E1000_SWSM, swsm); -} - -/** * e1000_acquire_swfw_sync_82575 - Acquire SW/FW semaphore - * @hw - pointer to the HW structure - * @mask - specifies which semaphore to acquire + * @hw: pointer to the HW structure + * @mask: specifies which semaphore to acquire * * Acquire the SW/FW semaphore to access the PHY or NVM. The mask * will also specify which port we're acquiring the lock for. @@ -783,7 +714,7 @@ e1000_acquire_swfw_sync_82575(struct e1000_hw *hw, u16 mask) DEBUGFUNC("e1000_acquire_swfw_sync_82575"); while (i < timeout) { - if (e1000_get_hw_semaphore_82575(hw)) { + if (e1000_get_hw_semaphore_generic(hw)) { ret_val = -E1000_ERR_SWFW_SYNC; goto out; } @@ -794,7 +725,7 @@ e1000_acquire_swfw_sync_82575(struct e1000_hw *hw, u16 mask) /* Firmware currently using resource (fwmask) * or other software thread using resource (swmask) */ - e1000_put_hw_semaphore_82575(hw); + e1000_put_hw_semaphore_generic(hw); msec_delay_irq(5); i++; } @@ -808,7 +739,7 @@ e1000_acquire_swfw_sync_82575(struct e1000_hw *hw, u16 mask) swfw_sync |= swmask; E1000_WRITE_REG(hw, E1000_SW_FW_SYNC, swfw_sync); - e1000_put_hw_semaphore_82575(hw); + e1000_put_hw_semaphore_generic(hw); out: return ret_val; @@ -816,8 +747,8 @@ out: /** * e1000_release_swfw_sync_82575 - Release SW/FW semaphore - * @hw - pointer to the HW structure - * @mask - specifies which semaphore to acquire + * @hw: pointer to the HW structure + * @mask: specifies which semaphore to acquire * * Release the SW/FW semaphore used to access the PHY or NVM. The mask * will also specify which port we're releasing the lock for. @@ -829,19 +760,19 @@ e1000_release_swfw_sync_82575(struct e1000_hw *hw, u16 mask) DEBUGFUNC("e1000_release_swfw_sync_82575"); - while (e1000_get_hw_semaphore_82575(hw) != E1000_SUCCESS); + while (e1000_get_hw_semaphore_generic(hw) != E1000_SUCCESS); /* Empty */ swfw_sync = E1000_READ_REG(hw, E1000_SW_FW_SYNC); swfw_sync &= ~mask; E1000_WRITE_REG(hw, E1000_SW_FW_SYNC, swfw_sync); - e1000_put_hw_semaphore_82575(hw); + e1000_put_hw_semaphore_generic(hw); } /** * e1000_get_cfg_done_82575 - Read config done bit - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Read the management control register for the config done bit for * completion status. NOTE: silicon which is EEPROM-less will fail trying @@ -882,9 +813,9 @@ e1000_get_cfg_done_82575(struct e1000_hw *hw) /** * e1000_get_link_up_info_82575 - Get link speed/duplex info - * @hw - pointer to the HW structure - * @speed - stores the current speed - * @duplex - stores the current duplex + * @hw: pointer to the HW structure + * @speed: stores the current speed + * @duplex: stores the current duplex * * This is a wrapper function, if using the serial gigabit media independent * interface, use pcs to retreive the link speed and duplex information. @@ -910,7 +841,7 @@ e1000_get_link_up_info_82575(struct e1000_hw *hw, u16 *speed, u16 *duplex) /** * e1000_check_for_link_82575 - Check for link - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * If sgmii is enabled, then use the pcs register to determine link, otherwise * use the generic interface for determining link. @@ -936,9 +867,9 @@ e1000_check_for_link_82575(struct e1000_hw *hw) /** * e1000_get_pcs_speed_and_duplex_82575 - Retrieve current speed/duplex - * @hw - pointer to the HW structure - * @speed - stores the current speed - * @duplex - stores the current duplex + * @hw: pointer to the HW structure + * @speed: stores the current speed + * @duplex: stores the current duplex * * Using the physical coding sub-layer (PCS), retreive the current speed and * duplex, then store the values in the pointers provided. @@ -991,9 +922,9 @@ e1000_get_pcs_speed_and_duplex_82575(struct e1000_hw *hw, u16 *speed, /** * e1000_rar_set_82575 - Set receive address register - * @hw - pointer to the HW structure - * @addr - pointer to the receive address - * @index - receive address array register + * @hw: pointer to the HW structure + * @addr: pointer to the receive address + * @index: receive address array register * * Sets the receive address array register at index to the address passed * in by addr. @@ -1014,7 +945,7 @@ out: /** * e1000_reset_hw_82575 - Reset hardware - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This resets the hardware into a known state. This is a * function pointer entry point called by the api module. @@ -1071,7 +1002,7 @@ e1000_reset_hw_82575(struct e1000_hw *hw) /** * e1000_init_hw_82575 - Initialize hardware - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This inits the hardware readying it for operation. **/ @@ -1119,7 +1050,7 @@ out: /** * e1000_setup_copper_link_82575 - Configure copper link settings - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Configures the link for auto-neg or forced speed and duplex. Then we check * for link, once link is established calls to configure collision distance @@ -1205,7 +1136,7 @@ out: /** * e1000_setup_fiber_serdes_link_82575 - Setup link for fiber/serdes - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Configures speed and duplex for fiber and serdes links. **/ @@ -1266,7 +1197,7 @@ e1000_setup_fiber_serdes_link_82575(struct e1000_hw *hw) /** * e1000_configure_pcs_link_82575 - Configure PCS link - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Configure the physical coding sub-layer (PCS) link. The PCS link is * only used on copper connections where the serialized gigabit media @@ -1332,7 +1263,7 @@ out: /** * e1000_sgmii_active_82575 - Return sgmii state - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * 82575 silicon has a serialized gigabit media independent interface (sgmii) * which can be enabled for use in the embedded applications. Simply @@ -1360,72 +1291,8 @@ out: } /** - * e1000_translate_register_adoram - Translate the proper regiser offset - * @reg - e1000 register to be read - * - * Registers in adoram are located in different offsets than other adapters - * even though they function in the same manner. This function takes in - * the name of the register to read and returns the correct offset for - * adoram silicon. - **/ -u32 -e1000_translate_register_adoram(u32 reg) -{ - /* Some of the Adoram registers are located at different - * offsets than they are in older adapters. - * Despite the difference in location, the registers - * function in the same manner. - */ - switch (reg) { - case E1000_TDBAL: - reg = 0x0E000; - break; - case E1000_TDBAH: - reg = 0x0E004; - break; - case E1000_TDLEN: - reg = 0x0E008; - break; - case E1000_TDH: - reg = 0x0E010; - break; - case E1000_TDT: - reg = 0x0E018; - break; - case E1000_TXDCTL: - reg = 0x0E028; - break; - case E1000_RDBAL: - reg = 0x0C000; - break; - case E1000_RDBAH: - reg = 0x0C004; - break; - case E1000_RDLEN: - reg = 0x0C008; - break; - case E1000_RDH: - reg = 0x0C010; - break; - case E1000_RDT: - reg = 0x0C018; - break; - case E1000_RXDCTL: - reg = 0x0C028; - break; - case E1000_SRRCTL0: - reg = 0x0C00C; - break; - default: - break; - } - - return reg; -} - -/** * e1000_reset_init_script_82575 - Inits HW defaults after reset - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Inits recommended HW defaults after a reset when there is no EEPROM * detected. This is only for the 82575. @@ -1464,7 +1331,7 @@ e1000_reset_init_script_82575(struct e1000_hw* hw) /** * e1000_clear_hw_cntrs_82575 - Clear device specific hardware counters - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Clears the hardware counters by reading the counter registers. **/ diff --git a/sys/dev/em/e1000_82575.h b/sys/dev/em/e1000_82575.h index 072e000..f9628bb 100644 --- a/sys/dev/em/e1000_82575.h +++ b/sys/dev/em/e1000_82575.h @@ -30,17 +30,12 @@ POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ - -/* - * $FreeBSD$ - */ +/*$FreeBSD$*/ #ifndef _E1000_82575_H_ #define _E1000_82575_H_ -#include "e1000_api.h" - /* Receive Address Register Count * Number of high/low register pairs in the RAR. The RAR (Receive Address * Registers) holds the directed and multicast addresses that we monitor. @@ -74,7 +69,6 @@ struct e1000_adv_data_desc { #define E1000_TXD_DTYP_ADV_C 0x2 /* Advanced Context Descriptor */ #define E1000_TXD_DTYP_ADV_D 0x3 /* Advanced Data Descriptor */ #define E1000_ADV_TXD_CMD_DEXT 0x20 /* Descriptor extension (0 = legacy) */ -#define E1000_ADV_TUCMD_SNAP 0x1 /* SNAP indication */ #define E1000_ADV_TUCMD_IPV4 0x2 /* IP Packet Type: 1=IPv4 */ #define E1000_ADV_TUCMD_IPV6 0x0 /* IP Packet Type: 0=IPv6 */ #define E1000_ADV_TUCMD_L4T_UDP 0x0 /* L4 Packet TYPE of UDP */ @@ -155,14 +149,14 @@ struct e1000_adv_context_desc { /* Immediate Interrupt RX (A.K.A. Low Latency Interrupt) */ #define E1000_IMIR_PORT_IM_EN 0x00010000 /* TCP port enable */ #define E1000_IMIR_PORT_BP 0x00020000 /* TCP port check bypass */ -#define E1000_IMIREX_SIZE_BP 0x00001000 /* Packet size bypass */ -#define E1000_IMIREX_CTRL_URG 0x00002000 /* Check URG bit in header */ -#define E1000_IMIREX_CTRL_ACK 0x00004000 /* Check ACK bit in header */ -#define E1000_IMIREX_CTRL_PSH 0x00008000 /* Check PSH bit in header */ -#define E1000_IMIREX_CTRL_RST 0x00010000 /* Check RST bit in header */ -#define E1000_IMIREX_CTRL_SYN 0x00020000 /* Check SYN bit in header */ -#define E1000_IMIREX_CTRL_FIN 0x00040000 /* Check FIN bit in header */ -#define E1000_IMIREX_CTRL_BP 0x00080000 /* Bypass check of control bits */ +#define E1000_IMIREXT_SIZE_BP 0x00001000 /* Packet size bypass */ +#define E1000_IMIREXT_CTRL_URG 0x00002000 /* Check URG bit in header */ +#define E1000_IMIREXT_CTRL_ACK 0x00004000 /* Check ACK bit in header */ +#define E1000_IMIREXT_CTRL_PSH 0x00008000 /* Check PSH bit in header */ +#define E1000_IMIREXT_CTRL_RST 0x00010000 /* Check RST bit in header */ +#define E1000_IMIREXT_CTRL_SYN 0x00020000 /* Check SYN bit in header */ +#define E1000_IMIREXT_CTRL_FIN 0x00040000 /* Check FIN bit in header */ +#define E1000_IMIREXT_CTRL_BP 0x00080000 /* Bypass check of control bits */ /* Receive Descriptor - Advanced */ union e1000_adv_rx_desc { @@ -203,11 +197,11 @@ union e1000_adv_rx_desc { /* RSS Hash results */ #define E1000_RXDADV_RSSTYPE_NONE 0x00000000 -#define E1000_RXDADV_RSSTYPE_IPV4 0x00000001 -#define E1000_RXDADV_RSSTYPE_IPV4_TCP 0x00000002 -#define E1000_RXDADV_RSSTYPE_IPV6 0x00000003 -#define E1000_RXDADV_RSSTYPE_IPV6_TCP 0x00000004 -#define E1000_RXDADV_RSSTYPE_IPV6_EX 0x00000005 +#define E1000_RXDADV_RSSTYPE_IPV4_TCP 0x00000001 +#define E1000_RXDADV_RSSTYPE_IPV4 0x00000002 +#define E1000_RXDADV_RSSTYPE_IPV6_TCP 0x00000003 +#define E1000_RXDADV_RSSTYPE_IPV6_EX 0x00000004 +#define E1000_RXDADV_RSSTYPE_IPV6 0x00000005 #define E1000_RXDADV_RSSTYPE_IPV6_TCP_EX 0x00000006 #define E1000_RXDADV_RSSTYPE_IPV4_UDP 0x00000007 #define E1000_RXDADV_RSSTYPE_IPV6_UDP 0x00000008 @@ -238,8 +232,8 @@ union e1000_adv_tx_desc { #define E1000_ADVTXD_DCMD_DEXT 0x20000000 /* Descriptor extension (1=Adv) */ #define E1000_ADVTXD_DCMD_VLE 0x40000000 /* VLAN pkt enable */ #define E1000_ADVTXD_DCMD_TSE 0x80000000 /* TCP Seg enable */ -#define E1000_ADV_MAC_LINKSEC 0x00040000 /* Apply LinkSec on packet */ -#define E1000_ADV_MAC_TSTAMP 0x00080000 /* IEEE1588 Timestamp packet */ +#define E1000_ADVTXD_MAC_LINKSEC 0x00040000 /* Apply LinkSec on packet */ +#define E1000_ADVTXD_MAC_TSTAMP 0x00080000 /* IEEE1588 Timestamp packet */ #define E1000_ADVTXD_STAT_SN_CRC 0x00000002 /* NXTSEQ/SEED present in WB */ #define E1000_ADVTXD_IDX_SHIFT 4 /* Adv desc Index shift */ #define E1000_ADVTXD_POPTS_EOM 0x00000400 /* Enable L bit in RDMA DDP hdr */ @@ -247,6 +241,7 @@ union e1000_adv_tx_desc { #define E1000_ADVTXD_POPTS_ISCO_MDL 0x00000800 /* Middle TSO of iSCSI PDU */ #define E1000_ADVTXD_POPTS_ISCO_LAST 0x00001000 /* Last TSO of iSCSI PDU */ #define E1000_ADVTXD_POPTS_ISCO_FULL 0x00001800 /* 1st&Last TSO-full iSCSI PDU*/ +#define E1000_ADVTXD_POPTS_IPSEC 0x00000400 /* IPSec offload request */ #define E1000_ADVTXD_PAYLEN_SHIFT 14 /* Adv desc PAYLEN shift */ /* Context descriptors */ @@ -259,14 +254,20 @@ struct e1000_adv_tx_context_desc { #define E1000_ADVTXD_MACLEN_SHIFT 9 /* Adv ctxt desc mac len shift */ #define E1000_ADVTXD_VLAN_SHIFT 16 /* Adv ctxt vlan tag shift */ -#define E1000_ADVTXD_TUCMD_SNAP 0x00000200 /* SNAP indication */ #define E1000_ADVTXD_TUCMD_IPV4 0x00000400 /* IP Packet Type: 1=IPv4 */ #define E1000_ADVTXD_TUCMD_IPV6 0x00000000 /* IP Packet Type: 0=IPv6 */ #define E1000_ADVTXD_TUCMD_L4T_UDP 0x00000000 /* L4 Packet TYPE of UDP */ #define E1000_ADVTXD_TUCMD_L4T_TCP 0x00000800 /* L4 Packet TYPE of TCP */ +#define E1000_ADVTXD_TUCMD_IPSEC_TYPE_ESP 0x00002000 /* IPSec Type ESP */ +/* IPSec Encrypt Enable for ESP */ +#define E1000_ADVTXD_TUCMD_IPSEC_ENCRYPT_EN 0x00004000 #define E1000_ADVTXD_TUCMD_MKRREQ 0x00002000 /* Req requires Markers and CRC */ #define E1000_ADVTXD_L4LEN_SHIFT 8 /* Adv ctxt L4LEN shift */ #define E1000_ADVTXD_MSS_SHIFT 16 /* Adv ctxt MSS shift */ +/* Adv ctxt IPSec SA IDX mask */ +#define E1000_ADVTXD_IPSEC_SA_INDEX_MASK 0x000000FF +/* Adv ctxt IPSec ESP len mask */ +#define E1000_ADVTXD_IPSEC_ESP_LEN_MASK 0x000000FF /* Additional Transmit Descriptor Control definitions */ #define E1000_TXDCTL_QUEUE_ENABLE 0x02000000 /* Enable specific Tx Queue */ @@ -279,9 +280,19 @@ struct e1000_adv_tx_context_desc { #define E1000_RXDCTL_SWFLSH 0x04000000 /* Rx Desc. write-back flushing */ /* Direct Cache Access (DCA) definitions */ -#define E1000_DCA_RXCTRL_DESC_DCA_EN (1 << 5) -#define E1000_DCA_RXCTRL_HEAD_DCA_EN (1 << 6) -#define E1000_DCA_RXCTRL_DATA_DCA_EN (1 << 7) +#define E1000_DCA_CTRL_DCA_ENABLE 0x00000000 /* DCA Enable */ +#define E1000_DCA_CTRL_DCA_DISABLE 0x00000001 /* DCA Disable */ + +#define E1000_DCA_CTRL_DCA_MODE_CB1 0x00 /* DCA Mode CB1 */ +#define E1000_DCA_CTRL_DCA_MODE_CB2 0x02 /* DCA Mode CB2 */ + +#define E1000_DCA_RXCTRL_CPUID_MASK 0x0000001F /* Rx CPUID Mask */ +#define E1000_DCA_RXCTRL_DESC_DCA_EN (1 << 5) /* DCA Rx Desc enable */ +#define E1000_DCA_RXCTRL_HEAD_DCA_EN (1 << 6) /* DCA Rx Desc header enable */ +#define E1000_DCA_RXCTRL_DATA_DCA_EN (1 << 7) /* DCA Rx Desc payload enable */ + +#define E1000_DCA_TXCTRL_CPUID_MASK 0x0000001F /* Tx CPUID Mask */ +#define E1000_DCA_TXCTRL_DESC_DCA_EN (1 << 5) /* DCA Tx Desc enable */ + -#define E1000_DCA_TXCTRL_DESC_DCA_EN (1 << 5) #endif diff --git a/sys/dev/em/e1000_api.c b/sys/dev/em/e1000_api.c index 1d05ee4..9f8a48e 100644 --- a/sys/dev/em/e1000_api.c +++ b/sys/dev/em/e1000_api.c @@ -30,11 +30,10 @@ POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); +/*$FreeBSD$*/ +#include "e1000_api.h" #include "e1000_mac.h" #include "e1000_nvm.h" #include "e1000_phy.h" @@ -52,7 +51,7 @@ extern void e1000_init_function_pointers_82575(struct e1000_hw *hw); /** * e1000_init_mac_params - Initialize MAC function pointers - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This function initializes the function pointers for the MAC * set of functions. Called by drivers or by e1000_setup_init_funcs. @@ -79,7 +78,7 @@ out: /** * e1000_init_nvm_params - Initialize NVM function pointers - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This function initializes the function pointers for the NVM * set of functions. Called by drivers or by e1000_setup_init_funcs. @@ -106,7 +105,7 @@ out: /** * e1000_init_phy_params - Initialize PHY function pointers - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This function initializes the function pointers for the PHY * set of functions. Called by drivers or by e1000_setup_init_funcs. @@ -133,7 +132,7 @@ out: /** * e1000_set_mac_type - Sets MAC type - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This function sets the mac type of the adapter based on the * device ID stored in the hw structure. @@ -214,6 +213,8 @@ e1000_set_mac_type(struct e1000_hw *hw) case E1000_DEV_ID_82571EB_COPPER: case E1000_DEV_ID_82571EB_FIBER: case E1000_DEV_ID_82571EB_SERDES: + case E1000_DEV_ID_82571EB_SERDES_DUAL: + case E1000_DEV_ID_82571EB_SERDES_QUAD: case E1000_DEV_ID_82571EB_QUAD_COPPER: case E1000_DEV_ID_82571EB_QUAD_FIBER: case E1000_DEV_ID_82571EB_QUAD_COPPER_LP: @@ -270,8 +271,8 @@ e1000_set_mac_type(struct e1000_hw *hw) /** * e1000_setup_init_funcs - Initializes function pointers - * @hw - pointer to the HW structure - * @init_device - TRUE will initialize the rest of the function pointers + * @hw: pointer to the HW structure + * @init_device: TRUE will initialize the rest of the function pointers * getting the device ready for use. FALSE will only set * MAC type and the function pointers for the other init * functions. Passing FALSE will not generate any hardware @@ -384,7 +385,7 @@ out: /** * e1000_remove_device - Free device specific structure - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * If a device specific structure was allocated, this function will * free it. This is a function pointer entry point called by drivers. @@ -398,7 +399,7 @@ e1000_remove_device(struct e1000_hw *hw) /** * e1000_get_bus_info - Obtain bus information for adapter - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This will obtain information about the HW bus for which the * adaper is attached and stores it in the hw structure. This is a @@ -415,7 +416,7 @@ e1000_get_bus_info(struct e1000_hw *hw) /** * e1000_clear_vfta - Clear VLAN filter table - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This clears the VLAN filter table on the adapter. This is a function * pointer entry point called by drivers. @@ -429,9 +430,9 @@ e1000_clear_vfta(struct e1000_hw *hw) /** * e1000_write_vfta - Write value to VLAN filter table - * @hw - pointer to the HW structure - * @offset - the 32-bit offset in which to write the value to. - * @value - the 32-bit value to write at location offset. + * @hw: pointer to the HW structure + * @offset: the 32-bit offset in which to write the value to. + * @value: the 32-bit value to write at location offset. * * This writes a 32-bit value to a 32-bit offset in the VLAN filter * table. This is a function pointer entry point called by drivers. @@ -445,11 +446,11 @@ e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value) /** * e1000_mc_addr_list_update - Update Multicast addresses - * @hw - pointer to the HW structure - * @mc_addr_list - array of multicast addresses to program - * @mc_addr_count - number of multicast addresses to program - * @rar_used_count - the first RAR register free to program - * @rar_count - total number of supported Receive Address Registers + * @hw: pointer to the HW structure + * @mc_addr_list: array of multicast addresses to program + * @mc_addr_count: number of multicast addresses to program + * @rar_used_count: the first RAR register free to program + * @rar_count: total number of supported Receive Address Registers * * Updates the Receive Address Registers and Multicast Table Array. * The caller must have a packed mc_addr_list of multicast addresses. @@ -475,7 +476,7 @@ e1000_mc_addr_list_update(struct e1000_hw *hw, /** * e1000_force_mac_fc - Force MAC flow control - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Force the MAC's flow control settings. Currently no func pointer exists * and all implementations are handled in the generic version of this @@ -489,7 +490,7 @@ e1000_force_mac_fc(struct e1000_hw *hw) /** * e1000_check_for_link - Check/Store link connection - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This checks the link condition of the adapter and stores the * results in the hw->mac structure. This is a function pointer entry @@ -506,7 +507,7 @@ e1000_check_for_link(struct e1000_hw *hw) /** * e1000_check_mng_mode - Check management mode - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This checks if the adapter has manageability enabled. * This is a function pointer entry point called by drivers. @@ -522,9 +523,9 @@ e1000_check_mng_mode(struct e1000_hw *hw) /** * e1000_mng_write_dhcp_info - Writes DHCP info to host interface - * @hw - pointer to the HW structure - * @buffer - pointer to the host interface - * @length - size of the buffer + * @hw: pointer to the HW structure + * @buffer: pointer to the host interface + * @length: size of the buffer * * Writes the DHCP information to the host interface. **/ @@ -536,7 +537,7 @@ e1000_mng_write_dhcp_info(struct e1000_hw *hw, u8 *buffer, u16 length) /** * e1000_reset_hw - Reset hardware - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This resets the hardware into a known state. This is a function pointer * entry point called by drivers. @@ -552,7 +553,7 @@ e1000_reset_hw(struct e1000_hw *hw) /** * e1000_init_hw - Initialize hardware - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This inits the hardware readying it for operation. This is a function * pointer entry point called by drivers. @@ -568,7 +569,7 @@ e1000_init_hw(struct e1000_hw *hw) /** * e1000_setup_link - Configures link and flow control - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This configures link and flow control settings for the adapter. This * is a function pointer entry point called by drivers. While modules can @@ -585,9 +586,9 @@ e1000_setup_link(struct e1000_hw *hw) /** * e1000_get_speed_and_duplex - Returns current speed and duplex - * @hw - pointer to the HW structure - * @speed - pointer to a 16-bit value to store the speed - * @duplex - pointer to a 16-bit value to store the duplex. + * @hw: pointer to the HW structure + * @speed: pointer to a 16-bit value to store the speed + * @duplex: pointer to a 16-bit value to store the duplex. * * This returns the speed and duplex of the adapter in the two 'out' * variables passed in. This is a function pointer entry point called @@ -604,7 +605,7 @@ e1000_get_speed_and_duplex(struct e1000_hw *hw, u16 *speed, u16 *duplex) /** * e1000_setup_led - Configures SW controllable LED - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This prepares the SW controllable LED for use and saves the current state * of the LED so it can be later restored. This is a function pointer entry @@ -621,7 +622,7 @@ e1000_setup_led(struct e1000_hw *hw) /** * e1000_cleanup_led - Restores SW controllable LED - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This restores the SW controllable LED to the value saved off by * e1000_setup_led. This is a function pointer entry point called by drivers. @@ -637,7 +638,7 @@ e1000_cleanup_led(struct e1000_hw *hw) /** * e1000_blink_led - Blink SW controllable LED - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This starts the adapter LED blinking. Request the LED to be setup first * and cleaned up after. This is a function pointer entry point called by @@ -654,7 +655,7 @@ e1000_blink_led(struct e1000_hw *hw) /** * e1000_led_on - Turn on SW controllable LED - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Turns the SW defined LED on. This is a function pointer entry point * called by drivers. @@ -670,7 +671,7 @@ e1000_led_on(struct e1000_hw *hw) /** * e1000_led_off - Turn off SW controllable LED - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Turns the SW defined LED off. This is a function pointer entry point * called by drivers. @@ -686,7 +687,7 @@ e1000_led_off(struct e1000_hw *hw) /** * e1000_reset_adaptive - Reset adaptive IFS - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Resets the adaptive IFS. Currently no func pointer exists and all * implementations are handled in the generic version of this function. @@ -699,7 +700,7 @@ e1000_reset_adaptive(struct e1000_hw *hw) /** * e1000_update_adaptive - Update adaptive IFS - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Updates adapter IFS. Currently no func pointer exists and all * implementations are handled in the generic version of this function. @@ -712,7 +713,7 @@ e1000_update_adaptive(struct e1000_hw *hw) /** * e1000_disable_pcie_master - Disable PCI-Express master access - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Disables PCI-Express master access and verifies there are no pending * requests. Currently no func pointer exists and all implementations are @@ -726,7 +727,7 @@ e1000_disable_pcie_master(struct e1000_hw *hw) /** * e1000_config_collision_dist - Configure collision distance - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Configures the collision distance to the default value and is used * during link setup. @@ -740,9 +741,9 @@ e1000_config_collision_dist(struct e1000_hw *hw) /** * e1000_rar_set - Sets a receive address register - * @hw - pointer to the HW structure - * @addr - address to set the RAR to - * @index - the RAR to set + * @hw: pointer to the HW structure + * @addr: address to set the RAR to + * @index: the RAR to set * * Sets a Receive Address Register (RAR) to the specified address. **/ @@ -755,7 +756,7 @@ e1000_rar_set(struct e1000_hw *hw, u8 *addr, u32 index) /** * e1000_validate_mdi_setting - Ensures valid MDI/MDIX SW state - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Ensures that the MDI/MDIX SW state is valid. **/ @@ -770,8 +771,8 @@ e1000_validate_mdi_setting(struct e1000_hw *hw) /** * e1000_mta_set - Sets multicast table bit - * @hw - pointer to the HW structure - * @hash_value - Multicast hash value. + * @hw: pointer to the HW structure + * @hash_value: Multicast hash value. * * This sets the bit in the multicast table corresponding to the * hash value. This is a function pointer entry point called by drivers. @@ -785,8 +786,8 @@ e1000_mta_set(struct e1000_hw *hw, u32 hash_value) /** * e1000_hash_mc_addr - Determines address location in multicast table - * @hw - pointer to the HW structure - * @mc_addr - Multicast address to hash. + * @hw: pointer to the HW structure + * @mc_addr: Multicast address to hash. * * This hashes an address to determine its location in the multicast * table. Currently no func pointer exists and all implementations @@ -800,7 +801,7 @@ e1000_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr) /** * e1000_enable_tx_pkt_filtering - Enable packet filtering on TX - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Enables packet filtering on transmit packets if manageability is enabled * and host interface is enabled. @@ -815,11 +816,11 @@ e1000_enable_tx_pkt_filtering(struct e1000_hw *hw) /** * e1000_mng_host_if_write - Writes to the manageability host interface - * @hw - pointer to the HW structure - * @buffer - pointer to the host interface buffer - * @length - size of the buffer - * @offset - location in the buffer to write to - * @sum - sum of the data (not checksum) + * @hw: pointer to the HW structure + * @buffer: pointer to the host interface buffer + * @length: size of the buffer + * @offset: location in the buffer to write to + * @sum: sum of the data (not checksum) * * This function writes the buffer content at the offset given on the host if. * It also does alignment considerations to do the writes in most efficient @@ -838,8 +839,8 @@ e1000_mng_host_if_write(struct e1000_hw * hw, u8 *buffer, u16 length, /** * e1000_mng_write_cmd_header - Writes manageability command header - * @hw - pointer to the HW structure - * @hdr - pointer to the host interface command header + * @hw: pointer to the HW structure + * @hdr: pointer to the host interface command header * * Writes the command header after does the checksum calculation. **/ @@ -855,7 +856,7 @@ e1000_mng_write_cmd_header(struct e1000_hw *hw, /** * e1000_mng_enable_host_if - Checks host interface is enabled - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Returns E1000_success upon success, else E1000_ERR_HOST_INTERFACE_COMMAND * @@ -874,7 +875,7 @@ e1000_mng_enable_host_if(struct e1000_hw * hw) /** * e1000_wait_autoneg - Waits for autonegotiation completion - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Waits for autoneg to complete. Currently no func pointer exists and all * implementations are handled in the generic version of this function. @@ -890,7 +891,7 @@ e1000_wait_autoneg(struct e1000_hw *hw) /** * e1000_check_reset_block - Verifies PHY can be reset - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Checks if the PHY is in a state that can be reset or if manageability * has it tied up. This is a function pointer entry point called by drivers. @@ -906,9 +907,9 @@ e1000_check_reset_block(struct e1000_hw *hw) /** * e1000_read_phy_reg - Reads PHY register - * @hw - pointer to the HW structure - * @offset - the register to read - * @data - the buffer to store the 16-bit read. + * @hw: pointer to the HW structure + * @offset: the register to read + * @data: the buffer to store the 16-bit read. * * Reads the PHY register and returns the value in data. * This is a function pointer entry point called by drivers. @@ -924,9 +925,9 @@ e1000_read_phy_reg(struct e1000_hw *hw, u32 offset, u16 *data) /** * e1000_write_phy_reg - Writes PHY register - * @hw - pointer to the HW structure - * @offset - the register to write - * @data - the value to write. + * @hw: pointer to the HW structure + * @offset: the register to write + * @data: the value to write. * * Writes the PHY register at offset with the value in data. * This is a function pointer entry point called by drivers. @@ -942,9 +943,9 @@ e1000_write_phy_reg(struct e1000_hw *hw, u32 offset, u16 data) /** * e1000_read_kmrn_reg - Reads register using Kumeran interface - * @hw - pointer to the HW structure - * @offset - the register to read - * @data - the location to store the 16-bit value read. + * @hw: pointer to the HW structure + * @offset: the register to read + * @data: the location to store the 16-bit value read. * * Reads a register out of the Kumeran interface. Currently no func pointer * exists and all implementations are handled in the generic version of @@ -958,9 +959,9 @@ e1000_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data) /** * e1000_write_kmrn_reg - Writes register using Kumeran interface - * @hw - pointer to the HW structure - * @offset - the register to write - * @data - the value to write. + * @hw: pointer to the HW structure + * @offset: the register to write + * @data: the value to write. * * Writes a register to the Kumeran interface. Currently no func pointer * exists and all implementations are handled in the generic version of @@ -974,7 +975,7 @@ e1000_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data) /** * e1000_get_cable_length - Retrieves cable length estimation - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This function estimates the cable length and stores them in * hw->phy.min_length and hw->phy.max_length. This is a function pointer @@ -991,7 +992,7 @@ e1000_get_cable_length(struct e1000_hw *hw) /** * e1000_get_phy_info - Retrieves PHY information from registers - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This function gets some information from various PHY registers and * populates hw->phy values with it. This is a function pointer entry @@ -1008,7 +1009,7 @@ e1000_get_phy_info(struct e1000_hw *hw) /** * e1000_phy_hw_reset - Hard PHY reset - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Performs a hard PHY reset. This is a function pointer entry point called * by drivers. @@ -1024,7 +1025,7 @@ e1000_phy_hw_reset(struct e1000_hw *hw) /** * e1000_phy_commit - Soft PHY reset - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Performs a soft PHY reset on those that apply. This is a function pointer * entry point called by drivers. @@ -1040,8 +1041,8 @@ e1000_phy_commit(struct e1000_hw *hw) /** * e1000_set_d3_lplu_state - Sets low power link up state for D0 - * @hw - pointer to the HW structure - * @active boolean used to enable/disable lplu + * @hw: pointer to the HW structure + * @active: boolean used to enable/disable lplu * * Success returns 0, Failure returns 1 * @@ -1063,8 +1064,8 @@ e1000_set_d0_lplu_state(struct e1000_hw *hw, boolean_t active) /** * e1000_set_d3_lplu_state - Sets low power link up state for D3 - * @hw - pointer to the HW structure - * @active boolean used to enable/disable lplu + * @hw: pointer to the HW structure + * @active: boolean used to enable/disable lplu * * Success returns 0, Failure returns 1 * @@ -1086,7 +1087,7 @@ e1000_set_d3_lplu_state(struct e1000_hw *hw, boolean_t active) /** * e1000_read_mac_addr - Reads MAC address - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Reads the MAC address out of the adapter and stores it in the HW structure. * Currently no func pointer exists and all implementations are handled in the @@ -1100,8 +1101,8 @@ e1000_read_mac_addr(struct e1000_hw *hw) /** * e1000_read_part_num - Read device part number - * @hw - pointer to the HW structure - * @part_num - pointer to device part number + * @hw: pointer to the HW structure + * @part_num: pointer to device part number * * Reads the product board assembly (PBA) number from the EEPROM and stores * the value in part_num. @@ -1116,7 +1117,7 @@ e1000_read_part_num(struct e1000_hw *hw, u32 *part_num) /** * e1000_validate_nvm_checksum - Verifies NVM (EEPROM) checksum - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Validates the NVM checksum is correct. This is a function pointer entry * point called by drivers. @@ -1132,7 +1133,7 @@ e1000_validate_nvm_checksum(struct e1000_hw *hw) /** * e1000_update_nvm_checksum - Updates NVM (EEPROM) checksum - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Updates the NVM checksum. Currently no func pointer exists and all * implementations are handled in the generic version of this function. @@ -1148,7 +1149,7 @@ e1000_update_nvm_checksum(struct e1000_hw *hw) /** * e1000_reload_nvm - Reloads EEPROM - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Reloads the EEPROM by setting the "Reinitialize from EEPROM" bit in the * extended control register. @@ -1162,10 +1163,10 @@ e1000_reload_nvm(struct e1000_hw *hw) /** * e1000_read_nvm - Reads NVM (EEPROM) - * @hw - pointer to the HW structure - * @offset - the word offset to read - * @words - number of 16-bit words to read - * @data - pointer to the properly sized buffer for the data. + * @hw: pointer to the HW structure + * @offset: the word offset to read + * @words: number of 16-bit words to read + * @data: pointer to the properly sized buffer for the data. * * Reads 16-bit chunks of data from the NVM (EEPROM). This is a function * pointer entry point called by drivers. @@ -1181,10 +1182,10 @@ e1000_read_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) /** * e1000_write_nvm - Writes to NVM (EEPROM) - * @hw - pointer to the HW structure - * @offset - the word offset to read - * @words - number of 16-bit words to write - * @data - pointer to the properly sized buffer for the data. + * @hw: pointer to the HW structure + * @offset: the word offset to read + * @words: number of 16-bit words to write + * @data: pointer to the properly sized buffer for the data. * * Writes 16-bit chunks of data to the NVM (EEPROM). This is a function * pointer entry point called by drivers. @@ -1200,10 +1201,10 @@ e1000_write_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data) /** * e1000_write_8bit_ctrl_reg - Writes 8bit Control register - * @hw - pointer to the HW structure - * @reg - 32bit register offset - * @offset - the register to write - * @data - the value to write. + * @hw: pointer to the HW structure + * @reg: 32bit register offset + * @offset: the register to write + * @data: the value to write. * * Writes the PHY register at offset with the value in data. * This is a function pointer entry point called by drivers. diff --git a/sys/dev/em/e1000_api.h b/sys/dev/em/e1000_api.h index 13f9d89..15a274f 100644 --- a/sys/dev/em/e1000_api.h +++ b/sys/dev/em/e1000_api.h @@ -30,10 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ - -/* - * $FreeBSD$ - */ +/*$FreeBSD$*/ #ifndef _E1000_API_H_ @@ -121,7 +118,7 @@ void e1000_set_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw, boolean_t state); void e1000_igp3_phy_powerdown_workaround_ich8lan(struct e1000_hw *hw); void e1000_gig_downshift_workaround_ich8lan(struct e1000_hw *hw); -u32 e1000_translate_register_adoram(u32 reg); + /* TBI_ACCEPT macro definition: * diff --git a/sys/dev/em/e1000_defines.h b/sys/dev/em/e1000_defines.h index 5969d74..3422976 100644 --- a/sys/dev/em/e1000_defines.h +++ b/sys/dev/em/e1000_defines.h @@ -30,10 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ - -/* - * $FreeBSD$ - */ +/*$FreeBSD$*/ #ifndef _E1000_DEFINES_H_ @@ -57,7 +54,7 @@ #define E1000_TXD_CMD_IP 0x02000000 /* IP packet */ #define E1000_TXD_CMD_TSE 0x04000000 /* TCP Seg enable */ #define E1000_TXD_STAT_TC 0x00000004 /* Tx Underrun */ - +/* Extended desc bits for Linksec and timesync */ /* Number of Transmit and Receive Descriptors must be a multiple of 8 */ #define REQ_TX_DESCRIPTOR_MULTIPLE 8 #define REQ_RX_DESCRIPTOR_MULTIPLE 8 @@ -150,10 +147,10 @@ #define E1000_CTRL_EXT_WR_WMARK_320 0x01000000 #define E1000_CTRL_EXT_WR_WMARK_384 0x02000000 #define E1000_CTRL_EXT_WR_WMARK_448 0x03000000 -#define E1000_CTRL_EXT_CANC 0x04000000 /* Interrupt delay cancellation */ -#define E1000_CTRL_EXT_DRV_LOAD 0x10000000 /* Driver loaded bit for FW */ -#define E1000_CTRL_EXT_IAME 0x08000000 /* Interrupt acknowledge Auto-mask */ -#define E1000_CTRL_EXT_INT_TIMER_CLR 0x20000000 /* Clear Interrupt timers after IMS clear */ +#define E1000_CTRL_EXT_CANC 0x04000000 /* Interrupt delay cancellation */ +#define E1000_CTRL_EXT_DRV_LOAD 0x10000000 /* Driver loaded bit for FW */ +#define E1000_CTRL_EXT_IAME 0x08000000 /* Interrupt acknowledge Auto-mask */ +#define E1000_CTRL_EXT_INT_TIMER_CLR 0x20000000 /* Clear Interrupt timers after IMS clear */ #define E1000_CRTL_EXT_PB_PAREN 0x01000000 /* packet buffer parity error detection enabled */ #define E1000_CTRL_EXT_DF_PAREN 0x02000000 /* descriptor FIFO parity error detection enable */ #define E1000_CTRL_EXT_GHOST_PAREN 0x40000000 diff --git a/sys/dev/em/e1000_hw.h b/sys/dev/em/e1000_hw.h index ed3b0e9..c5f2cd7 100644 --- a/sys/dev/em/e1000_hw.h +++ b/sys/dev/em/e1000_hw.h @@ -30,10 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ - -/* - * $FreeBSD$ - */ +/*$FreeBSD$*/ #ifndef _E1000_HW_H_ @@ -86,6 +83,8 @@ struct e1000_hw; #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_SERDES_DUAL 0x10D9 +#define E1000_DEV_ID_82571EB_SERDES_QUAD 0x10DA #define E1000_DEV_ID_82571EB_QUAD_COPPER 0x10A4 #define E1000_DEV_ID_82571EB_QUAD_FIBER 0x10A5 #define E1000_DEV_ID_82571EB_QUAD_COPPER_LP 0x10BC @@ -150,7 +149,7 @@ typedef enum { e1000_ich8lan, e1000_ich9lan, e1000_82575, - e1000_num_macs + e1000_num_macs /* List is 1-based, so subtract 1 for true count. */ } e1000_mac_type; typedef enum { diff --git a/sys/dev/em/e1000_ich8lan.c b/sys/dev/em/e1000_ich8lan.c index 912b949..7a7ced1 100644 --- a/sys/dev/em/e1000_ich8lan.c +++ b/sys/dev/em/e1000_ich8lan.c @@ -30,15 +30,14 @@ POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); +/*$FreeBSD$*/ /* e1000_ich8lan * e1000_ich9lan */ +#include "e1000_api.h" #include "e1000_ich8lan.h" void e1000_init_function_pointers_ich8lan(struct e1000_hw *hw); @@ -148,7 +147,7 @@ struct e1000_dev_spec_ich8lan { /** * e1000_init_phy_params_ich8lan - Initialize PHY function pointers - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Initialize family-specific PHY parameters and function pointers. **/ @@ -158,6 +157,7 @@ e1000_init_phy_params_ich8lan(struct e1000_hw *hw) struct e1000_phy_info *phy = &hw->phy; struct e1000_functions *func = &hw->func; s32 ret_val = E1000_SUCCESS; + u16 i = 0; DEBUGFUNC("e1000_init_phy_params_ich8lan"); @@ -178,9 +178,15 @@ e1000_init_phy_params_ich8lan(struct e1000_hw *hw) func->set_d3_lplu_state = e1000_set_d3_lplu_state_ich8lan; func->write_phy_reg = e1000_write_phy_reg_igp; - ret_val = e1000_get_phy_id(hw); - if (ret_val) - goto out; + + phy->id = 0; + while ((e1000_phy_unknown == e1000_get_phy_type_from_id(phy->id)) && + (i++ < 100)) { + msec_delay(1); + ret_val = e1000_get_phy_id(hw); + if (ret_val) + goto out; + } /* Verify phy id */ switch (phy->id) { @@ -205,7 +211,7 @@ out: /** * e1000_init_nvm_params_ich8lan - Initialize NVM function pointers - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Initialize family-specific NVM parameters and function * pointers. @@ -282,7 +288,7 @@ out: /** * e1000_init_mac_params_ich8lan - Initialize MAC function pointers - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Initialize family-specific MAC parameters and function * pointers. @@ -364,7 +370,7 @@ out: /** * e1000_init_function_pointers_ich8lan - Initialize ICH8 function pointers - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Initialize family-specific function pointers for PHY, MAC, and NVM. **/ @@ -380,7 +386,7 @@ e1000_init_function_pointers_ich8lan(struct e1000_hw *hw) /** * e1000_acquire_swflag_ich8lan - Acquire software control flag - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Acquires the software control flag for performing NVM and PHY * operations. This is a function pointer entry point only called by @@ -418,7 +424,7 @@ out: /** * e1000_release_swflag_ich8lan - Release software control flag - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Releases the software control flag for performing NVM and PHY operations. * This is a function pointer entry point only called by read/write @@ -440,7 +446,7 @@ e1000_release_swflag_ich8lan(struct e1000_hw *hw) /** * e1000_check_mng_mode_ich8lan - Checks management mode - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This checks if the adapter has manageability enabled. * This is a function pointer entry point only called by read/write @@ -461,7 +467,7 @@ e1000_check_mng_mode_ich8lan(struct e1000_hw *hw) /** * e1000_check_reset_block_ich8lan - Check if PHY reset is blocked - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Checks if firmware is blocking the reset of the PHY. * This is a function pointer entry point only called by @@ -482,7 +488,7 @@ e1000_check_reset_block_ich8lan(struct e1000_hw *hw) /** * e1000_phy_force_speed_duplex_ich8lan - Force PHY speed & duplex - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Forces the speed and duplex settings of the PHY. * This is a function pointer entry point only called by @@ -558,7 +564,7 @@ out: /** * e1000_phy_hw_reset_ich8lan - Performs a PHY reset - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Resets the PHY * This is a function pointer entry point called by drivers @@ -675,7 +681,7 @@ out: /** * e1000_get_phy_info_ich8lan - Calls appropriate PHY type get_phy_info - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Wrapper for calling the get_phy_info routines for the appropriate phy type. * This is a function pointer entry point called by drivers @@ -704,7 +710,7 @@ e1000_get_phy_info_ich8lan(struct e1000_hw *hw) /** * e1000_get_phy_info_ife_ich8lan - Retrieves various IFE PHY states - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Populates "phy" structure with various feature states. * This function is only called by other family-specific @@ -764,7 +770,7 @@ out: /** * e1000_check_polarity_ife_ich8lan - Check cable polarity for IFE PHY - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Polarity is determined on the polarity reveral feature being enabled. * This function is only called by other family-specific @@ -802,8 +808,8 @@ e1000_check_polarity_ife_ich8lan(struct e1000_hw *hw) /** * e1000_set_d0_lplu_state_ich8lan - Set Low Power Linkup D0 state - * @hw - pointer to the HW structure - * @active - TRUE to enable LPLU, FALSE to disable + * @hw: pointer to the HW structure + * @active: TRUE to enable LPLU, FALSE to disable * * Sets the LPLU D0 state according to the active flag. When * activating LPLU this function also disables smart speed @@ -891,8 +897,8 @@ out: /** * e1000_set_d3_lplu_state_ich8lan - Set Low Power Linkup D3 state - * @hw - pointer to the HW structure - * @active - TRUE to enable LPLU, FALSE to disable + * @hw: pointer to the HW structure + * @active: TRUE to enable LPLU, FALSE to disable * * Sets the LPLU D3 state according to the active flag. When * activating LPLU this function also disables smart speed @@ -979,10 +985,10 @@ out: /** * e1000_read_nvm_ich8lan - Read word(s) from the NVM - * @hw - pointer to the HW structure - * @offset - The offset (in bytes) of the word(s) to read. - * @words - Size of data to read in words - * @data - Pointer to the word(s) to read at offset. + * @hw: pointer to the HW structure + * @offset: The offset (in bytes) of the word(s) to read. + * @words: Size of data to read in words + * @data: Pointer to the word(s) to read at offset. * * Reads a word(s) from the NVM using the flash access registers. **/ @@ -1044,7 +1050,7 @@ out: /** * e1000_flash_cycle_init_ich8lan - Initialize flash - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This function does initial flash setup so that a new read/write/erase cycle * can be started. @@ -1118,8 +1124,8 @@ out: /** * e1000_flash_cycle_ich8lan - Starts flash cycle (read/write/erase) - * @hw - pointer to the HW structure - * @timeout - maximum time to wait for completion + * @hw: pointer to the HW structure + * @timeout: maximum time to wait for completion * * This function starts a flash cycle and waits for its completion. **/ @@ -1154,9 +1160,9 @@ e1000_flash_cycle_ich8lan(struct e1000_hw *hw, u32 timeout) /** * e1000_read_flash_word_ich8lan - Read word from flash - * @hw - pointer to the HW structure - * @offset - offset to data location - * @data - pointer to the location for storing the data + * @hw: pointer to the HW structure + * @offset: offset to data location + * @data: pointer to the location for storing the data * * Reads the flash word at offset into data. Offset is converted * to bytes before read. @@ -1184,10 +1190,10 @@ out: /** * e1000_read_flash_data_ich8lan - Read byte or word from NVM - * @hw - pointer to the HW structure - * @offset - The offset (in bytes) of the byte or word to read. - * @size - Size of data to read, 1=byte 2=word - * @data - Pointer to the word to store the value read. + * @hw: pointer to the HW structure + * @offset: The offset (in bytes) of the byte or word to read. + * @size: Size of data to read, 1=byte 2=word + * @data: Pointer to the word to store the value read. * * Reads a byte or word from the NVM using the flash access registers. **/ @@ -1266,10 +1272,10 @@ out: /** * e1000_write_nvm_ich8lan - Write word(s) to the NVM - * @hw - pointer to the HW structure - * @offset - The offset (in bytes) of the word(s) to write. - * @words - Size of data to write in words - * @data - Pointer to the word(s) to write at offset. + * @hw: pointer to the HW structure + * @offset: The offset (in bytes) of the word(s) to write. + * @words: Size of data to write in words + * @data: Pointer to the word(s) to write at offset. * * Writes a byte or word to the NVM using the flash access registers. **/ @@ -1315,7 +1321,7 @@ out: /** * e1000_update_nvm_checksum_ich8lan - Update the checksum for NVM - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * The NVM checksum is updated by calling the generic update_nvm_checksum, * which writes the checksum to the shadow ram. The changes in the shadow @@ -1455,7 +1461,7 @@ out: /** * e1000_validate_nvm_checksum_ich8lan - Validate EEPROM checksum - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Check to see if checksum needs to be fixed by reading bit 6 in word 0x19. * If the bit is 0, that the EEPROM had been modified, but the checksum was not @@ -1496,10 +1502,10 @@ out: /** * e1000_write_flash_data_ich8lan - Writes bytes to the NVM - * @hw - pointer to the HW structure - * @offset - The offset (in bytes) of the byte/word to read. - * @size - Size of data to read, 1=byte 2=word - * @data - The byte(s) to write to the NVM. + * @hw: pointer to the HW structure + * @offset: The offset (in bytes) of the byte/word to read. + * @size: Size of data to read, 1=byte 2=word + * @data: The byte(s) to write to the NVM. * * Writes one/two bytes to the NVM using the flash access registers. **/ @@ -1576,9 +1582,9 @@ out: /** * e1000_write_flash_byte_ich8lan - Write a single byte to NVM - * @hw - pointer to the HW structure - * @offset - The index of the byte to read. - * @data - The byte to write to the NVM. + * @hw: pointer to the HW structure + * @offset: The index of the byte to read. + * @data: The byte to write to the NVM. * * Writes a single byte to the NVM using the flash access registers. **/ @@ -1594,9 +1600,9 @@ e1000_write_flash_byte_ich8lan(struct e1000_hw *hw, u32 offset, u8 data) /** * e1000_retry_write_flash_byte_ich8lan - Writes a single byte to NVM - * @hw - pointer to the HW structure - * @offset - The offset of the byte to write. - * @byte - The byte to write to the NVM. + * @hw: pointer to the HW structure + * @offset: The offset of the byte to write. + * @byte: The byte to write to the NVM. * * Writes a single byte to the NVM using the flash access registers. * Goes through a retry algorithm before giving up. @@ -1633,8 +1639,8 @@ out: /** * e1000_erase_flash_bank_ich8lan - Erase a bank (4k) from NVM - * @hw - pointer to the HW structure - * @bank - 0 for first bank, 1 for second bank, etc. + * @hw: pointer to the HW structure + * @bank: 0 for first bank, 1 for second bank, etc. * * Erases the bank specified. Each bank is a 4k block. Banks are 0 based. * bank N is 4096 * N + flash_reg_addr. @@ -1750,8 +1756,8 @@ out: /** * e1000_valid_led_default_ich8lan - Set the default LED settings - * @hw - pointer to the HW structure - * @data - Pointer to the LED settings + * @hw: pointer to the HW structure + * @data: Pointer to the LED settings * * Reads the LED default settings from the NVM to data. If the NVM LED * settings is all 0's or F's, set the LED default to a valid LED default @@ -1780,7 +1786,7 @@ out: /** * e1000_get_bus_info_ich8lan - Get/Set the bus type and width - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * ICH8 use the PCI Express bus, but does not contain a PCI Express Capability * register, so the the bus width is hard coded. @@ -1808,7 +1814,7 @@ e1000_get_bus_info_ich8lan(struct e1000_hw *hw) /** * e1000_reset_hw_ich8lan - Reset the hardware - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Does a full reset of the hardware which includes a reset of the PHY and * MAC. @@ -1866,7 +1872,7 @@ e1000_reset_hw_ich8lan(struct e1000_hw *hw) ret_val = e1000_get_auto_rd_done_generic(hw); if (ret_val) { - /* + /* * When auto config read does not complete, do not * return with an error. This can happen in situations * where there is no eeprom and prevents getting link. @@ -1886,7 +1892,7 @@ e1000_reset_hw_ich8lan(struct e1000_hw *hw) /** * e1000_init_hw_ich8lan - Initialize the hardware - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Prepares the hardware for transmit and receive by doing the following: * - initialize hardware bits @@ -1964,7 +1970,7 @@ out: } /** * e1000_initialize_hw_bits_ich8lan - Initialize required hardware bits - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Sets/Clears required hardware bits necessary for correctly setting up the * hardware for transmit and receive. @@ -2023,7 +2029,7 @@ out: /** * e1000_setup_link_ich8lan - Setup flow control and link settings - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Determines which flow control settings to use, then configures flow * control. Calls the appropriate media-specific link configuration @@ -2069,7 +2075,7 @@ out: /** * e1000_setup_copper_link_ich8lan - Configure MAC/PHY interface - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Configures the kumeran interface to the PHY to wait the appropriate time * when polling the PHY, then call the generic setup_copper_link to finish @@ -2117,9 +2123,9 @@ out: /** * e1000_get_link_up_info_ich8lan - Get current link speed and duplex - * @hw - pointer to the HW structure - * @speed - pointer to store current link speed - * @duplex - pointer to store the current link duplex + * @hw: pointer to the HW structure + * @speed: pointer to store current link speed + * @duplex: pointer to store the current link duplex * * Calls the generic get_speed_and_duplex to retreive the current link * information and then calls the Kumeran lock loss workaround for links at @@ -2148,7 +2154,7 @@ out: /** * e1000_kmrn_lock_loss_workaround_ich8lan - Kumeran workaround - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Work-around for 82566 Kumeran PCS lock loss: * On link status change (i.e. PCI reset, speed change) and link is up and @@ -2231,8 +2237,8 @@ out: /** * e1000_set_kmrn_lock_loss_workaound_ich8lan - Set Kumeran workaround state - * @hw - pointer to the HW structure - * @state - boolean value used to set the current Kumaran workaround state + * @hw: pointer to the HW structure + * @state: boolean value used to set the current Kumaran workaround state * * If ICH8, set the current Kumeran workaround state (enabled - TRUE * /disabled - FALSE). @@ -2265,7 +2271,7 @@ out: /** * e1000_ipg3_phy_powerdown_workaround_ich8lan - Power down workaround on D3 - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Workaround for 82566 power-down on D3 entry: * 1) disable gigabit link @@ -2307,7 +2313,8 @@ e1000_igp3_phy_powerdown_workaround_ich8lan(struct e1000_hw *hw) /* Read it back and test */ e1000_read_phy_reg(hw, IGP3_VR_CTRL, &data); - if ((data & IGP3_VR_CTRL_MODE_SHUTDOWN) || retry) + data &= IGP3_VR_CTRL_DEV_POWERDOWN_MODE_MASK; + if ((data == IGP3_VR_CTRL_MODE_SHUTDOWN) || retry) break; /* Issue PHY reset and repeat at most one more time */ @@ -2322,7 +2329,7 @@ out: /** * e1000_gig_downshift_workaround_ich8lan - WoL from S5 stops working - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Steps to take when dropping from 1Gb/s (eg. link cable removal (LSC), * LPLU, Giga disable, MDIC PHY reset): @@ -2360,7 +2367,7 @@ out: /** * e1000_cleanup_led_ich8lan - Restore the default LED operation - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Return the LED back to the default configuration. **/ @@ -2383,7 +2390,7 @@ e1000_cleanup_led_ich8lan(struct e1000_hw *hw) /** * e1000_led_on_ich8lan - Turn LED's on - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Turn on the LED's. **/ @@ -2406,7 +2413,7 @@ e1000_led_on_ich8lan(struct e1000_hw *hw) /** * e1000_led_off_ich8lan - Turn LED's off - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Turn off the LED's. **/ @@ -2429,7 +2436,7 @@ e1000_led_off_ich8lan(struct e1000_hw *hw) /** * e1000_get_cfg_done_ich8lan - Read config done bit - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Read the management control register for the config done bit for * completion status. NOTE: silicon which is EEPROM-less will fail trying @@ -2453,7 +2460,7 @@ e1000_get_cfg_done_ich8lan(struct e1000_hw *hw) /** * e1000_clear_hw_cntrs_ich8lan - Clear statistical counters - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Clears hardware counters specific to the silicon family and calls * clear_hw_cntrs_generic to clear all general purpose counters. diff --git a/sys/dev/em/e1000_ich8lan.h b/sys/dev/em/e1000_ich8lan.h index 93123d4..95f0d55 100644 --- a/sys/dev/em/e1000_ich8lan.h +++ b/sys/dev/em/e1000_ich8lan.h @@ -30,17 +30,12 @@ POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ - -/* - * $FreeBSD$ - */ +/*$FreeBSD$*/ #ifndef _E1000_ICH8LAN_H_ #define _E1000_ICH8LAN_H_ -#include "e1000_api.h" - #define ICH_FLASH_GFPREG 0x0000 #define ICH_FLASH_HSFSTS 0x0004 #define ICH_FLASH_HSFCTL 0x0006 diff --git a/sys/dev/em/e1000_mac.c b/sys/dev/em/e1000_mac.c index 9f0f1b8..399a2c1 100644 --- a/sys/dev/em/e1000_mac.c +++ b/sys/dev/em/e1000_mac.c @@ -30,16 +30,15 @@ POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); +/*$FreeBSD$*/ +#include "e1000_api.h" #include "e1000_mac.h" /** * e1000_remove_device_generic - Free device specific structure - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * If a device specific structure was allocated, this function will * free it. @@ -55,7 +54,7 @@ e1000_remove_device_generic(struct e1000_hw *hw) /** * e1000_get_bus_info_pci_generic - Get PCI(x) bus information - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Determines and stores the system bus information for a particular * network interface. The following bus information is determined and stored: @@ -116,7 +115,7 @@ e1000_get_bus_info_pci_generic(struct e1000_hw *hw) /** * e1000_get_bus_info_pcie_generic - Get PCIe bus information - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Determines and stores the system bus information for a particular * network interface. The following bus information is determined and stored: @@ -158,7 +157,7 @@ e1000_get_bus_info_pcie_generic(struct e1000_hw *hw) /** * e1000_clear_vfta_generic - Clear VLAN filter table - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Clears the register array which contains the VLAN filter table by * setting all the values to 0. @@ -178,9 +177,9 @@ e1000_clear_vfta_generic(struct e1000_hw *hw) /** * e1000_write_vfta_generic - Write value to VLAN filter table - * @hw - pointer to the HW structure - * @offset - register offset in VLAN filter table - * @value - register value written to VLAN filter table + * @hw: pointer to the HW structure + * @offset: register offset in VLAN filter table + * @value: register value written to VLAN filter table * * Writes value at the given offset in the register array which stores * the VLAN filter table. @@ -196,8 +195,8 @@ e1000_write_vfta_generic(struct e1000_hw *hw, u32 offset, u32 value) /** * e1000_init_rx_addrs_generic - Initialize receive address's - * @hw - pointer to the HW structure - * @rar_count - receive address registers + * @hw: pointer to the HW structure + * @rar_count: receive address registers * * Setups the receive address registers by setting the base receive address * register to the devices MAC address and clearing all the other receive @@ -227,9 +226,9 @@ e1000_init_rx_addrs_generic(struct e1000_hw *hw, u16 rar_count) /** * e1000_rar_set_generic - Set receive address register - * @hw - pointer to the HW structure - * @addr - pointer to the receive address - * @index - receive address array register + * @hw: pointer to the HW structure + * @addr: pointer to the receive address + * @index: receive address array register * * Sets the receive address array register at index to the address passed * in by addr. @@ -259,8 +258,8 @@ e1000_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index) /** * e1000_mta_set_generic - Set multicast filter table address - * @hw - pointer to the HW structure - * @hash_value - determines the MTA register and bit to set + * @hw: pointer to the HW structure + * @hash_value: determines the MTA register and bit to set * * The multicast table address is a register array of 32-bit registers. * The hash_value is used to determine what register the bit is in, the @@ -295,11 +294,11 @@ e1000_mta_set_generic(struct e1000_hw *hw, u32 hash_value) /** * e1000_mc_addr_list_update_generic - Update Multicast addresses - * @hw - pointer to the HW structure - * @mc_addr_list - array of multicast addresses to program - * @mc_addr_count - number of multicast addresses to program - * @rar_used_count - the first RAR register free to program - * @rar_count - total number of supported Receive Address Registers + * @hw: pointer to the HW structure + * @mc_addr_list: array of multicast addresses to program + * @mc_addr_count: number of multicast addresses to program + * @rar_used_count: the first RAR register free to program + * @rar_count: total number of supported Receive Address Registers * * Updates the Receive Address Registers and Multicast Table Array. * The caller must have a packed mc_addr_list of multicast addresses. @@ -351,8 +350,8 @@ e1000_mc_addr_list_update_generic(struct e1000_hw *hw, /** * e1000_hash_mc_addr_generic - Generate a multicast hash value - * @hw - pointer to the HW structure - * @mc_addr - pointer to a multicast address + * @hw: pointer to the HW structure + * @mc_addr: pointer to a multicast address * * Generates a multicast address hash value which is used to determine * the multicast filter table array address and new table value. See @@ -422,7 +421,7 @@ e1000_hash_mc_addr_generic(struct e1000_hw *hw, u8 *mc_addr) /** * e1000_pcix_mmrbc_workaround_generic - Fix incorrect MMRBC value - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * In certain situations, a system BIOS may report that the PCIx maximum * memory read byte count (MMRBC) value is higher than than the actual @@ -460,7 +459,7 @@ e1000_pcix_mmrbc_workaround_generic(struct e1000_hw *hw) /** * e1000_clear_hw_cntrs_base_generic - Clear base hardware counters - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Clears the base hardware counters by reading the counter registers. **/ @@ -512,7 +511,7 @@ e1000_clear_hw_cntrs_base_generic(struct e1000_hw *hw) /** * e1000_check_for_copper_link_generic - Check for link (Copper) - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Checks to see of the link status of the hardware has changed. If a * change in link status has been detected, then we read the PHY registers @@ -584,7 +583,7 @@ out: /** * e1000_check_for_fiber_link_generic - Check for link (Fiber) - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Checks for link up on the hardware. If link is not up and we have * a signal, then we need to force link up. @@ -653,7 +652,7 @@ out: /** * e1000_check_for_serdes_link_generic - Check for link (Serdes) - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Checks for link up on the hardware. If link is not up and we have * a signal, then we need to force link up. @@ -743,7 +742,7 @@ out: /** * e1000_setup_link_generic - Setup flow control and link settings - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Determines which flow control settings to use, then configures flow * control. Calls the appropriate media-specific link configuration @@ -803,7 +802,7 @@ out: /** * e1000_setup_fiber_serdes_link_generic - Setup link for fiber/serdes - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Configures collision distance and flow control for fiber and serdes * links. Upon successful setup, poll for link. @@ -856,7 +855,7 @@ out: /** * e1000_config_collision_dist_generic - Configure collision distance - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Configures the collision distance to the default value and is used * during link setup. Currently no func pointer exists and all @@ -880,7 +879,7 @@ e1000_config_collision_dist_generic(struct e1000_hw *hw) /** * e1000_poll_fiber_serdes_link_generic - Poll for link up - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Polls for link up by reading the status register, if link fails to come * up with auto-negotiation, then the link is forced if a signal is detected. @@ -931,7 +930,7 @@ out: /** * e1000_commit_fc_settings_generic - Configure flow control - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Write the flow control settings to the Transmit Config Word Register (TXCW) * base on the flow control settings in e1000_mac_info. @@ -1004,7 +1003,7 @@ out: /** * e1000_set_fc_watermarks_generic - Set flow control high/low watermarks - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Sets the flow control high/low threshold (watermark) registers. If * flow control XON frame transmission is enabled, then set XON frame @@ -1044,7 +1043,7 @@ e1000_set_fc_watermarks_generic(struct e1000_hw *hw) /** * e1000_set_default_fc_generic - Set flow control default values - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Read the EEPROM for the default values for flow control and store the * values. @@ -1090,7 +1089,7 @@ out: /** * e1000_force_mac_fc_generic - Force the MAC's flow control settings - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Force the MAC's flow control settings. Sets the TFCE and RFCE bits in the * device control register to reflect the adapter settings. TFCE and RFCE @@ -1157,7 +1156,7 @@ out: /** * e1000_config_fc_after_link_up_generic - Configures flow control after link - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Checks the status of auto-negotiation after link up to ensure that the * speed and duplex were not forced. If the link needed to be forced, then @@ -1371,9 +1370,9 @@ out: /** * e1000_get_speed_and_duplex_copper_generic - Retreive current speed/duplex - * @hw - pointer to the HW structure - * @speed - stores the current speed - * @duplex - stores the current duplex + * @hw: pointer to the HW structure + * @speed: stores the current speed + * @duplex: stores the current duplex * * Read the status register for the current speed/duplex and store the current * speed and duplex for copper connections. @@ -1411,9 +1410,9 @@ e1000_get_speed_and_duplex_copper_generic(struct e1000_hw *hw, u16 *speed, /** * e1000_get_speed_and_duplex_fiber_generic - Retreive current speed/duplex - * @hw - pointer to the HW structure - * @speed - stores the current speed - * @duplex - stores the current duplex + * @hw: pointer to the HW structure + * @speed: stores the current speed + * @duplex: stores the current duplex * * Sets the speed and duplex to gigabit full duplex (the only possible option) * for fiber/serdes links. @@ -1432,10 +1431,9 @@ e1000_get_speed_and_duplex_fiber_serdes_generic(struct e1000_hw *hw, u16 *speed, /** * e1000_get_hw_semaphore_generic - Acquire hardware semaphore - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * - * Request a hardware semaphore by setting the firmware semaphore bit, once - * bit has been set, semaphore has been acquired. + * Acquire the HW semaphore to access the PHY or NVM **/ s32 e1000_get_hw_semaphore_generic(struct e1000_hw *hw) @@ -1447,6 +1445,22 @@ e1000_get_hw_semaphore_generic(struct e1000_hw *hw) DEBUGFUNC("e1000_get_hw_semaphore_generic"); + /* Get the SW semaphore */ + while (i < timeout) { + swsm = E1000_READ_REG(hw, E1000_SWSM); + if (!(swsm & E1000_SWSM_SMBI)) + break; + + usec_delay(50); + i++; + } + + if (i == timeout) { + DEBUGOUT("Driver can't access device - SMBI bit is set.\n"); + ret_val = -E1000_ERR_NVM; + goto out; + } + /* Get the FW semaphore. */ for (i = 0; i < timeout; i++) { swsm = E1000_READ_REG(hw, E1000_SWSM); @@ -1473,9 +1487,9 @@ out: /** * e1000_put_hw_semaphore_generic - Release hardware semaphore - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * - * Release hardware semaphore by clearing in the firmware semaphore bit. + * Release hardware semaphore used to access the PHY or NVM **/ void e1000_put_hw_semaphore_generic(struct e1000_hw *hw) @@ -1486,14 +1500,14 @@ e1000_put_hw_semaphore_generic(struct e1000_hw *hw) swsm = E1000_READ_REG(hw, E1000_SWSM); - swsm &= ~E1000_SWSM_SWESMBI; + swsm &= ~(E1000_SWSM_SMBI | E1000_SWSM_SWESMBI); E1000_WRITE_REG(hw, E1000_SWSM, swsm); } /** * e1000_get_auto_rd_done_generic - Check for auto read completion - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Check EEPROM for Auto Read done bit. **/ @@ -1524,8 +1538,8 @@ out: /** * e1000_valid_led_default_generic - Verify a valid default LED config - * @hw - pointer to the HW structure - * @data - pointer to the NVM (EEPROM) + * @hw: pointer to the HW structure + * @data: pointer to the NVM (EEPROM) * * Read the EEPROM for the current default LED configuration. If the * LED configuration is not valid, set to a valid LED configuration. @@ -1552,7 +1566,7 @@ out: /** * e1000_id_led_init_generic - - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * **/ s32 @@ -1620,7 +1634,7 @@ out: /** * e1000_setup_led_generic - Configures SW controllable LED - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * This prepares the SW controllable LED for use and saves the current state * of the LED so it can be later restored. @@ -1658,7 +1672,7 @@ out: /** * e1000_cleanup_led_generic - Set LED config to default operation - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Remove the current LED configuration and set the LED configuration * to the default value, saved from the EEPROM. @@ -1683,7 +1697,7 @@ out: /** * e1000_blink_led_generic - Blink LED - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Blink the led's which are set to be on. **/ @@ -1717,7 +1731,7 @@ e1000_blink_led_generic(struct e1000_hw *hw) /** * e1000_led_on_generic - Turn LED on - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Turn LED on. **/ @@ -1747,7 +1761,7 @@ e1000_led_on_generic(struct e1000_hw *hw) /** * e1000_led_off_generic - Turn LED off - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Turn LED off. **/ @@ -1777,8 +1791,8 @@ e1000_led_off_generic(struct e1000_hw *hw) /** * e1000_set_pcie_no_snoop_generic - Set PCI-express capabilities - * @hw - pointer to the HW structure - * @no_snoop - bitmap of snoop events + * @hw: pointer to the HW structure + * @no_snoop: bitmap of snoop events * * Set the PCI-express register to snoop for events enabled in 'no_snoop'. **/ @@ -1804,7 +1818,7 @@ out: /** * e1000_disable_pcie_master_generic - Disables PCI-express master access - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Returns 0 (E1000_SUCCESS) if successful, else returns -10 * (-E1000_ERR_MASTER_REQUESTS_PENDING) if master disable bit has not casued @@ -1849,7 +1863,7 @@ out: /** * e1000_reset_adaptive_generic - Reset Adaptive Interframe Spacing - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Reset the Adaptive Interframe Spacing throttle to default values. **/ @@ -1881,7 +1895,7 @@ out: /** * e1000_update_adaptive_generic - Update Adaptive Interframe Spacing - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Update the Adaptive Interframe Spacing Throttle value based on the * time between transmitted packets and time between collisions. @@ -1924,7 +1938,7 @@ out: /** * e1000_validate_mdi_setting_generic - Verify MDI/MDIx settings - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Verify that when not using auto-negotitation that MDI/MDIx is correctly * set, which is forced to MDI mode only. @@ -1949,10 +1963,10 @@ out: /** * e1000_write_8bit_ctrl_reg_generic - Write a 8bit CTRL register - * @hw - pointer to the HW structure - * @reg - 32bit register offset such as E1000_SCTL - * @offset - register offset to write to - * @data - data to write at register offset + * @hw: pointer to the HW structure + * @reg: 32bit register offset such as E1000_SCTL + * @offset: register offset to write to + * @data: data to write at register offset * * Writes an address/data control type register. There are several of these * and they all have the format address << 8 | data and bit 31 is polled for diff --git a/sys/dev/em/e1000_mac.h b/sys/dev/em/e1000_mac.h index b41e897..cc485db 100644 --- a/sys/dev/em/e1000_mac.h +++ b/sys/dev/em/e1000_mac.h @@ -30,17 +30,12 @@ POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ - -/* - * $FreeBSD$ - */ +/*$FreeBSD$*/ #ifndef _E1000_MAC_H_ #define _E1000_MAC_H_ -#include "e1000_api.h" - /* Functions that should not be called directly from drivers but can be used * by other files in this 'shared code' */ diff --git a/sys/dev/em/e1000_manage.c b/sys/dev/em/e1000_manage.c index 9a0342d..4908023 100644 --- a/sys/dev/em/e1000_manage.c +++ b/sys/dev/em/e1000_manage.c @@ -30,19 +30,18 @@ POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); +/*$FreeBSD$*/ +#include "e1000_api.h" #include "e1000_manage.h" static u8 e1000_calculate_checksum(u8 *buffer, u32 length); /** * e1000_calculate_checksum - Calculate checksum for buffer - * @buffer - pointer to EEPROM - * @length - size of EEPROM to calculate a checksum for + * @buffer: pointer to EEPROM + * @length: size of EEPROM to calculate a checksum for * * Calculates the checksum for some buffer on a specified length. The * checksum calculated is returned. @@ -66,7 +65,7 @@ e1000_calculate_checksum(u8 *buffer, u32 length) /** * e1000_mng_enable_host_if_generic - Checks host interface is enabled - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Returns E1000_success upon success, else E1000_ERR_HOST_INTERFACE_COMMAND * @@ -110,7 +109,7 @@ out: /** * e1000_check_mng_mode_generic - Generic check managament mode - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Reads the firmware semaphore register and returns true (>0) if * manageability is enabled, else false (0). @@ -130,7 +129,7 @@ e1000_check_mng_mode_generic(struct e1000_hw *hw) /** * e1000_enable_tx_pkt_filtering_generic - Enable packet filtering on TX - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Enables packet filtering on transmit packets if manageability is enabled * and host interface is enabled. @@ -194,9 +193,9 @@ out: /** * e1000_mng_write_dhcp_info_generic - Writes DHCP info to host interface - * @hw - pointer to the HW structure - * @buffer - pointer to the host interface - * @length - size of the buffer + * @hw: pointer to the HW structure + * @buffer: pointer to the host interface + * @length: size of the buffer * * Writes the DHCP information to the host interface. **/ @@ -241,8 +240,8 @@ out: /** * e1000_mng_write_cmd_header_generic - Writes manageability command header - * @hw - pointer to the HW structure - * @hdr - pointer to the host interface command header + * @hw: pointer to the HW structure + * @hdr: pointer to the host interface command header * * Writes the command header after does the checksum calculation. **/ @@ -270,11 +269,11 @@ e1000_mng_write_cmd_header_generic(struct e1000_hw * hw, /** * e1000_mng_host_if_write_generic - Writes to the manageability host interface - * @hw - pointer to the HW structure - * @buffer - pointer to the host interface buffer - * @length - size of the buffer - * @offset - location in the buffer to write to - * @sum - sum of the data (not checksum) + * @hw: pointer to the HW structure + * @buffer: pointer to the host interface buffer + * @length: size of the buffer + * @offset: location in the buffer to write to + * @sum: sum of the data (not checksum) * * This function writes the buffer content at the offset given on the host if. * It also does alignment considerations to do the writes in most efficient @@ -348,7 +347,7 @@ out: /** * e1000_enable_mng_pass_thru - Enable processing of ARP's - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Verifies the hardware needs to allow ARPs to be processed by the host. **/ diff --git a/sys/dev/em/e1000_manage.h b/sys/dev/em/e1000_manage.h index e34108c..0c02087 100644 --- a/sys/dev/em/e1000_manage.h +++ b/sys/dev/em/e1000_manage.h @@ -30,17 +30,12 @@ POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ - -/* - * $FreeBSD$ - */ +/*$FreeBSD$*/ #ifndef _E1000_MANAGE_H_ #define _E1000_MANAGE_H_ -#include "e1000_api.h" - boolean_t e1000_check_mng_mode_generic(struct e1000_hw *hw); boolean_t e1000_enable_tx_pkt_filtering_generic(struct e1000_hw *hw); s32 e1000_mng_enable_host_if_generic(struct e1000_hw *hw); diff --git a/sys/dev/em/e1000_nvm.c b/sys/dev/em/e1000_nvm.c index 1922435..7d58f53 100644 --- a/sys/dev/em/e1000_nvm.c +++ b/sys/dev/em/e1000_nvm.c @@ -30,17 +30,16 @@ POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); +/*$FreeBSD$*/ +#include "e1000_api.h" #include "e1000_nvm.h" /** * e1000_raise_eec_clk - Raise EEPROM clock - * @hw - pointer to the HW structure - * @eecd - pointer to the EEPROM + * @hw: pointer to the HW structure + * @eecd: pointer to the EEPROM * * Enable/Raise the EEPROM clock bit. **/ @@ -55,8 +54,8 @@ e1000_raise_eec_clk(struct e1000_hw *hw, u32 *eecd) /** * e1000_lower_eec_clk - Lower EEPROM clock - * @hw - pointer to the HW structure - * @eecd - pointer to the EEPROM + * @hw: pointer to the HW structure + * @eecd: pointer to the EEPROM * * Clear/Lower the EEPROM clock bit. **/ @@ -71,9 +70,9 @@ e1000_lower_eec_clk(struct e1000_hw *hw, u32 *eecd) /** * e1000_shift_out_eec_bits - Shift data bits our to the EEPROM - * @hw - pointer to the HW structure - * @data - data to send to the EEPROM - * @count - number of bits to shift out + * @hw: pointer to the HW structure + * @data: data to send to the EEPROM + * @count: number of bits to shift out * * We need to shift 'count' bits out to the EEPROM. So, the value in the * "data" parameter will be shifted out to the EEPROM one bit at a time. @@ -117,8 +116,8 @@ e1000_shift_out_eec_bits(struct e1000_hw *hw, u16 data, u16 count) /** * e1000_shift_in_eec_bits - Shift data bits in from the EEPROM - * @hw - pointer to the HW structure - * @count - number of bits to shift in + * @hw: pointer to the HW structure + * @count: number of bits to shift in * * In order to read a register from the EEPROM, we need to shift 'count' bits * in from the EEPROM. Bits are "shifted in" by raising the clock input to @@ -158,8 +157,8 @@ e1000_shift_in_eec_bits(struct e1000_hw *hw, u16 count) /** * e1000_poll_eerd_eewr_done - Poll for EEPROM read/write completion - * @hw - pointer to the HW structure - * @ee_reg - EEPROM flag for polling + * @hw: pointer to the HW structure + * @ee_reg: EEPROM flag for polling * * Polls the EEPROM status bit for either read or write completion based * upon the value of 'ee_reg'. @@ -192,7 +191,7 @@ e1000_poll_eerd_eewr_done(struct e1000_hw *hw, int ee_reg) /** * e1000_acquire_nvm_generic - Generic request for access to EEPROM - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Set the EEPROM access request bit and wait for EEPROM access grant bit. * Return successful if access grant bit set, else clear the request for @@ -230,7 +229,7 @@ e1000_acquire_nvm_generic(struct e1000_hw *hw) /** * e1000_standby_nvm - Return EEPROM to standby state - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Return the EEPROM to a standby state. **/ @@ -272,7 +271,7 @@ e1000_standby_nvm(struct e1000_hw *hw) /** * e1000_stop_nvm - Terminate EEPROM command - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Terminates the current command by inverting the EEPROM's chip select pin. **/ @@ -299,7 +298,7 @@ e1000_stop_nvm(struct e1000_hw *hw) /** * e1000_release_nvm_generic - Release exclusive access to EEPROM - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Stop any current commands to the EEPROM and clear the EEPROM request bit. **/ @@ -319,7 +318,7 @@ e1000_release_nvm_generic(struct e1000_hw *hw) /** * e1000_ready_nvm_eeprom - Prepares EEPROM for read/write - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Setups the EEPROM for reading and writing. **/ @@ -377,10 +376,10 @@ out: /** * e1000_read_nvm_spi - Read EEPROM's using SPI - * @hw - pointer to the HW structure - * @offset - offset of word in the EEPROM to read - * @words - number of words to read - * @data - word read from the EEPROM + * @hw: pointer to the HW structure + * @offset: offset of word in the EEPROM to read + * @words: number of words to read + * @data: word read from the EEPROM * * Reads a 16 bit word from the EEPROM. **/ @@ -438,10 +437,10 @@ out: /** * e1000_read_nvm_microwire - Reads EEPROM's using microwire - * @hw - pointer to the HW structure - * @offset - offset of word in the EEPROM to read - * @words - number of words to read - * @data - word read from the EEPROM + * @hw: pointer to the HW structure + * @offset: offset of word in the EEPROM to read + * @words: number of words to read + * @data: word read from the EEPROM * * Reads a 16 bit word from the EEPROM. **/ @@ -493,10 +492,10 @@ out: /** * e1000_read_nvm_eerd - Reads EEPROM using EERD register - * @hw - pointer to the HW structure - * @offset - offset of word in the EEPROM to read - * @words - number of words to read - * @data - word read from the EEPROM + * @hw: pointer to the HW structure + * @offset: offset of word in the EEPROM to read + * @words: number of words to read + * @data: word read from the EEPROM * * Reads a 16 bit word from the EEPROM using the EERD register. **/ @@ -536,10 +535,10 @@ out: /** * e1000_write_nvm_spi - Write to EEPROM using SPI - * @hw - pointer to the HW structure - * @offset - offset within the EEPROM to be written to - * @words - number of words to write - * @data - 16 bit word(s) to be written to the EEPROM + * @hw: pointer to the HW structure + * @offset: offset within the EEPROM to be written to + * @words: number of words to write + * @data: 16 bit word(s) to be written to the EEPROM * * Writes data to EEPROM at offset using SPI interface. * @@ -619,10 +618,10 @@ out: /** * e1000_write_nvm_microwire - Writes EEPROM using microwire - * @hw - pointer to the HW structure - * @offset - offset within the EEPROM to be written to - * @words - number of words to write - * @data - 16 bit word(s) to be written to the EEPROM + * @hw: pointer to the HW structure + * @offset: offset within the EEPROM to be written to + * @words: number of words to write + * @data: 16 bit word(s) to be written to the EEPROM * * Writes data to EEPROM at offset using microwire interface. * @@ -707,8 +706,8 @@ out: /** * e1000_read_part_num_generic - Read device part number - * @hw - pointer to the HW structure - * @part_num - pointer to device part number + * @hw: pointer to the HW structure + * @part_num: pointer to device part number * * Reads the product board assembly (PBA) number from the EEPROM and stores * the value in part_num. @@ -741,7 +740,7 @@ out: /** * e1000_read_mac_addr_generic - Read device MAC address - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Reads the device MAC address from the EEPROM and stores the value. * Since devices with two ports use the same EEPROM, we increment the @@ -779,7 +778,7 @@ out: /** * e1000_validate_nvm_checksum_generic - Validate EEPROM checksum - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Calculates the EEPROM checksum by reading/adding each word of the EEPROM * and then verifies that the sum of the EEPROM is equal to 0xBABA. @@ -814,7 +813,7 @@ out: /** * e1000_update_nvm_checksum_generic - Update EEPROM checksum - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Updates the EEPROM checksum by reading/adding each word of the EEPROM * up to the checksum. Then calculates the EEPROM checksum and writes the @@ -849,7 +848,7 @@ out: /** * e1000_reload_nvm_generic - Reloads EEPROM - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Reloads the EEPROM by setting the "Reinitialize from EEPROM" bit in the * extended control register. @@ -872,7 +871,7 @@ e1000_reload_nvm_generic(struct e1000_hw *hw) /** * e1000_acquire_nvm - Acquire exclusive access to EEPROM - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * For those silicon families which have implemented a NVM acquire function, * run the defined function else return success. @@ -888,7 +887,7 @@ e1000_acquire_nvm(struct e1000_hw *hw) /** * e1000_release_nvm - Release exclusive access to EEPROM - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * For those silicon families which have implemented a NVM release function, * run the defined fucntion else return success. diff --git a/sys/dev/em/e1000_nvm.h b/sys/dev/em/e1000_nvm.h index 572dc68..8093873 100644 --- a/sys/dev/em/e1000_nvm.h +++ b/sys/dev/em/e1000_nvm.h @@ -30,17 +30,12 @@ POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ - -/* - * $FreeBSD$ - */ +/*$FreeBSD$*/ #ifndef _E1000_NVM_H_ #define _E1000_NVM_H_ -#include "e1000_api.h" - s32 e1000_acquire_nvm_generic(struct e1000_hw *hw); s32 e1000_poll_eerd_eewr_done(struct e1000_hw *hw, int ee_reg); diff --git a/sys/dev/em/e1000_osdep.h b/sys/dev/em/e1000_osdep.h index fe20a34..b9877ca 100644 --- a/sys/dev/em/e1000_osdep.h +++ b/sys/dev/em/e1000_osdep.h @@ -30,10 +30,7 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ***************************************************************************/ - -/* - * $FreeBSD$ - */ +/*$FreeBSD$*/ #ifndef _FREEBSD_OS_H_ diff --git a/sys/dev/em/e1000_phy.c b/sys/dev/em/e1000_phy.c index 18f5252..298b470 100644 --- a/sys/dev/em/e1000_phy.c +++ b/sys/dev/em/e1000_phy.c @@ -30,11 +30,10 @@ POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); +/*$FreeBSD$*/ +#include "e1000_api.h" #include "e1000_phy.h" static s32 e1000_get_phy_cfg_done(struct e1000_hw *hw); @@ -65,7 +64,7 @@ u16 e1000_igp_2_cable_length_table[] = /** * e1000_check_reset_block_generic - Check if PHY reset is blocked - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Read the PHY management control register and check whether a PHY reset * is blocked. If a reset is not blocked return E1000_SUCCESS, otherwise @@ -86,7 +85,7 @@ e1000_check_reset_block_generic(struct e1000_hw *hw) /** * e1000_get_phy_id - Retrieve the PHY ID and revision - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Reads the PHY registers and stores the PHY ID and possibly the PHY * revision in the hardware structure. @@ -119,7 +118,7 @@ out: /** * e1000_phy_reset_dsp_generic - Reset PHY DSP - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Reset the digital signal processor. **/ @@ -142,9 +141,9 @@ out: /** * e1000_read_phy_reg_mdic - Read MDI control register - * @hw - pointer to the HW structure - * @offset - register offset to be read - * @data - pointer to the read data + * @hw: pointer to the HW structure + * @offset: register offset to be read + * @data: pointer to the read data * * Reads the MDI control regsiter in the PHY at offset and stores the * information read to data. @@ -199,9 +198,9 @@ out: /** * e1000_write_phy_reg_mdic - Write MDI control register - * @hw - pointer to the HW structure - * @offset - register offset to write to - * @data - data to write to register at offset + * @hw: pointer to the HW structure + * @offset: register offset to write to + * @data: data to write to register at offset * * Writes data to MDI control register in the PHY at offset. **/ @@ -250,9 +249,9 @@ out: /** * e1000_read_phy_reg_m88 - Read m88 PHY register - * @hw - pointer to the HW structure - * @offset - register offset to be read - * @data - pointer to the read data + * @hw: pointer to the HW structure + * @offset: register offset to be read + * @data: pointer to the read data * * Acquires semaphore, if necessary, then reads the PHY register at offset * and storing the retrieved information in data. Release any acquired @@ -281,9 +280,9 @@ out: /** * e1000_write_phy_reg_m88 - Write m88 PHY register - * @hw - pointer to the HW structure - * @offset - register offset to write to - * @data - data to write at register offset + * @hw: pointer to the HW structure + * @offset: register offset to write to + * @data: data to write at register offset * * Acquires semaphore, if necessary, then writes the data to PHY register * at the offset. Release any acquired semaphores before exiting. @@ -311,9 +310,9 @@ out: /** * e1000_read_phy_reg_igp - Read igp PHY register - * @hw - pointer to the HW structure - * @offset - register offset to be read - * @data - pointer to the read data + * @hw: pointer to the HW structure + * @offset: register offset to be read + * @data: pointer to the read data * * Acquires semaphore, if necessary, then reads the PHY register at offset * and storing the retrieved information in data. Release any acquired @@ -352,9 +351,9 @@ out: /** * e1000_write_phy_reg_igp - Write igp PHY register - * @hw - pointer to the HW structure - * @offset - register offset to write to - * @data - data to write at register offset + * @hw: pointer to the HW structure + * @offset: register offset to write to + * @data: data to write at register offset * * Acquires semaphore, if necessary, then writes the data to PHY register * at the offset. Release any acquired semaphores before exiting. @@ -392,9 +391,9 @@ out: /** * e1000_read_kmrn_reg_generic - Read kumeran register - * @hw - pointer to the HW structure - * @offset - register offset to be read - * @data - pointer to the read data + * @hw: pointer to the HW structure + * @offset: register offset to be read + * @data: pointer to the read data * * Acquires semaphore, if necessary. Then reads the PHY register at offset * using the kumeran interface. The information retrieved is stored in data. @@ -429,9 +428,9 @@ out: /** * e1000_write_kmrn_reg_generic - Write kumeran register - * @hw - pointer to the HW structure - * @offset - register offset to write to - * @data - data to write at register offset + * @hw: pointer to the HW structure + * @offset: register offset to write to + * @data: data to write at register offset * * Acquires semaphore, if necessary. Then write the data to PHY register * at the offset using the kumeran interface. Release any acquired semaphores @@ -462,7 +461,7 @@ out: /** * e1000_copper_link_setup_m88 - Setup m88 PHY's for copper link - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Sets up MDI/MDI-X and polarity for m88 PHY's. If necessary, transmit clock * and downshift values are set also. @@ -571,7 +570,7 @@ out: /** * e1000_copper_link_setup_igp - Setup igp PHY's for copper link - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Sets up LPLU, MDI/MDI-X, polarity, Smartspeed and Master/Slave config for * igp PHY's. @@ -705,7 +704,7 @@ out: /** * e1000_copper_link_autoneg - Setup/Enable autoneg for copper link - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Performs initial bounds checking on autoneg advertisement parameter, then * configure to advertise the full capability. Setup the PHY to autoneg @@ -772,7 +771,7 @@ out: /** * e1000_phy_setup_autoneg - Configure PHY for auto-negotiation - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Reads the MII auto-neg advertisement register and/or the 1000T control * register and if the PHY is already setup for auto-negotiation, then @@ -934,7 +933,7 @@ out: /** * e1000_setup_copper_link_generic - Configure copper link settings - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Calls the appropriate function to configure the link for auto-neg or forced * speed and duplex. Then we check for link, once link is established calls @@ -990,7 +989,7 @@ out: /** * e1000_phy_force_speed_duplex_igp - Force speed/duplex for igp PHY - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Calls the PHY setup function to force speed and duplex. Clears the * auto-crossover to force MDI manually. Waits for link and returns @@ -1063,7 +1062,7 @@ out: /** * e1000_phy_force_speed_duplex_m88 - Force speed/duplex for m88 PHY - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Calls the PHY setup function to force speed and duplex. Clears the * auto-crossover to force MDI manually. Resets the PHY to commit the @@ -1172,8 +1171,8 @@ out: /** * e1000_phy_force_speed_duplex_setup - Configure forced PHY speed/duplex - * @hw - pointer to the HW structure - * @phy_ctrl - pointer to current value of PHY_CONTROL + * @hw: pointer to the HW structure + * @phy_ctrl: pointer to current value of PHY_CONTROL * * Forces speed and duplex on the PHY by doing the following: disable flow * control, force speed/duplex on the MAC, disable auto speed detection, @@ -1235,8 +1234,8 @@ e1000_phy_force_speed_duplex_setup(struct e1000_hw *hw, u16 *phy_ctrl) /** * e1000_set_d3_lplu_state_generic - Sets low power link up state for D3 - * @hw - pointer to the HW structure - * @active boolean used to enable/disable lplu + * @hw: pointer to the HW structure + * @active: boolean used to enable/disable lplu * * Success returns 0, Failure returns 1 * @@ -1327,7 +1326,7 @@ out: /** * e1000_check_downshift_generic - Checks whether a downshift in speed occured - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Success returns 0, Failure returns 1 * @@ -1372,7 +1371,7 @@ out: /** * e1000_check_polarity_m88 - Checks the polarity. - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Success returns 0, Failure returns -E1000_ERR_PHY (-2) * @@ -1399,7 +1398,7 @@ e1000_check_polarity_m88(struct e1000_hw *hw) /** * e1000_check_polarity_igp - Checks the polarity. - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Success returns 0, Failure returns -E1000_ERR_PHY (-2) * @@ -1446,7 +1445,7 @@ out: /** * e1000_wait_autoneg_generic - Wait for auto-neg compeletion - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Waits for auto-negotiation to complete or for the auto-negotiation time * limit to expire, which ever happens first. @@ -1480,10 +1479,10 @@ e1000_wait_autoneg_generic(struct e1000_hw *hw) /** * e1000_phy_has_link_generic - Polls PHY for link - * @hw - pointer to the HW structure - * @iterations - number of times to poll for link - * @usec_interval - delay between polling attempts - * @success - pointer to whether polling was successful or not + * @hw: pointer to the HW structure + * @iterations: number of times to poll for link + * @usec_interval: delay between polling attempts + * @success: pointer to whether polling was successful or not * * Polls the PHY status register for link, 'iterations' number of times. **/ @@ -1522,7 +1521,7 @@ e1000_phy_has_link_generic(struct e1000_hw *hw, u32 iterations, /** * e1000_get_cable_length_m88 - Determine cable length for m88 PHY - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Reads the PHY specific status register to retrieve the cable length * information. The cable length is determined by averaging the minimum and @@ -1561,7 +1560,7 @@ out: /** * e1000_get_cable_length_igp_2 - Determine cable length for igp2 PHY - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * The automatic gain control (agc) normalizes the amplitude of the * received signal, adjusting for the attenuation produced by the @@ -1634,7 +1633,7 @@ out: /** * e1000_get_phy_info_m88 - Retrieve PHY information - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Valid for only copper links. Read the PHY status register (sticky read) * to verify that link is up. Read the PHY special control register to @@ -1715,7 +1714,7 @@ out: /** * e1000_get_phy_info_igp - Retrieve igp PHY information - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Read PHY status to determine if link is up. If link is up, then * set/determine 10base-T extended distance and polarity correction. Read @@ -1783,7 +1782,7 @@ out: /** * e1000_phy_sw_reset_generic - PHY software reset - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Does a software reset of the PHY by reading the PHY control register and * setting/write the control register reset bit to the PHY. @@ -1813,7 +1812,7 @@ out: /** * e1000_phy_hw_reset_generic - PHY hardware reset - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Verify the reset block is not blocking us from resetting. Acquire * semaphore (if necessary) and read/set/write the device control reset @@ -1860,7 +1859,7 @@ out: /** * e1000_get_cfg_done_generic - Generic configuration done - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Generic function to wait 10 milli-seconds for configuration to complete * and return success. @@ -1879,7 +1878,7 @@ e1000_get_cfg_done_generic(struct e1000_hw *hw) /** * e1000_get_phy_cfg_done - Generic PHY configuration done - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Return success if silicon family did not implement a family specific * get_cfg_done function. @@ -1895,7 +1894,7 @@ e1000_get_phy_cfg_done(struct e1000_hw *hw) /** * e1000_release_phy - Generic release PHY - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Return if silicon family does not require a semaphore when accessing the * PHY. @@ -1909,7 +1908,7 @@ e1000_release_phy(struct e1000_hw *hw) /** * e1000_acquire_phy - Generic acquire PHY - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Return success if silicon family does not require a semaphore when * accessing the PHY. @@ -1925,7 +1924,7 @@ e1000_acquire_phy(struct e1000_hw *hw) /** * e1000_phy_force_speed_duplex - Generic force PHY speed/duplex - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * When the silicon family has not implemented a forced speed/duplex * function for the PHY, simply return E1000_SUCCESS. @@ -1941,7 +1940,7 @@ e1000_phy_force_speed_duplex(struct e1000_hw *hw) /** * e1000_phy_init_script_igp3 - Inits the IGP3 PHY - * @hw - pointer to the HW structure + * @hw: pointer to the HW structure * * Initializes a Intel Gigabit PHY3 when an EEPROM is not present. **/ @@ -2022,3 +2021,44 @@ e1000_phy_init_script_igp3(struct e1000_hw *hw) return E1000_SUCCESS; } + +/** + * e1000_get_phy_type_from_id - Get PHY type from id + * @phy_id: phy_id read from the phy + * + * Returns the phy type from the id. + **/ +e1000_phy_type +e1000_get_phy_type_from_id(u32 phy_id) +{ + e1000_phy_type phy_type = e1000_phy_unknown; + + switch (phy_id) { + case M88E1000_I_PHY_ID: + case M88E1000_E_PHY_ID: + case M88E1111_I_PHY_ID: + case M88E1011_I_PHY_ID: + phy_type = e1000_phy_m88; + break; + case IGP01E1000_I_PHY_ID: /* IGP 1 & 2 share this */ + phy_type = e1000_phy_igp_2; + break; + case GG82563_E_PHY_ID: + phy_type = e1000_phy_gg82563; + break; + case IGP03E1000_E_PHY_ID: + phy_type = e1000_phy_igp_3; + break; + case IFE_E_PHY_ID: + case IFE_PLUS_E_PHY_ID: + case IFE_C_E_PHY_ID: + phy_type = e1000_phy_ife; + break; + default: + phy_type = e1000_phy_unknown; + break; + } + return phy_type; +} + + diff --git a/sys/dev/em/e1000_phy.h b/sys/dev/em/e1000_phy.h index eb9632c..3be660a 100644 --- a/sys/dev/em/e1000_phy.h +++ b/sys/dev/em/e1000_phy.h @@ -30,10 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ - -/* - * $FreeBSD$ - */ +/*$FreeBSD$*/ #ifndef _E1000_PHY_H_ @@ -52,8 +49,6 @@ typedef enum { e1000_smart_speed_off } e1000_smart_speed; -#include "e1000_api.h" - s32 e1000_check_downshift_generic(struct e1000_hw *hw); s32 e1000_check_polarity_m88(struct e1000_hw *hw); s32 e1000_check_polarity_igp(struct e1000_hw *hw); @@ -88,8 +83,8 @@ s32 e1000_phy_reset_dsp(struct e1000_hw *hw); s32 e1000_phy_has_link_generic(struct e1000_hw *hw, u32 iterations, u32 usec_interval, boolean_t *success); s32 e1000_phy_init_script_igp3(struct e1000_hw *hw); - - +e1000_phy_type e1000_get_phy_type_from_id(u32 phy_id); +#define E1000_MAX_PHY_ADDR 4 /* IGP01E1000 Specific Registers */ #define IGP01E1000_PHY_PORT_CONFIG 0x10 /* Port Config */ @@ -100,6 +95,17 @@ s32 e1000_phy_init_script_igp3(struct e1000_hw *hw); #define IGP01E1000_PHY_CHANNEL_QUALITY 0x15 /* PHY Channel Quality */ #define IGP02E1000_PHY_POWER_MGMT 0x19 /* Power Management */ #define IGP01E1000_PHY_PAGE_SELECT 0x1F /* Page Select */ +#define IGP4_PHY_PAGE_SELECT 22 /* Page Select for IGP 4 */ +#define IGP_PAGE_SHIFT 5 +#define PHY_REG_MASK 0x1F + +#define IGP4_WUC_PAGE 800 +#define IGP4_WUC_ADDRESS_OPCODE 0x11 +#define IGP4_WUC_DATA_OPCODE 0x12 +#define IGP4_WUC_ENABLE_PAGE 769 +#define IGP4_WUC_ENABLE_REG 17 +#define IGP4_WUC_ENABLE_BIT (1 << 2) +#define IGP4_WUC_HOST_WU_BIT (1 << 4) #define IGP01E1000_PHY_PCS_INIT_REG 0x00B4 #define IGP01E1000_PHY_POLARITY_MASK 0x0078 diff --git a/sys/dev/em/e1000_regs.h b/sys/dev/em/e1000_regs.h index 1f75021..e2bde1e 100644 --- a/sys/dev/em/e1000_regs.h +++ b/sys/dev/em/e1000_regs.h @@ -30,10 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ - -/* - * $FreeBSD$ - */ +/*$FreeBSD$*/ #ifndef _E1000_REGS_H_ @@ -382,22 +379,8 @@ /* RSS registers */ #define E1000_CPUVEC 0x02C10 /* CPU Vector Register - RW */ #define E1000_MRQC 0x05818 /* Multiple Receive Control - RW */ -#define E1000_IMIR0 0x05A80 /* Immediate Interrupt RX 0 - RW */ -#define E1000_IMIR1 0x05A84 /* Immediate Interrupt RX 1 - RW */ -#define E1000_IMIR2 0x05A88 /* Immediate Interrupt RX 2 - RW */ -#define E1000_IMIR3 0x05A8C /* Immediate Interrupt RX 3 - RW */ -#define E1000_IMIR4 0x05A90 /* Immediate Interrupt RX 4 - RW */ -#define E1000_IMIR5 0x05A94 /* Immediate Interrupt RX 5 - RW */ -#define E1000_IMIR6 0x05A98 /* Immediate Interrupt RX 6 - RW */ -#define E1000_IMIR7 0x05A9C /* Immediate Interrupt RX 7 - RW */ -#define E1000_IMIREX0 0x05AA0 /* Immediate Interrupt RX Extended 0 - RW */ -#define E1000_IMIREX1 0x05AA4 /* Immediate Interrupt RX Extended 1 - RW */ -#define E1000_IMIREX2 0x05AA8 /* Immediate Interrupt RX Extended 2 - RW */ -#define E1000_IMIREX3 0x05AAC /* Immediate Interrupt RX Extended 3 - RW */ -#define E1000_IMIREX4 0x05AB0 /* Immediate Interrupt RX Extended 4 - RW */ -#define E1000_IMIREX5 0x05AB4 /* Immediate Interrupt RX Extended 5 - RW */ -#define E1000_IMIREX6 0x05AB8 /* Immediate Interrupt RX Extended 6 - RW */ -#define E1000_IMIREX7 0x05ABC /* Immediate Interrupt RX Extended 7 - RW */ +#define E1000_IMIR(_i) (0x05A80 + ((_i) * 4)) /* Immediate Interrupt */ +#define E1000_IMIREXT(_i) (0x05AA0 + ((_i) * 4)) /* Immediate Interrupt Ext*/ #define E1000_IMIRVP 0x05AC0 /* Immediate Interrupt RX VLAN Priority - RW */ #define E1000_MSIXBM0 0x01600 /* MSI-X Allocation Register 0 - RW */ #define E1000_MSIXBM1 0x01604 /* MSI-X Allocation Register 1 - RW */ diff --git a/sys/dev/em/if_em.c b/sys/dev/em/if_em.c index d2a7538..e2ac3b3 100644 --- a/sys/dev/em/if_em.c +++ b/sys/dev/em/if_em.c @@ -89,7 +89,7 @@ int em_display_debug_stats = 0; /********************************************************************* * Driver version: *********************************************************************/ -char em_driver_version[] = "Version - 6.5.0"; +char em_driver_version[] = "Version - 6.5.2"; /********************************************************************* @@ -1291,9 +1291,9 @@ em_init_locked(struct adapter *adapter) ifp->if_hwassist = 0; if (adapter->hw.mac.type >= e1000_82543) { if (ifp->if_capenable & IFCAP_TXCSUM) - ifp->if_hwassist |= EM_CHECKSUM_FEATURES; - if (ifp->if_capenable & IFCAP_TSO) - ifp->if_hwassist |= EM_TCPSEG_FEATURES; + ifp->if_hwassist |= (CSUM_TCP | CSUM_UDP); + if (ifp->if_capenable & IFCAP_TSO4) + ifp->if_hwassist |= CSUM_TSO; } /* Configure for OS presence */ @@ -1683,7 +1683,6 @@ em_media_change(struct ifnet *ifp) static int em_encap(struct adapter *adapter, struct mbuf **m_headp) { - struct ifnet *ifp = adapter->ifp; bus_dma_segment_t segs[EM_MAX_SCATTER]; bus_dmamap_t map; struct em_buffer *tx_buffer, *tx_buffer_mapped; @@ -1804,15 +1803,12 @@ em_encap(struct adapter *adapter, struct mbuf **m_headp) m_head = *m_headp; /* Do hardware assists */ - if (ifp->if_hwassist > 0) { - if (do_tso && em_tso_setup(adapter, m_head, - &txd_upper, &txd_lower)) { - /* we need to make a final sentinel transmit desc */ - tso_desc = TRUE; - } else - em_transmit_checksum_setup(adapter, m_head, - &txd_upper, &txd_lower); - } + if (em_tso_setup(adapter, m_head, &txd_upper, &txd_lower)) + /* we need to make a final sentinel transmit desc */ + tso_desc = TRUE; + else if (m_head->m_pkthdr.csum_flags & CSUM_OFFLOAD) + em_transmit_checksum_setup(adapter, m_head, + &txd_upper, &txd_lower); i = adapter->next_avail_tx_desc; if (adapter->pcix_82544) @@ -1963,7 +1959,6 @@ em_encap(struct adapter *adapter, struct mbuf **m_headp) * used by the 82575 adapter. It also needs no workarounds. * **********************************************************************/ -#define CSUM_OFFLOAD 7 /* Checksum bits */ static int em_adv_encap(struct adapter *adapter, struct mbuf **m_headp) @@ -2774,9 +2769,8 @@ em_setup_interface(device_t dev, struct adapter *adapter) ifp->if_capenable |= IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM; } - /* Enable TSO if available */ - if ((adapter->hw.mac.type > e1000_82544) && - (adapter->hw.mac.type != e1000_82547)) { + /* Enable TSO for PCI Express adapters */ + if (adapter->hw.bus.type == e1000_bus_type_pci_express) { ifp->if_capabilities |= IFCAP_TSO4; ifp->if_capenable |= IFCAP_TSO4; } @@ -3370,8 +3364,9 @@ em_tso_setup(struct adapter *adapter, struct mbuf *mp, uint32_t *txd_upper, * in true failure cases as well. Should do -1 (failure), 0 (no) * and 1 (success). */ - if (mp->m_pkthdr.len <= EM_TX_BUFFER_SIZE) - return FALSE; /* 0 */ + if (((mp->m_pkthdr.csum_flags & CSUM_TSO) == 0) || + (mp->m_pkthdr.len <= EM_TX_BUFFER_SIZE)) + return FALSE; /* * This function could/should be extended to support IP/IPv6 diff --git a/sys/dev/em/if_em.h b/sys/dev/em/if_em.h index b54f779..5ec21a0 100644 --- a/sys/dev/em/if_em.h +++ b/sys/dev/em/if_em.h @@ -30,10 +30,7 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ***************************************************************************/ - -/* - * $FreeBSD$ - */ +/*$FreeBSD$*/ #ifndef _EM_H_DEFINED_ #define _EM_H_DEFINED_ @@ -136,16 +133,6 @@ POSSIBILITY OF SUCH DAMAGE. #define EM_RADV 64 /* - * Inform the stack about transmit checksum offload capabilities. - */ -#define EM_CHECKSUM_FEATURES (CSUM_TCP | CSUM_UDP) - -/* - * Inform the stack about transmit segmentation offload capabilities. - */ -#define EM_TCPSEG_FEATURES CSUM_TSO - -/* * This parameter controls the duration of transmit watchdog timer. */ #define EM_TX_TIMEOUT 5 /* set to 5 seconds */ @@ -155,7 +142,7 @@ POSSIBILITY OF SUCH DAMAGE. * transmit descriptors. */ #define EM_TX_CLEANUP_THRESHOLD (adapter->num_tx_desc / 8) -#define EM_TX_OP_THRESHOLD (adapter->num_tx_desc / 32) +#define EM_TX_OP_THRESHOLD (adapter->num_tx_desc / 32) /* * This parameter controls whether or not autonegotation is enabled. @@ -243,6 +230,7 @@ POSSIBILITY OF SUCH DAMAGE. #define EM_TSO_SEG_SIZE 4096 /* Max dma segment size */ #define ETH_ZLEN 60 #define ETH_ADDR_LEN 6 +#define CSUM_OFFLOAD 7 /* Offload bits in csum flags */ struct adapter; |