[edk2-devel] [edk2-platforms: PATCH 1/1] Platform/RPi3: Accept "ethernet" or "ethernet0" aliases in device tree

Michael Brown mbrown at fensystems.co.uk
Fri Jul 19 17:29:07 UTC 2019


Older device trees tend to use the alias "ethernet".  Newer device
trees tend to use "ethernet0" since older versions of U-Boot would
skip aliases that do not include an index number.  See, for example,
Linux kernel commit 10b6c0c ("ARM: dts: bcm2835: add index to the
ethernet alias") and U-Boot commit f8e57c6 ("fdt_support: Fixup
'ethernet' aliases not ending in digits").

Accept either "ethernet" or "ethernet0" as being the alias to the node
for which the MAC address should be updated.

Signed-off-by: Michael Brown <mbrown at fensystems.co.uk>
---
 Platform/RaspberryPi/RPi3/Drivers/FdtDxe/FdtDxe.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/Platform/RaspberryPi/RPi3/Drivers/FdtDxe/FdtDxe.c b/Platform/RaspberryPi/RPi3/Drivers/FdtDxe/FdtDxe.c
index 83446e3e45..e80bc2c391 100644
--- a/Platform/RaspberryPi/RPi3/Drivers/FdtDxe/FdtDxe.c
+++ b/Platform/RaspberryPi/RPi3/Drivers/FdtDxe/FdtDxe.c
@@ -35,11 +35,14 @@ UpdateMacAddress (
   UINT8         MacAddress[6];
 
   //
-  // Locate the node that the 'ethernet' alias refers to
+  // Locate the node that the 'ethernet[0]' alias refers to
   //
   Node = fdt_path_offset (mFdtImage, "ethernet");
   if (Node < 0) {
-    DEBUG ((DEBUG_ERROR, "%a: failed to locate 'ethernet' alias\n", __FUNCTION__));
+    Node = fdt_path_offset (mFdtImage, "ethernet0");
+  }
+  if (Node < 0) {
+    DEBUG ((DEBUG_ERROR, "%a: failed to locate 'ethernet[0]' alias\n", __FUNCTION__));
     return;
   }
 
-- 
2.20.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#44066): https://edk2.groups.io/g/devel/message/44066
Mute This Topic: https://groups.io/mt/32529756/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list