diff options
author | jfv <jfv@FreeBSD.org> | 2009-07-06 17:23:48 +0000 |
---|---|---|
committer | jfv <jfv@FreeBSD.org> | 2009-07-06 17:23:48 +0000 |
commit | 795d93a682989d355abd3e1365121b4ff87e33a1 (patch) | |
tree | 719b0fc90747e9373f6c87908671ac63b45f1b42 | |
parent | 0afab74da0a49ca8214088fb0ff3a1f7195f7c92 (diff) | |
download | FreeBSD-src-795d93a682989d355abd3e1365121b4ff87e33a1.zip FreeBSD-src-795d93a682989d355abd3e1365121b4ff87e33a1.tar.gz |
The new method of reading the mac address from the
RAR(0) register does not work on this old adapter,
provide a local routine that does it the older way.
Approved by: re
-rw-r--r-- | sys/dev/e1000/e1000_82542.c | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/sys/dev/e1000/e1000_82542.c b/sys/dev/e1000/e1000_82542.c index 3ce3657..46ef66a 100644 --- a/sys/dev/e1000/e1000_82542.c +++ b/sys/dev/e1000/e1000_82542.c @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2008, Intel Corporation + Copyright (c) 2001-2009, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -49,6 +49,8 @@ static s32 e1000_led_on_82542(struct e1000_hw *hw); static s32 e1000_led_off_82542(struct e1000_hw *hw); static void e1000_rar_set_82542(struct e1000_hw *hw, u8 *addr, u32 index); static void e1000_clear_hw_cntrs_82542(struct e1000_hw *hw); +static s32 e1000_read_mac_addr_82542(struct e1000_hw *hw); + /** * e1000_init_phy_params_82542 - Init PHY func ptrs. @@ -134,6 +136,8 @@ static s32 e1000_init_mac_params_82542(struct e1000_hw *hw) mac->ops.clear_vfta = e1000_clear_vfta_generic; /* setting MTA */ mac->ops.mta_set = e1000_mta_set_generic; + /* read mac address */ + mac->ops.read_mac_addr = e1000_read_mac_addr_82542; /* set RAR */ mac->ops.rar_set = e1000_rar_set_82542; /* turn on/off LED */ @@ -554,3 +558,34 @@ static void e1000_clear_hw_cntrs_82542(struct e1000_hw *hw) E1000_READ_REG(hw, E1000_PTC1023); E1000_READ_REG(hw, E1000_PTC1522); } + +/** + * e1000_read_mac_addr_82542 - Read device MAC address + * @hw: pointer to the HW structure + * + * Reads the device MAC address from the EEPROM and stores the value. + **/ +static s32 e1000_read_mac_addr_82542(struct e1000_hw *hw) +{ + s32 ret_val = E1000_SUCCESS; + u16 offset, nvm_data, i; + + DEBUGFUNC("e1000_read_mac_addr"); + + for (i = 0; i < ETH_ADDR_LEN; i += 2) { + offset = i >> 1; + ret_val = hw->nvm.ops.read(hw, offset, 1, &nvm_data); + if (ret_val) { + DEBUGOUT("NVM Read Error\n"); + goto out; + } + hw->mac.perm_addr[i] = (u8)(nvm_data & 0xFF); + hw->mac.perm_addr[i+1] = (u8)(nvm_data >> 8); + } + + for (i = 0; i < ETH_ADDR_LEN; i++) + hw->mac.addr[i] = hw->mac.perm_addr[i]; + +out: + return ret_val; +} |