summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/dev/pci/if_em_hw.c12
-rw-r--r--sys/dev/pci/if_em_hw.h3
2 files changed, 11 insertions, 4 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;
}
diff --git a/sys/dev/pci/if_em_hw.h b/sys/dev/pci/if_em_hw.h
index d094b887d25..e2770c0c3fa 100644
--- a/sys/dev/pci/if_em_hw.h
+++ b/sys/dev/pci/if_em_hw.h
@@ -31,7 +31,7 @@
*******************************************************************************/
-/* $OpenBSD: if_em_hw.h,v 1.46 2010/09/19 13:10:21 yasuoka Exp $ */
+/* $OpenBSD: if_em_hw.h,v 1.47 2011/02/06 23:47:14 dlg Exp $ */
/* $FreeBSD: if_em_hw.h,v 1.15 2005/05/26 23:32:02 tackerman Exp $ */
/* if_em_hw.h
@@ -2353,6 +2353,7 @@ struct em_host_command_info {
/* EEPROM Size definitions */
#define EEPROM_WORD_SIZE_SHIFT 6
+#define EEPROM_WORD_SIZE_SHIFT_MAX 14
#define EEPROM_SIZE_SHIFT 10
#define EEPROM_SIZE_MASK 0x1C00