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