[coreboot-gerrit] Change in coreboot[master]: lib/fit: support booting initrd placed above 4GiB

Philipp Deppenwiese (Code Review) gerrit at coreboot.org
Sat Aug 11 01:23:21 CEST 2018


Philipp Deppenwiese has submitted this change and it was merged. ( https://review.coreboot.org/28002 )

Change subject: lib/fit: support booting initrd placed above 4GiB
......................................................................

lib/fit: support booting initrd placed above 4GiB

Store initrd offset as 64bit integer.

Tested on Cavium CN81XX EVB: The initrd could be loaded when placed
above 4GiB. Previously it failed to find the initrd.

Change-Id: I5d1ae860ae4a4465546bc0ef89937d611d1e56ab
Signed-off-by: Patrick Rudolph <patrick.rudolph at 9elements.com>
Reviewed-on: https://review.coreboot.org/28002
Tested-by: build bot (Jenkins) <no-reply at coreboot.org>
Reviewed-by: Aaron Durbin <adurbin at chromium.org>
Reviewed-by: Philipp Deppenwiese <zaolin.daisuki at gmail.com>
---
M src/include/device_tree.h
M src/lib/device_tree.c
M src/lib/fit.c
3 files changed, 21 insertions(+), 5 deletions(-)

Approvals:
  build bot (Jenkins): Verified
  Aaron Durbin: Looks good to me, approved
  Philipp Deppenwiese: Looks good to me, approved



diff --git a/src/include/device_tree.h b/src/include/device_tree.h
index 7f725e4..4c1a37c 100644
--- a/src/include/device_tree.h
+++ b/src/include/device_tree.h
@@ -158,6 +158,7 @@
 		     size_t size);
 void dt_add_string_prop(struct device_tree_node *node, const char *name, char *str);
 void dt_add_u32_prop(struct device_tree_node *node, const char *name, u32 val);
+void dt_add_u64_prop(struct device_tree_node *node, const char *name, u64 val);
 void dt_add_reg_prop(struct device_tree_node *node, u64 *addrs, u64 *sizes,
 		     int count, u32 addr_cells, u32 size_cells);
 int dt_set_bin_prop_by_path(struct device_tree *tree, const char *path,
diff --git a/src/lib/device_tree.c b/src/lib/device_tree.c
index a905dbf..89387ff 100644
--- a/src/lib/device_tree.c
+++ b/src/lib/device_tree.c
@@ -882,6 +882,22 @@
 }
 
 /*
+ * Add a 64-bit integer property to a node, or update it if it already exists.
+ *
+ * @param node		The device tree node to add to.
+ * @param name		The name of the new property.
+ * @param val		The integer to be stored in the property.
+ */
+void dt_add_u64_prop(struct device_tree_node *node, const char *name, u64 val)
+{
+	u64 *val_ptr = malloc(sizeof(val));
+	if (!val_ptr)
+		return;
+	*val_ptr = htobe64(val);
+	dt_add_bin_prop(node, name, val_ptr, sizeof(*val_ptr));
+}
+
+/*
  * Add a 'reg' address list property to a node, or update it if it exists.
  *
  * @param node		The device tree node to add to.
diff --git a/src/lib/fit.c b/src/lib/fit.c
index fe8a82e..68f5bed 100644
--- a/src/lib/fit.c
+++ b/src/lib/fit.c
@@ -212,12 +212,11 @@
 	struct device_tree_node *node;
 	node = dt_find_node(tree->root, path, NULL, NULL, 1);
 
-	/* Warning: this assumes the ramdisk is currently located below 4GiB. */
-	u32 start = (uintptr_t)ramdisk_addr;
-	u32 end = start + ramdisk_size;
+	u64 start = (uintptr_t)ramdisk_addr;
+	u64 end = start + ramdisk_size;
 
-	dt_add_u32_prop(node, "linux,initrd-start", start);
-	dt_add_u32_prop(node, "linux,initrd-end", end);
+	dt_add_u64_prop(node, "linux,initrd-start", start);
+	dt_add_u64_prop(node, "linux,initrd-end", end);
 }
 
 static void update_reserve_map(uint64_t start, uint64_t end,

-- 
To view, visit https://review.coreboot.org/28002
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I5d1ae860ae4a4465546bc0ef89937d611d1e56ab
Gerrit-Change-Number: 28002
Gerrit-PatchSet: 2
Gerrit-Owner: Patrick Rudolph <patrick.rudolph at 9elements.com>
Gerrit-Reviewer: Aaron Durbin <adurbin at chromium.org>
Gerrit-Reviewer: David Hendricks <david.hendricks at gmail.com>
Gerrit-Reviewer: Julius Werner <jwerner at chromium.org>
Gerrit-Reviewer: Philipp Deppenwiese <zaolin.daisuki at gmail.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply at coreboot.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180810/3f2740ea/attachment.html>


More information about the coreboot-gerrit mailing list