Looks like u-boot was finally fixed and now assigns a
local-mac-address property to device nodes even if u-boot itself isn't
configured with a network driver.  This is helpful since this means we
can have a static MAC address even if y-boot doesn't touch the
hardware.

Diff below adds the necessary code to dwge(4) to take advantage of this.

ok?


Index: dev/fdt/if_dwxe.c
===================================================================
RCS file: /cvs/src/sys/dev/fdt/if_dwxe.c,v
retrieving revision 1.8
diff -u -p -r1.8 if_dwxe.c
--- dev/fdt/if_dwxe.c   27 May 2018 16:19:25 -0000      1.8
+++ dev/fdt/if_dwxe.c   27 May 2018 19:09:04 -0000
@@ -411,7 +411,9 @@ dwxe_attach(struct device *parent, struc
        else
                sc->sc_clk = DWXE_MDIO_CMD_MDC_DIV_RATIO_M_16;
 
-       dwxe_lladdr_read(sc, sc->sc_lladdr);
+       if (OF_getprop(faa->fa_node, "local-mac-address",
+           &sc->sc_lladdr, ETHER_ADDR_LEN) != ETHER_ADDR_LEN)
+               dwxe_lladdr_read(sc, sc->sc_lladdr);
        printf(": address %s\n", ether_sprintf(sc->sc_lladdr));
 
        /* Do hardware specific initializations. */

Reply via email to