diff options
author | Brad Smith <brad@cvs.openbsd.org> | 2008-10-21 19:41:14 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 2008-10-21 19:41:14 +0000 |
commit | 3900c6b3d33ae96b2923486a9790e356e64c87d9 (patch) | |
tree | 69527f6a33a50d20626c084e6656cabd6e0f8654 /sys/dev/pci | |
parent | dcdc75212ea93ef49c35e9da7312d35913163115 (diff) |
Make sure to read the last byte of EEPROM descriptor. Previously
the last byte of the Ethernet address was not read which in turn
resulted in getting 5 out of the 6 bytes of Ethernet address and
always returning ENOENT.
From FreeBSD
ok jsg@
Diffstat (limited to 'sys/dev/pci')
-rw-r--r-- | sys/dev/pci/if_jme.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/dev/pci/if_jme.c b/sys/dev/pci/if_jme.c index b9805950387..1f0b37569dc 100644 --- a/sys/dev/pci/if_jme.c +++ b/sys/dev/pci/if_jme.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_jme.c,v 1.10 2008/10/21 19:39:43 brad Exp $ */ +/* $OpenBSD: if_jme.c,v 1.11 2008/10/21 19:41:13 brad Exp $ */ /*- * Copyright (c) 2008, Pyun YongHyeon <yongari@FreeBSD.org> * All rights reserved. @@ -435,11 +435,8 @@ jme_eeprom_macaddr(struct jme_softc *sc, uint8_t eaddr[]) do { if (jme_eeprom_read_byte(sc, offset, &fup) != 0) break; - /* Check for the end of EEPROM descriptor. */ - if ((fup & JME_EEPROM_DESC_END) == JME_EEPROM_DESC_END) - break; - if ((uint8_t)JME_EEPROM_MKDESC(JME_EEPROM_FUNC0, - JME_EEPROM_PAGE_BAR1) == fup) { + if (JME_EEPROM_MKDESC(JME_EEPROM_FUNC0, JME_EEPROM_PAGE_BAR1) == + (fup & (JME_EEPROM_FUNC_MASK | JME_EEPROM_PAGE_MASK))) { if (jme_eeprom_read_byte(sc, offset + 1, ®) != 0) break; if (reg >= JME_PAR0 && @@ -451,6 +448,9 @@ jme_eeprom_macaddr(struct jme_softc *sc, uint8_t eaddr[]) match++; } } + /* Check for the end of EEPROM descriptor. */ + if ((fup & JME_EEPROM_DESC_END) == JME_EEPROM_DESC_END) + break; /* Try next eeprom descriptor. */ offset += JME_EEPROM_DESC_BYTES; } while (match != ETHER_ADDR_LEN && offset < JME_EEPROM_END); |