linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] efi/libstub/arm*: Set default address and size cells values for an empty dtb
@ 2017-02-07 17:59 Jeffrey Hugo
  2017-02-07 18:12 ` Ard Biesheuvel
  2017-02-07 18:15 ` Mark Rutland
  0 siblings, 2 replies; 20+ messages in thread
From: Jeffrey Hugo @ 2017-02-07 17:59 UTC (permalink / raw)
  To: linux-arm-kernel

From: Sameer Goel <sgoel@codeaurora.org>

In cases where a device tree is not provided (ie ACPI based system), an
empty fdt is generated by efistub.  Sets the address and size cell values
in a generated fdt to support 64 bit addressing.

This enables kexec/kdump on Qualcomm Technologies QDF24XX platforms as those
utilities will read the address/size values from the fdt, and such values
may exceed the range provided by the 32 bit default.

Change-Id: Ie7f3637e375bd6631c6bda1f7b3c9003765ff4a5
Signed-off-by: Sameer Goel <sgoel@codeaurora.org>
Signed-off-by: Jeffrey Hugo <jhugo@codeaurora.org>
---
 drivers/firmware/efi/libstub/fdt.c | 38 +++++++++++++++++++++++++++++++++++++-
 1 file changed, 37 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/efi/libstub/fdt.c b/drivers/firmware/efi/libstub/fdt.c
index 921dfa0..def5c9c 100644
--- a/drivers/firmware/efi/libstub/fdt.c
+++ b/drivers/firmware/efi/libstub/fdt.c
@@ -16,6 +16,34 @@
 
 #include "efistub.h"
 
+#define EFI_DT_ADDR_CELLS_DEFAULT 2
+#define EFI_DT_SIZE_CELLS_DEFAULT 2
+
+static void fdt_update_cell_size(efi_system_table_t *sys_table, void *fdt)
+{
+	int offset;
+	int status;
+
+	offset = fdt_path_offset(fdt, "/");
+	/* Set the #address-cells and #size-cells values for an empty tree */
+
+	status = fdt_setprop_u32(fdt, offset, "#address-cells",
+				 EFI_DT_ADDR_CELLS_DEFAULT);
+	if (status) {
+		pr_efi(sys_table,
+		       "Failed to set #address-cells for empty dtb\n");
+		return;
+	}
+
+	status = fdt_setprop_u32(fdt, offset, "#size-cells",
+				 EFI_DT_SIZE_CELLS_DEFAULT);
+	if (status) {
+		pr_efi(sys_table,
+		       "Failed to set #size-cells for empty dtb\n");
+		return;
+	}
+}
+
 static efi_status_t update_fdt(efi_system_table_t *sys_table, void *orig_fdt,
 			       unsigned long orig_fdt_size,
 			       void *fdt, int new_fdt_size, char *cmdline_ptr,
@@ -44,8 +72,16 @@ static efi_status_t update_fdt(efi_system_table_t *sys_table, void *orig_fdt,
 
 	if (orig_fdt)
 		status = fdt_open_into(orig_fdt, fdt, new_fdt_size);
-	else
+	else {
 		status = fdt_create_empty_tree(fdt, new_fdt_size);
+		if (status == 0) {
+			/*
+			 * Any failure from the following function is non
+			 * critical
+			 */
+			fdt_update_cell_size(sys_table, fdt);
+		}
+	}
 
 	if (status != 0)
 		goto fdt_set_fail;
-- 
Qualcomm Datacenter Technologies as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.

^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2017-02-13 20:55 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-07 17:59 [PATCH] efi/libstub/arm*: Set default address and size cells values for an empty dtb Jeffrey Hugo
2017-02-07 18:12 ` Ard Biesheuvel
2017-02-07 18:54   ` Jeffrey Hugo
2017-02-07 19:01     ` Mark Rutland
2017-02-07 19:06       ` Mark Rutland
2017-02-07 19:07       ` Jeffrey Hugo
2017-02-07 19:12         ` Ard Biesheuvel
2017-02-07 19:13         ` Mark Rutland
2017-02-07 19:29           ` Jeffrey Hugo
2017-02-07 19:55             ` Mark Rutland
2017-02-08  7:43               ` AKASHI, Takahiro
2017-02-08 10:40                 ` Ard Biesheuvel
2017-02-09  8:27                   ` AKASHI, Takahiro
2017-02-13 20:55                     ` Timur Tabi
2017-02-13 20:51                   ` Timur Tabi
2017-02-08 11:35                 ` Mark Rutland
2017-02-07 18:15 ` Mark Rutland
2017-02-07 18:41   ` Jeffrey Hugo
2017-02-07 19:24   ` Timur Tabi
2017-02-07 19:37     ` Mark Rutland

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).