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