Module Name: src Committed By: msaitoh Date: Fri Oct 20 09:51:49 UTC 2023
Modified Files: src/sys/dev/ic: dwc_eqos.c Log Message: eqos(4): Fix a bug that the MAC address is swapped. Don't swap the MAC address in eqos_get_eaddr(). Other OSes except FreeBSD (which was based on NetBSD's) don't swap it. With this change, my own OnLogic Helix 330's MAC address becomes correct. The OUI is 84:8b:cd:4d. It's owned by Logic Supply and they were acquired by OnLogic. On Quartz64 with UEIF, the MAC address is wrongly set and the multicast bit might be set. To do workaround, clear the bit if it's set. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/dev/ic/dwc_eqos.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/ic/dwc_eqos.c diff -u src/sys/dev/ic/dwc_eqos.c:1.17 src/sys/dev/ic/dwc_eqos.c:1.18 --- src/sys/dev/ic/dwc_eqos.c:1.17 Sat Jun 3 20:41:45 2023 +++ src/sys/dev/ic/dwc_eqos.c Fri Oct 20 09:51:49 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: dwc_eqos.c,v 1.17 2023/06/03 20:41:45 andvar Exp $ */ +/* $NetBSD: dwc_eqos.c,v 1.18 2023/10/20 09:51:49 msaitoh Exp $ */ /*- * Copyright (c) 2022 Jared McNeill <jmcne...@invisible.ca> @@ -33,7 +33,7 @@ #include "opt_net_mpsafe.h" #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.17 2023/06/03 20:41:45 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dwc_eqos.c,v 1.18 2023/10/20 09:51:49 msaitoh Exp $"); #include <sys/param.h> #include <sys/bus.h> @@ -1202,8 +1202,13 @@ eqos_get_eaddr(struct eqos_softc *sc, ui return; } - maclo = htobe32(RD4(sc, GMAC_MAC_ADDRESS0_LOW)); - machi = htobe16(RD4(sc, GMAC_MAC_ADDRESS0_HIGH) & 0xFFFF); + maclo = RD4(sc, GMAC_MAC_ADDRESS0_LOW); + machi = RD4(sc, GMAC_MAC_ADDRESS0_HIGH) & 0xFFFF; + if ((maclo & 0x00000001) != 0) { + aprint_error_dev(sc->sc_dev, + "Wrong MAC address. Clear the multicast bit.\n"); + maclo &= ~0x00000001; + } if (maclo == 0xFFFFFFFF && machi == 0xFFFF) { /* Create one */