summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2008-10-07 16:03:38 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2008-10-07 16:03:38 +0000
commit3fa5aa76be720e41321ecc777e65fbfaf96ef63b (patch)
tree0b5d62e838fcc3937a159bced61eec34e69eb275 /sys/dev/pci
parent70dcf2739b793b7e50da983e7f44e8dbe99ade0c (diff)
If we fail to read the MAC address from the eeprom, fallback to reading
the MAC address registers. In most cases these already have the correct MAC address. This should address PR5743. Thanks to Rodolfo Gouveia for testing earlier diffs. ok dlg@
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/if_lii.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/sys/dev/pci/if_lii.c b/sys/dev/pci/if_lii.c
index a6f3d1e45dd..216afe114ac 100644
--- a/sys/dev/pci/if_lii.c
+++ b/sys/dev/pci/if_lii.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_lii.c,v 1.19 2008/10/02 20:21:14 brad Exp $ */
+/* $OpenBSD: if_lii.c,v 1.20 2008/10/07 16:03:37 jsing Exp $ */
/*
* Copyright (c) 2007 The NetBSD Foundation.
@@ -137,7 +137,7 @@ struct cfattach lii_ca = {
int lii_reset(struct lii_softc *);
int lii_eeprom_present(struct lii_softc *);
-int lii_read_macaddr(struct lii_softc *, uint8_t *);
+void lii_read_macaddr(struct lii_softc *, uint8_t *);
int lii_eeprom_read(struct lii_softc *, uint32_t, uint32_t *);
void lii_spi_configure(struct lii_softc *);
int lii_spi_read(struct lii_softc *, uint32_t, uint32_t *);
@@ -230,8 +230,7 @@ lii_attach(struct device *parent, struct device *self, void *aux)
else
sc->sc_memread = lii_spi_read;
- if (lii_read_macaddr(sc, sc->sc_ac.ac_enaddr))
- goto unmap;
+ lii_read_macaddr(sc, sc->sc_ac.ac_enaddr);
if (pci_intr_map(pa, &ih) != 0) {
printf(": failed to map interrupt!\n");
@@ -435,7 +434,7 @@ lii_spi_read(struct lii_softc *sc, uint32_t reg, uint32_t *val)
return 0;
}
-int
+void
lii_read_macaddr(struct lii_softc *sc, uint8_t *ea)
{
uint32_t offset = 0x100;
@@ -468,10 +467,10 @@ lii_read_macaddr(struct lii_softc *sc, uint8_t *ea)
}
}
- if (found < 2) {
- printf(": error reading MAC address\n");
- return 1;
- }
+#ifdef LII_DEBUG
+ if (found < 2)
+ printf(": error reading MAC address, using registers...\n");
+#endif
addr0 = htole32(addr0);
addr1 = htole32(addr1);
@@ -488,8 +487,6 @@ lii_read_macaddr(struct lii_softc *sc, uint8_t *ea)
ea[3] = (addr0 & 0x00ff0000) >> 16;
ea[4] = (addr0 & 0x0000ff00) >> 8;
ea[5] = (addr0 & 0x000000ff);
-
- return 0;
}
int