diff options
author | Michael Brandt <michael.brandt@stericsson.com> | 2010-08-27 14:21:17 +0200 |
---|---|---|
committer | Michael BRANDT <michael.brandt@stericsson.com> | 2010-08-30 20:07:21 +0200 |
commit | 529adafde26d951fa425029e0b56370c36d29081 (patch) | |
tree | 4c8728938a2f68c54207c36e5fb4638cf22ba5f4 /board/st/u8500/u8500.c | |
parent | e12e3ecc89a65421b4e26267c5c71badfdf0dbbb (diff) |
Make U-Boot restartable and crash dump support
* Added an u8500 board specific ld script. Reserve space for .data
backup.
* Make a backup copy of initialised data (.data section). If restarted,
copy the backup data back to .data.
* Create crashkernel env variable dynamically, since it depends on
U-Boot start address. For dumping U-Boot itself is used as
crashkernel.
* Set preboot environment variable to checkcrash command, if
data_init_flag > 0, i.e. we were restarted e.g. by kexec.
* Added crashkernel parameter to common bootargs.
Decreased environment and pool sizes.
* Changed link address of U-Boot: moved it 32 K up for kdump info to
0x05608000
* Added "checkcrash" command
This command checks if there is a pending crash dump
and writes it to a file on SD/MMC.
ST-Ericsson ID: WP264488
Change-Id: If545822e424b95532f1128afb0e762b6b73834e9
Signed-off-by: Michael Brandt <michael.brandt@stericsson.com>
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/3011
Diffstat (limited to 'board/st/u8500/u8500.c')
-rw-r--r-- | board/st/u8500/u8500.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/board/st/u8500/u8500.c b/board/st/u8500/u8500.c index c02d7d9b0..debcc117c 100644 --- a/board/st/u8500/u8500.c +++ b/board/st/u8500/u8500.c @@ -69,6 +69,14 @@ int board_id; /* set in board_late_init() */ int errno; +/* + * Flag to indicate from where to where we have to copy the initialised data. + * In case we were loaded, its value is -1 and .data must be saved for an + * eventual restart. It is 1 if .data was restored, i.e. we were restarted, + * e.g. by kexec. + */ +static volatile int data_init_flag = -1; /* -1 to get it into .data section */ + /* PLLs for clock management registers */ enum { GATED = 0, @@ -194,6 +202,28 @@ int cpu_is_u8500v2(void) int board_init(void) { + extern char _idata_start[]; + extern char _data_start[]; + extern char _data_end[]; + unsigned long data_len; + + data_len = _data_end - _data_start; + if (++data_init_flag == 0) { + /* + * first init after reset/loading + * save .data section for restart + */ + memcpy(_idata_start, _data_start, data_len); + } else { + /* + * restart, e.g. by kexec + * copy back .data section + */ + memcpy(_data_start, _idata_start, data_len); + /* memcpy set data_init_flag back to zero */ + ++data_init_flag; + } + gd->bd->bi_arch_number = 0x1A4; gd->bd->bi_boot_params = 0x00000100; @@ -378,6 +408,7 @@ int board_late_init(void) #ifdef CONFIG_MMC uchar byte_array[] = {0x06, 0x06}; #endif + char strbuf[80]; /* * Determine and set board_id environment variable @@ -436,6 +467,25 @@ int board_late_init(void) setenv("mem", "512M"); } + /* + * Create crashkernel env dynamically since it depends on U-Boot start + * address. U-Boot itself is used for dumping. + * The 32K offset is hardcoded in the kexec-tools. + * Parsed by Linux setup.c:reserve_crashkernel() using + * lib/cmdline.c:memparse(). + * crashkernel=ramsize-range:size[,...][@offset] + */ + sprintf(strbuf, "crashkernel=1M@0x%lx", _armboot_start - 0x8000); + setenv("crashkernel", strbuf); + + /* + * Check for a crashdump, if data_init_flag > 0, i.e. we were + * restarted e.g. by kexec. Do not check for crashdump if we were just + * loaded from the x-loader. + */ + if (data_init_flag > 0) + setenv("preboot", "checkcrash"); + return (0); } #endif /* BOARD_LATE_INIT */ |