-/* $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 $ */
/*
#include <netinet/in.h>
#include <netinet/if_ether.h>
+#ifdef __HAVE_FDT
+#include <dev/ofw/openfirm.h>
+#endif
+
#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
#include <dev/pci/pcidevs.h>
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;