diff options
author | Andre Przywara <andre.przywara@arm.com> | 2021-12-19 13:55:33 +0000 |
---|---|---|
committer | Joanna Farley <joanna.farley@arm.com> | 2022-04-26 15:43:58 +0200 |
commit | 1aa7e302a84bbf46a97bcfbb54b6b6d57de76cee (patch) | |
tree | 3c659d3300306067d6dce445658c6ea3b3b60713 /include/common | |
parent | 6fa8e72e7bde73012d1e9b1f227d323864e739cf (diff) | |
download | arm-trusted-firmware-1aa7e302a84bbf46a97bcfbb54b6b6d57de76cee.tar.gz |
feat(libfdt): add function to set MAC addresses
The devicetree specification[1] defines the generic DT properties
"mac-address" and "local-mac-address", that allow to set the MAC address
for a network device. This is needed because many platform network
devices do not define a method for obtaining a unique MAC address, and
many devices lack the non-volatile storage to hold such a number.
Some platforms (for instance Allwinner) derive the MAC address from
another unique SoC property, for instance some serial number. To allow
those MAC address to be set by TF-A, add a function that finds the DT
node of a network device (by using the "ethernet<x>" alias), then adding
the "local-mac-address" property into that node, setting it to a user
provided address. Platforms can use this function to generate MAC
addresses in a platform specific way, and store them in the DT.
DT consumers like U-Boot or the Linux kernel will automatically pick up
the address from that property and program the MAC device accordingly.
[1] https://devicetree-specification.readthedocs.io/en/latest/chapter4-device-bindings.html#local-mac-address-property
Change-Id: I3f5766cc575fa9718f9ca23e8269b11495c43be2
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Diffstat (limited to 'include/common')
-rw-r--r-- | include/common/fdt_fixup.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/common/fdt_fixup.h b/include/common/fdt_fixup.h index 7a590b2dc..0399ff50f 100644 --- a/include/common/fdt_fixup.h +++ b/include/common/fdt_fixup.h @@ -17,5 +17,7 @@ int fdt_add_cpus_node(void *dtb, unsigned int afflv0, unsigned int afflv1, unsigned int afflv2); int fdt_adjust_gic_redist(void *dtb, unsigned int nr_cores, uintptr_t gicr_base, unsigned int gicr_frame_size); +int fdt_set_mac_address(void *dtb, unsigned int ethernet_idx, + const uint8_t *mac_addr); #endif /* FDT_FIXUP_H */ |