Skip to content
Snippets Groups Projects
Commit bce1b92a authored by Simon Glass's avatar Simon Glass Committed by Tom Rini
Browse files

arm: Implement the 'fake' go command


Implement this feature on ARM for tracing.

It would be nice to have generic bootm support so that it is easily
implemented on any arch.

Signed-off-by: default avatarSimon Glass <sjg@chromium.org>
Acked-by: default avatarAlbert ARIBAUD <albert.u.boot@aribaud.net>
parent d0ae31eb
Branches
Tags
No related merge requests found
...@@ -68,11 +68,18 @@ void arch_lmb_reserve(struct lmb *lmb) ...@@ -68,11 +68,18 @@ void arch_lmb_reserve(struct lmb *lmb)
gd->bd->bi_dram[0].start + gd->bd->bi_dram[0].size - sp); gd->bd->bi_dram[0].start + gd->bd->bi_dram[0].size - sp);
} }
static void announce_and_cleanup(void) /**
* announce_and_cleanup() - Print message and prepare for kernel boot
*
* @fake: non-zero to do everything except actually boot
*/
static void announce_and_cleanup(int fake)
{ {
printf("\nStarting kernel ...\n\n"); printf("\nStarting kernel ...%s\n\n", fake ?
"(fake run for tracing)" : "");
bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel"); bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel");
#ifdef CONFIG_BOOTSTAGE_FDT #ifdef CONFIG_BOOTSTAGE_FDT
if (flag == BOOTM_STATE_OS_FAKE_GO)
bootstage_fdt_add_report(); bootstage_fdt_add_report();
#endif #endif
#ifdef CONFIG_BOOTSTAGE_REPORT #ifdef CONFIG_BOOTSTAGE_REPORT
...@@ -225,12 +232,13 @@ static void boot_prep_linux(bootm_headers_t *images) ...@@ -225,12 +232,13 @@ static void boot_prep_linux(bootm_headers_t *images)
} }
/* Subcommand: GO */ /* Subcommand: GO */
static void boot_jump_linux(bootm_headers_t *images) static void boot_jump_linux(bootm_headers_t *images, int flag)
{ {
unsigned long machid = gd->bd->bi_arch_number; unsigned long machid = gd->bd->bi_arch_number;
char *s; char *s;
void (*kernel_entry)(int zero, int arch, uint params); void (*kernel_entry)(int zero, int arch, uint params);
unsigned long r2; unsigned long r2;
int fake = (flag & BOOTM_STATE_OS_FAKE_GO);
kernel_entry = (void (*)(int, int, uint))images->ep; kernel_entry = (void (*)(int, int, uint))images->ep;
...@@ -243,13 +251,14 @@ static void boot_jump_linux(bootm_headers_t *images) ...@@ -243,13 +251,14 @@ static void boot_jump_linux(bootm_headers_t *images)
debug("## Transferring control to Linux (at address %08lx)" \ debug("## Transferring control to Linux (at address %08lx)" \
"...\n", (ulong) kernel_entry); "...\n", (ulong) kernel_entry);
bootstage_mark(BOOTSTAGE_ID_RUN_OS); bootstage_mark(BOOTSTAGE_ID_RUN_OS);
announce_and_cleanup(); announce_and_cleanup(fake);
if (IMAGE_ENABLE_OF_LIBFDT && images->ft_len) if (IMAGE_ENABLE_OF_LIBFDT && images->ft_len)
r2 = (unsigned long)images->ft_addr; r2 = (unsigned long)images->ft_addr;
else else
r2 = gd->bd->bi_boot_params; r2 = gd->bd->bi_boot_params;
if (!fake)
kernel_entry(0, machid, r2); kernel_entry(0, machid, r2);
} }
...@@ -270,13 +279,13 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images) ...@@ -270,13 +279,13 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
return 0; return 0;
} }
if (flag & BOOTM_STATE_OS_GO) { if (flag & (BOOTM_STATE_OS_GO | BOOTM_STATE_OS_FAKE_GO)) {
boot_jump_linux(images); boot_jump_linux(images, flag);
return 0; return 0;
} }
boot_prep_linux(images); boot_prep_linux(images);
boot_jump_linux(images); boot_jump_linux(images, flag);
return 0; return 0;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment