Rename bootretry functions and remove #ifdefs
Add a bootretry_ prefix to these two functions, and remove the need for the #ifdef around everything (it moves to the Makefile). Signed-off-by: Simon Glass <sjg@chromium.org>utp
parent
0098e179e1
commit
b26440f1fa
|
@ -415,13 +415,11 @@ last_stage_init (void)
|
||||||
hymod_conf_t *cp = &gd->bd->bi_hymod_conf;
|
hymod_conf_t *cp = &gd->bd->bi_hymod_conf;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
#ifdef CONFIG_BOOT_RETRY_TIME
|
|
||||||
/*
|
/*
|
||||||
* we use the cli_readline() function, but we also want
|
* we use the cli_readline() function, but we also want
|
||||||
* command timeout enabled
|
* command timeout enabled
|
||||||
*/
|
*/
|
||||||
init_cmd_timeout ();
|
bootretry_init_cmd_timeout();
|
||||||
#endif
|
|
||||||
|
|
||||||
memset ((void *) cp, 0, sizeof (*cp));
|
memset ((void *) cp, 0, sizeof (*cp));
|
||||||
|
|
||||||
|
|
|
@ -16,9 +16,7 @@ hymod_get_serno (const char *prompt)
|
||||||
int n, serno;
|
int n, serno;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
#ifdef CONFIG_BOOT_RETRY_TIME
|
bootretry_reset_cmd_timeout();
|
||||||
reset_cmd_timeout ();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
n = cli_readline(prompt);
|
n = cli_readline(prompt);
|
||||||
|
|
||||||
|
@ -44,9 +42,7 @@ hymod_get_ethaddr (void)
|
||||||
for (;;) {
|
for (;;) {
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
#ifdef CONFIG_BOOT_RETRY_TIME
|
bootretry_reset_cmd_timeout();
|
||||||
reset_cmd_timeout ();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
n = cli_readline("Enter board ethernet address: ");
|
n = cli_readline("Enter board ethernet address: ");
|
||||||
|
|
||||||
|
|
|
@ -113,11 +113,9 @@ static int abortboot_keyed(int bootdelay)
|
||||||
delaykey[i].retry ? "delay" :
|
delaykey[i].retry ? "delay" :
|
||||||
"stop");
|
"stop");
|
||||||
|
|
||||||
# ifdef CONFIG_BOOT_RETRY_TIME
|
|
||||||
/* don't retry auto boot */
|
/* don't retry auto boot */
|
||||||
if (!delaykey[i].retry)
|
if (!delaykey[i].retry)
|
||||||
bootretry_dont_retry();
|
bootretry_dont_retry();
|
||||||
# endif
|
|
||||||
abort = 1;
|
abort = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -305,9 +303,7 @@ void bootdelay_process(void)
|
||||||
#if defined(CONFIG_MENU_SHOW)
|
#if defined(CONFIG_MENU_SHOW)
|
||||||
bootdelay = menu_show(bootdelay);
|
bootdelay = menu_show(bootdelay);
|
||||||
#endif
|
#endif
|
||||||
# ifdef CONFIG_BOOT_RETRY_TIME
|
bootretry_init_cmd_timeout();
|
||||||
init_cmd_timeout();
|
|
||||||
# endif /* CONFIG_BOOT_RETRY_TIME */
|
|
||||||
|
|
||||||
#ifdef CONFIG_POST
|
#ifdef CONFIG_POST
|
||||||
if (gd->flags & GD_FLG_POSTFAIL) {
|
if (gd->flags & GD_FLG_POSTFAIL) {
|
||||||
|
|
|
@ -21,7 +21,7 @@ static int retry_time = -1; /* -1 so can call readline before main_loop */
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* initialize command line timeout
|
* initialize command line timeout
|
||||||
*/
|
*/
|
||||||
void init_cmd_timeout(void)
|
void bootretry_init_cmd_timeout(void)
|
||||||
{
|
{
|
||||||
char *s = getenv("bootretry");
|
char *s = getenv("bootretry");
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ void init_cmd_timeout(void)
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* reset command line timeout to retry_time seconds
|
* reset command line timeout to retry_time seconds
|
||||||
*/
|
*/
|
||||||
void reset_cmd_timeout(void)
|
void bootretry_reset_cmd_timeout(void)
|
||||||
{
|
{
|
||||||
endtime = endtick(retry_time);
|
endtime = endtick(retry_time);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1000,12 +1000,7 @@ static void get_user_input(struct in_str *i)
|
||||||
int n;
|
int n;
|
||||||
static char the_command[CONFIG_SYS_CBSIZE + 1];
|
static char the_command[CONFIG_SYS_CBSIZE + 1];
|
||||||
|
|
||||||
#ifdef CONFIG_BOOT_RETRY_TIME
|
bootretry_reset_cmd_timeout();
|
||||||
# ifndef CONFIG_RESET_TO_RETRY
|
|
||||||
# error "This currently only works with CONFIG_RESET_TO_RETRY enabled"
|
|
||||||
# endif
|
|
||||||
reset_cmd_timeout();
|
|
||||||
#endif
|
|
||||||
i->__promptme = 1;
|
i->__promptme = 1;
|
||||||
if (i->promptmode == 1) {
|
if (i->promptmode == 1) {
|
||||||
n = cli_readline(CONFIG_SYS_PROMPT);
|
n = cli_readline(CONFIG_SYS_PROMPT);
|
||||||
|
|
|
@ -265,14 +265,12 @@ void cli_loop(void)
|
||||||
int rc = 1;
|
int rc = 1;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
#ifdef CONFIG_BOOT_RETRY_TIME
|
|
||||||
if (rc >= 0) {
|
if (rc >= 0) {
|
||||||
/* Saw enough of a valid command to
|
/* Saw enough of a valid command to
|
||||||
* restart the timeout.
|
* restart the timeout.
|
||||||
*/
|
*/
|
||||||
reset_cmd_timeout();
|
bootretry_reset_cmd_timeout();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
len = cli_readline(CONFIG_SYS_PROMPT);
|
len = cli_readline(CONFIG_SYS_PROMPT);
|
||||||
|
|
||||||
flag = 0; /* assume no special flags for now */
|
flag = 0; /* assume no special flags for now */
|
||||||
|
|
|
@ -564,9 +564,7 @@ mod_i2c_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const arg
|
||||||
if (argc != 3)
|
if (argc != 3)
|
||||||
return CMD_RET_USAGE;
|
return CMD_RET_USAGE;
|
||||||
|
|
||||||
#ifdef CONFIG_BOOT_RETRY_TIME
|
bootretry_reset_cmd_timeout(); /* got a good command to get here */
|
||||||
reset_cmd_timeout(); /* got a good command to get here */
|
|
||||||
#endif
|
|
||||||
/*
|
/*
|
||||||
* We use the last specified parameters, unless new ones are
|
* We use the last specified parameters, unless new ones are
|
||||||
* entered.
|
* entered.
|
||||||
|
@ -623,9 +621,8 @@ mod_i2c_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const arg
|
||||||
if (incrflag)
|
if (incrflag)
|
||||||
addr += size;
|
addr += size;
|
||||||
nbytes = size;
|
nbytes = size;
|
||||||
#ifdef CONFIG_BOOT_RETRY_TIME
|
/* good enough to not time out */
|
||||||
reset_cmd_timeout(); /* good enough to not time out */
|
bootretry_reset_cmd_timeout();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#ifdef CONFIG_BOOT_RETRY_TIME
|
#ifdef CONFIG_BOOT_RETRY_TIME
|
||||||
else if (nbytes == -2)
|
else if (nbytes == -2)
|
||||||
|
@ -642,12 +639,10 @@ mod_i2c_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const arg
|
||||||
data = be32_to_cpu(data);
|
data = be32_to_cpu(data);
|
||||||
nbytes = endp - console_buffer;
|
nbytes = endp - console_buffer;
|
||||||
if (nbytes) {
|
if (nbytes) {
|
||||||
#ifdef CONFIG_BOOT_RETRY_TIME
|
|
||||||
/*
|
/*
|
||||||
* good enough to not time out
|
* good enough to not time out
|
||||||
*/
|
*/
|
||||||
reset_cmd_timeout();
|
bootretry_reset_cmd_timeout();
|
||||||
#endif
|
|
||||||
if (i2c_write(chip, addr, alen, (uchar *)&data, size) != 0)
|
if (i2c_write(chip, addr, alen, (uchar *)&data, size) != 0)
|
||||||
puts ("Error writing the chip.\n");
|
puts ("Error writing the chip.\n");
|
||||||
#ifdef CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS
|
#ifdef CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS
|
||||||
|
|
|
@ -1098,9 +1098,7 @@ mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const argv[])
|
||||||
if (argc != 2)
|
if (argc != 2)
|
||||||
return CMD_RET_USAGE;
|
return CMD_RET_USAGE;
|
||||||
|
|
||||||
#ifdef CONFIG_BOOT_RETRY_TIME
|
bootretry_reset_cmd_timeout(); /* got a good command to get here */
|
||||||
reset_cmd_timeout(); /* got a good command to get here */
|
|
||||||
#endif
|
|
||||||
/* We use the last specified parameters, unless new ones are
|
/* We use the last specified parameters, unless new ones are
|
||||||
* entered.
|
* entered.
|
||||||
*/
|
*/
|
||||||
|
@ -1159,9 +1157,8 @@ mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const argv[])
|
||||||
if (incrflag)
|
if (incrflag)
|
||||||
addr += nbytes ? -size : size;
|
addr += nbytes ? -size : size;
|
||||||
nbytes = 1;
|
nbytes = 1;
|
||||||
#ifdef CONFIG_BOOT_RETRY_TIME
|
/* good enough to not time out */
|
||||||
reset_cmd_timeout(); /* good enough to not time out */
|
bootretry_reset_cmd_timeout();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#ifdef CONFIG_BOOT_RETRY_TIME
|
#ifdef CONFIG_BOOT_RETRY_TIME
|
||||||
else if (nbytes == -2) {
|
else if (nbytes == -2) {
|
||||||
|
@ -1177,11 +1174,9 @@ mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const argv[])
|
||||||
#endif
|
#endif
|
||||||
nbytes = endp - console_buffer;
|
nbytes = endp - console_buffer;
|
||||||
if (nbytes) {
|
if (nbytes) {
|
||||||
#ifdef CONFIG_BOOT_RETRY_TIME
|
|
||||||
/* good enough to not time out
|
/* good enough to not time out
|
||||||
*/
|
*/
|
||||||
reset_cmd_timeout();
|
bootretry_reset_cmd_timeout();
|
||||||
#endif
|
|
||||||
if (size == 4)
|
if (size == 4)
|
||||||
*((u32 *)ptr) = i;
|
*((u32 *)ptr) = i;
|
||||||
#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
|
#ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
|
||||||
|
|
|
@ -355,9 +355,8 @@ pci_cfg_modify (pci_dev_t bdf, ulong addr, ulong size, ulong value, int incrflag
|
||||||
if (incrflag)
|
if (incrflag)
|
||||||
addr += nbytes ? -size : size;
|
addr += nbytes ? -size : size;
|
||||||
nbytes = 1;
|
nbytes = 1;
|
||||||
#ifdef CONFIG_BOOT_RETRY_TIME
|
/* good enough to not time out */
|
||||||
reset_cmd_timeout(); /* good enough to not time out */
|
bootretry_reset_cmd_timeout();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#ifdef CONFIG_BOOT_RETRY_TIME
|
#ifdef CONFIG_BOOT_RETRY_TIME
|
||||||
else if (nbytes == -2) {
|
else if (nbytes == -2) {
|
||||||
|
@ -369,11 +368,9 @@ pci_cfg_modify (pci_dev_t bdf, ulong addr, ulong size, ulong value, int incrflag
|
||||||
i = simple_strtoul(console_buffer, &endp, 16);
|
i = simple_strtoul(console_buffer, &endp, 16);
|
||||||
nbytes = endp - console_buffer;
|
nbytes = endp - console_buffer;
|
||||||
if (nbytes) {
|
if (nbytes) {
|
||||||
#ifdef CONFIG_BOOT_RETRY_TIME
|
|
||||||
/* good enough to not time out
|
/* good enough to not time out
|
||||||
*/
|
*/
|
||||||
reset_cmd_timeout();
|
bootretry_reset_cmd_timeout();
|
||||||
#endif
|
|
||||||
pci_cfg_write (bdf, addr, size, i);
|
pci_cfg_write (bdf, addr, size, i);
|
||||||
if (incrflag)
|
if (incrflag)
|
||||||
addr += size;
|
addr += size;
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
* SPDX-License-Identifier: GPL-2.0+
|
* SPDX-License-Identifier: GPL-2.0+
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __bootretry_h
|
#ifndef __BOOTRETRY_H
|
||||||
#define __bootretry_h
|
#define __BOOTRETRY_H
|
||||||
|
|
||||||
#ifdef CONFIG_BOOT_RETRY_TIME
|
#ifdef CONFIG_BOOT_RETRY_TIME
|
||||||
/**
|
/**
|
||||||
|
@ -18,14 +18,42 @@
|
||||||
* @return 0 if a key is received in time, -ETIMEDOUT if not
|
* @return 0 if a key is received in time, -ETIMEDOUT if not
|
||||||
*/
|
*/
|
||||||
int bootretry_tstc_timeout(void);
|
int bootretry_tstc_timeout(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* bootretry_init_cmd_timeout() - set up command timeout
|
||||||
|
*
|
||||||
|
* Get the required command timeout from the environment.
|
||||||
|
*/
|
||||||
|
void bootretry_init_cmd_timeout(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* bootretry_reset_cmd_timeout() - reset command timeout
|
||||||
|
*
|
||||||
|
* Reset the command timeout so that the user has a fresh start. This is
|
||||||
|
* typically used when input is received from the user.
|
||||||
|
*/
|
||||||
|
void bootretry_reset_cmd_timeout(void);
|
||||||
|
|
||||||
|
/** bootretry_dont_retry() - Indicate that we should not retry the boot */
|
||||||
|
void bootretry_dont_retry(void);
|
||||||
#else
|
#else
|
||||||
static inline int bootretry_tstc_timeout(void)
|
static inline int bootretry_tstc_timeout(void)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void init_cmd_timeout(void);
|
static inline void bootretry_init_cmd_timeout(void)
|
||||||
void reset_cmd_timeout(void);
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void bootretry_reset_cmd_timeout(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void bootretry_dont_retry(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -100,9 +100,6 @@ int cli_readline_into_buffer(const char *const prompt, char *buffer,
|
||||||
*/
|
*/
|
||||||
int cli_simple_parse_line(char *line, char *argv[]);
|
int cli_simple_parse_line(char *line, char *argv[]);
|
||||||
|
|
||||||
/** bootretry_dont_retry() - Indicate that we should not retry the boot */
|
|
||||||
void bootretry_dont_retry(void);
|
|
||||||
|
|
||||||
#define endtick(seconds) (get_ticks() + (uint64_t)(seconds) * get_tbclk())
|
#define endtick(seconds) (get_ticks() + (uint64_t)(seconds) * get_tbclk())
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue