1 // SPDX-License-Identifier: GPL-2.0+
13 #include <asm/global_data.h>
14 #include <u-boot/zlib.h>
17 #include <asm/byteorder.h>
18 #ifdef CONFIG_SHOW_BOOT_PROGRESS
19 # include <status_led.h>
22 DECLARE_GLOBAL_DATA_PTR;
26 #define LINUX_MAX_ENVS 256
27 #define LINUX_MAX_ARGS 256
29 static void set_clocks_in_mhz (struct bd_info *kbd);
31 int do_bootm_linux(int flag, struct bootm_info *bmi)
33 struct bootm_headers *images = bmi->images;
36 void (*kernel) (struct bd_info *, ulong, ulong, ulong, ulong);
39 * allow the PREP bootm subcommand, it is required for bootm to work
41 if (flag & BOOTM_STATE_OS_PREP)
44 if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
47 /* allocate space for kernel copy of board info */
48 ret = boot_get_kbd(&kbd);
50 puts("ERROR with allocation of kernel bd\n");
53 set_clocks_in_mhz(kbd);
55 if (IS_ENABLED(CONFIG_LMB)) {
56 ret = image_setup_linux(images);
61 kernel = (void (*)(struct bd_info *, ulong, ulong, ulong, ulong))images->ep;
63 debug("## Transferring control to Linux (at address %08lx) ...\n",
66 bootstage_mark(BOOTSTAGE_ID_RUN_OS);
69 * Linux Kernel Parameters (passing board info data):
70 * sp+00: Ignore, side effect of using jsr to jump to kernel
71 * sp+04: ptr to board info data
72 * sp+08: initrd_start or 0 if no initrd
73 * sp+12: initrd_end - unused if initrd_start is 0
74 * sp+16: Start of command line string
75 * sp+20: End of command line string
77 (*kernel)(kbd, images->initrd_start, images->initrd_end,
78 images->cmdline_start, images->cmdline_end);
84 static void set_clocks_in_mhz (struct bd_info *kbd)
88 s = env_get("clocks_in_mhz");
90 /* convert all clock information to MHz */
91 kbd->bi_intfreq /= 1000000L;
92 kbd->bi_busfreq /= 1000000L;