Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Simon Glass | b639640 | 2014-06-12 07:24:46 -0600 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2000-2009 |
| 4 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
Simon Glass | b639640 | 2014-06-12 07:24:46 -0600 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #ifndef _BOOTM_H |
| 8 | #define _BOOTM_H |
| 9 | |
| 10 | #include <command.h> |
| 11 | #include <image.h> |
| 12 | |
| 13 | #define BOOTM_ERR_RESET (-1) |
| 14 | #define BOOTM_ERR_OVERLAP (-2) |
| 15 | #define BOOTM_ERR_UNIMPLEMENTED (-3) |
| 16 | |
| 17 | /* |
| 18 | * Continue booting an OS image; caller already has: |
| 19 | * - copied image header to global variable `header' |
| 20 | * - checked header magic number, checksums (both header & image), |
| 21 | * - verified image architecture (PPC) and type (KERNEL or MULTI), |
| 22 | * - loaded (first part of) image to header load address, |
| 23 | * - disabled interrupts. |
| 24 | * |
| 25 | * @flag: Flags indicating what to do (BOOTM_STATE_...) |
| 26 | * @argc: Number of arguments. Note that the arguments are shifted down |
| 27 | * so that 0 is the first argument not processed by U-Boot, and |
| 28 | * argc is adjusted accordingly. This avoids confusion as to how |
| 29 | * many arguments are available for the OS. |
| 30 | * @images: Pointers to os/initrd/fdt |
| 31 | * @return 1 on error. On success the OS boots so this function does |
| 32 | * not return. |
| 33 | */ |
| 34 | typedef int boot_os_fn(int flag, int argc, char * const argv[], |
| 35 | bootm_headers_t *images); |
| 36 | |
| 37 | extern boot_os_fn do_bootm_linux; |
Bin Meng | f2a53c7 | 2018-12-21 07:13:40 -0800 | [diff] [blame] | 38 | extern boot_os_fn do_bootm_vxworks; |
| 39 | |
Simon Glass | b639640 | 2014-06-12 07:24:46 -0600 | [diff] [blame] | 40 | int do_bootelf(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]); |
| 41 | void lynxkdi_boot(image_header_t *hdr); |
| 42 | |
| 43 | boot_os_fn *bootm_os_get_boot_func(int os); |
| 44 | |
Fabrice Fontaine | 93e0788 | 2019-05-03 22:37:05 +0200 | [diff] [blame] | 45 | #if defined(CONFIG_FIT_SIGNATURE) |
Simon Glass | ce1400f | 2014-06-12 07:24:53 -0600 | [diff] [blame] | 46 | int bootm_host_load_images(const void *fit, int cfg_noffset); |
Fabrice Fontaine | 93e0788 | 2019-05-03 22:37:05 +0200 | [diff] [blame] | 47 | #endif |
Simon Glass | ce1400f | 2014-06-12 07:24:53 -0600 | [diff] [blame] | 48 | |
Simon Glass | b639640 | 2014-06-12 07:24:46 -0600 | [diff] [blame] | 49 | int boot_selected_os(int argc, char * const argv[], int state, |
| 50 | bootm_headers_t *images, boot_os_fn *boot_fn); |
| 51 | |
| 52 | ulong bootm_disable_interrupts(void); |
| 53 | |
Tom Rini | d2b2ffe | 2014-08-14 06:42:36 -0400 | [diff] [blame] | 54 | /* This is a special function used by booti/bootz */ |
Karl Apsite | d52e857 | 2015-05-21 09:52:49 -0400 | [diff] [blame] | 55 | int bootm_find_images(int flag, int argc, char * const argv[]); |
Simon Glass | b639640 | 2014-06-12 07:24:46 -0600 | [diff] [blame] | 56 | |
| 57 | int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[], |
| 58 | int states, bootm_headers_t *images, int boot_progress); |
| 59 | |
Jeroen Hofstee | f1bd871 | 2014-10-08 22:58:00 +0200 | [diff] [blame] | 60 | void arch_preboot_os(void); |
| 61 | |
Simon Glass | 081cc19 | 2014-12-02 13:17:33 -0700 | [diff] [blame] | 62 | /** |
| 63 | * bootm_decomp_image() - decompress the operating system |
| 64 | * |
| 65 | * @comp: Compression algorithm that is used (IH_COMP_...) |
| 66 | * @load: Destination load address in U-Boot memory |
| 67 | * @image_start Image start address (where we are decompressing from) |
| 68 | * @type: OS type (IH_OS_...) |
| 69 | * @load_bug: Place to decompress to |
| 70 | * @image_buf: Address to decompress from |
| 71 | * @image_len: Number of bytes in @image_buf to decompress |
| 72 | * @unc_len: Available space for decompression |
| 73 | * @return 0 if OK, -ve on error (BOOTM_ERR_...) |
| 74 | */ |
| 75 | int bootm_decomp_image(int comp, ulong load, ulong image_start, int type, |
| 76 | void *load_buf, void *image_buf, ulong image_len, |
| 77 | uint unc_len, ulong *load_end); |
| 78 | |
Simon Glass | 896019b | 2018-05-16 09:42:26 -0600 | [diff] [blame] | 79 | /* |
| 80 | * boards should define this to disable devices when EFI exits from boot |
| 81 | * services. |
| 82 | * |
| 83 | * TODO(sjg@chromium.org>): Update this to use driver model's device_remove(). |
| 84 | */ |
Simon Glass | 329da48 | 2018-05-16 09:42:25 -0600 | [diff] [blame] | 85 | void board_quiesce_devices(void); |
| 86 | |
Heinrich Schuchardt | f6c6df7 | 2019-01-08 18:13:06 +0100 | [diff] [blame] | 87 | /** |
| 88 | * switch_to_non_secure_mode() - switch to non-secure mode |
| 89 | */ |
| 90 | void switch_to_non_secure_mode(void); |
| 91 | |
Simon Glass | b639640 | 2014-06-12 07:24:46 -0600 | [diff] [blame] | 92 | #endif |