uboot/include/bootm.h
<<
>>
Prefs
   1/* SPDX-License-Identifier: GPL-2.0+ */
   2/*
   3 * (C) Copyright 2000-2009
   4 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
   5 */
   6
   7#ifndef _BOOTM_H
   8#define _BOOTM_H
   9
  10#include <image.h>
  11
  12struct cmd_tbl;
  13
  14#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 */
  35typedef int boot_os_fn(int flag, int argc, char *const argv[],
  36                        bootm_headers_t *images);
  37
  38extern boot_os_fn do_bootm_linux;
  39extern boot_os_fn do_bootm_vxworks;
  40
  41int do_bootelf(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
  42
  43boot_os_fn *bootm_os_get_boot_func(int os);
  44
  45#if defined(CONFIG_FIT_SIGNATURE)
  46int bootm_host_load_images(const void *fit, int cfg_noffset);
  47#endif
  48
  49int boot_selected_os(int argc, char *const argv[], int state,
  50                     bootm_headers_t *images, boot_os_fn *boot_fn);
  51
  52ulong bootm_disable_interrupts(void);
  53
  54/* This is a special function used by booti/bootz */
  55int bootm_find_images(int flag, int argc, char *const argv[], ulong start,
  56                      ulong size);
  57
  58int 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);
  61
  62void arch_preboot_os(void);
  63
  64/*
  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 */
  70void board_quiesce_devices(void);
  71
  72/**
  73 * switch_to_non_secure_mode() - switch to non-secure mode
  74 */
  75void switch_to_non_secure_mode(void);
  76
  77/* Flags to control bootm_process_cmdline() */
  78enum bootm_cmdline_t {
  79        BOOTM_CL_SILENT = 1 << 0,       /* Do silent console processing */
  80        BOOTM_CL_SUBST  = 1 << 1,       /* Do substitution */
  81
  82        BOOTM_CL_ALL    = 3,            /* All substitutions */
  83};
  84
  85/**
  86 * arch_preboot_os() - arch specific configuration before booting
  87 */
  88void arch_preboot_os(void);
  89
  90/**
  91 * board_preboot_os() - board specific configuration before booting
  92 */
  93void board_preboot_os(void);
  94
  95/*
  96 * bootm_process_cmdline() - Process fix-ups for the command line
  97 *
  98 * This handles:
  99 *
 100 *  - making Linux boot silently if requested ('silent_linux' envvar)
 101 *  - performing substitutions in the command line ('bootargs_subst' envvar)
 102 *
 103 * @maxlen must provide enough space for the string being processed plus the
 104 * resulting string
 105 *
 106 * @buf: buffer holding commandline string to adjust
 107 * @maxlen: Maximum length of buffer at @buf (including \0)
 108 * @flags: Flags to control what happens (see bootm_cmdline_t)
 109 * @return 0 if OK, -ENOMEM if out of memory, -ENOSPC if the commandline is too
 110 *      long
 111 */
 112int bootm_process_cmdline(char *buf, int maxlen, int flags);
 113
 114/**
 115 * bootm_process_cmdline_env() - Process fix-ups for the command line
 116 *
 117 * Updates the 'bootargs' envvar as required. This handles:
 118 *
 119 *  - making Linux boot silently if requested ('silent_linux' envvar)
 120 *  - performing substitutions in the command line ('bootargs_subst' envvar)
 121 *
 122 * @flags: Flags to control what happens (see bootm_cmdline_t)
 123 * @return 0 if OK, -ENOMEM if out of memory
 124 */
 125int bootm_process_cmdline_env(int flags);
 126
 127#endif
 128