Blame SOURCES/0238-arm64-make-sure-fdt-has-address-cells-and-size-cells.patch

d41074
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
a85e8e
From: Mark Salter <msalter@redhat.com>
a85e8e
Date: Mon, 17 Apr 2017 08:44:29 -0400
d41074
Subject: [PATCH] arm64: make sure fdt has #address-cells and #size-cells
d41074
 properties
a85e8e
a85e8e
Recent upstream changes to kexec-tools relies on #address-cells
a85e8e
and #size-cells properties in the FDT. If grub2 needs to create
a85e8e
a chosen node, it is likely because firmware did not provide one.
a85e8e
In that case, set #address-cells and #size-cells properties to
a85e8e
make sure they exist.
a85e8e
---
a85e8e
 grub-core/loader/arm64/linux.c | 16 +++++++++++++++-
a85e8e
 1 file changed, 15 insertions(+), 1 deletion(-)
a85e8e
a85e8e
diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c
d41074
index 0452a20e98b..1eb332a892c 100644
a85e8e
--- a/grub-core/loader/arm64/linux.c
a85e8e
+++ b/grub-core/loader/arm64/linux.c
a85e8e
@@ -147,7 +147,21 @@ finalize_params (void)
a85e8e
 
a85e8e
   node = grub_fdt_find_subnode (fdt, 0, "chosen");
a85e8e
   if (node < 0)
a85e8e
-    node = grub_fdt_add_subnode (fdt, 0, "chosen");
a85e8e
+    {
a85e8e
+      /*
a85e8e
+       * If we have to create a chosen node, Make sure we
a85e8e
+       * have #address-cells and #size-cells properties.
a85e8e
+       */
a85e8e
+      retval = grub_fdt_set_prop32(fdt, 0, "#address-cells", 2);
a85e8e
+      if (retval)
a85e8e
+	goto failure;
a85e8e
+
a85e8e
+      retval = grub_fdt_set_prop32(fdt, 0, "#size-cells", 2);
a85e8e
+      if (retval)
a85e8e
+	goto failure;
a85e8e
+
a85e8e
+      node = grub_fdt_add_subnode (fdt, 0, "chosen");
a85e8e
+    }
a85e8e
 
a85e8e
   if (node < 1)
a85e8e
     goto failure;