summaryrefslogtreecommitdiffstats
path: root/src/drivers/net/realtek.h
diff options
context:
space:
mode:
authorMichael Brown2013-04-28 19:50:10 +0200
committerMichael Brown2013-04-28 19:59:09 +0200
commitd90fc3156c57ba90156ceb4e33fda4a6a19ca382 (patch)
treed6bf81fe4ebbe22e7db8cae60ce79ab9ea2f0565 /src/drivers/net/realtek.h
parent[build] Default to short wchar_t in stddef.h (diff)
downloadipxe-d90fc3156c57ba90156ceb4e33fda4a6a19ca382.tar.gz
ipxe-d90fc3156c57ba90156ceb4e33fda4a6a19ca382.tar.xz
ipxe-d90fc3156c57ba90156ceb4e33fda4a6a19ca382.zip
[realtek] Use ID word to detect EEPROM presence
Some onboard RTL8169 NICs seem to leave the EEPROM pins disconnected. The existing is_valid_ether_addr() test will not necessarily catch this, since it expects a missing EEPROM to show up as a MAC address of 00:00:00:00:00:00 or ff:ff:ff:ff:ff:ff. When the EEPROM pins are floating the MAC address may read as e.g. 00:00:00:00:0f:00, which will not be detected as invalid. Check the ID word in the first two bytes of the EEPROM (which should have the value 0x8129 for all RTL8139 and RTL8169 chips), and use this to determine whether or not an EEPROM is present. Reported-by: Carl Karsten <carl@nextdayvideo.com> Tested-by: Carl Karsten <carl@nextdayvideo.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/drivers/net/realtek.h')
-rw-r--r--src/drivers/net/realtek.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/drivers/net/realtek.h b/src/drivers/net/realtek.h
index 6a7b10a9..1cd85d95 100644
--- a/src/drivers/net/realtek.h
+++ b/src/drivers/net/realtek.h
@@ -166,6 +166,12 @@ enum realtek_legacy_status {
#define RTL_9346CR_EEDI 0x02 /**< Data in */
#define RTL_9346CR_EEDO 0x01 /**< Data out */
+/** Word offset of ID code word within EEPROM */
+#define RTL_EEPROM_ID ( 0x00 / 2 )
+
+/** EEPROM code word magic value */
+#define RTL_EEPROM_ID_MAGIC 0x8129
+
/** Word offset of MAC address within EEPROM */
#define RTL_EEPROM_MAC ( 0x0e / 2 )