e1000_82540.c (190872) | e1000_82540.c (194865) |
---|---|
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_82540.c 190872 2009-04-10 00:05:46Z jfv $*/ | 33/*$FreeBSD: head/sys/dev/e1000/e1000_82540.c 194865 2009-06-24 17:41:29Z jfv $*/ |
34 35/* 36 * 82540EM Gigabit Ethernet Controller 37 * 82540EP Gigabit Ethernet Controller 38 * 82545EM Gigabit Ethernet Controller (Copper) 39 * 82545EM Gigabit Ethernet Controller (Fiber) 40 * 82545GM Gigabit Ethernet Controller 41 * 82546EB Gigabit Ethernet Controller (Copper) --- 10 unchanged lines hidden (view full) --- 52static void e1000_clear_hw_cntrs_82540(struct e1000_hw *hw); 53static s32 e1000_init_hw_82540(struct e1000_hw *hw); 54static s32 e1000_reset_hw_82540(struct e1000_hw *hw); 55static s32 e1000_set_phy_mode_82540(struct e1000_hw *hw); 56static s32 e1000_set_vco_speed_82540(struct e1000_hw *hw); 57static s32 e1000_setup_copper_link_82540(struct e1000_hw *hw); 58static s32 e1000_setup_fiber_serdes_link_82540(struct e1000_hw *hw); 59static void e1000_power_down_phy_copper_82540(struct e1000_hw *hw); | 34 35/* 36 * 82540EM Gigabit Ethernet Controller 37 * 82540EP Gigabit Ethernet Controller 38 * 82545EM Gigabit Ethernet Controller (Copper) 39 * 82545EM Gigabit Ethernet Controller (Fiber) 40 * 82545GM Gigabit Ethernet Controller 41 * 82546EB Gigabit Ethernet Controller (Copper) --- 10 unchanged lines hidden (view full) --- 52static void e1000_clear_hw_cntrs_82540(struct e1000_hw *hw); 53static s32 e1000_init_hw_82540(struct e1000_hw *hw); 54static s32 e1000_reset_hw_82540(struct e1000_hw *hw); 55static s32 e1000_set_phy_mode_82540(struct e1000_hw *hw); 56static s32 e1000_set_vco_speed_82540(struct e1000_hw *hw); 57static s32 e1000_setup_copper_link_82540(struct e1000_hw *hw); 58static s32 e1000_setup_fiber_serdes_link_82540(struct e1000_hw *hw); 59static void e1000_power_down_phy_copper_82540(struct e1000_hw *hw); |
60static s32 e1000_read_mac_addr_82540(struct e1000_hw *hw); |
|
60 61/** 62 * e1000_init_phy_params_82540 - Init PHY func ptrs. 63 * @hw: pointer to the HW structure 64 **/ 65static s32 e1000_init_phy_params_82540(struct e1000_hw *hw) 66{ 67 struct e1000_phy_info *phy = &hw->phy; --- 156 unchanged lines hidden (view full) --- 224 /* multicast address update */ 225 mac->ops.update_mc_addr_list = e1000_update_mc_addr_list_generic; 226 /* writing VFTA */ 227 mac->ops.write_vfta = e1000_write_vfta_generic; 228 /* clearing VFTA */ 229 mac->ops.clear_vfta = e1000_clear_vfta_generic; 230 /* setting MTA */ 231 mac->ops.mta_set = e1000_mta_set_generic; | 61 62/** 63 * e1000_init_phy_params_82540 - Init PHY func ptrs. 64 * @hw: pointer to the HW structure 65 **/ 66static s32 e1000_init_phy_params_82540(struct e1000_hw *hw) 67{ 68 struct e1000_phy_info *phy = &hw->phy; --- 156 unchanged lines hidden (view full) --- 225 /* multicast address update */ 226 mac->ops.update_mc_addr_list = e1000_update_mc_addr_list_generic; 227 /* writing VFTA */ 228 mac->ops.write_vfta = e1000_write_vfta_generic; 229 /* clearing VFTA */ 230 mac->ops.clear_vfta = e1000_clear_vfta_generic; 231 /* setting MTA */ 232 mac->ops.mta_set = e1000_mta_set_generic; |
233 /* read mac address */ 234 mac->ops.read_mac_addr = e1000_read_mac_addr_82540; |
|
232 /* ID LED init */ 233 mac->ops.id_led_init = e1000_id_led_init_generic; 234 /* setup LED */ 235 mac->ops.setup_led = e1000_setup_led_generic; 236 /* cleanup LED */ 237 mac->ops.cleanup_led = e1000_cleanup_led_generic; 238 /* turn on/off LED */ 239 mac->ops.led_on = e1000_led_on_generic; --- 431 unchanged lines hidden (view full) --- 671 E1000_READ_REG(hw, E1000_TSCTC); 672 E1000_READ_REG(hw, E1000_TSCTFC); 673 674 E1000_READ_REG(hw, E1000_MGTPRC); 675 E1000_READ_REG(hw, E1000_MGTPDC); 676 E1000_READ_REG(hw, E1000_MGTPTC); 677} 678 | 235 /* ID LED init */ 236 mac->ops.id_led_init = e1000_id_led_init_generic; 237 /* setup LED */ 238 mac->ops.setup_led = e1000_setup_led_generic; 239 /* cleanup LED */ 240 mac->ops.cleanup_led = e1000_cleanup_led_generic; 241 /* turn on/off LED */ 242 mac->ops.led_on = e1000_led_on_generic; --- 431 unchanged lines hidden (view full) --- 674 E1000_READ_REG(hw, E1000_TSCTC); 675 E1000_READ_REG(hw, E1000_TSCTFC); 676 677 E1000_READ_REG(hw, E1000_MGTPRC); 678 E1000_READ_REG(hw, E1000_MGTPDC); 679 E1000_READ_REG(hw, E1000_MGTPTC); 680} 681 |
682/** 683 * e1000_read_mac_addr_82540 - Read device MAC address 684 * @hw: pointer to the HW structure 685 * 686 * Reads the device MAC address from the EEPROM and stores the value. 687 * Since devices with two ports use the same EEPROM, we increment the 688 * last bit in the MAC address for the second port. 689 * 690 * This version is being used over generic because of customer issues 691 * with VmWare and Virtual Box when using generic. It seems in 692 * the emulated 82545, RAR[0] does NOT have a valid address after a 693 * reset, this older method works and using this breaks nothing for 694 * these legacy adapters. 695 **/ 696s32 e1000_read_mac_addr_82540(struct e1000_hw *hw) 697{ 698 s32 ret_val = E1000_SUCCESS; 699 u16 offset, nvm_data, i; 700 701 DEBUGFUNC("e1000_read_mac_addr"); 702 703 for (i = 0; i < ETH_ADDR_LEN; i += 2) { 704 offset = i >> 1; 705 ret_val = hw->nvm.ops.read(hw, offset, 1, &nvm_data); 706 if (ret_val) { 707 DEBUGOUT("NVM Read Error\n"); 708 goto out; 709 } 710 hw->mac.perm_addr[i] = (u8)(nvm_data & 0xFF); 711 hw->mac.perm_addr[i+1] = (u8)(nvm_data >> 8); 712 } 713 714 /* Flip last bit of mac address if we're on second port */ 715 if (hw->bus.func == E1000_FUNC_1) 716 hw->mac.perm_addr[5] ^= 1; 717 718 for (i = 0; i < ETH_ADDR_LEN; i++) 719 hw->mac.addr[i] = hw->mac.perm_addr[i]; 720 721out: 722 return ret_val; 723} |
|