mirror of
https://xff.cz/git/u-boot/
synced 2025-09-04 02:02:08 +02:00
autoboot: Tidy up use of menukey
Move the variable to the top of the file and adjust the code which uses it to use if() rather than #ifdef, to make it easier to read. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -28,6 +28,7 @@ DECLARE_GLOBAL_DATA_PTR;
|
|||||||
|
|
||||||
/* Stored value of bootdelay, used by autoboot_command() */
|
/* Stored value of bootdelay, used by autoboot_command() */
|
||||||
static int stored_bootdelay;
|
static int stored_bootdelay;
|
||||||
|
static int menukey;
|
||||||
|
|
||||||
#ifdef CONFIG_AUTOBOOT_ENCRYPTION
|
#ifdef CONFIG_AUTOBOOT_ENCRYPTION
|
||||||
#define AUTOBOOT_STOP_STR_SHA256 CONFIG_AUTOBOOT_STOP_STR_SHA256
|
#define AUTOBOOT_STOP_STR_SHA256 CONFIG_AUTOBOOT_STOP_STR_SHA256
|
||||||
@@ -35,6 +36,12 @@ static int stored_bootdelay;
|
|||||||
#define AUTOBOOT_STOP_STR_SHA256 ""
|
#define AUTOBOOT_STOP_STR_SHA256 ""
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_USE_AUTOBOOT_MENUKEY
|
||||||
|
#define AUTOBOOT_MENUKEY CONFIG_USE_AUTOBOOT_MENUKEY
|
||||||
|
#else
|
||||||
|
#define AUTOBOOT_MENUKEY 0
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Use a "constant-length" time compare function for this
|
* Use a "constant-length" time compare function for this
|
||||||
* hash compare:
|
* hash compare:
|
||||||
@@ -224,10 +231,6 @@ static int abortboot_key_sequence(int bootdelay)
|
|||||||
return abort;
|
return abort;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_USE_AUTOBOOT_MENUKEY
|
|
||||||
static int menukey;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static int abortboot_single_key(int bootdelay)
|
static int abortboot_single_key(int bootdelay)
|
||||||
{
|
{
|
||||||
int abort = 0;
|
int abort = 0;
|
||||||
@@ -250,13 +253,13 @@ static int abortboot_single_key(int bootdelay)
|
|||||||
ts = get_timer(0);
|
ts = get_timer(0);
|
||||||
do {
|
do {
|
||||||
if (tstc()) { /* we got a key press */
|
if (tstc()) { /* we got a key press */
|
||||||
|
int key;
|
||||||
|
|
||||||
abort = 1; /* don't auto boot */
|
abort = 1; /* don't auto boot */
|
||||||
bootdelay = 0; /* no more delay */
|
bootdelay = 0; /* no more delay */
|
||||||
# ifdef CONFIG_USE_AUTOBOOT_MENUKEY
|
key = getc(); /* consume input */
|
||||||
menukey = getc();
|
if (IS_ENABLED(CONFIG_USE_AUTOBOOT_MENUKEY))
|
||||||
# else
|
menukey = key;
|
||||||
(void) getc(); /* consume input */
|
|
||||||
# endif
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
udelay(10000);
|
udelay(10000);
|
||||||
@@ -358,11 +361,10 @@ void autoboot_command(const char *s)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_USE_AUTOBOOT_MENUKEY
|
if (IS_ENABLED(CONFIG_USE_AUTOBOOT_MENUKEY) &&
|
||||||
if (menukey == CONFIG_AUTOBOOT_MENUKEY) {
|
menukey == AUTOBOOT_MENUKEY) {
|
||||||
s = env_get("menucmd");
|
s = env_get("menucmd");
|
||||||
if (s)
|
if (s)
|
||||||
run_command_list(s, -1, 0);
|
run_command_list(s, -1, 0);
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_USE_AUTOBOOT_MENUKEY */
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user