e1000_mac.c (194865) | e1000_mac.c (200243) |
---|---|
1/****************************************************************************** 2 3 Copyright (c) 2001-2009, Intel Corporation 4 All rights reserved. 5 6 Redistribution and use in source and binary forms, with or without 7 modification, are permitted provided that the following conditions are met: 8 --- 16 unchanged lines hidden (view full) --- 25 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 POSSIBILITY OF SUCH DAMAGE. 31 32******************************************************************************/ | 1/****************************************************************************** 2 3 Copyright (c) 2001-2009, Intel Corporation 4 All rights reserved. 5 6 Redistribution and use in source and binary forms, with or without 7 modification, are permitted provided that the following conditions are met: 8 --- 16 unchanged lines hidden (view full) --- 25 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 POSSIBILITY OF SUCH DAMAGE. 31 32******************************************************************************/ |
33/*$FreeBSD: head/sys/dev/e1000/e1000_mac.c 194865 2009-06-24 17:41:29Z jfv $*/ | 33/*$FreeBSD: head/sys/dev/e1000/e1000_mac.c 200243 2009-12-08 01:07:44Z jfv $*/ |
34 35#include "e1000_api.h" 36 37static s32 e1000_validate_mdi_setting_generic(struct e1000_hw *hw); 38static void e1000_set_lan_id_multi_port_pcie(struct e1000_hw *hw); 39 40/** 41 * e1000_init_mac_ops_generic - Initialize MAC function pointers --- 183 unchanged lines hidden (view full) --- 225 * Determines and stores the system bus information for a particular 226 * network interface. The following bus information is determined and stored: 227 * bus speed, bus width, type (PCIe), and PCIe function. 228 **/ 229s32 e1000_get_bus_info_pcie_generic(struct e1000_hw *hw) 230{ 231 struct e1000_mac_info *mac = &hw->mac; 232 struct e1000_bus_info *bus = &hw->bus; | 34 35#include "e1000_api.h" 36 37static s32 e1000_validate_mdi_setting_generic(struct e1000_hw *hw); 38static void e1000_set_lan_id_multi_port_pcie(struct e1000_hw *hw); 39 40/** 41 * e1000_init_mac_ops_generic - Initialize MAC function pointers --- 183 unchanged lines hidden (view full) --- 225 * Determines and stores the system bus information for a particular 226 * network interface. The following bus information is determined and stored: 227 * bus speed, bus width, type (PCIe), and PCIe function. 228 **/ 229s32 e1000_get_bus_info_pcie_generic(struct e1000_hw *hw) 230{ 231 struct e1000_mac_info *mac = &hw->mac; 232 struct e1000_bus_info *bus = &hw->bus; |
233 | |
234 s32 ret_val; 235 u16 pcie_link_status; 236 237 DEBUGFUNC("e1000_get_bus_info_pcie_generic"); 238 239 bus->type = e1000_bus_type_pci_express; 240 bus->speed = e1000_bus_speed_2500; 241 --- 161 unchanged lines hidden (view full) --- 403 404 if (nvm_alt_mac_addr_offset == 0xFFFF) { 405 /* There is no Alternate MAC Address */ 406 goto out; 407 } 408 409 if (hw->bus.func == E1000_FUNC_1) 410 nvm_alt_mac_addr_offset += E1000_ALT_MAC_ADDRESS_OFFSET_LAN1; | 233 s32 ret_val; 234 u16 pcie_link_status; 235 236 DEBUGFUNC("e1000_get_bus_info_pcie_generic"); 237 238 bus->type = e1000_bus_type_pci_express; 239 bus->speed = e1000_bus_speed_2500; 240 --- 161 unchanged lines hidden (view full) --- 402 403 if (nvm_alt_mac_addr_offset == 0xFFFF) { 404 /* There is no Alternate MAC Address */ 405 goto out; 406 } 407 408 if (hw->bus.func == E1000_FUNC_1) 409 nvm_alt_mac_addr_offset += E1000_ALT_MAC_ADDRESS_OFFSET_LAN1; |
410 if (hw->bus.func == E1000_FUNC_2) 411 nvm_alt_mac_addr_offset += E1000_ALT_MAC_ADDRESS_OFFSET_LAN2; 412 413 if (hw->bus.func == E1000_FUNC_3) 414 nvm_alt_mac_addr_offset += E1000_ALT_MAC_ADDRESS_OFFSET_LAN3; |
|
411 for (i = 0; i < ETH_ADDR_LEN; i += 2) { 412 offset = nvm_alt_mac_addr_offset + (i >> 1); 413 ret_val = hw->nvm.ops.read(hw, offset, 1, &nvm_data); 414 if (ret_val) { 415 DEBUGOUT("NVM Read Error\n"); 416 goto out; 417 } 418 --- 326 unchanged lines hidden (view full) --- 745 if (ret_val) 746 goto out; 747 748 if (!link) 749 goto out; /* No link detected */ 750 751 mac->get_link_status = FALSE; 752 | 415 for (i = 0; i < ETH_ADDR_LEN; i += 2) { 416 offset = nvm_alt_mac_addr_offset + (i >> 1); 417 ret_val = hw->nvm.ops.read(hw, offset, 1, &nvm_data); 418 if (ret_val) { 419 DEBUGOUT("NVM Read Error\n"); 420 goto out; 421 } 422 --- 326 unchanged lines hidden (view full) --- 749 if (ret_val) 750 goto out; 751 752 if (!link) 753 goto out; /* No link detected */ 754 755 mac->get_link_status = FALSE; 756 |
753 if (hw->phy.type == e1000_phy_82578) { 754 ret_val = e1000_link_stall_workaround_hv(hw); 755 if (ret_val) 756 goto out; 757 } 758 | |
759 /* 760 * Check if there was DownShift, must be checked 761 * immediately after link-up 762 */ 763 e1000_check_downshift_generic(hw); 764 765 /* 766 * If we are forcing speed/duplex, then we simply return since --- 222 unchanged lines hidden (view full) --- 989 s32 ret_val = E1000_SUCCESS; 990 991 DEBUGFUNC("e1000_setup_link_generic"); 992 993 /* 994 * In the case of the phy reset being blocked, we already have a link. 995 * We do not need to set it up again. 996 */ | 757 /* 758 * Check if there was DownShift, must be checked 759 * immediately after link-up 760 */ 761 e1000_check_downshift_generic(hw); 762 763 /* 764 * If we are forcing speed/duplex, then we simply return since --- 222 unchanged lines hidden (view full) --- 987 s32 ret_val = E1000_SUCCESS; 988 989 DEBUGFUNC("e1000_setup_link_generic"); 990 991 /* 992 * In the case of the phy reset being blocked, we already have a link. 993 * We do not need to set it up again. 994 */ |
997 if (hw->phy.ops.check_reset_block) 998 if (hw->phy.ops.check_reset_block(hw)) 999 goto out; | 995 if (e1000_check_reset_block(hw)) 996 goto out; |
1000 1001 /* 1002 * If requested flow control is set to default, set flow control 1003 * based on the EEPROM flow control settings. 1004 */ 1005 if (hw->fc.requested_mode == e1000_fc_default) { 1006 ret_val = e1000_set_default_fc_generic(hw); 1007 if (ret_val) --- 499 unchanged lines hidden (view full) --- 1507 * 1 | DC | 1 | DC | E1000_fc_full 1508 * 1509 */ 1510 if ((mii_nway_adv_reg & NWAY_AR_PAUSE) && 1511 (mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE)) { 1512 /* 1513 * Now we need to check if the user selected Rx ONLY 1514 * of pause frames. In this case, we had to advertise | 997 998 /* 999 * If requested flow control is set to default, set flow control 1000 * based on the EEPROM flow control settings. 1001 */ 1002 if (hw->fc.requested_mode == e1000_fc_default) { 1003 ret_val = e1000_set_default_fc_generic(hw); 1004 if (ret_val) --- 499 unchanged lines hidden (view full) --- 1504 * 1 | DC | 1 | DC | E1000_fc_full 1505 * 1506 */ 1507 if ((mii_nway_adv_reg & NWAY_AR_PAUSE) && 1508 (mii_nway_lp_ability_reg & NWAY_LPAR_PAUSE)) { 1509 /* 1510 * Now we need to check if the user selected Rx ONLY 1511 * of pause frames. In this case, we had to advertise |
1515 * FULL flow control because we could not advertise RX | 1512 * FULL flow control because we could not advertise Rx |
1516 * ONLY. Hence, we must now check to see if we need to 1517 * turn OFF the TRANSMISSION of PAUSE frames. 1518 */ 1519 if (hw->fc.requested_mode == e1000_fc_full) { 1520 hw->fc.current_mode = e1000_fc_full; 1521 DEBUGOUT("Flow Control = FULL.\r\n"); 1522 } else { 1523 hw->fc.current_mode = e1000_fc_rx_pause; --- 504 unchanged lines hidden (view full) --- 2028out: 2029 return; 2030} 2031 2032/** 2033 * e1000_disable_pcie_master_generic - Disables PCI-express master access 2034 * @hw: pointer to the HW structure 2035 * | 1513 * ONLY. Hence, we must now check to see if we need to 1514 * turn OFF the TRANSMISSION of PAUSE frames. 1515 */ 1516 if (hw->fc.requested_mode == e1000_fc_full) { 1517 hw->fc.current_mode = e1000_fc_full; 1518 DEBUGOUT("Flow Control = FULL.\r\n"); 1519 } else { 1520 hw->fc.current_mode = e1000_fc_rx_pause; --- 504 unchanged lines hidden (view full) --- 2025out: 2026 return; 2027} 2028 2029/** 2030 * e1000_disable_pcie_master_generic - Disables PCI-express master access 2031 * @hw: pointer to the HW structure 2032 * |
2036 * Returns 0 (E1000_SUCCESS) if successful, else returns -10 | 2033 * Returns E1000_SUCCESS if successful, else returns -10 |
2037 * (-E1000_ERR_MASTER_REQUESTS_PENDING) if master disable bit has not caused 2038 * the master requests to be disabled. 2039 * 2040 * Disables PCI-Express master access and verifies there are no pending 2041 * requests. 2042 **/ 2043s32 e1000_disable_pcie_master_generic(struct e1000_hw *hw) 2044{ --- 101 unchanged lines hidden (view full) --- 2146 2147/** 2148 * e1000_validate_mdi_setting_generic - Verify MDI/MDIx settings 2149 * @hw: pointer to the HW structure 2150 * 2151 * Verify that when not using auto-negotiation that MDI/MDIx is correctly 2152 * set, which is forced to MDI mode only. 2153 **/ | 2034 * (-E1000_ERR_MASTER_REQUESTS_PENDING) if master disable bit has not caused 2035 * the master requests to be disabled. 2036 * 2037 * Disables PCI-Express master access and verifies there are no pending 2038 * requests. 2039 **/ 2040s32 e1000_disable_pcie_master_generic(struct e1000_hw *hw) 2041{ --- 101 unchanged lines hidden (view full) --- 2143 2144/** 2145 * e1000_validate_mdi_setting_generic - Verify MDI/MDIx settings 2146 * @hw: pointer to the HW structure 2147 * 2148 * Verify that when not using auto-negotiation that MDI/MDIx is correctly 2149 * set, which is forced to MDI mode only. 2150 **/ |
2154s32 e1000_validate_mdi_setting_generic(struct e1000_hw *hw) | 2151static s32 e1000_validate_mdi_setting_generic(struct e1000_hw *hw) |
2155{ 2156 s32 ret_val = E1000_SUCCESS; 2157 2158 DEBUGFUNC("e1000_validate_mdi_setting_generic"); 2159 2160 if (!hw->mac.autoneg && (hw->phy.mdix == 0 || hw->phy.mdix == 3)) { 2161 DEBUGOUT("Invalid MDI setting detected\n"); 2162 hw->phy.mdix = 1; --- 47 unchanged lines hidden --- | 2152{ 2153 s32 ret_val = E1000_SUCCESS; 2154 2155 DEBUGFUNC("e1000_validate_mdi_setting_generic"); 2156 2157 if (!hw->mac.autoneg && (hw->phy.mdix == 0 || hw->phy.mdix == 3)) { 2158 DEBUGOUT("Invalid MDI setting detected\n"); 2159 hw->phy.mdix = 1; --- 47 unchanged lines hidden --- |