blob: 1e7f29e1341d7573cca6f9c752cb7d8edbc70d82 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Simon Glassb6396402014-06-12 07:24:46 -06002/*
3 * (C) Copyright 2000-2009
4 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
Simon Glassb6396402014-06-12 07:24:46 -06005 */
6
7#ifndef _BOOTM_H
8#define _BOOTM_H
9
Simon Glassb6396402014-06-12 07:24:46 -060010#include <image.h>
11
Simon Glass09140112020-05-10 11:40:03 -060012struct cmd_tbl;
13
Simon Glassb6396402014-06-12 07:24:46 -060014#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 */
Simon Glass09140112020-05-10 11:40:03 -060035typedef int boot_os_fn(int flag, int argc, char *const argv[],
Simon Glassb6396402014-06-12 07:24:46 -060036 bootm_headers_t *images);
37
38extern boot_os_fn do_bootm_linux;
Bin Mengf2a53c72018-12-21 07:13:40 -080039extern boot_os_fn do_bootm_vxworks;
40
Simon Glass09140112020-05-10 11:40:03 -060041int do_bootelf(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
Simon Glassb6396402014-06-12 07:24:46 -060042void lynxkdi_boot(image_header_t *hdr);
43
44boot_os_fn *bootm_os_get_boot_func(int os);
45
Fabrice Fontaine93e07882019-05-03 22:37:05 +020046#if defined(CONFIG_FIT_SIGNATURE)
Simon Glassce1400f2014-06-12 07:24:53 -060047int bootm_host_load_images(const void *fit, int cfg_noffset);
Fabrice Fontaine93e07882019-05-03 22:37:05 +020048#endif
Simon Glassce1400f2014-06-12 07:24:53 -060049
Simon Glass09140112020-05-10 11:40:03 -060050int boot_selected_os(int argc, char *const argv[], int state,
Simon Glassb6396402014-06-12 07:24:46 -060051 bootm_headers_t *images, boot_os_fn *boot_fn);
52
53ulong bootm_disable_interrupts(void);
54
Tom Rinid2b2ffe2014-08-14 06:42:36 -040055/* This is a special function used by booti/bootz */
Simon Glass09140112020-05-10 11:40:03 -060056int bootm_find_images(int flag, int argc, char *const argv[]);
Simon Glassb6396402014-06-12 07:24:46 -060057
Simon Glass09140112020-05-10 11:40:03 -060058int do_bootm_states(struct cmd_tbl *cmdtp, int flag, int argc,
59 char *const argv[], int states, bootm_headers_t *images,
60 int boot_progress);
Simon Glassb6396402014-06-12 07:24:46 -060061
Jeroen Hofsteef1bd8712014-10-08 22:58:00 +020062void arch_preboot_os(void);
63
Simon Glass896019b2018-05-16 09:42:26 -060064/*
65 * boards should define this to disable devices when EFI exits from boot
66 * services.
67 *
68 * TODO(sjg@chromium.org>): Update this to use driver model's device_remove().
69 */
Simon Glass329da482018-05-16 09:42:25 -060070void board_quiesce_devices(void);
71
Heinrich Schuchardtf6c6df72019-01-08 18:13:06 +010072/**
73 * switch_to_non_secure_mode() - switch to non-secure mode
74 */
75void switch_to_non_secure_mode(void);
76
Simon Glassb6396402014-06-12 07:24:46 -060077#endif