summaryrefslogtreecommitdiff
path: root/sys/dev/pci/if_em_hw.c
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2011-02-06 23:47:15 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2011-02-06 23:47:15 +0000
commit21c01657aec0fb1c59da7f68798c6121189a789d (patch)
treee3c48addde162268d7fd82ab9eec67fffc7084a9 /sys/dev/pci/if_em_hw.c
parentc2001eec5487d17ec1b19f75883f9663f682981b (diff)
cap the max size of the eeprom to 16k, as per the linux and freebsd
drivers. fix found by jonathan matthew and tested on an "Intel PRO/1000 (82576)" rev 0x01 which didnt work before this change. tested by jsg on the following chips: "Intel PRO/1000MT (82540EP)" rev 0x03 "Intel PRO/1000MT (82541GI)" rev 0x05 "Intel PRO/1000 MT (82574L)" rev 0x00 "Intel EP80579 LAN" rev 0x01 "Intel PRO/1000 PT (82572EI)" rev 0x06 "Intel PRO/1000 (82576)" rev 0x01 "Intel 82578DM" rev 0x06 "Intel I340-T4 (82580)" rev 0x01 some style issues are still being discussed which can be fixed in tree if necessary. ok jsg@
Diffstat (limited to 'sys/dev/pci/if_em_hw.c')
-rw-r--r--sys/dev/pci/if_em_hw.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/dev/pci/if_em_hw.c b/sys/dev/pci/if_em_hw.c
index b007600b646..20d9ce86f80 100644
--- a/sys/dev/pci/if_em_hw.c
+++ b/sys/dev/pci/if_em_hw.c
@@ -31,7 +31,7 @@
*******************************************************************************/
-/* $OpenBSD: if_em_hw.c,v 1.58 2010/09/19 13:10:21 yasuoka Exp $ */
+/* $OpenBSD: if_em_hw.c,v 1.59 2011/02/06 23:47:14 dlg Exp $ */
/*
* if_em_hw.c Shared functions for accessing and configuring the MAC
*/
@@ -5353,8 +5353,14 @@ em_init_eeprom_params(struct em_hw *hw)
E1000_EECD_SIZE_EX_SHIFT);
}
- eeprom->word_size = 1 <<
- (eeprom_size + EEPROM_WORD_SIZE_SHIFT);
+ /* EEPROM access above 16k is unsupported */
+ if (eeprom_size + EEPROM_WORD_SIZE_SHIFT >
+ EEPROM_WORD_SIZE_SHIFT_MAX) {
+ eeprom->word_size = 1 << EEPROM_WORD_SIZE_SHIFT_MAX;
+ } else {
+ eeprom->word_size = 1 <<
+ (eeprom_size + EEPROM_WORD_SIZE_SHIFT);
+ }
}
return ret_val;
}