]> Git Repo - J-u-boot.git/blame - include/bootm.h
bootm: Adjust arguments of boot_os_fn
[J-u-boot.git] / include / bootm.h
CommitLineData
83d290c5 1/* SPDX-License-Identifier: GPL-2.0+ */
b6396403
SG
2/*
3 * (C) Copyright 2000-2009
4 * Wolfgang Denk, DENX Software Engineering, [email protected].
b6396403
SG
5 */
6
7#ifndef _BOOTM_H
8#define _BOOTM_H
9
b6396403
SG
10#include <image.h>
11
1a081092 12struct boot_params;
09140113
SG
13struct cmd_tbl;
14
b6396403
SG
15#define BOOTM_ERR_RESET (-1)
16#define BOOTM_ERR_OVERLAP (-2)
17#define BOOTM_ERR_UNIMPLEMENTED (-3)
18
c4921625
SG
19/**
20 * struct bootm_info() - information used when processing images to boot
21 *
22 * @images: images information
23 * @argc: Number of arguments to the command (excluding the actual command).
24 * This is 0 if there are no arguments
25 * @argv: NULL-terminated list of arguments, or NULL if there are no arguments
26 */
27struct bootm_info {
28 struct bootm_headers *images;
29 int argc;
30 char *const *argv;
31};
32
b6396403
SG
33/*
34 * Continue booting an OS image; caller already has:
35 * - copied image header to global variable `header'
36 * - checked header magic number, checksums (both header & image),
37 * - verified image architecture (PPC) and type (KERNEL or MULTI),
38 * - loaded (first part of) image to header load address,
39 * - disabled interrupts.
40 *
41 * @flag: Flags indicating what to do (BOOTM_STATE_...)
a48336e5 42 * bmi: Bootm information
185f812c 43 * Return: 1 on error. On success the OS boots so this function does
b6396403
SG
44 * not return.
45 */
a48336e5 46typedef int boot_os_fn(int flag, struct bootm_info *bmi);
b6396403
SG
47
48extern boot_os_fn do_bootm_linux;
f2a53c76
BM
49extern boot_os_fn do_bootm_vxworks;
50
c4921625 51int do_bootelf(struct cmd_tbl *cmdtp, int fglag, int argc, char *const argv[]);
b6396403
SG
52
53boot_os_fn *bootm_os_get_boot_func(int os);
54
93e07880 55#if defined(CONFIG_FIT_SIGNATURE)
ce1400f6 56int bootm_host_load_images(const void *fit, int cfg_noffset);
93e07880 57#endif
ce1400f6 58
09140113 59int boot_selected_os(int argc, char *const argv[], int state,
d9d7c20b 60 struct bootm_headers *images, boot_os_fn *boot_fn);
b6396403
SG
61
62ulong bootm_disable_interrupts(void);
63
3ac85bdc
SG
64/**
65 * bootm_find_images() - find and locate various images
66 *
67 * @img_addr: Address of image being loaded
68 * @conf_ramdisk: Indicates the ramdisk to use (typically second arg of bootm)
69 * @conf_fdt: Indicates the FDT to use (typically third arg of bootm)
70 * @start: OS image start address
71 * @size: OS image size
72 *
73 * boot_find_images() will attempt to load an available ramdisk,
74 * flattened device tree, as well as specifically marked
75 * "loadable" images (loadables are FIT only)
76 *
77 * Note: bootm_find_images will skip an image if it is not found
78 *
79 * This is a special function used by booti/bootz
80 *
81 * Return:
82 * 0, if all existing images were loaded correctly
83 * 1, if an image is found but corrupted, or invalid
84 */
85int bootm_find_images(ulong img_addr, const char *conf_ramdisk,
86 const char *conf_fdt, ulong start, ulong size);
b6396403 87
dec166d6
EJ
88/*
89 * Measure the boot images. Measurement is the process of hashing some binary
90 * data and storing it into secure memory, i.e. TPM PCRs. In addition, each
91 * measurement is logged into the platform event log such that the operating
92 * system can access it and perform attestation of the boot.
93 *
94 * @images: The structure containing the various images to boot (linux,
95 * initrd, dts, etc.)
96 */
97int bootm_measure(struct bootm_headers *images);
98
09140113 99int do_bootm_states(struct cmd_tbl *cmdtp, int flag, int argc,
d9d7c20b 100 char *const argv[], int states, struct bootm_headers *images,
09140113 101 int boot_progress);
b6396403 102
f1bd871a
JH
103void arch_preboot_os(void);
104
896019b1
SG
105/*
106 * boards should define this to disable devices when EFI exits from boot
107 * services.
108 *
109 * TODO([email protected]>): Update this to use driver model's device_remove().
110 */
329da485
SG
111void board_quiesce_devices(void);
112
f6c6df7e
HS
113/**
114 * switch_to_non_secure_mode() - switch to non-secure mode
115 */
116void switch_to_non_secure_mode(void);
117
b3c01678
SG
118/* Flags to control bootm_process_cmdline() */
119enum bootm_cmdline_t {
120 BOOTM_CL_SILENT = 1 << 0, /* Do silent console processing */
51bb3384 121 BOOTM_CL_SUBST = 1 << 1, /* Do substitution */
b3c01678 122
51bb3384 123 BOOTM_CL_ALL = 3, /* All substitutions */
b3c01678
SG
124};
125
73fdb955
HS
126/**
127 * arch_preboot_os() - arch specific configuration before booting
128 */
129void arch_preboot_os(void);
130
131/**
132 * board_preboot_os() - board specific configuration before booting
133 */
134void board_preboot_os(void);
135
4ae42643 136/*
4448fe8e
SG
137 * bootm_process_cmdline() - Process fix-ups for the command line
138 *
51bb3384
SG
139 * This handles:
140 *
141 * - making Linux boot silently if requested ('silent_linux' envvar)
142 * - performing substitutions in the command line ('bootargs_subst' envvar)
4448fe8e
SG
143 *
144 * @maxlen must provide enough space for the string being processed plus the
145 * resulting string
146 *
147 * @buf: buffer holding commandline string to adjust
148 * @maxlen: Maximum length of buffer at @buf (including \0)
149 * @flags: Flags to control what happens (see bootm_cmdline_t)
185f812c 150 * Return: 0 if OK, -ENOMEM if out of memory, -ENOSPC if the commandline is too
4448fe8e
SG
151 * long
152 */
153int bootm_process_cmdline(char *buf, int maxlen, int flags);
154
155/**
4dcb8154 156 * bootm_process_cmdline_env() - Process fix-ups for the command line
4ae42643 157 *
51bb3384
SG
158 * Updates the 'bootargs' envvar as required. This handles:
159 *
160 * - making Linux boot silently if requested ('silent_linux' envvar)
161 * - performing substitutions in the command line ('bootargs_subst' envvar)
4ae42643 162 *
b3c01678 163 * @flags: Flags to control what happens (see bootm_cmdline_t)
185f812c 164 * Return: 0 if OK, -ENOMEM if out of memory
4ae42643 165 */
b3c01678 166int bootm_process_cmdline_env(int flags);
f158ba15 167
1a081092
SG
168/**
169 * zboot_start() - Boot a zimage
170 *
171 * Boot a zimage, given the component parts
172 *
173 * @addr: Address where the bzImage is moved before booting, either
174 * BZIMAGE_LOAD_ADDR or ZIMAGE_LOAD_ADDR
175 * @base: Pointer to the boot parameters, typically at address
176 * DEFAULT_SETUP_BASE
177 * @initrd: Address of the initial ramdisk, or 0 if none
178 * @initrd_size: Size of the initial ramdisk, or 0 if none
179 * @cmdline: Command line to use for booting
180 * Return: -EFAULT on error (normally it does not return)
181 */
182int zboot_start(ulong addr, ulong size, ulong initrd, ulong initrd_size,
183 ulong base, char *cmdline);
184
185/*
186 * zimage_get_kernel_version() - Get the version string from a kernel
187 *
188 * @params: boot_params pointer
189 * @kernel_base: base address of kernel
190 * Return: Kernel version as a NUL-terminated string
191 */
192const char *zimage_get_kernel_version(struct boot_params *params,
193 void *kernel_base);
194
cbb607d2
SG
195/**
196 * zimage_dump() - Dump the metadata of a zimage
197 *
198 * This shows all available information in a zimage that has been loaded.
199 *
200 * @base_ptr: Pointer to the boot parameters, typically at address
201 * DEFAULT_SETUP_BASE
202 * @show_cmdline: true to show the full command line
203 */
204void zimage_dump(struct boot_params *base_ptr, bool show_cmdline);
205
daffb0be
SG
206/*
207 * bootm_boot_start() - Boot an image at the given address
208 *
209 * @addr: Image address
210 * @cmdline: Command line to set
211 */
212int bootm_boot_start(ulong addr, const char *cmdline);
213
b6396403 214#endif
This page took 0.492556 seconds and 4 git commands to generate.