From nobody Sun Jun 14 20:57:26 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4gdltv57fzz6hQvB for ; Sun, 14 Jun 2026 20:57:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gdltv0WQqz3Ht0 for ; Sun, 14 Jun 2026 20:57:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1781470647; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kT0NLof7+ayaKOBpjCBZny8YDOWISSATCW3Ma4JTtxk=; b=mN8d8L851XnTvxU9wlwcEWNVoZIiHVOWZ5UKYHkFgAqq3JvmzsvDCfzZvgABSsRt2EAUwZ gGEe6hEYmvRotSYc7NbdHyFkCbwlgMQFOu28gvN3u4IB4dyW4KE9sMZJxblrhvJ4Lqx3aO z3ixV0NAxdKT5UNUTeTh3TELUFpsXCLYnBaJD6kMkn68pjg6oJwgetlOrO18vKalMAJCzY ruNOH3W+QmqtHLXBK9nUwnFR/Brzc0htl9/dfqrabnkU2gTEwfuy/hKLDh7+kZ/sXOc9nw bK0PYbvr+4Z6KuEdh1SW5u5Ri7QFDypg78IRBwWbQ8ZI4Ue5YusAlpxpfabwmA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1781470647; a=rsa-sha256; cv=none; b=Ku/0qT2oPZ/82Wdp+F7RD9uaR9PfIwh1CAw+Dc3zTwppWAUszH4aqR7kTLre8iB7GydJ6z I2rxyW5hwCwRgdJqf1Po5Aaj7p13zVk0xaHbuqjjkoDws0ChfU1mj6TIKuQIhmvSk/t6BU /a1Lmo7rZ0IB217tYMyWymWSx1nJgzSTo21eOGUvT3giOnU6D3DjiXqRilXXYUMWbLtq5Y ZVBANrSfzEZacG5UWETp3xWKJnl2n3Xk1U5Eac3SzNGQniHzEBGtzF8QXW5y3zoNStDaF4 ykoMZSyZv8iEaIwOzpBcfbMfbXPgbOvY1znZgIzSEG2eEA144mMGktI+s7evaQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1781470647; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kT0NLof7+ayaKOBpjCBZny8YDOWISSATCW3Ma4JTtxk=; b=RY27eISWjLJ3FweWaoi0B4snse7O1XXNQxSANemdu6QoN2n3UX05ci8bwxSt0vjqE0HXq5 mhIhVn7Q2iJ8/TcdeuLq5VfrPjjxbZykuxlbLxpQmNiw4rgQLd64VZCp56Hq0iiFiXydvO tsK9wJ5o6h6qq7D4vFUyA8i+ZBE6pgLVqJ2JwWau+/rx2u94xBKgsJD3Thib84eiUngNVq n35WFJ7RkCyQW6P0vigbpcUaKdpZlDnIYoNXoRAdXpqHXqEHbGbwfzh5PSKTgev6PLgWFt lUPexJf8Ki0gNZCbfpqDIc6q1dVAP/VdIElw4xvMQ8HGwvefLZZ3n0pP0yy8zg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gdltt71bGz918 for ; Sun, 14 Jun 2026 20:57:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 38f19 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 14 Jun 2026 20:57:26 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Abdelkader Boudih From: Adrian Chadd Subject: git: 142cba958b7a - main - bge: read MAC from loader hint for boards without NVRAM/EEPROM List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 142cba958b7a6dd11e4257740db03d335475ede8 Auto-Submitted: auto-generated Date: Sun, 14 Jun 2026 20:57:26 +0000 Message-Id: <6a2f15b6.38f19.50459a27@gitrepo.freebsd.org> The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=142cba958b7a6dd11e4257740db03d335475ede8 commit 142cba958b7a6dd11e4257740db03d335475ede8 Author: Abdelkader Boudih AuthorDate: 2026-06-14 20:55:33 +0000 Commit: Adrian Chadd CommitDate: 2026-06-14 20:56:59 +0000 bge: read MAC from loader hint for boards without NVRAM/EEPROM BCM57766 on Apple T2 Macs (Macmini8,1) has no dedicated EEPROM and the chip firmware handshake fails (the T2 intercepts PCI config space), leaving the SRAM mailbox unpopulated. All four existing MAC retrieval paths (SRAM mailbox, NVRAM, EEPROM, firmware stub) fail, causing bge to abort attach with "failed to read station address". Work around this with two changes: 1. Tolerate EEPROM read failure on BCM57766. The chip is copper-only so hwcfg=0 is correct; skip the fatal error that aborts attach before bge_get_eaddr() is ever called. 2. Implement bge_get_eaddr_fw() to read a "hint.bge.N.mac" string (e.g. "f0:18:98:f4:1e:2f") from loader(8) tunable / kenv. This is a workaround until the T2 BCE API is understood well enough to either poke the chip firmware into completing its handshake or read the MAC from the T2 directly. Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D57090 --- sys/dev/bge/if_bge.c | 42 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/sys/dev/bge/if_bge.c b/sys/dev/bge/if_bge.c index 3551f10b2ae3..1fbf8bfb7e93 100644 --- a/sys/dev/bge/if_bge.c +++ b/sys/dev/bge/if_bge.c @@ -3766,11 +3766,19 @@ bge_attach(device_t dev) (sc->bge_asicrev != BGE_ASICREV_BCM5906)) { if (bge_read_eeprom(sc, (caddr_t)&hwcfg, BGE_EE_HWCFG_OFFSET, sizeof(hwcfg))) { - device_printf(sc->bge_dev, "failed to read EEPROM\n"); - error = ENXIO; - goto fail; - } - hwcfg = ntohl(hwcfg); + /* + * BCM57766 on Apple T2 Macs has no dedicated EEPROM; + * the chip is copper-only so hwcfg=0 is correct. + */ + if (sc->bge_asicrev != BGE_ASICREV_BCM57766) { + device_printf(sc->bge_dev, + "failed to read EEPROM\n"); + error = ENXIO; + goto fail; + } + hwcfg = 0; + } else + hwcfg = ntohl(hwcfg); } /* The SysKonnect SK-9D41 is a 1000baseSX card. */ @@ -6677,7 +6685,29 @@ bge_sysctl_mem_read(SYSCTL_HANDLER_ARGS) static int bge_get_eaddr_fw(struct bge_softc *sc, uint8_t ether_addr[]) { - return (1); + const char *mac_str; + unsigned int o[ETHER_ADDR_LEN]; + char trail; + int i, n, unit; + + unit = device_get_unit(sc->bge_dev); + if (resource_string_value("bge", unit, "mac", &mac_str) != 0) + return (1); + + /* Parse and validate; trailing-char check rejects garbage. */ + n = sscanf(mac_str, "%x:%x:%x:%x:%x:%x%c", + &o[0], &o[1], &o[2], &o[3], &o[4], &o[5], &trail); + if (n != 6) + return (1); + for (i = 0; i < ETHER_ADDR_LEN; i++) { + if (o[i] > 0xff) + return (1); + ether_addr[i] = (uint8_t)o[i]; + } + if (ETHER_IS_MULTICAST(ether_addr) || + ETHER_IS_ZERO(ether_addr)) + return (1); + return (0); } static int