mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-22 12:54:37 +00:00
global_data: Convert have_console into a flag
We don't need a full word for this boolean value. Convert it into a flag to save space in global_data. Reviewed-by: Alexander Sverdlin <alexander.sverdlin@siemens.com> Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
30e331e9cb
commit
f44fded236
9 changed files with 20 additions and 23 deletions
|
@ -117,7 +117,7 @@ static void mxs_spl_console_init(void)
|
||||||
gd->bd = &bdata;
|
gd->bd = &bdata;
|
||||||
gd->baudrate = CONFIG_BAUDRATE;
|
gd->baudrate = CONFIG_BAUDRATE;
|
||||||
serial_init();
|
serial_init();
|
||||||
gd->have_console = 1;
|
gd->flags |= GD_FLG_HAVE_CONSOLE;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -312,7 +312,7 @@ static void setup_global_data(gd_t *gdp)
|
||||||
memzero((void *)gd, sizeof(gd_t));
|
memzero((void *)gd, sizeof(gd_t));
|
||||||
gd->flags |= GD_FLG_RELOC;
|
gd->flags |= GD_FLG_RELOC;
|
||||||
gd->baudrate = CONFIG_BAUDRATE;
|
gd->baudrate = CONFIG_BAUDRATE;
|
||||||
gd->have_console = 1;
|
gd->flags |= GD_FLG_HAVE_CONSOLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void board_init_f(unsigned long bootflag)
|
void board_init_f(unsigned long bootflag)
|
||||||
|
|
|
@ -104,7 +104,7 @@ int early_console_init(void)
|
||||||
|
|
||||||
gd->cur_serial_dev = dev;
|
gd->cur_serial_dev = dev;
|
||||||
gd->flags |= GD_FLG_SERIAL_READY;
|
gd->flags |= GD_FLG_SERIAL_READY;
|
||||||
gd->have_console = 1;
|
gd->flags |= GD_FLG_HAVE_CONSOLE;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -451,7 +451,7 @@ void k3_sysfw_loader(bool rom_loaded_sysfw,
|
||||||
* the case when continuing to boot serially from the same
|
* the case when continuing to boot serially from the same
|
||||||
* UART that the ROM loaded the initial bootloader from.
|
* UART that the ROM loaded the initial bootloader from.
|
||||||
*/
|
*/
|
||||||
if (!gd->have_console)
|
if (!(gd->flags & GD_FLG_HAVE_CONSOLE))
|
||||||
early_console_init();
|
early_console_init();
|
||||||
#endif
|
#endif
|
||||||
ret = spl_ymodem_load_image(&spl_image, &bootdev);
|
ret = spl_ymodem_load_image(&spl_image, &bootdev);
|
||||||
|
|
|
@ -36,7 +36,7 @@ void set_mux_conf_regs(void)
|
||||||
/* enable early the console */
|
/* enable early the console */
|
||||||
gd->baudrate = CONFIG_BAUDRATE;
|
gd->baudrate = CONFIG_BAUDRATE;
|
||||||
serial_init();
|
serial_init();
|
||||||
gd->have_console = 1;
|
gd->flags |= GD_FLG_HAVE_CONSOLE;
|
||||||
|
|
||||||
siemens_ee_setup();
|
siemens_ee_setup();
|
||||||
if (draco_read_eeprom() < 0)
|
if (draco_read_eeprom() < 0)
|
||||||
|
|
|
@ -1022,7 +1022,7 @@ static const init_fnc_t init_sequence_f[] = {
|
||||||
void board_init_f(ulong boot_flags)
|
void board_init_f(ulong boot_flags)
|
||||||
{
|
{
|
||||||
gd->flags = boot_flags;
|
gd->flags = boot_flags;
|
||||||
gd->have_console = 0;
|
gd->flags &= ~GD_FLG_HAVE_CONSOLE;
|
||||||
|
|
||||||
if (initcall_run_list(init_sequence_f))
|
if (initcall_run_list(init_sequence_f))
|
||||||
hang();
|
hang();
|
||||||
|
|
|
@ -586,7 +586,7 @@ int getchar(void)
|
||||||
if (IS_ENABLED(CONFIG_DISABLE_CONSOLE) && (gd->flags & GD_FLG_DISABLE_CONSOLE))
|
if (IS_ENABLED(CONFIG_DISABLE_CONSOLE) && (gd->flags & GD_FLG_DISABLE_CONSOLE))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!gd->have_console)
|
if (!(gd->flags & GD_FLG_HAVE_CONSOLE))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
ch = console_record_getc();
|
ch = console_record_getc();
|
||||||
|
@ -607,7 +607,7 @@ int tstc(void)
|
||||||
if (IS_ENABLED(CONFIG_DISABLE_CONSOLE) && (gd->flags & GD_FLG_DISABLE_CONSOLE))
|
if (IS_ENABLED(CONFIG_DISABLE_CONSOLE) && (gd->flags & GD_FLG_DISABLE_CONSOLE))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!gd->have_console)
|
if (!(gd->flags & GD_FLG_HAVE_CONSOLE))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (console_record_tstc())
|
if (console_record_tstc())
|
||||||
|
@ -715,7 +715,7 @@ void putc(const char c)
|
||||||
if (IS_ENABLED(CONFIG_DISABLE_CONSOLE) && (gd->flags & GD_FLG_DISABLE_CONSOLE))
|
if (IS_ENABLED(CONFIG_DISABLE_CONSOLE) && (gd->flags & GD_FLG_DISABLE_CONSOLE))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!gd->have_console)
|
if (!(gd->flags & GD_FLG_HAVE_CONSOLE))
|
||||||
return pre_console_putc(c);
|
return pre_console_putc(c);
|
||||||
|
|
||||||
if (gd->flags & GD_FLG_DEVINIT) {
|
if (gd->flags & GD_FLG_DEVINIT) {
|
||||||
|
@ -759,7 +759,7 @@ void puts(const char *s)
|
||||||
if (IS_ENABLED(CONFIG_DISABLE_CONSOLE) && (gd->flags & GD_FLG_DISABLE_CONSOLE))
|
if (IS_ENABLED(CONFIG_DISABLE_CONSOLE) && (gd->flags & GD_FLG_DISABLE_CONSOLE))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!gd->have_console)
|
if (!(gd->flags & GD_FLG_HAVE_CONSOLE))
|
||||||
return pre_console_puts(s);
|
return pre_console_puts(s);
|
||||||
|
|
||||||
if (gd->flags & GD_FLG_DEVINIT) {
|
if (gd->flags & GD_FLG_DEVINIT) {
|
||||||
|
@ -793,7 +793,7 @@ void flush(void)
|
||||||
if (IS_ENABLED(CONFIG_DISABLE_CONSOLE) && (gd->flags & GD_FLG_DISABLE_CONSOLE))
|
if (IS_ENABLED(CONFIG_DISABLE_CONSOLE) && (gd->flags & GD_FLG_DISABLE_CONSOLE))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!gd->have_console)
|
if (!(gd->flags & GD_FLG_HAVE_CONSOLE))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (gd->flags & GD_FLG_DEVINIT) {
|
if (gd->flags & GD_FLG_DEVINIT) {
|
||||||
|
@ -872,7 +872,7 @@ static int ctrlc_disabled = 0; /* see disable_ctrl() */
|
||||||
static int ctrlc_was_pressed = 0;
|
static int ctrlc_was_pressed = 0;
|
||||||
int ctrlc(void)
|
int ctrlc(void)
|
||||||
{
|
{
|
||||||
if (!ctrlc_disabled && gd->have_console) {
|
if (!ctrlc_disabled && (gd->flags & GD_FLG_HAVE_CONSOLE)) {
|
||||||
if (tstc()) {
|
if (tstc()) {
|
||||||
switch (getchar()) {
|
switch (getchar()) {
|
||||||
case 0x03: /* ^C - Control C */
|
case 0x03: /* ^C - Control C */
|
||||||
|
@ -1011,7 +1011,7 @@ int console_announce_r(void)
|
||||||
/* Called before relocation - use serial functions */
|
/* Called before relocation - use serial functions */
|
||||||
int console_init_f(void)
|
int console_init_f(void)
|
||||||
{
|
{
|
||||||
gd->have_console = 1;
|
gd->flags |= GD_FLG_HAVE_CONSOLE;
|
||||||
|
|
||||||
console_update_silent();
|
console_update_silent();
|
||||||
|
|
||||||
|
|
|
@ -838,7 +838,7 @@ void preloader_console_init(void)
|
||||||
|
|
||||||
serial_init(); /* serial communications setup */
|
serial_init(); /* serial communications setup */
|
||||||
|
|
||||||
gd->have_console = 1;
|
gd->flags |= GD_FLG_HAVE_CONSOLE;
|
||||||
|
|
||||||
#if CONFIG_IS_ENABLED(BANNER_PRINT)
|
#if CONFIG_IS_ENABLED(BANNER_PRINT)
|
||||||
puts("\nU-Boot " SPL_TPL_NAME " " PLAIN_VERSION " (" U_BOOT_DATE " - "
|
puts("\nU-Boot " SPL_TPL_NAME " " PLAIN_VERSION " (" U_BOOT_DATE " - "
|
||||||
|
|
|
@ -93,15 +93,6 @@ struct global_data {
|
||||||
*/
|
*/
|
||||||
unsigned long board_type;
|
unsigned long board_type;
|
||||||
#endif
|
#endif
|
||||||
/**
|
|
||||||
* @have_console: console is available
|
|
||||||
*
|
|
||||||
* A value of 1 indicates that serial_init() was called and a console
|
|
||||||
* is available.
|
|
||||||
* A value of 0 indicates that console input and output drivers shall
|
|
||||||
* not be called.
|
|
||||||
*/
|
|
||||||
unsigned long have_console;
|
|
||||||
#if CONFIG_IS_ENABLED(PRE_CONSOLE_BUFFER)
|
#if CONFIG_IS_ENABLED(PRE_CONSOLE_BUFFER)
|
||||||
/**
|
/**
|
||||||
* @precon_buf_idx: pre-console buffer index
|
* @precon_buf_idx: pre-console buffer index
|
||||||
|
@ -709,6 +700,12 @@ enum gd_flags {
|
||||||
* @GD_FLG_UPL: Read/write a Universal Payload (UPL) handoff
|
* @GD_FLG_UPL: Read/write a Universal Payload (UPL) handoff
|
||||||
*/
|
*/
|
||||||
GD_FLG_UPL = 0x4000000,
|
GD_FLG_UPL = 0x4000000,
|
||||||
|
/**
|
||||||
|
* @GD_FLG_HAVE_CONSOLE: serial_init() was called and a console
|
||||||
|
* is available. When not set, indicates that console input and output
|
||||||
|
* drivers shall not be called.
|
||||||
|
*/
|
||||||
|
GD_FLG_HAVE_CONSOLE = 0x8000000,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __ASSEMBLY__ */
|
#endif /* __ASSEMBLY__ */
|
||||||
|
|
Loading…
Add table
Reference in a new issue