summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoe Rubinstein <nrubinstein@avencall.com>2012-07-23 16:56:40 +0200
committerNoe Rubinstein <nrubinstein@avencall.com>2012-07-23 16:56:40 +0200
commitb3797e44227b835eaeb1d333451c854158f11c7a (patch)
tree96619d64939aabc34de75222f1b1a06526422635
parente877238db7811782dd761d20a26591e60eb3398f (diff)
support version 3 of xioh data in ROM
-rw-r--r--e1000_hw.c47
1 files changed, 37 insertions, 10 deletions
diff --git a/e1000_hw.c b/e1000_hw.c
index c0234c6..e316ef8 100644
--- a/e1000_hw.c
+++ b/e1000_hw.c
@@ -4274,6 +4274,28 @@ static s32 e1000_write_eeprom_microwire(struct e1000_hw *hw, u16 offset,
}
#ifdef XIOH
+
+static const u8 xioh_magic[] = {'X','I','O','H'};
+
+union mac {
+ uint8_t b[6];
+ uint64_t n:48;
+} __packed;
+
+struct serial {
+ uint16_t date;
+ unsigned version:4;
+ unsigned number:12;
+} __packed;
+
+struct xioh_data {
+ u8 magic[4];
+ uint16_t version;
+ uint16_t reserved;
+ struct serial serial;
+ union mac addr[3];
+} __packed;
+
static int devnum(struct e1000_hw *hw)
{
struct e1000_adapter *adapter = hw->back;
@@ -4300,22 +4322,27 @@ s32 e1000_read_mac_addr(struct e1000_hw *hw)
#ifdef XIOH
#define XIOH_MAC_OFFSET 0xfff00000
- static const u8 xioh_mac_magic[] = {'X','I','O','H', 0x00, 0x00};
-
int num = devnum(hw);
int i;
- u8 *mac;
+ struct xioh_data *xioh_data;
- mac = ioremap(XIOH_MAC_OFFSET, 24);
- for (i = 0; i < ARRAY_SIZE(xioh_mac_magic); i++)
- if (xioh_mac_magic[i] != mac[i])
+ xioh_data = ioremap(XIOH_MAC_OFFSET, sizeof(struct xioh_data));
+ for (i = 0; i < ARRAY_SIZE(xioh_magic); i++)
+ if (xioh_magic[i] != xioh_data->magic[i])
return -E1000_ERR_EEPROM;
- for (i = 0; i < 6; i++)
- hw->perm_mac_addr[i] = mac[ARRAY_SIZE(xioh_mac_magic)+6*num+i];
-
- iounmap(mac);
+ switch (xioh_data->version) {
+ case 0:
+ for (i = 0; i < 6; i++)
+ hw->perm_mac_addr[i] = ((u8*)xioh_data)[6+6*num+i];
+ break;
+ case 1:
+ for (i = 0; i < 6; i++)
+ hw->perm_mac_addr[i] = xioh_data->addr[num].b[i];
+ break;
+ }
+ iounmap(xioh_data);
#else
u16 offset;
u16 eeprom_data, i;