]> Git Repo - u-boot.git/blame - include/bootm.h
x86: zboot: Rename zboot_start() to zboot_run()
[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
19/*
20 * Continue booting an OS image; caller already has:
21 * - copied image header to global variable `header'
22 * - checked header magic number, checksums (both header & image),
23 * - verified image architecture (PPC) and type (KERNEL or MULTI),
24 * - loaded (first part of) image to header load address,
25 * - disabled interrupts.
26 *
27 * @flag: Flags indicating what to do (BOOTM_STATE_...)
28 * @argc: Number of arguments. Note that the arguments are shifted down
29 * so that 0 is the first argument not processed by U-Boot, and
30 * argc is adjusted accordingly. This avoids confusion as to how
31 * many arguments are available for the OS.
32 * @images: Pointers to os/initrd/fdt
185f812c 33 * Return: 1 on error. On success the OS boots so this function does
b6396403
SG
34 * not return.
35 */
09140113 36typedef int boot_os_fn(int flag, int argc, char *const argv[],
d9d7c20b 37 struct bootm_headers *images);
b6396403
SG
38
39extern boot_os_fn do_bootm_linux;
f2a53c76
BM
40extern boot_os_fn do_bootm_vxworks;
41
09140113 42int do_bootelf(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
b6396403
SG
43
44boot_os_fn *bootm_os_get_boot_func(int os);
45
93e07880 46#if defined(CONFIG_FIT_SIGNATURE)
ce1400f6 47int bootm_host_load_images(const void *fit, int cfg_noffset);
93e07880 48#endif
ce1400f6 49
09140113 50int boot_selected_os(int argc, char *const argv[], int state,
d9d7c20b 51 struct bootm_headers *images, boot_os_fn *boot_fn);
b6396403
SG
52
53ulong bootm_disable_interrupts(void);
54
d2b2ffe3 55/* This is a special function used by booti/bootz */
fbde7589
TK
56int bootm_find_images(int flag, int argc, char *const argv[], ulong start,
57 ulong size);
b6396403 58
dec166d6
EJ
59/*
60 * Measure the boot images. Measurement is the process of hashing some binary
61 * data and storing it into secure memory, i.e. TPM PCRs. In addition, each
62 * measurement is logged into the platform event log such that the operating
63 * system can access it and perform attestation of the boot.
64 *
65 * @images: The structure containing the various images to boot (linux,
66 * initrd, dts, etc.)
67 */
68int bootm_measure(struct bootm_headers *images);
69
09140113 70int do_bootm_states(struct cmd_tbl *cmdtp, int flag, int argc,
d9d7c20b 71 char *const argv[], int states, struct bootm_headers *images,
09140113 72 int boot_progress);
b6396403 73
f1bd871a
JH
74void arch_preboot_os(void);
75
896019b1
SG
76/*
77 * boards should define this to disable devices when EFI exits from boot
78 * services.
79 *
80 * TODO([email protected]>): Update this to use driver model's device_remove().
81 */
329da485
SG
82void board_quiesce_devices(void);
83
f6c6df7e
HS
84/**
85 * switch_to_non_secure_mode() - switch to non-secure mode
86 */
87void switch_to_non_secure_mode(void);
88
b3c01678
SG
89/* Flags to control bootm_process_cmdline() */
90enum bootm_cmdline_t {
91 BOOTM_CL_SILENT = 1 << 0, /* Do silent console processing */
51bb3384 92 BOOTM_CL_SUBST = 1 << 1, /* Do substitution */
b3c01678 93
51bb3384 94 BOOTM_CL_ALL = 3, /* All substitutions */
b3c01678
SG
95};
96
73fdb955
HS
97/**
98 * arch_preboot_os() - arch specific configuration before booting
99 */
100void arch_preboot_os(void);
101
102/**
103 * board_preboot_os() - board specific configuration before booting
104 */
105void board_preboot_os(void);
106
4ae42643 107/*
4448fe8e
SG
108 * bootm_process_cmdline() - Process fix-ups for the command line
109 *
51bb3384
SG
110 * This handles:
111 *
112 * - making Linux boot silently if requested ('silent_linux' envvar)
113 * - performing substitutions in the command line ('bootargs_subst' envvar)
4448fe8e
SG
114 *
115 * @maxlen must provide enough space for the string being processed plus the
116 * resulting string
117 *
118 * @buf: buffer holding commandline string to adjust
119 * @maxlen: Maximum length of buffer at @buf (including \0)
120 * @flags: Flags to control what happens (see bootm_cmdline_t)
185f812c 121 * Return: 0 if OK, -ENOMEM if out of memory, -ENOSPC if the commandline is too
4448fe8e
SG
122 * long
123 */
124int bootm_process_cmdline(char *buf, int maxlen, int flags);
125
126/**
4dcb8154 127 * bootm_process_cmdline_env() - Process fix-ups for the command line
4ae42643 128 *
51bb3384
SG
129 * Updates the 'bootargs' envvar as required. This handles:
130 *
131 * - making Linux boot silently if requested ('silent_linux' envvar)
132 * - performing substitutions in the command line ('bootargs_subst' envvar)
4ae42643 133 *
b3c01678 134 * @flags: Flags to control what happens (see bootm_cmdline_t)
185f812c 135 * Return: 0 if OK, -ENOMEM if out of memory
4ae42643 136 */
b3c01678 137int bootm_process_cmdline_env(int flags);
f158ba15 138
1a081092 139/**
d2c485a0 140 * zboot_run() - Run through the various steps to boot a zimage
1a081092
SG
141 *
142 * Boot a zimage, given the component parts
143 *
144 * @addr: Address where the bzImage is moved before booting, either
145 * BZIMAGE_LOAD_ADDR or ZIMAGE_LOAD_ADDR
146 * @base: Pointer to the boot parameters, typically at address
147 * DEFAULT_SETUP_BASE
148 * @initrd: Address of the initial ramdisk, or 0 if none
149 * @initrd_size: Size of the initial ramdisk, or 0 if none
150 * @cmdline: Command line to use for booting
151 * Return: -EFAULT on error (normally it does not return)
152 */
d2c485a0
SG
153int zboot_run(ulong addr, ulong size, ulong initrd, ulong initrd_size,
154 ulong base, char *cmdline);
1a081092
SG
155
156/*
157 * zimage_get_kernel_version() - Get the version string from a kernel
158 *
159 * @params: boot_params pointer
160 * @kernel_base: base address of kernel
161 * Return: Kernel version as a NUL-terminated string
162 */
163const char *zimage_get_kernel_version(struct boot_params *params,
164 void *kernel_base);
165
cbb607d2
SG
166/**
167 * zimage_dump() - Dump the metadata of a zimage
168 *
169 * This shows all available information in a zimage that has been loaded.
170 *
171 * @base_ptr: Pointer to the boot parameters, typically at address
172 * DEFAULT_SETUP_BASE
173 * @show_cmdline: true to show the full command line
174 */
175void zimage_dump(struct boot_params *base_ptr, bool show_cmdline);
176
daffb0be
SG
177/*
178 * bootm_boot_start() - Boot an image at the given address
179 *
180 * @addr: Image address
181 * @cmdline: Command line to set
182 */
183int bootm_boot_start(ulong addr, const char *cmdline);
184
b6396403 185#endif
This page took 0.341137 seconds and 4 git commands to generate.