summaryrefslogtreecommitdiffstats
path: root/sys/dev/tsec/if_tsec.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/tsec/if_tsec.c')
-rw-r--r--sys/dev/tsec/if_tsec.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/sys/dev/tsec/if_tsec.c b/sys/dev/tsec/if_tsec.c
index 8ea171a..ccee8f7 100644
--- a/sys/dev/tsec/if_tsec.c
+++ b/sys/dev/tsec/if_tsec.c
@@ -170,22 +170,26 @@ tsec_get_hwaddr(struct tsec_softc *sc, uint8_t *addr)
uint8_t addr[6];
} curmac;
uint32_t a[6];
- int count, i;
- char *cp;
+ device_t parent;
+ uintptr_t macaddr;
+ int i;
+
+ parent = device_get_parent(sc->dev);
+ if (BUS_READ_IVAR(parent, sc->dev, OCPBUS_IVAR_MACADDR,
+ &macaddr) == 0) {
+ bcopy((uint8_t *)macaddr, addr, 6);
+ return;
+ }
- /* Use the currently programmed MAC address by default. */
+ /*
+ * Fall back -- use the currently programmed address in the hope that
+ * it was set be firmware...
+ */
curmac.reg[0] = TSEC_READ(sc, TSEC_REG_MACSTNADDR1);
curmac.reg[1] = TSEC_READ(sc, TSEC_REG_MACSTNADDR2);
for (i = 0; i < 6; i++)
a[5-i] = curmac.addr[i];
- cp = getenv("ethaddr");
- if (cp != NULL) {
- count = sscanf(cp, "%x:%x:%x:%x:%x:%x", &a[0], &a[1], &a[2],
- &a[3], &a[4], &a[5]);
- freeenv(cp);
- }
-
addr[0] = a[0];
addr[1] = a[1];
addr[2] = a[2];
OpenPOWER on IntegriCloud