Add ARM flat device tree support
Subsystems (6)
v2 cover Add ARM flat device tree support
This is the third submission of this patch series. The first was an RFC and I received lots of comments that I addressed in the second for which I got no feedback.
This version fixes some issues I found in testing on a hacked Beagle kernel with enough device tree functionality to verify that u-boot is able to pass a device tree.
Patch summary:
1-4 are fixes/clean up to existing code
3 needs testing on nios and microblaze
5 actually adds the ARM FDT support
6 enables FDT support for omap3_beagle
John Rigby (6):
fdt_relocate: fix fdt size and endian bugs
FDT: Add fixup support for multiple banks of memory
FDT: only call boot_get_fdt from generic code
boot: change some arch ifdefs to feature ifdefs
ARM: add flat device tree support
ARM: enable device tree for beagle
arch/arm/include/asm/config.h | 2 + arch/arm/lib/bootm.c | 137 ++++++++++++++++++++++++++++++++---- arch/m68k/include/asm/config.h | 3 + arch/microblaze/lib/bootm.c | 12 +--- arch/nios2/lib/bootm.c | 8 +-- arch/powerpc/include/asm/config.h | 3 + arch/sparc/include/asm/config.h | 1 + common/cmd_bootm.c | 4 +- common/fdt_support.c | 86 ++++++++++++----------- common/image.c | 18 +++-- include/configs/omap3_beagle.h | 9 +++ include/fdt_support.h | 1 + include/image.h | 9 ++- 13 files changed, 210 insertions(+), 83 deletions(-)
PATCH v2 1/6 fdt_relocate: fix fdt size and endian bugs
Fix two problems in fdt_relocate.
First, for the non relocation case current code calculates fdt blob size by subtracting the fdt address from the end of bootmap. This wrong because it assumes that the fdt_blob is located at the top (high) of the bootmap. Use the current size plus padding instead. For example if the blob is at the beginning of bootmap then the calculated size will be the size of the entire bootmapped area.
Second, fdt_relocate returns bad size info on little endian platforms because it calls be32_to_cpu on the value returned by fdt_totalsize. This is wrong because the value returned by fdt_totalsize is already cpu endian.
--- common/image.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
common/image.c +3 -3
@@ -1252,7 +1252,7 @@ int boot_relocate_fdt (struct lmb *lmb, ulong bootmap_base, *of_size = of_len; }else { *of_flat_tree = fdt_blob; - of_len = (CONFIG_SYS_BOOTMAPSZ + bootmap_base) - (ulong )fdt_blob; + of_len = *of_size + (unsigned )CONFIG_SYS_FDT_PAD ;lmb_reserve (lmb, (ulong )fdt_blob, of_len);fdt_set_totalsize (*of_flat_tree, of_len);
@@ -1561,7 +1561,7 @@ int boot_get_fdt (int flag, int argc, char * const argv[], bootm_headers_t *imag goto error; } -if (be32_to_cpu (fdt_totalsize (fdt_blob)) != fdt_len) { +if (fdt_totalsize (fdt_blob) != fdt_len) {fdt_error ("fdt size != image size" ); goto error; }
@@ -1575,7 +1575,7 @@ int boot_get_fdt (int flag, int argc, char * const argv[], bootm_headers_t *imag } *of_flat_tree = fdt_blob; - *of_size =be32_to_cpu (fdt_totalsize (fdt_blob)); + *of_size =fdt_totalsize (fdt_blob);debug (" of_flat_tree at 0x%08lx size 0x%08lx\n" , (ulong)*of_flat_tree, *of_size);
Signature · 1 line
1.7.0.4
PATCH v2 1/6 fdt_relocate: fix fdt size and endian bugs
Dear John Rigby,
Quoted 4 lines · In message <[email protected]> you wrote:
Fix two problems in
fdt_relocate.First, for the non relocation case current code calculates fdt blob size by subtracting the fdt address from the end
Please consider the non relocation case obsoleted. This is nothing that needs to or should have FDT support added.
Quoted 11 lines
of bootmap. This wrong because it assumes that the
fdt_blobis located at the top (high) of the bootmap. Use the current size plus padding instead. For example if the blob is at the beginning of bootmap then the calculated size will be the size of the entire bootmapped area.Second,
fdt_relocatereturns bad size info on little endian platforms because it callsbe32_to_cpuon the value returned byfdt_totalsize. This is wrong because the value returned byfdt_totalsizeis already cpu endian.
Quoted 4 lines
Signed-off-by John Rigby <[email protected]>--- common/image.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
Sorry, but the commit message and the code changes don't match at all.
You say you were fixing fdt_relocate(), but you change only common/image.c which is unrelated,
Please fix the commit message.
common/image.c int boot_relocate_fdt (struct lmb *lmb, ulong bootmap_base, · line 1255
Quoted 10 lines
common/image.c +1
-1@@ -1252,7 +1252,7 @@ int boot_relocate_fdt (struct lmb *lmb, ulong bootmap_base, *of_size = of_len; }else { *of_flat_tree = fdt_blob; - of_len = (CONFIG_SYS_BOOTMAPSZ + bootmap_base) - (ulong )fdt_blob; + of_len = *of_size + (unsigned )CONFIG_SYS_FDT_PAD ;
Um... what are the implications of this on other architectures?
For example, on which PowerPC systems has this been tested?
Best regards,
Wolfgang Denk
Signature · 8 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "Science makes godlike -- it is all over with priests and gods when man becomes scientific. Moral: science is the forbidden as such -- it alone is forbidden. Science is the *first* sin, the *original* sin. *This alone is morality.* ``Thou shalt not know'' -- the rest follows." - Friedrich Nietzsche
PATCH v2 1/6 fdt_relocate: fix fdt size and endian bugs
Quoted 4 lines · Wolfgang Denk
Dear John Rigby,
Quoted 1 line · In message <[email protected]> you wrote:
Fix two problems in
fdt_relocate.
Sorry this should be boot_relocate_fdt
Quoted 17 lines
Quoted 3 lines
First, for the non relocation case current code calculates fdt blob size by subtracting the fdt address from the end
Please consider the non relocation case obsoleted. This is nothing that needs to or should have FDT support added.
Quoted 10 lines
of bootmap. ?This wrong because it assumes that the
fdt_blobis located at the top (high) of the bootmap. ?Use the current size plus padding instead. ?For example if the blob is at the beginning of bootmap then the calculated size will be the size of the entire bootmapped area.Second,
fdt_relocatereturns bad size info on little endian platforms because it callsbe32_to_cpuon the value returned byfdt_totalsize. ?This is wrong because the value returned byfdt_totalsizeis already cpu endian.
After changing fdt_relocate to boot_relocate_fdt the commit message is correct.
Quoted 11 lines
common/image.c int boot_relocate_fdt (struct lmb *lmb, ulong bootmap_base, · line 1255
Quoted 9 lines
index 3a2f25e..4aec9d6 100644
common/image.c +1
-1@@ -1252,7 +1252,7 @@ int boot_relocate_fdt (struct lmb *lmb, ulong bootmap_base, ? ? ? ? ? ? ? *of_size = of_len; ? ? ? } else { ? ? ? ? ? ? ? *of_flat_tree = fdt_blob; - ? ? ? ? ? ? of_len = (CONFIG_SYS_BOOTMAPSZ + bootmap_base) - (ulong)fdt_blob; + ? ? ? ? ? ? of_len = *of_size + (unsigned)CONFIG_SYS_FDT_PAD;Um... what are the implications of this on other architectures?
I believe this bug has never caused anyone problems because the else has never been reached.
PATCH v2 1/6 fdt_relocate: fix fdt size and endian bugs
Dear John Rigby,
Quoted 6 lines · In message <[email protected]> you…
Quoted 4 lines · Wolfgang Denk
Dear John Rigby,
Quoted 1 line · In message <[email protected]> you wrote:
Fix two problems in
fdt_relocate.Sorry this should be
boot_relocate_fdt
In the Subject: it's more helpful to refer to the component / file name, i. e. here: "common/image.c: ..."
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
Second,
fdt_relocatereturns bad size info on little endian platforms because it callsbe32_to_cpuon the value returned byfdt_totalsize. ?This is wrong because the value returned byfdt_totalsizeis already cpu endian.After changing
fdt_relocatetoboot_relocate_fdtthe commit message is correct.
I disagree. My understanding is that fdt_relocate() does not return a bad size, the additional use of be32_to_cpu() in image.c corrupts the correct value. Otherwise the fix would need to be done in fdt_relocate().
Quoted 4 lines
Quoted 1 line
Um... what are the implications of this on other architectures?
I believe this bug has never caused anyone problems because the else has never been reached.
So what are the implications, and how has it been tested?
Best regards,
Wolfgang Denk
Signature · 8 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Making files is easy under the UNIX operating system. Therefore, users tend to create numerous files using large amounts of file space. It has been said that the only standard thing about all UNIX systems is the message-of-the-day telling users to clean up their files. -- System V.2 administrator's guide
PATCH v2 2/6 FDT: Add fixup support for multiple banks of memory
In reply to John RigbyAdd fdt_fixup_memory_banks and reimplement fdt_fixup_memory using it.
--- common/fdt_support.c | 86 ++++++++++++++++++++++++++----------------------- include/fdt_support.h | 1 + 2 files changed, 47 insertions(+), 40 deletions(-)
common/fdt_support.c +46 -40
@@ -362,10 +362,40 @@ void do_fixup_by_compat_u32(void *fdt, const char *compat,do_fixup_by_compat (fdt, compat, prop, &val,4 , create); } -int fdt_fixup_memory (void *blob,u64 start,u64 size) +/* +* 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 u32 *cell; + + cell =fdt_getprop (blob,0 , nr_cells_name,NULL ); +if (cell && *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 err, nodeoffset, len =0 ; -u8 tmp[16 ]; +int shift = (size -1 ) *8 ; +while (size-- >0 ) { + *addr++ = (val >> shift) &0xff ; + shift -=8 ; + } +} + +int fdt_fixup_memory_banks (void *blob,u64 start[],u64 size[],int banks) +{ +int err, nodeoffset; +int addr_cell_len, size_cell_len, len; +u8 tmp[banks *8 ]; +int bank;const u32 *addrcell, *sizecell; err =fdt_check_header (blob);
@@ -391,44 +421,15 @@ int fdt_fixup_memory(void *blob, u64 start, u64 size)return err; } - addrcell =fdt_getprop (blob,0 ,"#address-cells" ,NULL ); -/* use shifts and mask to ensure endianness */ -if ((addrcell) && (*addrcell ==2 )) { - tmp[0 ] = (start >>56 ) &0xff ; - tmp[1 ] = (start >>48 ) &0xff ; - tmp[2 ] = (start >>40 ) &0xff ; - tmp[3 ] = (start >>32 ) &0xff ; - tmp[4 ] = (start >>24 ) &0xff ; - tmp[5 ] = (start >>16 ) &0xff ; - tmp[6 ] = (start >>8 ) &0xff ; - tmp[7 ] = (start ) &0xff ; - len =8 ; - }else { - tmp[0 ] = (start >>24 ) &0xff ; - tmp[1 ] = (start >>16 ) &0xff ; - tmp[2 ] = (start >>8 ) &0xff ; - tmp[3 ] = (start ) &0xff ; - len =4 ; - } + addr_cell_len =get_cells_len (blob,"#address-cells" ); + size_cell_len =get_cells_len (blob,"#size-cells" ); - sizecell =fdt_getprop (blob,0 ,"#size-cells" ,NULL ); -/* use shifts and mask to ensure endianness */ -if ((sizecell) && (*sizecell ==2 )) { - tmp[0 +len] = (size >>56 ) &0xff ; - tmp[1 +len] = (size >>48 ) &0xff ; - tmp[2 +len] = (size >>40 ) &0xff ; - tmp[3 +len] = (size >>32 ) &0xff ; - tmp[4 +len] = (size >>24 ) &0xff ; - tmp[5 +len] = (size >>16 ) &0xff ; - tmp[6 +len] = (size >>8 ) &0xff ; - tmp[7 +len] = (size ) &0xff ; - len +=8 ; - }else { - tmp[0 +len] = (size >>24 ) &0xff ; - tmp[1 +len] = (size >>16 ) &0xff ; - tmp[2 +len] = (size >>8 ) &0xff ; - tmp[3 +len] = (size ) &0xff ; - len +=4 ; +for (bank =0 , len =0 ; bank < banks; bank++) { +write_cell (tmp + len, start[bank], addr_cell_len); + len += addr_cell_len; + +write_cell (tmp + len, size[bank], size_cell_len); + len += size_cell_len; } err =fdt_setprop (blob, nodeoffset,"reg" , tmp, len);
@@ -440,6 +441,11 @@ int fdt_fixup_memory(void *blob, u64 start, u64 size)return 0 ; } +int fdt_fixup_memory (void *blob,u64 start,u64 size) +{ +return fdt_fixup_memory_banks (blob, &start, &size,1 ); +} +void fdt_fixup_ethernet (void *fdt) {int node, i, j;
include/fdt_support.h +1 -0
@@ -48,6 +48,7 @@ void do_fixup_by_compat(void *fdt, const char *compat,void do_fixup_by_compat_u32 (void *fdt,const char *compat,const char *prop,u32 val,int create);int fdt_fixup_memory (void *blob,u64 start,u64 size); +int fdt_fixup_memory_banks (void *blob,u64 start[],u64 size[],int banks);void fdt_fixup_ethernet (void *fdt);int fdt_find_and_setprop (void *fdt,const char *node,const char *prop,const void *val,int len,int create);
Signature · 1 line
1.7.0.4
PATCH v2 2/6 FDT: Add fixup support for multiple banks of memory
Dear John Rigby,
Quoted 4 lines · In message <[email protected]> you wrote:
Add
fdt_fixup_memory_banksand reimplementfdt_fixup_memoryusing it.Signed-off-by John Rigby <[email protected]>
This needs to go thorugh the FDT custodian or at least needs his ACK.
You probably want to put him on Cc: so he gets aware of the patch [done here].
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Blast medicine anyway! We've learned to tie into every organ in the human body but one. The brain! The brain is what life is all about. -- McCoy, "The Menagerie", stardate 3012.4
PATCH v2 3/6 FDT: only call boot_get_fdt from generic code
In reply to John RigbyAll arches except nios2 and microblaze call boot_get_fdt from bootm_start in common/cmd_bootm.c.
Having nios2 and microblaze do so as well removes code from their respective do_bootm_linux routines and allows removal of a nasty ifdef from bootm_start.
--- arch/microblaze/lib/bootm.c | 12 +++--------- arch/nios2/lib/bootm.c | 8 +++----- common/cmd_bootm.c | 2 -- 3 files changed, 6 insertions(+), 16 deletions(-)
arch/microblaze/lib/bootm.c +3 -9
@@ -46,12 +46,9 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *imachar *of_flat_tree =NULL ;#if defined(CONFIG_OF_LIBFDT ) -ulong of_size =0 ; - -/* find flattened device tree */ - ret =boot_get_fdt (flag, argc, argv, images, &of_flat_tree, &of_size); -if (ret) -return 1 ; +/* did generic code already find a device tree? */ +if (images->ft_len) + of_flat_tree = images->ft_addr;#endif theKernel = (void (*)(char *,ulong ,ulong ))images->ep;
@@ -64,9 +61,6 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *imashow_boot_progress (15 ); -if (!(ulong ) of_flat_tree) - of_flat_tree = (char *)simple_strtoul (argv[3 ],NULL ,16 ); -#ifdef DEBUG printf ("## Transferring control to Linux (at address 0x%08lx) " \ "ramdisk 0x%08lx, FDT 0x%08lx...\n",
arch/nios2/lib/bootm.c +3 -5
@@ -36,11 +36,9 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *imaulong initrd_end = images->rd_end;char *of_flat_tree =NULL ;#if defined(CONFIG_OF_LIBFDT ) -ulong of_size =0 ; - -/* find flattened device tree */ -if (boot_get_fdt (flag, argc, argv, images, &of_flat_tree, &of_size)) -return 1 ; +/* did generic code already find a device tree? */ +if (images->ft_len) + of_flat_tree = images->ft_addr;#endif if (!of_flat_tree && argc >3 ) of_flat_tree = (char *)simple_strtoul (argv[3 ],NULL ,16 );
common/cmd_bootm.c +0 -2
@@ -308,7 +308,6 @@ static int bootm_start(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[] }#if defined(CONFIG_OF_LIBFDT ) -#if defined(CONFIG_PPC ) || defined(CONFIG_M68K ) || defined(CONFIG_SPARC )/* find flattened device tree */ ret =boot_get_fdt (flag, argc, argv, &images, &images.ft_addr, &images.ft_len);
@@ -319,7 +318,6 @@ static int bootm_start(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]set_working_fdt_addr (images.ft_addr);#endif -#endif } images.os.start = (ulong )os_hdr;
Signature · 1 line
1.7.0.4
PATCH v2 3/6 FDT: only call boot_get_fdt from generic code
Dear John Rigby,
Quoted 24 lines · In message <[email protected]> you wrote:
All arches except nios2 and microblaze call
boot_get_fdtfrombootm_startincommon/cmd_bootm.c.Having nios2 and microblaze do so as well removes code from their respective
do_bootm_linuxroutines and allows removal of a nasty ifdef frombootm_start.Signed-off-by John Rigby <[email protected]>CC Scott McNutt <[email protected]>CC Michal Simek <[email protected]>--- arch/microblaze/lib/bootm.c | 12 +++--------- arch/nios2/lib/bootm.c | 8 +++----- common/cmd_bootm.c | 2 -- 3 files changed, 6 insertions(+), 16 deletions(-)arch/microblaze/lib/bootm.c +0
-0@@ -46,12 +46,9 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *imachar *of_flat_tree =NULL ;#if defined(CONFIG_OF_LIBFDT )
arch/microblaze/lib/bootm.c int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *ima · line 52
Quoted 10 lines
arch/microblaze/lib/bootm.c +3
-6-ulong of_size =0 ; - -/* find flattened device tree */ - ret =boot_get_fdt (flag, argc, argv, images, &of_flat_tree, &of_size); -if (ret) -return 1 ; +/* did generic code already find a device tree? */ +if (images->ft_len) + of_flat_tree = images->ft_addr;#endif
So what if the generic code did NOT find a device tree?
Before, there was an error return. And now?
Quoted 6 lines
arch/nios2/lib/bootm.c +0
-0@@ -36,11 +36,9 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *imaulong initrd_end = images->rd_end;
arch/nios2/lib/bootm.c int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *ima · line 41
Quoted 10 lines
arch/nios2/lib/bootm.c +3
-5char *of_flat_tree =NULL ;#if defined(CONFIG_OF_LIBFDT ) -ulong of_size =0 ; - -/* find flattened device tree */ -if (boot_get_fdt (flag, argc, argv, images, &of_flat_tree, &of_size)) -return 1 ; +/* did generic code already find a device tree? */ +if (images->ft_len) + of_flat_tree = images->ft_addr;
Ditto.
On which nios2 and microblaze has this been tested?
You may want to put the NIOS and MB custodians on Cc:
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "I say we take off; nuke the site from orbit. It's the only way to be sure." - Corporal Hicks, in "Aliens"
PATCH v2 3/6 FDT: only call boot_get_fdt from generic code
Quoted 6 lines · Wolfgang Denk
Dear John Rigby,
Quoted 3 lines · In message <[email protected]> you wrote:
All arches except nios2 and microblaze call
boot_get_fdtfrombootm_startincommon/cmd_bootm.c.
....
Quoted 9 lines
Quoted 8 lines
- ? ? /* find flattened device tree */
- ? ? ret =boot_get_fdt(flag, argc, argv, images,&of_flat_tree,&of_size);
- ? ? if (ret)
- ? ? ? ? ? ? return 1;
+ ? ? /* did generic code already find a device tree? */
+ ? ? if (images->ft_len)
+ ? ? ? ? ? ?of_flat_tree=images->ft_addr;
?#endif
Quoted 3 lines
So what if the generic code did NOT find a device tree?
Before, there was an error return. And now?
I'll fix this.
Quoted 8 lines
Quoted 6 lines
- ? ? /* find flattened device tree */
- ? ? if (boot_get_fdt(flag, argc, argv, images, &of_flat_tree, &of_size))
- ? ? ? ? ? ? return 1;
+ ? ? /* did generic code already find a device tree? */
+ ? ? if (images->ft_len)
+ ? ? ? ? ? ?of_flat_tree=images->ft_addr;Ditto.
And this.
Quoted 3 lines
On which nios2 and microblaze has this been tested?
It hasn't that is why the custodians were CC'd.
Quoted 2 lines
You may want to put the NIOS and MB custodians on Cc:
I just checked my original message. They were CC'd unless I am very confused.
Thanks,
John
PATCH v2 3/6 FDT: only call boot_get_fdt from generic code
Dear John Rigby,
Quoted 3 lines · In message <[email protected]> you…
Quoted 2 lines
You may want to put the NIOS and MB custodians on Cc:
I just checked my original message. They were CC'd unless I am very confused.
We really have to find out when and why the list server is playing such tricks on us :-(
Sorry for the noise, then.
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Here is an Appalachian version of management's answer to those who are concerned with the fate of the project: "Don't worry about the mule. Just load the wagon." - Mike Dennison's hillbilly uncle
PATCH v2 4/6 boot: change some arch ifdefs to feature ifdefs
In reply to John RigbyThe routines boot_ramdisk_high, boot_get_cmdline and boot_get_kbd are currently enabled by various combinations of CONFIG_M68K, CONFIG_POWERPC and CONFIG_SPARC.
Use CONFIG_<FEATURE> defines instead.
CONFIG_BOOT_RAMDISK_HIGHCONFIG_BOOT_GET_CMDLINECONFIG_BOOT_GET_KBD
Define these as appropriate in arch/include/asm/config.h files.
--- arch/m68k/include/asm/config.h | 3 +++ arch/powerpc/include/asm/config.h | 3 +++ arch/sparc/include/asm/config.h | 1 + common/cmd_bootm.c | 2 +- common/image.c | 10 ++++++---- include/image.h | 9 ++++++--- 6 files changed, 20 insertions(+), 8 deletions(-)
arch/m68k/include/asm/config.h +3 -0
@@ -22,5 +22,8 @@#define _ASM_CONFIG_H_#define CONFIG_LMB +#define CONFIG_BOOT_RAMDISK_HIGH +#define CONFIG_BOOT_GET_CMDLINE +#define CONFIG_BOOT_GET_KBD #endif
arch/powerpc/include/asm/config.h +3 -0
@@ -22,6 +22,9 @@#define _ASM_CONFIG_H_#define CONFIG_LMB +#define CONFIG_BOOT_RAMDISK_HIGH +#define CONFIG_BOOT_GET_CMDLINE +#define CONFIG_BOOT_GET_KBD #ifndef CONFIG_MAX_MEM_MAPPED #if defined(CONFIG_4xx) || defined(CONFIG_E500 ) || defined(CONFIG_MPC86xx)
arch/sparc/include/asm/config.h +1 -0
@@ -22,5 +22,6 @@#define _ASM_CONFIG_H_#define CONFIG_LMB +#define CONFIG_BOOT_RAMDISK_HIGH #endif
common/cmd_bootm.c +1 -1
@@ -528,7 +528,7 @@ int do_bootm_subcommand (cmd_tbl_t *cmdtp, int flag, int argc, char * const argvlmb_reserve (&images.lmb, images.os.load, (load_end - images.os.load));break ; -#if defined(CONFIG_PPC ) || defined(CONFIG_M68K ) || defined(CONFIG_SPARC ) +#ifdef CONFIG_BOOT_RAMDISK_HIGH case BOOTM_STATE_RAMDISK : {ulong rd_len = images.rd_end - images.rd_start;
common/image.c +6 -4
@@ -992,7 +992,7 @@ int boot_get_ramdisk (int argc, char * const argv[], bootm_headers_t *images,return 0 ; } -#if defined(CONFIG_PPC ) || defined(CONFIG_M68K ) || defined(CONFIG_SPARC ) +#ifdef CONFIG_BOOT_RAMDISK_HIGH /** * boot_ramdisk_high - relocate init ramdisk * @lmb: pointer to lmb handle, will be used for memory mgmt
@@ -1081,7 +1081,7 @@ int boot_ramdisk_high (struct lmb *lmb, ulong rd_data, ulong rd_len, error: return -1; } -#endif /* defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_SPARC) */ +#endif /* CONFIG_BOOT_RAMDISK_HIGH */ #ifdef CONFIG_OF_LIBFDT static void fdt_error (const char *msg)
@@ -1588,7 +1588,7 @@ error: }#endif /* CONFIG_OF_LIBFDT */ -#if defined(CONFIG_PPC ) || defined(CONFIG_M68K ) +#ifdef CONFIG_BOOT_GET_CMDLINE /** * boot_get_cmdline - allocate and initialize kernel cmdline * @lmb: pointer to lmb handle, will be used for memory mgmt
@@ -1630,7 +1630,9 @@ int boot_get_cmdline (struct lmb *lmb, ulong *cmd_start, ulong *cmd_end, return 0; } +#endif /* CONFIG_BOOT_GET_CMDLINE */ +#ifdef CONFIG_BOOT_GET_KBD /** * boot_get_kbd - allocate and initialize kernel copy of board info * @lmb: pointer to lmb handle, will be used for memory mgmt
@@ -1663,7 +1665,7 @@ int boot_get_kbd (struct lmb *lmb, bd_t **kbd, ulong bootmap_base)return 0 ; } -#endif /* CONFIG_PPC || CONFIG_M68K */ +#endif /* CONFIG_BOOT_GET_KBD */ #endif /* !USE_HOSTCC */ #if defined(CONFIG_FIT )
include/image.h +6 -3
@@ -340,14 +340,17 @@ int boot_relocate_fdt (struct lmb *lmb, ulong bootmap_base, char **of_flat_tree, ulong *of_size);#endif -#if defined(CONFIG_PPC ) || defined(CONFIG_M68K ) +#ifdef CONFIG_BOOT_RAMDISK_HIGH int boot_ramdisk_high (struct lmb *lmb,ulong rd_data,ulong rd_len,ulong *initrd_start,ulong *initrd_end); - +#endif /* CONFIG_BOOT_RAMDISK_HIGH */ +#ifdef CONFIG_BOOT_GET_CMDLINE int boot_get_cmdline (struct lmb *lmb,ulong *cmd_start,ulong *cmd_end,ulong bootmap_base); +#endif /* CONFIG_BOOT_GET_CMDLINE */ +#ifdef CONFIG_BOOT_GET_KBD int boot_get_kbd (struct lmb *lmb,bd_t **kbd,ulong bootmap_base); -#endif /* CONFIG_PPC || CONFIG_M68K */ +#endif /* CONFIG_BOOT_GET_KBD */ #endif /* !USE_HOSTCC */ /*******************************************************************/
Signature · 1 line
1.7.0.4
PATCH v2 4/6 boot: change some arch ifdefs to feature ifdefs
Dear John Rigby,
Quoted 11 lines · In message <[email protected]> you wrote:
The routines
boot_ramdisk_high,boot_get_cmdlineandboot_get_kbdare currently enabled by various combinations ofCONFIG_M68K,CONFIG_POWERPCandCONFIG_SPARC.Use CONFIG_<FEATURE> defines instead.
CONFIG_BOOT_RAMDISK_HIGHCONFIG_BOOT_GET_CMDLINECONFIG_BOOT_GET_KBDDefine these as appropriate in
arch/include/asm/config.hfiles.
No. CONFIG_ means user coinfigurable options; these are not actually configurable on a per-board base by the end user, so CONFIG_SYS_ should be used.
Quoted 9 lines
Signed-off-by John Rigby <[email protected]>--- arch/m68k/include/asm/config.h | 3 +++ arch/powerpc/include/asm/config.h | 3 +++ arch/sparc/include/asm/config.h | 1 + common/cmd_bootm.c | 2 +- common/image.c | 10 ++++++---- include/image.h | 9 ++++++--- 6 files changed, 20 insertions(+), 8 deletions(-)
Also, the new variables need to be documented in the README.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de He's dead, Jim -- McCoy, "The Devil in the Dark", stardate 3196.1
PATCH v2 4/6 boot: change some arch ifdefs to feature ifdefs
Quoted 13 lines · Wolfgang Denk
Dear John Rigby,
Quoted 10 lines · In message <[email protected]> you wrote:
The routines
boot_ramdisk_high,boot_get_cmdlineandboot_get_kbdare currently enabled by various combinations ofCONFIG_M68K,CONFIG_POWERPCandCONFIG_SPARC.Use CONFIG_<FEATURE> defines instead.
CONFIG_BOOT_RAMDISK_HIGHCONFIG_BOOT_GET_CMDLINECONFIG_BOOT_GET_KBD
Quoted 5 lines
Quoted 1 line
Define these as appropriate in
arch/include/asm/config.hfiles.No.
CONFIG_means user coinfigurable options; these are not actually configurable on a per-board base by the end user, soCONFIG_SYS_should be used.
I will change these to CONFIG_SYS_ and document them in README.
PATCH v2 5/6 ARM: add flat device tree support
In reply to John RigbyBased on other architectures already supported.
--- arch/arm/include/asm/config.h | 2 + arch/arm/lib/bootm.c | 137 ++++++++++++++++++++++++++++++++++++----- common/image.c | 2 + 3 files changed, 125 insertions(+), 16 deletions(-)
arch/arm/include/asm/config.h +2 -0
@@ -25,4 +25,6 @@/* Relocation to SDRAM works on all ARM boards */ #define CONFIG_RELOC_FIXUP_WORKS #endif +#define CONFIG_LMB +#define CONFIG_BOOT_RAMDISK_HIGH #endif
arch/arm/lib/bootm.c +121 -16
186 lines not on this page · raw message
common/image.c +2 -0
@@ -1214,9 +1214,11 @@ int boot_relocate_fdt (struct lmb *lmb, ulong bootmap_base,if (fdt_blob < (char *)bootmap_base) relocate =1 ; +#ifdef CONFIG_SYS_BOOTMAPSZ if ((fdt_blob + *of_size +CONFIG_SYS_FDT_PAD ) >= ((char *)CONFIG_SYS_BOOTMAPSZ + bootmap_base)) relocate =1 ; +#endif /* move flattend device tree if needed */ if (relocate) {
Signature · 1 line
1.7.0.4
PATCH v2 5/6 ARM: add flat device tree support
Quoted 3 lines · John Rigby
Based on other architectures already supported.
Signed-off-by John Rigby <[email protected]>
PATCH v2 5/6 ARM: add flat device tree support
In reply to John RigbyDear John Rigby,
Quoted 14 lines · In message <[email protected]> you wrote:
Based on other architectures already supported.
Signed-off-by John Rigby <[email protected]>--- arch/arm/include/asm/config.h | 2 + arch/arm/lib/bootm.c | 137 ++++++++++++++++++++++++++++++++++++----- common/image.c | 2 + 3 files changed, 125 insertions(+), 16 deletions(-)arch/arm/include/asm/config.h +0
-0
arch/arm/include/asm/config.h line 30
Quoted 6 lines
arch/arm/include/asm/config.h +2
-0@@ -25,4 +25,6 @@/* Relocation to SDRAM works on all ARM boards */ #define CONFIG_RELOC_FIXUP_WORKS #endif +#define CONFIG_LMB +#define CONFIG_BOOT_RAMDISK_HIGH #endif
These should be CONFIG_SYS_ instead.
common/image.c int boot_relocate_fdt (struct lmb *lmb, ulong bootmap_base, · line 1221
Quoted 13 lines
common/image.c +2
-0@@ -1214,9 +1214,11 @@ int boot_relocate_fdt (struct lmb *lmb, ulong bootmap_base,if (fdt_blob < (char *)bootmap_base) relocate =1 ; +#ifdef CONFIG_SYS_BOOTMAPSZ if ((fdt_blob + *of_size +CONFIG_SYS_FDT_PAD ) >= ((char *)CONFIG_SYS_BOOTMAPSZ + bootmap_base)) relocate =1 ; +#endif
What is the impact of this on other architectures?
On which systems / architectures has this been tested?
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
I wish I had a bronze torc for every user who didn't read the manual.
- Terry Pratchett, _The Light Fantastic_PATCH v2 5/6 ARM: add flat device tree support
Quoted 12 lines · Wolfgang Denk
Dear John Rigby,
Quoted 9 lines · In message <[email protected]> you wrote:
Based on other architectures already supported.
Signed-off-by John Rigby <[email protected]>---
?arch/arm/include/asm/config.h | ? ?2 + ?arch/arm/lib/bootm.c ? ? ? ? ?| ?137 ++++++++++++++++++++++++++++++++++++----- ?common/image.c ? ? ? ? ? ? ? ?| ? ?2 +?3 files changed, 125 insertions(+), 16 deletions(-)
Quoted 13 lines
Quoted 11 lines
arch/arm/include/asm/config.h +0
-0@@ -25,4 +25,6 @@?/* Relocation to SDRAM works on all ARM boards */ ?#define
CONFIG_RELOC_FIXUP_WORKS
?#endifarch/arm/include/asm/config.h +2
-0+#define CONFIG_LMB +#define CONFIG_BOOT_RAMDISK_HIGH ?#endif
These should be
CONFIG_SYS_instead.
These are not new. Do you want me to submit a patch changing all existing instances to CONFIG_SYS_*?
Quoted 10 lines
Quoted 10 lines
common/image.c +0
-0@@ -1214,9 +1214,11 @@ int boot_relocate_fdt (struct lmb *lmb, ulong bootmap_base, ? ? ? if (fdt_blob < (char *)bootmap_base) ? ? ? ? ? ? ? relocate = 1;
Quoted 7 lines
Quoted 5 lines
common/image.c +1
-0+#ifdef CONFIG_SYS_BOOTMAPSZ ? ? ? if ((
fdt_blob+*of_size+CONFIG_SYS_FDT_PAD) >=
? ? ? ? ? ? ? ? ? ? ? ((char *)CONFIG_SYS_BOOTMAPSZ +bootmap_base)) ? ? ? ? ? ? ? relocate = 1;
+#endifWhat is the impact of this on other architectures?
This ifdef is not needed I will remove it. It is an artifact of trying to make the code work without CONFIG_SYS_BOOTMAPSZ which I subsequently abandoned.
Quoted 14 lines
On which systems / architectures has this been tested?
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, ? ? MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de I wish I had a bronze torc for every user who didn't read the manual. ? ? ? ? ? ? ? ? ? ? ? ? ? ? - Terry Pratchett,_TheLightFantastic_
PATCH v2 5/6 ARM: add flat device tree support
Dear John Rigby,
Quoted 13 lines · In message <[email protected]> you…
Quoted 13 lines
arch/arm/include/asm/config.h line 30
Quoted 11 lines
index 4e8dfd7..d85a396 100644
arch/arm/include/asm/config.h +2
-0@@ -25,4 +25,6 @@/* Relocation to SDRAM works on all ARM boards */ #define CONFIG_RELOC_FIXUP_WORKS #endif +#define CONFIG_LMB +#define CONFIG_BOOT_RAMDISK_HIGH #endif These should be
CONFIG_SYS_instead.
Quoted 2 lines
These are not new. Do you want me to submit a patch changing all existing instances to CONFIG_SYS_*?
Not new? I must be missing something then. I cannot find any reference to CONFIG_BOOT_RAMDISK_HIGH anywhere in the current code.
CONFIG_LMB is indeed not new, but a misnomer that should by fixed. Also, an explanation should be added to the README. [I am aware that this is not a fault of your patch.]
CONFIG_RELOC_FIXUP_WORKS is also a misnomer now, and undocumented :-(
Quoted 1 line
Quoted 1 line
On which systems / architectures has this been tested?
Please make sure to proovide such information, it _is_ important.
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Celestial navigation is based on the premise that the Earth is the center of the universe. The premise is wrong, but the navigation works. An incorrect model can be a useful tool. - Kelvin Throop III
PATCH v2 6/6 ARM: enable device tree for beagle
In reply to John RigbyFor testing ARM device tree support
--- include/configs/omap3_beagle.h | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
include/configs/omap3_beagle.h +9 -0
@@ -55,6 +55,15 @@#undef CONFIG_USE_IRQ/* no support for IRQs */ #define CONFIG_MISC_INIT_R +#define CONFIG_OF_LIBFDT 1 +/* +* The early kernel mapping on ARM currently only maps from the base of DRAM +* to the end of the kernel image. The kernel is loaded at DRAM base + 0x8000. +* The early kernel pagetable uses DRAM base + 0x4000 to DRAM base + 0x8000, +* so that leaves DRAM base to DRAM base + 0x4000 available. +*/ +#define CONFIG_SYS_BOOTMAPSZ 0x4000 +#define CONFIG_CMDLINE_TAG 1/* enable passing of ATAGs */ #define CONFIG_SETUP_MEMORY_TAGS 1#define CONFIG_INITRD_TAG 1
Signature · 1 line
1.7.0.4
v2 cover Add ARM flat device tree support
In reply to John RigbyThere have been no NACK's to this and one Tested-by, so can this series go into 2010.12?
Thanks,
John
Quoted 38 lines · John Rigby
This is the third submission of this patch series. ?The first was an RFC and I received lots of comments that I addressed in the second for which I got no feedback.
This version fixes some issues I found in testing on a hacked Beagle kernel with enough device tree functionality to verify that u-boot is able to pass a device tree.
Patch summary:
?1-4 are fixes/clean up to existing code
?3 needs testing on nios and microblaze
?5 actually adds the ARM FDT support
?6 enables FDT support foromap3_beagleJohn Rigby (6):
?fdt_relocate: fix fdt size and endian bugs ?FDT: Add fixup support for multiple banks of memory ?FDT: only callboot_get_fdtfrom generic code ?boot: change some arch ifdefs to feature ifdefs ?ARM: add flat device tree support
?ARM: enable device tree for beagle?arch/arm/include/asm/config.h ? ? | ? ?2 + ?arch/arm/lib/bootm.c ? ? ? ? ? ? ?| ?137 ++++++++++++++++++++++++++++++++---- ?arch/m68k/include/asm/config.h ? ?| ? ?3 + ?arch/microblaze/lib/bootm.c ? ? ? | ? 12 +--- ?arch/nios2/lib/bootm.c ? ? ? ? ? ?| ? ?8 +-- ?arch/powerpc/include/asm/config.h | ? ?3 + ?arch/sparc/include/asm/config.h ? | ? ?1 + ?common/cmd_bootm.c ? ? ? ? ? ? ? ?| ? ?4 +- ?common/fdt_support.c ? ? ? ? ? ? ?| ? 86 ++++++++++++----------- ?common/image.c ? ? ? ? ? ? ? ? ? ?| ? 18 +++-- ?include/configs/omap3_beagle.h ? ?| ? ?9 +++ ?include/fdt_support.h ? ? ? ? ? ? | ? ?1 + ?include/image.h ? ? ? ? ? ? ? ? ? | ? ?9 ++-?13 files changed, 210 insertions(+), 83 deletions(-)
v2 cover Add ARM flat device tree support
Quoted 6 lines · John Rigby
There have been no NACK's to this and one Tested-by, so can this series go into 2010.12?
Thanks,
John
Apologies in advance for the top post.
v2 cover Add ARM flat device tree support
In reply to John RigbyDear John Rigby,
Quoted 2 lines · In message <[email protected]> you…
There have been no NACK's to this and one Tested-by, so can this series go into 2010.12?
Sure. Sorry, I'm late with ARM related stuff, but your patches are on my list.
Best regards,
Wolfgang Denk
Signature · 7 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "No one talks peace unless he's ready to back it up with war." "He talks of peace if it is the only way to live." -- Colonel Green and Surak of Vulcan, "The Savage Curtain", stardate 5906.5.
v3 cover Add ARM flat device tree support
In reply to John RigbyThis new v3 series attempts to address all feedback received regarding v2.
Patch 1/7 and 2/7 (old 1/6) split in two with better commit message to explain what exactly the fixes do. Patch 3/7 (old 2/6) added CC to libfdt maintainer.
Patch 4/7 (old 3/6) fixed patch and better commit message and added another CC.
Patch 5/7 (old 4/6) changed the new CONFIG_*'s to CONFIG_SYS_*'s and documented them in README.
Patch 6/7 (old 5/6) Removed redundant ifdef, better commit message. Patch 7/7 (old 6/6) Unchanged.
John Rigby (7):
common/image.c fix length calculation in boot_relocate_fdt common/image.c remove extra calls to be32_to_cpu in boot_get_fdt
FDT: Add fixup support for multiple banks of memory
FDT: only call boot_get_fdt from generic code
boot: change some arch ifdefs to feature ifdefs
ARM: add flat device tree support
ARM: enable device tree for beagle
README | 13 ++++ arch/arm/include/asm/config.h | 2 + arch/arm/lib/bootm.c | 137 ++++++++++++++++++++++++++++++++---- arch/m68k/include/asm/config.h | 3 + arch/microblaze/lib/bootm.c | 14 ++--- arch/nios2/lib/bootm.c | 8 +-- arch/powerpc/include/asm/config.h | 3 + arch/sparc/include/asm/config.h | 1 + common/cmd_bootm.c | 6 +- common/fdt_support.c | 86 ++++++++++++----------- common/image.c | 16 +++-- include/configs/omap3_beagle.h | 9 +++ include/fdt_support.h | 1 + include/image.h | 9 ++- 14 files changed, 224 insertions(+), 84 deletions(-)
v3 cover Add ARM flat device tree support
Dear John Rigby,
Quoted 12 lines · In message <[email protected]> you wrote:
This new v3 series attempts to address all feedback received regarding v2.
Patch 1/7 and 2/7 (old 1/6) split in two with better commit message to explain what exactly the fixes do. Patch 3/7 (old 2/6) added CC to libfdt maintainer.
Patch 4/7 (old 3/6) fixed patch and better commit message and added another CC.
Patch 5/7 (old 4/6) changed the new CONFIG_*'s to CONFIG_SYS_*'s and documented them in README.
Patch 6/7 (old 5/6) Removed redundant ifdef, better commit message. Patch 7/7 (old 6/6) Unchanged.
Plase check and confirm if my understanding of this series is correct:
Patch 1/7 and 2/7 affect generic code and go through me.
Patch 3/7 affects FDT code and goes through Gerry (or Gerry AKC's and
tells me to pull it directly as part of the series).
Patch 4/7 affects generic code, plus NIOS2 and MicroBlace specific
parts; it goes through me but needs ACKs from Scott McNutt and Michal Simek
Patch 5/7 affects generic code and goes through me.
Patch 6/7 and 7/7 affect ARM code and go through the ARM custodian
(which happens to be me ATM).
Is this understanding correct? So you need the ACKs from Scott,
Michal, and Gerry...
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "I've finally learned what `upward compatible' means. It means we get to keep all our old mistakes." - Dennie van Tassel
v3 cover Add ARM flat device tree support
Quoted 27 lines · Wolfgang Denk
Dear John Rigby,
Quoted 12 lines · In message <[email protected]> you wrote:
This new v3 series attempts to address all feedback received regarding v2.
Patch 1/7 and 2/7 (old 1/6) split in two with better commit message to explain what exactly the fixes do. Patch 3/7 (old 2/6) added CC to libfdt maintainer.
Patch 4/7 (old 3/6) fixed patch and better commit message and added another CC.
Patch 5/7 (old 4/6) changed the new CONFIG_*'s to CONFIG_SYS_*'s and documented them in README.
Patch 6/7 (old 5/6) Removed redundant ifdef, better commit message. Patch 7/7 (old 6/6) Unchanged.Plase check and confirm if my understanding of this series is correct:
Patch 1/7 and 2/7 affect generic code and go through me.
Patch 3/7 affects FDT code and goes through Gerry (or Gerry AKC's and ? ? ? ?tells me to pull it directly as part of the series).
Patch 4/7 affects generic code, plus NIOS2 and MicroBlace specific ? ? ? ?parts; it goes through me but needs ACKs from Scott McNutt and ? ? ? ?Michal Simek
Quoted 9 lines
Patch 5/7 affects generic code and goes through me.
Patch 6/7 and 7/7 affect ARM code and go through the ARM custodian ? ? ? ?(which happens to be me ATM).
Is this understanding correct? ? So you need the ACKs from Scott, Michal, and Gerry...
Yes I believe this is correct.
Thanks,
John
v3 cover Add ARM flat device tree support
In reply to Wolfgang DenkDear John, Wolfgang,
The patch 4/7 looks good to me and runs on my MPC8360EMDS board (acked below). Wolfgang, if you would pull this directly, I would appreciate it.
Quoted 16 lines · Wolfgang Denk
Dear John Rigby,
Quoted 12 lines · In message<[email protected]> you wrote:
This new v3 series attempts to address all feedback received regarding v2.
Patch 1/7 and 2/7 (old 1/6) split in two with better commit message to explain what exactly the fixes do. Patch 3/7 (old 2/6) added CC to libfdt maintainer.
Patch 4/7 (old 3/6) fixed patch and better commit message and added another CC.
Patch 5/7 (old 4/6) changed the new CONFIG_*'s to CONFIG_SYS_*'s and documented them in README.
Patch 6/7 (old 5/6) Removed redundant ifdef, better commit message. Patch 7/7 (old 6/6) Unchanged.
Quoted 6 lines
Plase check and confirm if my understanding of this series is correct:
Patch 1/7 and 2/7 affect generic code and go through me.
Patch 3/7 affects FDT code and goes through Gerry (or Gerry AKC's and
tells me to pull it directly as part of the series).
[snip]
Quoted 6 lines
Is this understanding correct? So you need the ACKs from Scott,
Michal, and Gerry...Best regards,
Wolfgang Denk
Best regards,
gvb
PATCH v3 1/7 common/image.c fix length calculation in boot_relocate_fdt
In reply to John Rigbyboot_relocate_fdt is called on platforms with CONFIG_SYS_BOOTMAPSZ defined to relocate the device tree blob to be inside the boot map area between bootmap_base and bootmap_base+CONFIG_SYS_BOOTMAPSZ.
For the case where the blob needs to be relocated, space is allocated inside the bootmap by calling lmb_alloc_base with size passed in plus some padding:
of_len = *of_size + CONFIG_SYS_FDT_PAD;
For the case where the blob is already inside the bounds of the boot map area, lmb_reserve is called to reserve the the space where the blob is already residing. The calculation for this case is currently:
of_len = (CONFIG_SYS_BOOTMAPSZ + bootmap_base) - (ulong)fdt_blob;
This is wrong because it reserves all the space in the boot map area from the blob to the end ignoring completely the actual size. The worst case is where the blob is at the beginning and the entire boot map area get reserved. Fix this by changing the length calculation to this:
of_len = *of_size + CONFIG_SYS_FDT_PAD;
This bug has likely never manifested itself because bootm has never been called with the fdt blob already in the bootmap area. In my testing on an OMAP3 beagle board I initially worked around the bug by simply moving the initial location of the fdt blob. I have tested with the new calculation with the fdt blob both inside and outside the boot map area.
--- common/image.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
common/image.c +1 -1
@@ -1252,7 +1252,7 @@ int boot_relocate_fdt (struct lmb *lmb, ulong bootmap_base, *of_size = of_len; }else { *of_flat_tree = fdt_blob; - of_len = (CONFIG_SYS_BOOTMAPSZ + bootmap_base) - (ulong )fdt_blob; + of_len = *of_size +CONFIG_SYS_FDT_PAD ;lmb_reserve (lmb, (ulong )fdt_blob, of_len);fdt_set_totalsize (*of_flat_tree, of_len);
Signature · 1 line
1.7.1
PATCH v3 1/7 common/image.c fix length calculation in boot_relocate_fdt
Dear John Rigby,
Quoted 30 lines · In message <[email protected]> you wrote:
boot_relocate_fdtis called on platforms withCONFIG_SYS_BOOTMAPSZdefined to relocate the device tree blob to be inside the boot map area betweenbootmap_baseand bootmap_base+CONFIG_SYS_BOOTMAPSZ.For the case where the blob needs to be relocated, space is allocated inside the bootmap by calling
lmb_alloc_basewith size passed in plus some padding:of_len = *of_size + CONFIG_SYS_FDT_PAD;For the case where the blob is already inside the bounds of the boot map area,
lmb_reserveis called to reserve the the space where the blob is already residing. The calculation for this case is currently:of_len = (CONFIG_SYS_BOOTMAPSZ + bootmap_base) - (ulong)fdt_blob;This is wrong because it reserves all the space in the boot map area from the blob to the end ignoring completely the actual size. The worst case is where the blob is at the beginning and the entire boot map area get reserved. Fix this by changing the length calculation to this:
of_len = *of_size + CONFIG_SYS_FDT_PAD;This bug has likely never manifested itself because bootm has never been called with the fdt blob already in the bootmap area. In my testing on an OMAP3 beagle board I initially worked around the bug by simply moving the initial location of the fdt blob. I have tested with the new calculation with the fdt blob both inside and outside the boot map area.
Quoted 4 lines
Signed-off-by John Rigby <[email protected]>--- common/image.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Applied to u-boot-arm, thanks.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de An expert is a person who avoids the small errors while sweeping on to the grand fallacy.
PATCH v3 2/7 common/image.c remove extra calls to be32_to_cpu in boot_get_fdt
In reply to John Rigbyfdt_totalsize returns size in cpu endian so don't call be32_to_cpu on the result. This was harmless on big endian platforms but not on little endian ARMs.
--- common/image.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
common/image.c +2 -2
@@ -1561,7 +1561,7 @@ int boot_get_fdt (int flag, int argc, char * const argv[], bootm_headers_t *imag goto error; } -if (be32_to_cpu (fdt_totalsize (fdt_blob)) != fdt_len) { +if (fdt_totalsize (fdt_blob) != fdt_len) {fdt_error ("fdt size != image size" ); goto error; }
@@ -1575,7 +1575,7 @@ int boot_get_fdt (int flag, int argc, char * const argv[], bootm_headers_t *imag } *of_flat_tree = fdt_blob; - *of_size =be32_to_cpu (fdt_totalsize (fdt_blob)); + *of_size =fdt_totalsize (fdt_blob);debug (" of_flat_tree at 0x%08lx size 0x%08lx\n" , (ulong)*of_flat_tree, *of_size);
Signature · 1 line
1.7.1
PATCH v3 2/7 common/image.c remove extra calls to be32_to_cpu in boot_get_fdt
Dear John Rigby,
Quoted 8 lines · In message <[email protected]> you wrote:
fdt_totalsizereturns size in cpu endian so don't callbe32_to_cpuon the result. This was harmless on big endian platforms but not on little endian ARMs.Signed-off-by John Rigby <[email protected]>--- common/image.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
Applied to u-boot-arm, thanks.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de [Braddock:] Mr. Churchill, you are drunk. [Churchill:] And you madam, are ugly. But I shall be sober tomorrow.
PATCH v3 3/7 FDT: Add fixup support for multiple banks of memory
In reply to John RigbyAdd fdt_fixup_memory_banks and reimplement fdt_fixup_memory using it. Tested on OMAP3 beagle board with two banks of memory.
--- common/fdt_support.c | 86 ++++++++++++++++++++++++++----------------------- include/fdt_support.h | 1 + 2 files changed, 47 insertions(+), 40 deletions(-)
common/fdt_support.c +46 -40
@@ -362,10 +362,40 @@ void do_fixup_by_compat_u32(void *fdt, const char *compat,do_fixup_by_compat (fdt, compat, prop, &val,4 , create); } -int fdt_fixup_memory (void *blob,u64 start,u64 size) +/* +* 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 u32 *cell; + + cell =fdt_getprop (blob,0 , nr_cells_name,NULL ); +if (cell && *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 err, nodeoffset, len =0 ; -u8 tmp[16 ]; +int shift = (size -1 ) *8 ; +while (size-- >0 ) { + *addr++ = (val >> shift) &0xff ; + shift -=8 ; + } +} + +int fdt_fixup_memory_banks (void *blob,u64 start[],u64 size[],int banks) +{ +int err, nodeoffset; +int addr_cell_len, size_cell_len, len; +u8 tmp[banks *8 ]; +int bank;const u32 *addrcell, *sizecell; err =fdt_check_header (blob);
@@ -391,44 +421,15 @@ int fdt_fixup_memory(void *blob, u64 start, u64 size)return err; } - addrcell =fdt_getprop (blob,0 ,"#address-cells" ,NULL ); -/* use shifts and mask to ensure endianness */ -if ((addrcell) && (*addrcell ==2 )) { - tmp[0 ] = (start >>56 ) &0xff ; - tmp[1 ] = (start >>48 ) &0xff ; - tmp[2 ] = (start >>40 ) &0xff ; - tmp[3 ] = (start >>32 ) &0xff ; - tmp[4 ] = (start >>24 ) &0xff ; - tmp[5 ] = (start >>16 ) &0xff ; - tmp[6 ] = (start >>8 ) &0xff ; - tmp[7 ] = (start ) &0xff ; - len =8 ; - }else { - tmp[0 ] = (start >>24 ) &0xff ; - tmp[1 ] = (start >>16 ) &0xff ; - tmp[2 ] = (start >>8 ) &0xff ; - tmp[3 ] = (start ) &0xff ; - len =4 ; - } + addr_cell_len =get_cells_len (blob,"#address-cells" ); + size_cell_len =get_cells_len (blob,"#size-cells" ); - sizecell =fdt_getprop (blob,0 ,"#size-cells" ,NULL ); -/* use shifts and mask to ensure endianness */ -if ((sizecell) && (*sizecell ==2 )) { - tmp[0 +len] = (size >>56 ) &0xff ; - tmp[1 +len] = (size >>48 ) &0xff ; - tmp[2 +len] = (size >>40 ) &0xff ; - tmp[3 +len] = (size >>32 ) &0xff ; - tmp[4 +len] = (size >>24 ) &0xff ; - tmp[5 +len] = (size >>16 ) &0xff ; - tmp[6 +len] = (size >>8 ) &0xff ; - tmp[7 +len] = (size ) &0xff ; - len +=8 ; - }else { - tmp[0 +len] = (size >>24 ) &0xff ; - tmp[1 +len] = (size >>16 ) &0xff ; - tmp[2 +len] = (size >>8 ) &0xff ; - tmp[3 +len] = (size ) &0xff ; - len +=4 ; +for (bank =0 , len =0 ; bank < banks; bank++) { +write_cell (tmp + len, start[bank], addr_cell_len); + len += addr_cell_len; + +write_cell (tmp + len, size[bank], size_cell_len); + len += size_cell_len; } err =fdt_setprop (blob, nodeoffset,"reg" , tmp, len);
@@ -440,6 +441,11 @@ int fdt_fixup_memory(void *blob, u64 start, u64 size)return 0 ; } +int fdt_fixup_memory (void *blob,u64 start,u64 size) +{ +return fdt_fixup_memory_banks (blob, &start, &size,1 ); +} +void fdt_fixup_ethernet (void *fdt) {int node, i, j;
include/fdt_support.h +1 -0
@@ -48,6 +48,7 @@ void do_fixup_by_compat(void *fdt, const char *compat,void do_fixup_by_compat_u32 (void *fdt,const char *compat,const char *prop,u32 val,int create);int fdt_fixup_memory (void *blob,u64 start,u64 size); +int fdt_fixup_memory_banks (void *blob,u64 start[],u64 size[],int banks);void fdt_fixup_ethernet (void *fdt);int fdt_find_and_setprop (void *fdt,const char *node,const char *prop,const void *val,int len,int create);
Signature · 1 line
1.7.1
PATCH v3 3/7 FDT: Add fixup support for multiple banks of memory
Dear John Rigby,
Quoted 10 lines · In message <[email protected]> you wrote:
Add
fdt_fixup_memory_banksand reimplementfdt_fixup_memoryusing it. Tested on OMAP3 beagle board with two banks of memory.Signed-off-by John Rigby <[email protected]>CC Jerry Van Baren <[email protected]>--- common/fdt_support.c | 86 ++++++++++++++++++++++++++----------------------- include/fdt_support.h | 1 + 2 files changed, 47 insertions(+), 40 deletions(-)
Applied to u-boot-arm, thanks.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Speculation is always more interesting than facts.
- Terry Pratchett, _Making_Money_PATCH 1/1 common/fdt_support.c: Fix compile warnings
In reply to John RigbyCommit a6bd9e8 "FDT: Add fixup support for multiple banks of memory" removed code but forgot to remove the variables used by it, resulting in warnings:
fdt_support.c: In function 'fdt_fixup_memory_banks':
fdt_support.c:399: warning: unused variable 'sizecell' fdt_support.c:399: warning: unused variable 'addrcell'
Remove the declarations, too.
--- common/fdt_support.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
common/fdt_support.c +0 -1
@@ -396,7 +396,6 @@ int fdt_fixup_memory_banks(void *blob, u64 start[], u64 size[], int banks)int addr_cell_len, size_cell_len, len;u8 tmp[banks *8 ];int bank; -const u32 *addrcell, *sizecell; err =fdt_check_header (blob);if (err <0 ) {
Signature · 1 line
1.7.2.3
PATCH v3 4/7 FDT: only call boot_get_fdt from generic code
In reply to John RigbyAll arches except nios2 and microblaze call boot_get_fdt from bootm_start in common/cmd_bootm.c.
Having nios2 and microblaze do so as well removes code from their respective do_bootm_linux routines and allows removal of a nasty ifdef from bootm_start.
In the case where boot_get_fdt returns an error bootm_start returns and the platform specific do_bootm_linux routines will never get called.
Also only check argv[3] for an fdt addr if argc > 3 first. This is already the case for nios2.
--- arch/microblaze/lib/bootm.c | 14 +++++--------- arch/nios2/lib/bootm.c | 8 +++----- common/cmd_bootm.c | 2 -- 3 files changed, 8 insertions(+), 16 deletions(-)
arch/microblaze/lib/bootm.c +5 -9
@@ -46,12 +46,9 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *imachar *of_flat_tree =NULL ;#if defined(CONFIG_OF_LIBFDT ) -ulong of_size =0 ; - -/* find flattened device tree */ - ret =boot_get_fdt (flag, argc, argv, images, &of_flat_tree, &of_size); -if (ret) -return 1 ; +/* did generic code already find a device tree? */ +if (images->ft_len) + of_flat_tree = images->ft_addr;#endif theKernel = (void (*)(char *,ulong ,ulong ))images->ep;
@@ -64,9 +61,8 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *imashow_boot_progress (15 ); -if (!(ulong ) of_flat_tree) - of_flat_tree = (char *)simple_strtoul (argv[3 ],NULL ,16 ); - +if (!of_flat_tree && argc >3 ) + of_flat_tree = (char *)simple_strtoul (argv[3 ],NULL ,16 );#ifdef DEBUG printf ("## Transferring control to Linux (at address 0x%08lx) " \ "ramdisk 0x%08lx, FDT 0x%08lx...\n",
arch/nios2/lib/bootm.c +3 -5
@@ -36,11 +36,9 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *imaulong initrd_end = images->rd_end;char *of_flat_tree =NULL ;#if defined(CONFIG_OF_LIBFDT ) -ulong of_size =0 ; - -/* find flattened device tree */ -if (boot_get_fdt (flag, argc, argv, images, &of_flat_tree, &of_size)) -return 1 ; +/* did generic code already find a device tree? */ +if (images->ft_len) + of_flat_tree = images->ft_addr;#endif if (!of_flat_tree && argc >3 ) of_flat_tree = (char *)simple_strtoul (argv[3 ],NULL ,16 );
common/cmd_bootm.c +0 -2
@@ -308,7 +308,6 @@ static int bootm_start(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[] }#if defined(CONFIG_OF_LIBFDT ) -#if defined(CONFIG_PPC ) || defined(CONFIG_M68K ) || defined(CONFIG_SPARC )/* find flattened device tree */ ret =boot_get_fdt (flag, argc, argv, &images, &images.ft_addr, &images.ft_len);
@@ -319,7 +318,6 @@ static int bootm_start(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]set_working_fdt_addr (images.ft_addr);#endif -#endif } images.os.start = (ulong )os_hdr;
Signature · 1 line
1.7.1
Michal Simek
maintainerPATCH v3 4/7 FDT: only call boot_get_fdt from generic code
Quoted 14 lines · John Rigby
All arches except nios2 and microblaze call
boot_get_fdtfrombootm_startincommon/cmd_bootm.c.Having nios2 and microblaze do so as well removes code from their respective
do_bootm_linuxroutines and allows removal of a nasty ifdef frombootm_start.In the case where
boot_get_fdtreturns an errorbootm_startreturns and the platform specificdo_bootm_linuxroutines will never get called.Also only check argv[3] for an fdt addr if argc > 3 first. This is already the case for nios2.
Quoted 6 lines
Signed-off-by John Rigby <[email protected]>CC Scott McNutt <[email protected]>CC Michal Simek <[email protected]>CC Thomas Chou <[email protected]>--- arch/microblaze/lib/bootm.c | 14 +++++---------
Signature · 4 lines
Michal Simek, Ing. (M.Eng) w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/ Microblaze U-BOOT custodian
PATCH v3 4/7 FDT: only call boot_get_fdt from generic code
In reply to John RigbyQuoted 14 lines · John Rigby
All arches except nios2 and microblaze call
boot_get_fdtfrombootm_startincommon/cmd_bootm.c.Having nios2 and microblaze do so as well removes code from their respective
do_bootm_linuxroutines and allows removal of a nasty ifdef frombootm_start.In the case where
boot_get_fdtreturns an errorbootm_startreturns and the platform specificdo_bootm_linuxroutines will never get called.Also only check argv[3] for an fdt addr if argc > 3 first. This is already the case for nios2.
Quoted 6 lines
Signed-off-by John Rigby <[email protected]>CC Scott McNutt <[email protected]>CC Michal Simek <[email protected]>CC Thomas Chou <[email protected]>--- arch/nios2/lib/bootm.c | 8 +++-----
Tested with/without libfdt support on nios2 board.
PATCH v3 4/7 FDT: only call boot_get_fdt from generic code
In reply to John RigbyDear John Rigby,
Quoted 18 lines · In message <[email protected]> you wrote:
All arches except nios2 and microblaze call
boot_get_fdtfrombootm_startincommon/cmd_bootm.c.Having nios2 and microblaze do so as well removes code from their respective
do_bootm_linuxroutines and allows removal of a nasty ifdef frombootm_start.In the case where
boot_get_fdtreturns an errorbootm_startreturns and the platform specificdo_bootm_linuxroutines will never get called.Also only check argv[3] for an fdt addr if argc > 3 first. This is already the case for nios2.
Signed-off-by John Rigby <[email protected]>CC Scott McNutt <[email protected]>CC Michal Simek <[email protected]>CC Thomas Chou <[email protected]>
Quoted 5 lines
--- arch/microblaze/lib/bootm.c | 14 +++++--------- arch/nios2/lib/bootm.c | 8 +++----- common/cmd_bootm.c | 2 -- 3 files changed, 8 insertions(+), 16 deletions(-)
Applied to u-boot-arm, thanks.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de There's no sense in being precise when you don't even know what you're talking about. -- John von Neumann
PATCH v3 5/7 boot: change some arch ifdefs to feature ifdefs
In reply to John RigbyThe routines boot_ramdisk_high, boot_get_cmdline and boot_get_kbd are currently enabled by various combinations of CONFIG_M68K, CONFIG_POWERPC and CONFIG_SPARC.
Use CONFIG_SYS_BOOT_<FEATURE> defines instead.
CONFIG_SYS_BOOT_RAMDISK_HIGHCONFIG_SYS_BOOT_GET_CMDLINECONFIG_SYS_BOOT_GET_KBD
Define these as appropriate in arch/include/asm/config.h files.
--- README | 13 +++++++++++++ arch/m68k/include/asm/config.h | 3 +++ arch/powerpc/include/asm/config.h | 3 +++ arch/sparc/include/asm/config.h | 1 + common/cmd_bootm.c | 4 ++-- common/image.c | 10 ++++++---- include/image.h | 9 ++++++--- 7 files changed, 34 insertions(+), 9 deletions(-)
README +13 -0
@@ -2275,6 +2275,19 @@ Configuration Settings: all data for the Linux kernel must be between "bootm_low" and "bootm_low" + CONFIG_SYS_BOOTMAPSZ. +- CONFIG_SYS_BOOT_RAMDISK_HIGH: + Enable initrd_high functionality. If defined then the + initrd_high feature is enabled and the bootm ramdisk subcommand + is enabled. + +- CONFIG_SYS_BOOT_GET_CMDLINE: + Enables allocating and saving kernel cmdline in space between + "bootm_low" and "bootm_low" + BOOTMAPSZ. + +- CONFIG_SYS_BOOT_GET_KBD: + Enables allocating and saving a kernel copy of the bd_info in + space between "bootm_low" and "bootm_low" + BOOTMAPSZ. + - CONFIG_SYS_MAX_FLASH_BANKS: Max number of Flash memory banks
arch/m68k/include/asm/config.h +3 -0
@@ -22,5 +22,8 @@#define _ASM_CONFIG_H_#define CONFIG_LMB +#define CONFIG_SYS_BOOT_RAMDISK_HIGH +#define CONFIG_SYS_BOOT_GET_CMDLINE +#define CONFIG_SYS_BOOT_GET_KBD #endif
arch/powerpc/include/asm/config.h +3 -0
@@ -22,6 +22,9 @@#define _ASM_CONFIG_H_#define CONFIG_LMB +#define CONFIG_SYS_BOOT_RAMDISK_HIGH +#define CONFIG_SYS_BOOT_GET_CMDLINE +#define CONFIG_SYS_BOOT_GET_KBD #ifndef CONFIG_MAX_MEM_MAPPED #if defined(CONFIG_4xx) || defined(CONFIG_E500 ) || defined(CONFIG_MPC86xx)
arch/sparc/include/asm/config.h +1 -0
@@ -22,5 +22,6 @@#define _ASM_CONFIG_H_#define CONFIG_LMB +#define CONFIG_SYS_BOOT_RAMDISK_HIGH #endif
common/cmd_bootm.c +2 -2
@@ -472,7 +472,7 @@ static int bootm_start_standalone(ulong iflag, int argc, char * const argv[])static cmd_tbl_t cmd_bootm_sub[] = {U_BOOT_CMD_MKENT (start,0 ,1 , (void *)BOOTM_STATE_START ,"" ,"" ),U_BOOT_CMD_MKENT (loados,0 ,1 , (void *)BOOTM_STATE_LOADOS ,"" ,"" ), -#if defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_SPARC) +#ifdef CONFIG_SYS_BOOT_RAMDISK_HIGHU_BOOT_CMD_MKENT (ramdisk,0 ,1 , (void *)BOOTM_STATE_RAMDISK ,"" ,"" ), #endif #ifdef CONFIG_OF_LIBFDT
@@ -528,7 +528,7 @@ int do_bootm_subcommand (cmd_tbl_t *cmdtp, int flag, int argc, char * const argvlmb_reserve (&images.lmb, images.os.load, (load_end - images.os.load));break ; -#if defined(CONFIG_PPC ) || defined(CONFIG_M68K ) || defined(CONFIG_SPARC ) +#ifdef CONFIG_SYS_BOOT_RAMDISK_HIGH case BOOTM_STATE_RAMDISK : {ulong rd_len = images.rd_end - images.rd_start;
common/image.c +6 -4
@@ -992,7 +992,7 @@ int boot_get_ramdisk (int argc, char * const argv[], bootm_headers_t *images,return 0 ; } -#if defined(CONFIG_PPC ) || defined(CONFIG_M68K ) || defined(CONFIG_SPARC ) +#ifdef CONFIG_SYS_BOOT_RAMDISK_HIGH /** * boot_ramdisk_high - relocate init ramdisk * @lmb: pointer to lmb handle, will be used for memory mgmt
@@ -1081,7 +1081,7 @@ int boot_ramdisk_high (struct lmb *lmb, ulong rd_data, ulong rd_len, error: return -1; } -#endif /* defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_SPARC) */ +#endif /* CONFIG_SYS_BOOT_RAMDISK_HIGH */ #ifdef CONFIG_OF_LIBFDT static void fdt_error (const char *msg)
@@ -1588,7 +1588,7 @@ error: }#endif /* CONFIG_OF_LIBFDT */ -#if defined(CONFIG_PPC ) || defined(CONFIG_M68K ) +#ifdef CONFIG_SYS_BOOT_GET_CMDLINE /** * boot_get_cmdline - allocate and initialize kernel cmdline * @lmb: pointer to lmb handle, will be used for memory mgmt
@@ -1630,7 +1630,9 @@ int boot_get_cmdline (struct lmb *lmb, ulong *cmd_start, ulong *cmd_end, return 0; } +#endif /* CONFIG_SYS_BOOT_GET_CMDLINE */ +#ifdef CONFIG_SYS_BOOT_GET_KBD /** * boot_get_kbd - allocate and initialize kernel copy of board info * @lmb: pointer to lmb handle, will be used for memory mgmt
@@ -1663,7 +1665,7 @@ int boot_get_kbd (struct lmb *lmb, bd_t **kbd, ulong bootmap_base)return 0 ; } -#endif /* CONFIG_PPC || CONFIG_M68K */ +#endif /* CONFIG_SYS_BOOT_GET_KBD */ #endif /* !USE_HOSTCC */ #if defined(CONFIG_FIT )
include/image.h +6 -3
@@ -340,14 +340,17 @@ int boot_relocate_fdt (struct lmb *lmb, ulong bootmap_base, char **of_flat_tree, ulong *of_size);#endif -#if defined(CONFIG_PPC ) || defined(CONFIG_M68K ) +#ifdef CONFIG_SYS_BOOT_RAMDISK_HIGH int boot_ramdisk_high (struct lmb *lmb,ulong rd_data,ulong rd_len,ulong *initrd_start,ulong *initrd_end); - +#endif /* CONFIG_SYS_BOOT_RAMDISK_HIGH */ +#ifdef CONFIG_SYS_BOOT_GET_CMDLINE int boot_get_cmdline (struct lmb *lmb,ulong *cmd_start,ulong *cmd_end,ulong bootmap_base); +#endif /* CONFIG_SYS_BOOT_GET_CMDLINE */ +#ifdef CONFIG_SYS_BOOT_GET_KBD int boot_get_kbd (struct lmb *lmb,bd_t **kbd,ulong bootmap_base); -#endif /* CONFIG_PPC || CONFIG_M68K */ +#endif /* CONFIG_SYS_BOOT_GET_KBD */ #endif /* !USE_HOSTCC */ /*******************************************************************/
Signature · 1 line
1.7.1
PATCH v3 5/7 boot: change some arch ifdefs to feature ifdefs
Dear John Rigby,
Quoted 13 lines · In message <[email protected]> you wrote:
The routines
boot_ramdisk_high,boot_get_cmdlineandboot_get_kbdare currently enabled by various combinations ofCONFIG_M68K,CONFIG_POWERPCandCONFIG_SPARC.Use CONFIG_SYS_BOOT_<FEATURE> defines instead.
CONFIG_SYS_BOOT_RAMDISK_HIGHCONFIG_SYS_BOOT_GET_CMDLINECONFIG_SYS_BOOT_GET_KBDDefine these as appropriate in
arch/include/asm/config.hfiles.Signed-off-by John Rigby <[email protected]>
Quoted 9 lines
--- README | 13 +++++++++++++ arch/m68k/include/asm/config.h | 3 +++ arch/powerpc/include/asm/config.h | 3 +++ arch/sparc/include/asm/config.h | 1 + common/cmd_bootm.c | 4 ++-- common/image.c | 10 ++++++---- include/image.h | 9 ++++++--- 7 files changed, 34 insertions(+), 9 deletions(-)
Applied to u-boot-arm, thanks.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de There is a multi-legged creature crawling on your shoulder. -- Spock, "A Taste of Armageddon", stardate 3193.9
PATCH v3 6/7 ARM: add flat device tree support
In reply to John RigbyBased on other architectures already supported. Tested on OMAP3 Beagle board and another unnamed ARM platform.
--- arch/arm/include/asm/config.h | 2 + arch/arm/lib/bootm.c | 137 ++++++++++++++++++++++++++++++++++++----- 2 files changed, 123 insertions(+), 16 deletions(-)
arch/arm/include/asm/config.h +2 -0
@@ -25,4 +25,6 @@/* Relocation to SDRAM works on all ARM boards */ #define CONFIG_RELOC_FIXUP_WORKS #endif +#define CONFIG_LMB +#define CONFIG_SYS_BOOT_RAMDISK_HIGH #endif
arch/arm/lib/bootm.c +121 -16
186 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH v3 6/7 ARM: add flat device tree support
Dear John Rigby,
Quoted 9 lines · In message <[email protected]> you wrote:
Based on other architectures already supported. Tested on OMAP3 Beagle board and another unnamed ARM platform.
Signed-off-by John Rigby <[email protected]>Tested-by Rob Herring <[email protected]>--- arch/arm/include/asm/config.h | 2 + arch/arm/lib/bootm.c | 137 ++++++++++++++++++++++++++++++++++++----- 2 files changed, 123 insertions(+), 16 deletions(-)
Applied to u-boot-arm, thanks.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Disobedience: The silver lining to the cloud of servitude. - Ambrose Bierce
PATCH v3 7/7 ARM: enable device tree for beagle
In reply to John RigbyFor testing ARM device tree support
--- include/configs/omap3_beagle.h | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
include/configs/omap3_beagle.h +9 -0
@@ -55,6 +55,15 @@#undef CONFIG_USE_IRQ/* no support for IRQs */ #define CONFIG_MISC_INIT_R +#define CONFIG_OF_LIBFDT 1 +/* +* The early kernel mapping on ARM currently only maps from the base of DRAM +* to the end of the kernel image. The kernel is loaded at DRAM base + 0x8000. +* The early kernel pagetable uses DRAM base + 0x4000 to DRAM base + 0x8000, +* so that leaves DRAM base to DRAM base + 0x4000 available. +*/ +#define CONFIG_SYS_BOOTMAPSZ 0x4000 +#define CONFIG_CMDLINE_TAG 1/* enable passing of ATAGs */ #define CONFIG_SETUP_MEMORY_TAGS 1#define CONFIG_INITRD_TAG 1
Signature · 1 line
1.7.1
PATCH v3 7/7 ARM: enable device tree for beagle
Dear John Rigby,
Quoted 6 lines · In message <[email protected]> you wrote:
For testing ARM device tree support
Signed-off-by John Rigby <[email protected]>--- include/configs/omap3_beagle.h | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
Applied to u-boot-arm, thanks.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "The one charm of marriage is that it makes a life of deception a neccessity." - Oscar Wilde