u-boot/opensbi determine the ethernet MAC address from ROM and pass it to the O/S in the device tree.
This change sets the correct MAC address. This prevents the eqos class driver from generating random MAC addresses at each boot.
Details
- Reviewers
mhorne - Group Reviewers
riscv - Commits
- rG351fad05e075: if_eqos_starfive: Read MAC address from device tree
On a visionfive2 system, verify that a correct static MAC address is assigned rather than a random MAC address (f2:xx:xx:xx:xx:xx)
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Thanks for digging into this.
I think the code can be simplified. Something like this:
if (OF_getprop(node, "local-mac-address", eaddr, sizeof(eaddr)) == sizeof(eaddr)) {
machi = eaddr[5] | (eaddr[4] << 8);
WR4(sc, GMAC_MAC_ADDRESS0_HIGH, machi);
maclo = eaddr[3] | (eaddr[2] << 8) | (eaddr[1] << 16) | (eaddr[0] << 24);
WR4(sc, GMAC_MAC_ADDRESS0_LOW, maclo);
}Please check for accuracy.
| sys/dev/eqos/if_eqos_starfive.c | ||
|---|---|---|
| 199–207 | It seems we don't need this block at all. | |
| 216 | Please drop the print messages. They are useful for debugging, but most ethernet drivers don't print this when setting the MAC address. | |
| sys/dev/eqos/if_eqos_starfive.c | ||
|---|---|---|
| 199–207 | Currently the MAC address is set to ff:ff:ff:ff:ff:ff after the reset. The intention was to make some noise if this isn't always the case on some future variant. | |
| 216 | Agree. This was just debugging. | |
Thanks again. When I have the chance I will test this and merge the change (likely early next week).