Page MenuHomeFreeBSD

bge: read MAC from loader hint for boards without NVRAM/EEPROM
AcceptedPublic

Authored by guest-seuros on Tue, May 19, 10:35 AM.
Referenced Files
F157775311: D57090.diff
Mon, May 25, 1:03 AM
Unknown Object (File)
Fri, May 22, 8:35 PM
Unknown Object (File)
Fri, May 22, 6:50 PM
Unknown Object (File)
Fri, May 22, 12:30 AM
Subscribers

Details

Reviewers
adrian
Summary

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.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 73220
Build 70103: arc lint + arc unit

Event Timeline

Besides wanting some function comments, this looks fine to me. I've had to do this before for MIPS boards whose MAC addresses are not in a common location :(

sys/dev/bge/if_bge.c
6684

Please add some function documentation explaining what this does (parses ethernet address from a given hint, which hint it is) and what the return values are.

(I'm holding myself to this level of "new functions get documented" too, don't worry!)

This revision is now accepted and ready to land.Wed, May 20, 4:46 PM
guest-seuros added inline comments.
sys/dev/bge/if_bge.c
6684

I did not document this because like i wrote in the description, this is hack to set the MAC address in loader.conf . I need to poke into the firmware or check if linux already did it.

In this stack i shipped only the code bring-up a machine to userland. There are many other commits i need to clean up before submitting upstream.

I will either figure out the API or we document it as a quirk in asmc/bce