spl: fit: move fdt_record_loadable out of ARCH_FIXUP_FDT_MEMORY guard
PATCH 1/1 spl: fit: move fdt_record_loadable out of ARCH_FIXUP_FDT_MEMORY guard
The fdt_record_loadable()-function was wedged between other functions that were guarded by ARCH_FIXUP_FDT_MEMORY. This could lead to linker errors on some configurations.
With this change, fdt_record_loadable() is moved out of the ARCH_FIXUP_FDT_MEMORY guard (plus I tried to retain alphabetical ordering for functions by placing it appropriately).
References: 9f45aeb ("spl: fit: implement fdt_record_loadable")
---
common/fdt_support.c | 78 ++++++++++++++++++++++++++-------------------------- 1 file changed, 39 insertions(+), 39 deletions(-)
common/fdt_support.c +39 -39
@@ -410,45 +410,6 @@ static int fdt_pack_reg(const void *fdt, void *buf, u64 *address, u64 *size,return p - (char *)buf; } -int fdt_record_loadable (void *blob,u32 index,const char *name, -uintptr_t load_addr,u32 size,uintptr_t entry_point, -const char *type,const char *os) -{ -int err, node; - - err =fdt_check_header (blob); -if (err <0 ) { -printf ("%s: %s\n" , __func__,fdt_strerror (err)); -return err; - } - -/* find or create "/fit-images" node */ - node =fdt_find_or_add_subnode (blob,0 ,"fit-images" ); -if (node <0 ) -return node; - -/* find or create "/fit-images/<name>" node */ - node =fdt_find_or_add_subnode (blob, node, name); -if (node <0 ) -return node; - -/* -* We record these as 32bit entities, possibly truncating addresses. -* However, spl_fit.c is not 64bit safe either: i.e. we should not -* have an issue here. -*/ -fdt_setprop_u32 (blob, node,"load-addr" , load_addr); -if (entry_point !=-1 ) -fdt_setprop_u32 (blob, node,"entry-point" , entry_point); -fdt_setprop_u32 (blob, node,"size" , size); -if (type) -fdt_setprop_string (blob, node,"type" , type); -if (os) -fdt_setprop_string (blob, node,"os" , os); - -return node; -} -#ifdef CONFIG_NR_DRAM_BANKS #define MEMORY_BANKS_MAX CONFIG_NR_DRAM_BANKS#else
@@ -584,6 +545,45 @@ void fdt_fixup_ethernet(void *fdt) } } +int fdt_record_loadable (void *blob,u32 index,const char *name, +uintptr_t load_addr,u32 size,uintptr_t entry_point, +const char *type,const char *os) +{ +int err, node; + + err =fdt_check_header (blob); +if (err <0 ) { +printf ("%s: %s\n" , __func__,fdt_strerror (err)); +return err; + } + +/* find or create "/fit-images" node */ + node =fdt_find_or_add_subnode (blob,0 ,"fit-images" ); +if (node <0 ) +return node; + +/* find or create "/fit-images/<name>" node */ + node =fdt_find_or_add_subnode (blob, node, name); +if (node <0 ) +return node; + +/* +* We record these as 32bit entities, possibly truncating addresses. +* However, spl_fit.c is not 64bit safe either: i.e. we should not +* have an issue here. +*/ +fdt_setprop_u32 (blob, node,"load-addr" , load_addr); +if (entry_point !=-1 ) +fdt_setprop_u32 (blob, node,"entry-point" , entry_point); +fdt_setprop_u32 (blob, node,"size" , size); +if (type) +fdt_setprop_string (blob, node,"type" , type); +if (os) +fdt_setprop_string (blob, node,"os" , os); + +return node; +} +/* Resize the fdt to its actual size + a bit of padding */ int fdt_shrink_to_minimum (void *blob,uint extrasize) {
Signature · 1 line
2.1.4
PATCH 1/1 spl: fit: move fdt_record_loadable out of ARCH_FIXUP_FDT_MEMORY guard
Quoted 102 lines · Philipp Tomsich
The fdt_record_loadable()-function was wedged between other functions that were guarded by
ARCH_FIXUP_FDT_MEMORY. This could lead to linker errors on some configurations.With this change,
fdt_record_loadable()is moved out of theARCH_FIXUP_FDT_MEMORYguard (plus I tried to retain alphabetical ordering for functions by placing it appropriately).References: 9f45aeb ("spl: fit: implement
fdt_record_loadable")Signed-off-by Philipp Tomsich <[email protected]>---
common/fdt_support.c | 78 ++++++++++++++++++++++++++-------------------------- 1 file changed, 39 insertions(+), 39 deletions(-)common/fdt_support.c +32
-39@@ -410,45 +410,6 @@ static int fdt_pack_reg(const void *fdt, void *buf, u64 *address, u64 *size,return p - (char *)buf; } -int fdt_record_loadable (void *blob,u32 index,const char *name, -uintptr_t load_addr,u32 size,uintptr_t entry_point, -const char *type,const char *os) -{ -int err, node; - - err =fdt_check_header (blob); -if (err <0 ) { -printf ("%s: %s\n" , __func__,fdt_strerror (err)); -return err; - } - -/* find or create "/fit-images" node */ - node =fdt_find_or_add_subnode (blob,0 ,"fit-images" ); -if (node <0 ) -return node; - -/* find or create "/fit-images/<name>" node */ - node =fdt_find_or_add_subnode (blob, node, name); -if (node <0 ) -return node; - -/* -* We record these as 32bit entities, possibly truncating addresses. -* However, spl_fit.c is not 64bit safe either: i.e. we should not -* have an issue here. -*/ -fdt_setprop_u32 (blob, node,"load-addr" , load_addr); -if (entry_point !=-1 ) -fdt_setprop_u32 (blob, node,"entry-point" , entry_point); -fdt_setprop_u32 (blob, node,"size" , size); -if (type) -fdt_setprop_string (blob, node,"type" , type); -if (os) -fdt_setprop_string (blob, node,"os" , os); - -return node; -} -#ifdef CONFIG_NR_DRAM_BANKS #define MEMORY_BANKS_MAX CONFIG_NR_DRAM_BANKS#else @@ -584,6 +545,45 @@ void fdt_fixup_ethernet(void *fdt) } } +int fdt_record_loadable (void *blob,u32 index,const char *name, +uintptr_t load_addr,u32 size,uintptr_t entry_point, +const char *type,const char *os) +{ +int err, node; + + err =fdt_check_header (blob); +if (err <0 ) { +printf ("%s: %s\n" , __func__,fdt_strerror (err)); +return err; + } + +/* find or create "/fit-images" node */ + node =fdt_find_or_add_subnode (blob,0 ,"fit-images" ); +if (node <0 ) +return node; + +/* find or create "/fit-images/<name>" node */ + node =fdt_find_or_add_subnode (blob, node, name); +if (node <0 ) +return node; + +/* +* We record these as 32bit entities, possibly truncating addresses. +* However, spl_fit.c is not 64bit safe either: i.e. we should not +* have an issue here. +*/ +fdt_setprop_u32 (blob, node,"load-addr" , load_addr); +if (entry_point !=-1 ) +fdt_setprop_u32 (blob, node,"entry-point" , entry_point); +fdt_setprop_u32 (blob, node,"size" , size); +if (type)
common/fdt_support.c void fdt_fixup_ethernet(void *fdt) · line 589
Quoted 10 lines
common/fdt_support.c +7
-0+fdt_setprop_string (blob, node,"type" , type); +if (os) +fdt_setprop_string (blob, node,"os" , os); + +return node; +} +/* Resize the fdt to its actual size + a bit of padding */ int fdt_shrink_to_minimum (void *blob,uint extrasize) {
Thanks,
Michal
PATCH 1/1 spl: fit: move fdt_record_loadable out of ARCH_FIXUP_FDT_MEMORY guard
Tom,
Do you plan to apply this or should I include it into my next pull-request?
Thanks,
Philipp.
Quoted 121 lines · Michal Simek
Quoted 102 lines · Philipp Tomsich
The fdt_record_loadable()-function was wedged between other functions that were guarded by
ARCH_FIXUP_FDT_MEMORY. This could lead to linker errors on some configurations.With this change,
fdt_record_loadable()is moved out of theARCH_FIXUP_FDT_MEMORYguard (plus I tried to retain alphabetical ordering for functions by placing it appropriately).References: 9f45aeb ("spl: fit: implement
fdt_record_loadable")Signed-off-by Philipp Tomsich <[email protected]>---
common/fdt_support.c| 78 ++++++++++++++++++++++++++--------------------------1 file changed, 39 insertions(+), 39 deletions(-)common/fdt_support.c +32
-39@@ -410,45 +410,6 @@ static int fdt_pack_reg(const void *fdt, void *buf, u64 *address, u64 *size,return p - (char *)buf; } -int fdt_record_loadable (void *blob,u32 index,const char *name, -uintptr_t load_addr,u32 size,uintptr_t entry_point, -const char *type,const char *os) -{ -int err, node; - - err =fdt_check_header (blob); -if (err <0 ) { -printf ("%s: %s\n" , __func__,fdt_strerror (err)); -return err; - } - -/* find or create "/fit-images" node */ - node =fdt_find_or_add_subnode (blob,0 ,"fit-images" ); -if (node <0 ) -return node; - -/* find or create "/fit-images/<name>" node */ - node =fdt_find_or_add_subnode (blob, node, name); -if (node <0 ) -return node; - -/* -* We record these as 32bit entities, possibly truncating addresses. -* However, spl_fit.c is not 64bit safe either: i.e. we should not -* have an issue here. -*/ -fdt_setprop_u32 (blob, node,"load-addr" , load_addr); -if (entry_point !=-1 ) -fdt_setprop_u32 (blob, node,"entry-point" , entry_point); -fdt_setprop_u32 (blob, node,"size" , size); -if (type) -fdt_setprop_string (blob, node,"type" , type); -if (os) -fdt_setprop_string (blob, node,"os" , os); - -return node; -} -#ifdef CONFIG_NR_DRAM_BANKS #define MEMORY_BANKS_MAX CONFIG_NR_DRAM_BANKS#else @@ -584,6 +545,45 @@ void fdt_fixup_ethernet(void *fdt) } } +int fdt_record_loadable (void *blob,u32 index,const char *name, +uintptr_t load_addr,u32 size,uintptr_t entry_point, +const char *type,const char *os) +{ +int err, node; + + err =fdt_check_header (blob); +if (err <0 ) { +printf ("%s: %s\n" , __func__,fdt_strerror (err)); +return err; + } + +/* find or create "/fit-images" node */ + node =fdt_find_or_add_subnode (blob,0 ,"fit-images" ); +if (node <0 ) +return node; + +/* find or create "/fit-images/<name>" node */ + node =fdt_find_or_add_subnode (blob, node, name); +if (node <0 ) +return node; + +/* +* We record these as 32bit entities, possibly truncating addresses. +* However, spl_fit.c is not 64bit safe either: i.e. we should not +* have an issue here. +*/ +fdt_setprop_u32 (blob, node,"load-addr" , load_addr); +if (entry_point !=-1 ) +fdt_setprop_u32 (blob, node,"entry-point" , entry_point); +fdt_setprop_u32 (blob, node,"size" , size); +if (type)common/fdt_support.c void fdt_fixup_ethernet(void *fdt) · line 589
Quoted 10 lines
common/fdt_support.c +7
-0+fdt_setprop_string (blob, node,"type" , type); +if (os) +fdt_setprop_string (blob, node,"os" , os); + +return node; +} +/* Resize the fdt to its actual size + a bit of padding */ int fdt_shrink_to_minimum (void *blob,uint extrasize) {Reported-by Michal Simek <[email protected]>Tested-by Michal Simek <[email protected]>Thanks,
Michal
PATCH 1/1 spl: fit: move fdt_record_loadable out of ARCH_FIXUP_FDT_MEMORY guard
Quoted 3 lines · Dr. Philipp Tomsich
Tom,
Do you plan to apply this or should I include it into my next pull-request?
Please pick it up, thanks!
Quoted 126 lines
Thanks,
Philipp.Quoted 121 lines · Michal Simek
Quoted 102 lines · Philipp Tomsich
The fdt_record_loadable()-function was wedged between other functions that were guarded by
ARCH_FIXUP_FDT_MEMORY. This could lead to linker errors on some configurations.With this change,
fdt_record_loadable()is moved out of theARCH_FIXUP_FDT_MEMORYguard (plus I tried to retain alphabetical ordering for functions by placing it appropriately).References: 9f45aeb ("spl: fit: implement
fdt_record_loadable")Signed-off-by Philipp Tomsich <[email protected]>---
common/fdt_support.c| 78 ++++++++++++++++++++++++++--------------------------1 file changed, 39 insertions(+), 39 deletions(-)common/fdt_support.c +32
-39@@ -410,45 +410,6 @@ static int fdt_pack_reg(const void *fdt, void *buf, u64 *address, u64 *size,return p - (char *)buf; } -int fdt_record_loadable (void *blob,u32 index,const char *name, -uintptr_t load_addr,u32 size,uintptr_t entry_point, -const char *type,const char *os) -{ -int err, node; - - err =fdt_check_header (blob); -if (err <0 ) { -printf ("%s: %s\n" , __func__,fdt_strerror (err)); -return err; - } - -/* find or create "/fit-images" node */ - node =fdt_find_or_add_subnode (blob,0 ,"fit-images" ); -if (node <0 ) -return node; - -/* find or create "/fit-images/<name>" node */ - node =fdt_find_or_add_subnode (blob, node, name); -if (node <0 ) -return node; - -/* -* We record these as 32bit entities, possibly truncating addresses. -* However, spl_fit.c is not 64bit safe either: i.e. we should not -* have an issue here. -*/ -fdt_setprop_u32 (blob, node,"load-addr" , load_addr); -if (entry_point !=-1 ) -fdt_setprop_u32 (blob, node,"entry-point" , entry_point); -fdt_setprop_u32 (blob, node,"size" , size); -if (type) -fdt_setprop_string (blob, node,"type" , type); -if (os) -fdt_setprop_string (blob, node,"os" , os); - -return node; -} -#ifdef CONFIG_NR_DRAM_BANKS #define MEMORY_BANKS_MAX CONFIG_NR_DRAM_BANKS#else @@ -584,6 +545,45 @@ void fdt_fixup_ethernet(void *fdt) } } +int fdt_record_loadable (void *blob,u32 index,const char *name, +uintptr_t load_addr,u32 size,uintptr_t entry_point, +const char *type,const char *os) +{ +int err, node; + + err =fdt_check_header (blob); +if (err <0 ) { +printf ("%s: %s\n" , __func__,fdt_strerror (err)); +return err; + } + +/* find or create "/fit-images" node */ + node =fdt_find_or_add_subnode (blob,0 ,"fit-images" ); +if (node <0 ) +return node; + +/* find or create "/fit-images/<name>" node */ + node =fdt_find_or_add_subnode (blob, node, name); +if (node <0 ) +return node; + +/* +* We record these as 32bit entities, possibly truncating addresses. +* However, spl_fit.c is not 64bit safe either: i.e. we should not +* have an issue here. +*/ +fdt_setprop_u32 (blob, node,"load-addr" , load_addr); +if (entry_point !=-1 ) +fdt_setprop_u32 (blob, node,"entry-point" , entry_point); +fdt_setprop_u32 (blob, node,"size" , size); +if (type)common/fdt_support.c void fdt_fixup_ethernet(void *fdt) · line 589
Quoted 10 lines
common/fdt_support.c +7
-0+fdt_setprop_string (blob, node,"type" , type); +if (os) +fdt_setprop_string (blob, node,"os" , os); + +return node; +} +/* Resize the fdt to its actual size + a bit of padding */ int fdt_shrink_to_minimum (void *blob,uint extrasize) {Reported-by Michal Simek <[email protected]>Tested-by Michal Simek <[email protected]>Thanks,
Michal
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180206/561aa2d7/attachment.sig>
Quoted 8 lines
The fdt_record_loadable()-function was wedged between other functions that were guarded by
ARCH_FIXUP_FDT_MEMORY. This could lead to linker errors on some configurations.With this change,
fdt_record_loadable()is moved out of theARCH_FIXUP_FDT_MEMORYguard (plus I tried to retain alphabetical ordering for functions by placing it appropriately).
Quoted 9 lines
References: 9f45aeb ("spl: fit: implement
fdt_record_loadable")Signed-off-by Philipp Tomsich <[email protected]>Reported-by Michal Simek <[email protected]>Tested-by Michal Simek <[email protected]>---
common/fdt_support.c | 78 ++++++++++++++++++++++++++-------------------------- 1 file changed, 39 insertions(+), 39 deletions(-)
Applied to u-boot-rockchip, thanks!