summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2007-04-03 22:13:00 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2007-04-03 22:13:00 +0000
commit540a974d9e8a7ac78c8dd7f2f2ff26eb465c0618 (patch)
treef7e7d8c29c4e2f3cdf2cb1c685ecc66ca2e2e056 /sys
parent64dd3b095e7da7b517742ef21b07116739209a16 (diff)
On sparc64, prefer the local-mac-address provided by the PROM. Makes sure the
MAC address on the builtin ports of the Sun Fire V215 match what is used by the PROM. ok deraadt@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/if_bge.c37
1 files changed, 21 insertions, 16 deletions
diff --git a/sys/dev/pci/if_bge.c b/sys/dev/pci/if_bge.c
index 097a08ebeb3..4b4e4a274f5 100644
--- a/sys/dev/pci/if_bge.c
+++ b/sys/dev/pci/if_bge.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bge.c,v 1.208 2007/03/19 02:27:40 krw Exp $ */
+/* $OpenBSD: if_bge.c,v 1.209 2007/04/03 22:12:59 kettenis Exp $ */
/*
* Copyright (c) 2001 Wind River Systems
@@ -1860,19 +1860,29 @@ bge_attach(struct device *parent, struct device *self, void *aux)
bge_chipinit(sc);
+#ifdef __sparc64__
+ if (!gotenaddr) {
+ if (OF_getprop(PCITAG_NODE(pa->pa_tag), "local-mac-address",
+ sc->arpcom.ac_enaddr, ETHER_ADDR_LEN) == ETHER_ADDR_LEN)
+ gotenaddr = 1;
+ }
+#endif
+
/*
* Get station address from the EEPROM.
*/
- mac_addr = bge_readmem_ind(sc, 0x0c14);
- if ((mac_addr >> 16) == 0x484b) {
- sc->arpcom.ac_enaddr[0] = (u_char)(mac_addr >> 8);
- sc->arpcom.ac_enaddr[1] = (u_char)mac_addr;
- mac_addr = bge_readmem_ind(sc, 0x0c18);
- sc->arpcom.ac_enaddr[2] = (u_char)(mac_addr >> 24);
- sc->arpcom.ac_enaddr[3] = (u_char)(mac_addr >> 16);
- sc->arpcom.ac_enaddr[4] = (u_char)(mac_addr >> 8);
- sc->arpcom.ac_enaddr[5] = (u_char)mac_addr;
- gotenaddr = 1;
+ if (!gotenaddr) {
+ mac_addr = bge_readmem_ind(sc, 0x0c14);
+ if ((mac_addr >> 16) == 0x484b) {
+ sc->arpcom.ac_enaddr[0] = (u_char)(mac_addr >> 8);
+ sc->arpcom.ac_enaddr[1] = (u_char)mac_addr;
+ mac_addr = bge_readmem_ind(sc, 0x0c18);
+ sc->arpcom.ac_enaddr[2] = (u_char)(mac_addr >> 24);
+ sc->arpcom.ac_enaddr[3] = (u_char)(mac_addr >> 16);
+ sc->arpcom.ac_enaddr[4] = (u_char)(mac_addr >> 8);
+ sc->arpcom.ac_enaddr[5] = (u_char)mac_addr;
+ gotenaddr = 1;
+ }
}
if (!gotenaddr && (!(sc->bge_flags & BGE_NO_EEPROM))) {
if (bge_read_eeprom(sc, (caddr_t)&sc->arpcom.ac_enaddr,
@@ -1882,11 +1892,6 @@ bge_attach(struct device *parent, struct device *self, void *aux)
#ifdef __sparc64__
if (!gotenaddr) {
- if (OF_getprop(PCITAG_NODE(pa->pa_tag), "local-mac-address",
- sc->arpcom.ac_enaddr, ETHER_ADDR_LEN) == ETHER_ADDR_LEN)
- gotenaddr = 1;
- }
- if (!gotenaddr) {
extern void myetheraddr(u_char *);
myetheraddr(sc->arpcom.ac_enaddr);