Prepare v2025.01
[u-boot.git] / include / autoboot.h
blobc68bd79f8dca9e9b890358e578f5c2131ed324df
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3 * (C) Copyright 2000
4 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
6 * Add to readline cmdline-editing by
7 * (C) Copyright 2005
8 * JinHua Luo, GuangDong Linux Center, <luo.jinhua@gd-linux.com>
9 */
11 #ifndef __AUTOBOOT_H
12 #define __AUTOBOOT_H
14 #include <stdbool.h>
15 #include <stddef.h>
17 #ifdef CONFIG_SANDBOX
19 /**
20 * autoboot_keyed() - check whether keyed autoboot should be used
22 * This is only implemented for sandbox since other platforms don't have a way
23 * of controlling the feature at runtime.
25 * Return: true if enabled, false if not
27 bool autoboot_keyed(void);
29 /**
30 * autoboot_set_keyed() - set whether keyed autoboot should be used
32 * @autoboot_keyed: true to enable the feature, false to disable
33 * Return: old value of the flag
35 bool autoboot_set_keyed(bool autoboot_keyed);
36 #else
37 static inline bool autoboot_keyed(void)
39 /* There is no runtime flag, so just use the CONFIG */
40 return IS_ENABLED(CONFIG_AUTOBOOT_KEYED);
43 static inline bool autoboot_set_keyed(bool autoboot_keyed)
45 /* There is no runtime flag to set */
46 return false;
49 #endif
51 #ifdef CONFIG_AUTOBOOT
52 /**
53 * bootdelay_process() - process the bootd delay
55 * Process the boot delay, boot limit, then get the value of either
56 * bootcmd, failbootcmd or altbootcmd depending on the current state.
57 * Return this command so it can be executed.
59 * Return: command to executed
61 const char *bootdelay_process(void);
63 /**
64 * autoboot_command() - run the autoboot command
66 * If enabled, run the autoboot command returned from bootdelay_process().
67 * Also do the CONFIG_AUTOBOOT_MENUKEY processing if enabled.
69 * @cmd: Command to run
71 void autoboot_command(const char *cmd);
72 #else
73 static inline const char *bootdelay_process(void)
75 return NULL;
78 static inline void autoboot_command(const char *s)
81 #endif
83 #endif