From d685096f7bb8a65f93d29d3b292bbf157ab2326a Mon Sep 17 00:00:00 2001 From: kettenis Date: Mon, 1 May 2023 08:25:55 +0000 Subject: [PATCH] The built-in 10G Ethernet on Apple arm64 hardware does not have a MAC address programmed into the hardware. Get it from the device tree instead. ok dlg@, jmatthew@ --- sys/dev/pci/if_aq_pci.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/sys/dev/pci/if_aq_pci.c b/sys/dev/pci/if_aq_pci.c index b79099c4fc0..206e4b3a4e0 100644 --- a/sys/dev/pci/if_aq_pci.c +++ b/sys/dev/pci/if_aq_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_aq_pci.c,v 1.20 2023/04/24 09:18:55 jmatthew Exp $ */ +/* $OpenBSD: if_aq_pci.c,v 1.21 2023/05/01 08:25:55 kettenis Exp $ */ /* $NetBSD: if_aq.c,v 1.27 2021/06/16 00:21:18 riastradh Exp $ */ /* @@ -96,6 +96,10 @@ #include #include +#ifdef __HAVE_FDT +#include +#endif + #include #include #include @@ -2260,6 +2264,14 @@ aq2_get_mac_addr(struct aq_softc *sc) AQ_READ_REGS(sc, AQ2_FW_INTERFACE_IN_MAC_ADDRESS_REG, mac_addr, nitems(mac_addr)); +#ifdef __HAVE_FDT + if (mac_addr[0] == 0 && mac_addr[1] == 0 && + PCITAG_NODE(sc->sc_pcitag)) { + OF_getprop(PCITAG_NODE(sc->sc_pcitag), "local-mac-address", + mac_addr, ETHER_ADDR_LEN); + } +#endif + if (mac_addr[0] == 0 && mac_addr[1] == 0) { printf(": mac address not found\n"); return ENXIO; -- 2.20.1