[U-Boot] [PATCH] Revert "fdt_support: 64bit initrd start address support"
Otavio Salvador
otavio at ossystems.com.br
Mon Jan 20 18:43:23 CET 2014
This reverts commit f77a606a0602be5d1fe23e8dcdfa5defde51dfd7 as it
breaks 32bit initrd use as it uses #address-cells as '2'.
Signed-off-by: Otavio Salvador <otavio at ossystems.com.br>
---
common/fdt_support.c | 66 +++++++++++++++++++++++++---------------------------
1 file changed, 32 insertions(+), 34 deletions(-)
diff --git a/common/fdt_support.c b/common/fdt_support.c
index b9dce99..4e32b02 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -21,34 +21,6 @@
*/
DECLARE_GLOBAL_DATA_PTR;
-/*
- * Get cells len in bytes
- * if #NNNN-cells property is 2 then len is 8
- * otherwise len is 4
- */
-static int get_cells_len(void *blob, char *nr_cells_name)
-{
- const fdt32_t *cell;
-
- cell = fdt_getprop(blob, 0, nr_cells_name, NULL);
- if (cell && fdt32_to_cpu(*cell) == 2)
- return 8;
-
- return 4;
-}
-
-/*
- * Write a 4 or 8 byte big endian cell
- */
-static void write_cell(u8 *addr, u64 val, int size)
-{
- int shift = (size - 1) * 8;
- while (size-- > 0) {
- *addr++ = (val >> shift) & 0xff;
- shift -= 8;
- }
-}
-
/**
* fdt_getprop_u32_default - Find a node and return it's property or a default
*
@@ -159,9 +131,9 @@ static int fdt_fixup_stdout(void *fdt, int chosenoff)
int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end, int force)
{
- int nodeoffset, addr_cell_len;
+ int nodeoffset;
int err, j, total;
- fdt64_t tmp;
+ fdt32_t tmp;
const char *path;
uint64_t addr, size;
@@ -198,11 +170,9 @@ int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end, int force)
return err;
}
- addr_cell_len = get_cells_len(fdt, "#address-cells");
-
path = fdt_getprop(fdt, nodeoffset, "linux,initrd-start", NULL);
if ((path == NULL) || force) {
- write_cell((u8 *)&tmp, initrd_start, addr_cell_len);
+ tmp = cpu_to_fdt32(initrd_start);
err = fdt_setprop(fdt, nodeoffset,
"linux,initrd-start", &tmp, sizeof(tmp));
if (err < 0) {
@@ -211,7 +181,7 @@ int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end, int force)
fdt_strerror(err));
return err;
}
- write_cell((u8 *)&tmp, initrd_end, addr_cell_len);
+ tmp = cpu_to_fdt32(initrd_end);
err = fdt_setprop(fdt, nodeoffset,
"linux,initrd-end", &tmp, sizeof(tmp));
if (err < 0) {
@@ -373,6 +343,34 @@ void do_fixup_by_compat_u32(void *fdt, const char *compat,
do_fixup_by_compat(fdt, compat, prop, &tmp, 4, create);
}
+/*
+ * Get cells len in bytes
+ * if #NNNN-cells property is 2 then len is 8
+ * otherwise len is 4
+ */
+static int get_cells_len(void *blob, char *nr_cells_name)
+{
+ const fdt32_t *cell;
+
+ cell = fdt_getprop(blob, 0, nr_cells_name, NULL);
+ if (cell && fdt32_to_cpu(*cell) == 2)
+ return 8;
+
+ return 4;
+}
+
+/*
+ * Write a 4 or 8 byte big endian cell
+ */
+static void write_cell(u8 *addr, u64 val, int size)
+{
+ int shift = (size - 1) * 8;
+ while (size-- > 0) {
+ *addr++ = (val >> shift) & 0xff;
+ shift -= 8;
+ }
+}
+
#ifdef CONFIG_NR_DRAM_BANKS
#define MEMORY_BANKS_MAX CONFIG_NR_DRAM_BANKS
#else
--
1.8.5.2
More information about the U-Boot
mailing list