Introduce generic pre-relocation board_f.c
Subsystems (4)
PATCH v9 9/31 Introduce generic pre-relocation board_f.c
This file handles common pre-relocation init for boards which use the generic framework.
It starts up the console, DRAM, performs relocation and then jumps to post-relocation init.
---
Changes in v9:
- Rebase x86 global_data patch on top of mainline
Changes in v8: None
Changes in v7: None
Changes in v6:
- Tidy up stack reservation code to separate out ARM
- Fix up ordering of dram init (specifically to get ARM SPL boards to boot)
- Add debug() to show RAM top
- Adjust the way the top of memory is calculated
Changes in v5:
- Add fdtdec header file to board_f.c
- Remove setup_global_data_ptr()
- Tidy up stack init
- Put global data on stack in board_init_f()
- Add fdt relocation
- Remove fdt relocation field from x86 arch_global_data
- Deal with change of board_init_f() semantics on ARM
- Save boot_flags in global_data in board_init_f()
- Add print_cpuinfo() prototype to include/common.h
Changes in v4:
- Use asm/sections.h instead of asm-generic/sections.h
Changes in v3:
- Cast away the volatile on gd for memcpy()
Changes in v2: None
arch/x86/lib/board.c | 2 +- arch/x86/lib/init_helpers.c | 2 +- arch/x86/lib/relocate.c | 8 +- common/Makefile | 3 + common/board_f.c | 579 ++++++++++++++++++++++++++++++++++++++ include/asm-generic/global_data.h | 2 + include/common.h | 1 + 7 files changed, 591 insertions(+), 6 deletions(-) create mode 100644 common/board_f.c
arch/x86/lib/board.c +1 -1
@@ -219,7 +219,7 @@ static void do_init_loop(init_fnc_t **init_fnc_ptr)void board_init_f (ulong boot_flags) { - gd->fdt_blob = gd->arch.new_fdt =NULL ; + gd->fdt_blob = gd->new_fdt =NULL ; gd->flags = boot_flags;do_init_loop (init_sequence_f);
arch/x86/lib/init_helpers.c +1 -1
@@ -111,7 +111,7 @@ int calculate_relocation_address(void)*/ if (gd->fdt_blob) { dest_addr -= fdt_size; - gd->arch.new_fdt = (void *)dest_addr; + gd->new_fdt = (void *)dest_addr; dest_addr &= ~15 ; }#endif
arch/x86/lib/relocate.c +4 -4
@@ -49,15 +49,15 @@ int copy_uboot_to_ram(void)int copy_fdt_to_ram (void ) { -if (gd->arch.new_fdt) { +if (gd->new_fdt) {ulong fdt_size; fdt_size =ALIGN (fdt_totalsize (gd->fdt_blob) +0x1000 ,32 ); -memcpy (gd->arch.new_fdt, gd->fdt_blob, fdt_size); +memcpy (gd->new_fdt, gd->fdt_blob, fdt_size);debug ("Relocated fdt from %p to %p, size %lx\n" , - gd->fdt_blob, gd->arch.new_fdt, fdt_size); - gd->fdt_blob = gd->arch.new_fdt; + gd->fdt_blob, gd->new_fdt, fdt_size); + gd->fdt_blob = gd->new_fdt; }return 0 ;
common/Makefile +3 -0
@@ -36,6 +36,9 @@ COBJS-y += s_record.o COBJS-y += xyzModem.o COBJS-y += cmd_disk.o +# boards +COBJS-$(CONFIG_SYS_GENERIC_BOARD) += board_f.o + # core command COBJS-y += cmd_boot.o COBJS-$(CONFIG_CMD_BOOTM) += cmd_bootm.o
common/board_f.c new file +579 -0
579 lines not on this page · raw message
include/asm-generic/global_data.h +2 -0
@@ -81,6 +81,8 @@ typedef struct global_data {unsigned long reloc_off;struct global_data *new_gd;/* relocated global data */ const void *fdt_blob;/* Our device tree, NULL if none */ +void *new_fdt;/* Relocated FDT */ +unsigned long fdt_size;/* Space reserved for relocated FDT */ void **jt;/* jump table */ char env_buf[32 ];/* buffer for getenv() before reloc. */ struct arch_global_data arch;/* architecture-specific data */
include/common.h +1 -0
@@ -311,6 +311,7 @@ extern ulong monitor_flash_len;int mac_read_from_eeprom (void );extern u8 _binary_dt_dtb_start[];/* embedded device tree blob */ int set_cpu_clk_info (void ); +int print_cpuinfo (void );/** * Show the DRAM size in a board-specific way
Signature · 1 line
1.8.1.3
PATCH v9 13/31 arm: Enable generic board support
This enables generic board support so that ARM boards can define CONFIG_SYS_GENERIC_BOARD.
---
Changes in v9:
- Use !CONFIG instead of nCONFIG
Changes in v8:
- Define __HAVE_ARCH_GENERIC_BOARD in ARM's config.mk
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None
arch/arm/config.mk | 3 +++ arch/arm/include/asm/u-boot.h | 9 +++++++++ arch/arm/lib/Makefile | 3 +++ 3 files changed, 15 insertions(+)
arch/arm/config.mk +3 -0
@@ -31,6 +31,9 @@ CONFIG_STANDALONE_LOAD_ADDR = 0xc100000 endif endif +# Support generic board on ARM +__HAVE_ARCH_GENERIC_BOARD := y + PLATFORM_CPPFLAGS += -DCONFIG_ARM -D__ARM__ # Choose between ARM/Thumb instruction sets
arch/arm/include/asm/u-boot.h +9 -0
@@ -36,6 +36,12 @@ #ifndef _U_BOOT_H_ #define _U_BOOT_H_ 1 +#ifdef CONFIG_SYS_GENERIC_BOARD +/* Use the generic board which requires a unified bd_info */ +#include <asm-generic/u-boot.h> +#else + +#ifndef __ASSEMBLY__ typedef struct bd_info { unsigned int bi_baudrate; /* serial console baudrate */ ulong bi_arch_number; /* unique id for this board */
@@ -49,6 +55,9 @@ typedef struct bd_info {ulong size; } bi_dram[CONFIG_NR_DRAM_BANKS]; } bd_t; +#endif + +#endif /* !CONFIG_SYS_GENERIC_BOARD */ /* For image.h:image_check_target_arch() */ #define IH_ARCH_DEFAULT IH_ARCH_ARM
arch/arm/lib/Makefile +3 -0
@@ -39,7 +39,10 @@ GLCOBJS += div0.o SOBJS-y += crt0.o ifndef CONFIG_SPL_BUILD +ifndef CONFIG_SYS_GENERIC_BOARD COBJS-y += board.o +endif + COBJS-y += bootm.o COBJS-$(CONFIG_SYS_L2_PL310) += cache-pl310.o SOBJS-$(CONFIG_USE_ARCH_MEMSET) += memset.o
Signature · 1 line
1.8.1.3
PATCH v9 17/31 ppc: Enable generic board support
In reply to Simon GlassThis enables generic board support so that ppc boards can define CONFIG_SYS_GENERIC_BOARD.
---
Changes in v9:
- Use !CONFIG instead of nCONFIG
Changes in v8:
- Define __HAVE_ARCH_GENERIC_BOARD in PPC's config.mk
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None
arch/powerpc/config.mk | 3 +++ arch/powerpc/include/asm/u-boot.h | 7 +++++++ arch/powerpc/lib/Makefile | 2 ++ 3 files changed, 12 insertions(+)
arch/powerpc/config.mk +3 -0
@@ -29,6 +29,9 @@ PLATFORM_RELFLAGS += -fpic -mrelocatable -ffunction-sections -fdata-sections PLATFORM_CPPFLAGS += -DCONFIG_PPC -D__powerpc__ PLATFORM_LDFLAGS += -n +# Support generic board on PPC +__HAVE_ARCH_GENERIC_BOARD := y + # # When cross-compiling on NetBSD, we have to define __PPC__ or else we # will pick up a va_list declaration that is incompatible with the
arch/powerpc/include/asm/u-boot.h +7 -0
@@ -34,6 +34,11 @@* include/asm-ppc/u-boot.h */ +#ifdef CONFIG_SYS_GENERIC_BOARD +/* Use the generic board which requires a unified bd_info */ +#include <asm-generic/u-boot.h> +#else + #ifndef __ASSEMBLY__ typedef struct bd_info {
@@ -144,6 +149,8 @@ typedef struct bd_info {#endif /* __ASSEMBLY__ */ +#endif /* !CONFIG_SYS_GENERIC_BOARD */ +/* For image.h:image_check_target_arch() */ #define IH_ARCH_DEFAULT IH_ARCH_PPC
arch/powerpc/lib/Makefile +2 -0
@@ -59,8 +59,10 @@ SOBJS-y += reloc.o COBJS-$(CONFIG_BAT_RW) += bat_rw.o ifndef CONFIG_SPL_BUILD +ifndef CONFIG_SYS_GENERIC_BOARD COBJS-y += board.o endif +endif COBJS-y += bootm.o COBJS-y += cache.o COBJS-y += extable.o
Signature · 1 line
1.8.1.3
PATCH v9 21/31 x86: Enable generic board support
In reply to Simon GlassThis enables generic board support so that x86 boards can define CONFIG_SYS_GENERIC_BOARD.
---
Changes in v9:
- Use !CONFIG instead of nCONFIG
Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5:
- Avoid setting up gd on x86 as it is already done
Changes in v4: None
Changes in v3: None
Changes in v2: None
arch/x86/include/asm/u-boot.h | 11 +++++++++++ arch/x86/lib/Makefile | 3 +++ common/board_r.c | 2 ++ 3 files changed, 16 insertions(+)
arch/x86/include/asm/u-boot.h +11 -0
@@ -39,6 +39,13 @@#include <config.h> #include <compiler.h> +#ifdef CONFIG_SYS_GENERIC_BOARD +/* Use the generic board which requires a unified bd_info */ +#include <asm-generic/u-boot.h> +#else + +#ifndef __ASSEMBLY__ + typedef struct bd_info { unsigned long bi_memstart; /* start of DRAM memory */ phys_size_t bi_memsize; /* size of DRAM memory in bytes */
@@ -60,6 +67,10 @@ typedef struct bd_info { }bi_dram[CONFIG_NR_DRAM_BANKS]; } bd_t; +#endif /* __ASSEMBLY__ */ + +#endif /* !CONFIG_SYS_GENERIC_BOARD */ +/* For image.h:image_check_target_arch() */ #define IH_ARCH_DEFAULT IH_ARCH_I386
arch/x86/lib/Makefile +3 -0
@@ -25,7 +25,10 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(ARCH).o +ifeq ($(CONFIG_SYS_GENERIC_BOARD),) COBJS-y += board.o +endif + COBJS-y += bootm.o COBJS-y += cmd_boot.o COBJS-y += gcc.o
common/board_r.c +2 -0
@@ -509,11 +509,13 @@ static int show_model_r(void)#endif /* enable exceptions */ +#ifdef CONFIG_ARM static int initr_enable_interrupts (void ) {enable_interrupts ();return 0 ; } +#endif #ifdef CONFIG_CMD_NET static int initr_ethaddr (void )
Signature · 1 line
1.8.1.3
A message that is not in the archive (sent off-list or not yet received): [email protected]
v9 cover Create generic board init for ARM, x86, PPC
Dear Simon Glass,
Quoted 4 lines · In message <[email protected]> you wrote:
This series creates a generic board init implementation which contains the essential functions of the major
arch/xxx/lib/board.cfiles. It is split into two parts:board_f.cfor pre-relocation andboard_r.cfor post-relocation.
...
Quoted 7 lines
ARM is a relatively large
board.cfile and one which I can test, therefore I think it is a good target for this series. On the other hand, x86 is relatively small and simple, but different enough that it introduces a few issues to be solved. So I have chosen both ARM and x86 for this series. After a suggestion from Wolfgang I have added PPC also. This is the largest and most feature-full board, so hopefully we have all bases covered in this series. Other archs are mostly a subset of these.
I did some testing on Power Architecture systems - to be precise:
CPU Board
--------------------------
MPC860T TQM860L
MPC5200 TQM5200S
PPC405EX Kilauea
PPC440EP Yosemite
PPC440EX Sequoia
PPC440SPe Katmai
PPC460EX Canyonlands
On all boards I verified at least environment access (printenv, saveenv) and network operation (TFTP download); where available also PCI. Everything appears to work fine, no problems noted.
A well done job, thanks a lot!
For the whole series:
Best regards,
Wolfgang Denk
Signature · 10 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 Certain old men prefer to rise at dawn, taking a cold bath and a long walk with an empty stomach and otherwise mortifying the flesh. They then point with pride to these practices as the cause of their sturdy health and ripe years; the truth being that they are hearty and old, not because of their habits, but in spite of them. The reason we find only robust persons doing this thing is that it has killed all the others who have tried it. - Ambrose Bierce, "The Devil's Dictionary"
v9 cover Create generic board init for ARM, x86, PPC
Quoted 32 lines · Wolfgang Denk
Dear Simon Glass,
Quoted 4 lines · In message <[email protected]> you wrote:
This series creates a generic board init implementation which contains the essential functions of the major
arch/xxx/lib/board.cfiles. It is split into two parts:board_f.cfor pre-relocation andboard_r.cfor post-relocation....
Quoted 7 lines
ARM is a relatively large
board.cfile and one which I can test, therefore I think it is a good target for this series. On the other hand, x86 is relatively small and simple, but different enough that it introduces a few issues to be solved. So I have chosen both ARM and x86 for this series. After a suggestion from Wolfgang I have added PPC also. This is the largest and most feature-full board, so hopefully we have all bases covered in this series. Other archs are mostly a subset of these.I did some testing on Power Architecture systems - to be precise:
CPU Board
--------------------------
MPC860T TQM860L
MPC5200 TQM5200S
PPC405EX Kilauea
PPC440EP Yosemite
PPC440EX Sequoia
PPC440SPe Katmai
PPC460EX CanyonlandsOn all boards I verified at least environment access (printenv, saveenv) and network operation (TFTP download); where available also PCI. Everything appears to work fine, no problems noted.
Quoted 6 lines
A well done job, thanks a lot!
For the whole series:
Tested-by Wolfgang Denk <[email protected]>Acked-by Wolfgang Denk <[email protected]>
OK, I've taken http://patchwork.ozlabs.org/bundle/sjg/us-board/ but with
http://patchwork.ozlabs.org/patch/228080/ for 2/31 and applied this to u-boot/master now, thanks again!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130315/da1bf0d1/attachment.pgp>
v9 cover Create generic board init for ARM, x86, PPC
In reply to Wolfgang DenkHi Wolfgang,
Quoted 30 lines · Wolfgang Denk
Dear Simon Glass,
Quoted 4 lines · In message <[email protected]> you wrote:
This series creates a generic board init implementation which contains the essential functions of the major
arch/xxx/lib/board.cfiles. It is split into two parts:board_f.cfor pre-relocation andboard_r.cfor post-relocation....
Quoted 1 line
ARM is a relatively large
board.cfile and one which I can test,therefore
Quoted 3 lines
I think it is a good target for this series. On the other hand, x86 is relatively small and simple, but different enough that it introduces a few issues to be solved. So I have chosen both ARM and x86 for this
series.
Quoted 3 lines
After a suggestion from Wolfgang I have added PPC also. This is the largest and most feature-full board, so hopefully we have all bases covered in this series. Other archs are mostly a subset of these.
I did some testing on Power Architecture systems - to be precise:
CPU Board
--------------------------MPC860T TQM860L MPC5200 TQM5200S PPC405EX Kilauea PPC440EP Yosemite PPC440EX Sequoia PPC440SPe Katmai PPC460EX Canyonlands
Quoted 6 lines
On all boards I verified at least environment access (printenv, saveenv) and network operation (TFTP download); where available also PCI. Everything appears to work fine, no problems noted.
A well done job, thanks a lot!
Thanks for your comments which are much appreciated. There is still work to do, in cleaning up the implementation to reduce the differences between arch code (e.g. all the #ifdefs in board_f/r.c). But this is a great first step and I am pleased to get this in.
Quoted 11 lines
For the whole series:
Tested-by Wolfgang Denk <[email protected]>Acked-by Wolfgang Denk <[email protected]>Best regards,
Wolfgang Denk
Quoted 12 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 Certain old men prefer to rise at dawn, taking a cold bath and a long walk with an empty stomach and otherwise mortifying the flesh. They then point with pride to these practices as the cause of their sturdy health and ripe years; the truth being that they are hearty and old, not because of their habits, but in spite of them. The reason we find only robust persons doing this thing is that it has killed all the others who have tried it. - Ambrose Bierce, "The Devil's Dictionary"
But I wonder if this is trying to tell me to stop these tricky refactors :-)
Regards,
Simon