diff options
author | Bill Hayes <bill.hayes@hp.com> | 2007-10-31 18:21:52 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:03:42 -0500 |
commit | 93ca161027eb6a1761fb674ad7b995aedccf5f6e (patch) | |
tree | a1d4dde667d24ff8031607e3098d5e4f96d4614b /drivers/net/e1000e/lib.c | |
parent | 3df5920c46089b8b1873cb1333248c3e9b01eaf8 (diff) |
e1000e: alternate MAC address support
Port alternate MAC address support from the sourceforge
e1000 driver to the upstream e1000e driver.
Signed-off-by: Bill Hayes <bill.hayes@hp.com>
Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/e1000e/lib.c')
-rw-r--r-- | drivers/net/e1000e/lib.c | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/drivers/net/e1000e/lib.c b/drivers/net/e1000e/lib.c index 0bdeca30c75f..16f35fadb74b 100644 --- a/drivers/net/e1000e/lib.c +++ b/drivers/net/e1000e/lib.c | |||
@@ -2059,9 +2059,44 @@ s32 e1000e_read_mac_addr(struct e1000_hw *hw) | |||
2059 | { | 2059 | { |
2060 | s32 ret_val; | 2060 | s32 ret_val; |
2061 | u16 offset, nvm_data, i; | 2061 | u16 offset, nvm_data, i; |
2062 | u16 mac_addr_offset = 0; | ||
2063 | |||
2064 | if (hw->mac.type == e1000_82571) { | ||
2065 | /* Check for an alternate MAC address. An alternate MAC | ||
2066 | * address can be setup by pre-boot software and must be | ||
2067 | * treated like a permanent address and must override the | ||
2068 | * actual permanent MAC address. */ | ||
2069 | ret_val = e1000_read_nvm(hw, NVM_ALT_MAC_ADDR_PTR, 1, | ||
2070 | &mac_addr_offset); | ||
2071 | if (ret_val) { | ||
2072 | hw_dbg(hw, "NVM Read Error\n"); | ||
2073 | return ret_val; | ||
2074 | } | ||
2075 | if (mac_addr_offset == 0xFFFF) | ||
2076 | mac_addr_offset = 0; | ||
2077 | |||
2078 | if (mac_addr_offset) { | ||
2079 | if (hw->bus.func == E1000_FUNC_1) | ||
2080 | mac_addr_offset += ETH_ALEN/sizeof(u16); | ||
2081 | |||
2082 | /* make sure we have a valid mac address here | ||
2083 | * before using it */ | ||
2084 | ret_val = e1000_read_nvm(hw, mac_addr_offset, 1, | ||
2085 | &nvm_data); | ||
2086 | if (ret_val) { | ||
2087 | hw_dbg(hw, "NVM Read Error\n"); | ||
2088 | return ret_val; | ||
2089 | } | ||
2090 | if (nvm_data & 0x0001) | ||
2091 | mac_addr_offset = 0; | ||
2092 | } | ||
2093 | |||
2094 | if (mac_addr_offset) | ||
2095 | hw->dev_spec.e82571.alt_mac_addr_is_present = 1; | ||
2096 | } | ||
2062 | 2097 | ||
2063 | for (i = 0; i < ETH_ALEN; i += 2) { | 2098 | for (i = 0; i < ETH_ALEN; i += 2) { |
2064 | offset = i >> 1; | 2099 | offset = mac_addr_offset + (i >> 1); |
2065 | ret_val = e1000_read_nvm(hw, offset, 1, &nvm_data); | 2100 | ret_val = e1000_read_nvm(hw, offset, 1, &nvm_data); |
2066 | if (ret_val) { | 2101 | if (ret_val) { |
2067 | hw_dbg(hw, "NVM Read Error\n"); | 2102 | hw_dbg(hw, "NVM Read Error\n"); |
@@ -2072,7 +2107,7 @@ s32 e1000e_read_mac_addr(struct e1000_hw *hw) | |||
2072 | } | 2107 | } |
2073 | 2108 | ||
2074 | /* Flip last bit of mac address if we're on second port */ | 2109 | /* Flip last bit of mac address if we're on second port */ |
2075 | if (hw->bus.func == E1000_FUNC_1) | 2110 | if (!mac_addr_offset && hw->bus.func == E1000_FUNC_1) |
2076 | hw->mac.perm_addr[5] ^= 1; | 2111 | hw->mac.perm_addr[5] ^= 1; |
2077 | 2112 | ||
2078 | for (i = 0; i < ETH_ALEN; i++) | 2113 | for (i = 0; i < ETH_ALEN; i++) |