1b6396403SSimon Glass /* 2b6396403SSimon Glass * (C) Copyright 2000-2009 3b6396403SSimon Glass * Wolfgang Denk, DENX Software Engineering, wd@denx.de. 4b6396403SSimon Glass * 5b6396403SSimon Glass * SPDX-License-Identifier: GPL-2.0+ 6b6396403SSimon Glass */ 7b6396403SSimon Glass 8b6396403SSimon Glass #ifndef _BOOTM_H 9b6396403SSimon Glass #define _BOOTM_H 10b6396403SSimon Glass 11b6396403SSimon Glass #include <command.h> 12b6396403SSimon Glass #include <image.h> 13b6396403SSimon Glass 14b6396403SSimon Glass #define BOOTM_ERR_RESET (-1) 15b6396403SSimon Glass #define BOOTM_ERR_OVERLAP (-2) 16b6396403SSimon Glass #define BOOTM_ERR_UNIMPLEMENTED (-3) 17b6396403SSimon Glass 18b6396403SSimon Glass /* 19b6396403SSimon Glass * Continue booting an OS image; caller already has: 20b6396403SSimon Glass * - copied image header to global variable `header' 21b6396403SSimon Glass * - checked header magic number, checksums (both header & image), 22b6396403SSimon Glass * - verified image architecture (PPC) and type (KERNEL or MULTI), 23b6396403SSimon Glass * - loaded (first part of) image to header load address, 24b6396403SSimon Glass * - disabled interrupts. 25b6396403SSimon Glass * 26b6396403SSimon Glass * @flag: Flags indicating what to do (BOOTM_STATE_...) 27b6396403SSimon Glass * @argc: Number of arguments. Note that the arguments are shifted down 28b6396403SSimon Glass * so that 0 is the first argument not processed by U-Boot, and 29b6396403SSimon Glass * argc is adjusted accordingly. This avoids confusion as to how 30b6396403SSimon Glass * many arguments are available for the OS. 31b6396403SSimon Glass * @images: Pointers to os/initrd/fdt 32b6396403SSimon Glass * @return 1 on error. On success the OS boots so this function does 33b6396403SSimon Glass * not return. 34b6396403SSimon Glass */ 35b6396403SSimon Glass typedef int boot_os_fn(int flag, int argc, char * const argv[], 36b6396403SSimon Glass bootm_headers_t *images); 37b6396403SSimon Glass 38b6396403SSimon Glass extern boot_os_fn do_bootm_linux; 39b6396403SSimon Glass int do_bootelf(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]); 40b6396403SSimon Glass void lynxkdi_boot(image_header_t *hdr); 41b6396403SSimon Glass 42b6396403SSimon Glass boot_os_fn *bootm_os_get_boot_func(int os); 43b6396403SSimon Glass 4496f5441eSJoseph Chen int bootm_host_load_images(const void *fit, int cfg_noffset, int is_spl); 45ce1400f6SSimon Glass 46b6396403SSimon Glass int boot_selected_os(int argc, char * const argv[], int state, 47b6396403SSimon Glass bootm_headers_t *images, boot_os_fn *boot_fn); 48b6396403SSimon Glass 49b6396403SSimon Glass ulong bootm_disable_interrupts(void); 50b6396403SSimon Glass 51d2b2ffe3STom Rini /* This is a special function used by booti/bootz */ 52d52e8575SKarl Apsite int bootm_find_images(int flag, int argc, char * const argv[]); 53b6396403SSimon Glass 54b6396403SSimon Glass int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[], 55b6396403SSimon Glass int states, bootm_headers_t *images, int boot_progress); 56b6396403SSimon Glass 57*4c3bac62SJoseph Chen void arch_preboot_os(uint32_t bootm_state, bootm_headers_t *images); 58f1bd871aSJeroen Hofstee 59998aeb5fSJoseph Chen int board_do_bootm(int argc, char * const argv[]); 60998aeb5fSJoseph Chen 61081cc197SSimon Glass /** 62081cc197SSimon Glass * bootm_decomp_image() - decompress the operating system 63081cc197SSimon Glass * 64081cc197SSimon Glass * @comp: Compression algorithm that is used (IH_COMP_...) 65081cc197SSimon Glass * @load: Destination load address in U-Boot memory 66081cc197SSimon Glass * @image_start Image start address (where we are decompressing from) 67081cc197SSimon Glass * @type: OS type (IH_OS_...) 68081cc197SSimon Glass * @load_bug: Place to decompress to 69081cc197SSimon Glass * @image_buf: Address to decompress from 70081cc197SSimon Glass * @image_len: Number of bytes in @image_buf to decompress 71081cc197SSimon Glass * @unc_len: Available space for decompression 72081cc197SSimon Glass * @return 0 if OK, -ve on error (BOOTM_ERR_...) 73081cc197SSimon Glass */ 74081cc197SSimon Glass int bootm_decomp_image(int comp, ulong load, ulong image_start, int type, 75081cc197SSimon Glass void *load_buf, void *image_buf, ulong image_len, 76081cc197SSimon Glass uint unc_len, ulong *load_end); 77081cc197SSimon Glass 78b6396403SSimon Glass #endif 79