]>
Commit | Line | Data |
---|---|---|
83d290c5 | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
66ded17d SG |
2 | /* |
3 | * (C) Copyright 2000 | |
4 | * Wolfgang Denk, DENX Software Engineering, [email protected]. | |
5 | * | |
6 | * Add to readline cmdline-editing by | |
7 | * (C) Copyright 2005 | |
8 | * JinHua Luo, GuangDong Linux Center, <[email protected]> | |
66ded17d SG |
9 | */ |
10 | ||
11 | #ifndef __AUTOBOOT_H | |
12 | #define __AUTOBOOT_H | |
13 | ||
cb897009 | 14 | #include <stdbool.h> |
a79fc7a7 | 15 | #include <stddef.h> |
cb897009 SG |
16 | |
17 | #ifdef CONFIG_SANDBOX | |
18 | ||
19 | /** | |
20 | * autoboot_keyed() - check whether keyed autoboot should be used | |
21 | * | |
22 | * This is only implemented for sandbox since other platforms don't have a way | |
23 | * of controlling the feature at runtime. | |
24 | * | |
185f812c | 25 | * Return: true if enabled, false if not |
cb897009 SG |
26 | */ |
27 | bool autoboot_keyed(void); | |
28 | ||
29 | /** | |
30 | * autoboot_set_keyed() - set whether keyed autoboot should be used | |
31 | * | |
32 | * @autoboot_keyed: true to enable the feature, false to disable | |
185f812c | 33 | * Return: old value of the flag |
cb897009 SG |
34 | */ |
35 | bool autoboot_set_keyed(bool autoboot_keyed); | |
36 | #else | |
37 | static inline bool autoboot_keyed(void) | |
38 | { | |
39 | /* There is no runtime flag, so just use the CONFIG */ | |
40 | return IS_ENABLED(CONFIG_AUTOBOOT_KEYED); | |
41 | } | |
42 | ||
43 | static inline bool autoboot_set_keyed(bool autoboot_keyed) | |
44 | { | |
45 | /* There is no runtime flag to set */ | |
46 | return false; | |
47 | } | |
48 | ||
49 | #endif | |
50 | ||
41598c82 | 51 | #ifdef CONFIG_AUTOBOOT |
affb2156 SG |
52 | /** |
53 | * bootdelay_process() - process the bootd delay | |
54 | * | |
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. | |
58 | * | |
185f812c | 59 | * Return: command to executed |
affb2156 SG |
60 | */ |
61 | const char *bootdelay_process(void); | |
62 | ||
63 | /** | |
64 | * autoboot_command() - run the autoboot command | |
65 | * | |
66 | * If enabled, run the autoboot command returned from bootdelay_process(). | |
8fc31e23 | 67 | * Also do the CONFIG_AUTOBOOT_MENUKEY processing if enabled. |
affb2156 SG |
68 | * |
69 | * @cmd: Command to run | |
70 | */ | |
71 | void autoboot_command(const char *cmd); | |
66ded17d | 72 | #else |
affb2156 SG |
73 | static inline const char *bootdelay_process(void) |
74 | { | |
75 | return NULL; | |
76 | } | |
77 | ||
78 | static inline void autoboot_command(const char *s) | |
66ded17d SG |
79 | { |
80 | } | |
81 | #endif | |
82 | ||
83 | #endif |