Added arch_lmb_reserve to allow arch specific memory regions protection
PATCH v2 1/1 Added arch_lmb_reserve to allow arch specific memory regions protection
Each architecture has different ways of determine what regions of memory might not be valid to get overwritten when we boot. This provides a hook to allow them to reserve any regions they care about. Currently only ppc, m68k and sparc need/use this.
---
For some reason I had two commits in my tree and the cmd_bootm.c changes didn't make it out.
- k
common/cmd_bootm.c | 7 +++++++ lib_m68k/bootm.c | 29 ++++++++++++++++------------- lib_ppc/bootm.c | 50 ++++++++++++++++++++++++++++---------------------- lib_sparc/bootm.c | 16 +++++++++------- 4 files changed, 60 insertions(+), 42 deletions(-)
common/cmd_bootm.c +7 -0
@@ -128,6 +128,12 @@ void __board_lmb_reserve(struct lmb *lmb) }void board_lmb_reserve (struct lmb *lmb) __attribute__((weak,alias ("__board_lmb_reserve" ))); +void __arch_lmb_reserve (struct lmb *lmb) +{ +/* please define platform specific arch_lmb_reserve() */ +} +void arch_lmb_reserve (struct lmb *lmb) __attribute__((weak,alias ("__arch_lmb_reserve" ))); +#if defined(__ARM__)#define IH_INITRD_ARCH IH_ARCH_ARM#elif defined(__avr32__)
@@ -173,6 +179,7 @@ static int bootm_start(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])lmb_add (&images.lmb, (phys_addr_t )mem_start, mem_size); +arch_lmb_reserve (&images.lmb);board_lmb_reserve (&images.lmb);/* get kernel image header, start address and length */
lib_m68k/bootm.c +16 -13
@@ -43,22 +43,10 @@ DECLARE_GLOBAL_DATA_PTR;static ulong get_sp (void );static void set_clocks_in_mhz (bd_t *kbd); -int do_bootm_linux (int flag,int argc,char *argv[],bootm_headers_t *images) +void arch_lmb_reserve (struct lmb *lmb) {ulong sp; -ulong rd_len; -ulong initrd_start, initrd_end; -int ret; - -ulong cmd_start, cmd_end; -ulong bootmap_base; -bd_t *kbd; -void (*kernel) (bd_t *,ulong ,ulong ,ulong ,ulong ); -struct lmb *lmb = &images->lmb; - - bootmap_base =getenv_bootm_low (); -/* * Booting a (Linux) kernel image *
@@ -74,6 +62,21 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)/* adjust sp by 1K to be safe */ sp -=1024 ;lmb_reserve (lmb, sp, (CFG_SDRAM_BASE + gd->ram_size - sp)); +} + +int do_bootm_linux (int flag,int argc,char *argv[],bootm_headers_t *images) +{ +ulong rd_len; +ulong initrd_start, initrd_end; +int ret; + +ulong cmd_start, cmd_end; +ulong bootmap_base; +bd_t *kbd; +void (*kernel) (bd_t *,ulong ,ulong ,ulong ,ulong ); +struct lmb *lmb = &images->lmb; + + bootmap_base =getenv_bootm_low ();/* allocate space and init command line */ ret =boot_get_cmdline (lmb, &cmd_start, &cmd_end, bootmap_base);
lib_ppc/bootm.c +28 -22
64 lines not on this page · raw message
lib_sparc/bootm.c +9 -7
@@ -81,6 +81,15 @@ struct __attribute__ ((packed)) {/* temporary initrd image holder */ image_header_t ihdr; +void arch_lmb_reserve (struct lmb *lmb) +{ +/* Reserve the space used by PROM and stack. This is done +* to avoid that the RAM image is copied over stack or +* PROM. +*/ +lmb_reserve (lmb,CFG_RELOC_MONITOR_BASE ,CFG_RAM_END ); +} +/* boot the linux kernel */ int do_bootm_linux (int flag,int argc,char *argv[],bootm_headers_t * images) {
@@ -124,13 +133,6 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t * images) rd_len = images->rd_end - images->rd_start;if (rd_len) { - -/* Reserve the space used by PROM and stack. This is done -* to avoid that the RAM image is copied over stack or -* PROM. -*/ -lmb_reserve (lmb,CFG_RELOC_MONITOR_BASE ,CFG_RAM_END ); - ret =boot_ramdisk_high (lmb, images->rd_start, rd_len, &initrd_start, &initrd_end);if (ret) {
Signature · 1 line
1.5.5.1
PATCH v2 1/1 Added arch_lmb_reserve to allow arch specific memory regions protection
Dear Kumar Gala,
Quoted 11 lines · In message <[email protected]> you…
Each architecture has different ways of determine what regions of memory might not be valid to get overwritten when we boot. This provides a hook to allow them to reserve any regions they care about. Currently only ppc, m68k and sparc need/use this.
Signed-off-by Kumar Gala <[email protected]>---
For some reason I had two commits in my tree and the
cmd_bootm.cchanges didn't make it out.
Quoted 7 lines
- k
common/cmd_bootm.c | 7 +++++++ lib_m68k/bootm.c | 29 ++++++++++++++++------------- lib_ppc/bootm.c | 50 ++++++++++++++++++++++++++++---------------------- lib_sparc/bootm.c | 16 +++++++++------- 4 files changed, 60 insertions(+), 42 deletions(-)
Tried to apply to "next" branch as requested, but this fails with non-trivial merge conflicts:
Applying Added arch_lmb_reserve to allow arch specific memory regions protection
error: patch failed: lib_m68k/bootm.c:74
error: lib_m68k/bootm.c: patch does not apply
error: patch failed: lib_ppc/bootm.c:55
error: lib_ppc/bootm.c: patch does not apply
error: patch failed: lib_sparc/bootm.c:124
error: lib_sparc/bootm.c: patch does not apply
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge... Auto-merged common/cmd_bootm.c
Auto-merged lib_m68k/bootm.c
CONFLICT (content): Merge conflict in lib_m68k/bootm.c Auto-merged lib_ppc/bootm.c
Auto-merged lib_sparc/bootm.c
CONFLICT (content): Merge conflict in lib_sparc/bootm.c Failed to merge in the changes.
Patch failed at 0001.
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 Program maintenance is an entropy-increasing process, and even its most skilfull execution only delays the subsidence of the system into unfixable obsolescence. - Fred Brooks, "The Mythical Man Month"