]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
global_data: Convert have_console into a flag
authorSimon Glass <sjg@chromium.org>
Wed, 21 Aug 2024 16:19:04 +0000 (10:19 -0600)
committerTom Rini <trini@konsulko.com>
Mon, 26 Aug 2024 20:05:38 +0000 (14:05 -0600)
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>
arch/arm/cpu/arm926ejs/mxs/spl_boot.c
arch/arm/mach-exynos/spl_boot.c
arch/arm/mach-k3/common.c
arch/arm/mach-k3/r5/sysfw-loader.c
board/siemens/common/board_am335x.c
common/board_f.c
common/console.c
common/spl/spl.c
include/asm-generic/global_data.h

index 76a69d7f9586b3e29bd45cd1216b2d9b7e97b9b5..dd7483282936e195030b5580f11cf8ca2166b492 100644 (file)
@@ -117,7 +117,7 @@ static void mxs_spl_console_init(void)
        gd->bd = &bdata;
        gd->baudrate = CONFIG_BAUDRATE;
        serial_init();
-       gd->have_console = 1;
+       gd->flags |= GD_FLG_HAVE_CONSOLE;
 #endif
 }
 
index bd5a06447b9c8977e06da9f26068921c0e7ac4bb..219d7fbf957912ef5e7507d73dffef5e0a40ab8e 100644 (file)
@@ -312,7 +312,7 @@ static void setup_global_data(gd_t *gdp)
        memzero((void *)gd, sizeof(gd_t));
        gd->flags |= GD_FLG_RELOC;
        gd->baudrate = CONFIG_BAUDRATE;
-       gd->have_console = 1;
+       gd->flags |= GD_FLG_HAVE_CONSOLE;
 }
 
 void board_init_f(unsigned long bootflag)
index eaa7d3617672f7c6eb39f88645bcd8d1e0b0cfae..df48ec8d4791920a564437e808bcb7fb57c9247e 100644 (file)
@@ -104,7 +104,7 @@ int early_console_init(void)
 
        gd->cur_serial_dev = dev;
        gd->flags |= GD_FLG_SERIAL_READY;
-       gd->have_console = 1;
+       gd->flags |= GD_FLG_HAVE_CONSOLE;
 
        return 0;
 }
index 94d051ba0fbb2ccff0fc38f1460525a8d35e8df2..188731e673d759f388f80de0446ad3243ebb3ac6 100644 (file)
@@ -451,7 +451,7 @@ void k3_sysfw_loader(bool rom_loaded_sysfw,
                 * the case when continuing to boot serially from the same
                 * UART that the ROM loaded the initial bootloader from.
                 */
-               if (!gd->have_console)
+               if (!(gd->flags & GD_FLG_HAVE_CONSOLE))
                        early_console_init();
 #endif
                ret = spl_ymodem_load_image(&spl_image, &bootdev);
index 2a727606bc369bdf73cae73e19c41ab84c0ebe91..e6537b0675a843604f3438076937830406ea4ef0 100644 (file)
@@ -36,7 +36,7 @@ void set_mux_conf_regs(void)
        /* enable early the console */
        gd->baudrate = CONFIG_BAUDRATE;
        serial_init();
-       gd->have_console = 1;
+       gd->flags |= GD_FLG_HAVE_CONSOLE;
 
        siemens_ee_setup();
        if (draco_read_eeprom() < 0)
index 454426d921c7049689328f9ccd6be71cdd0d20b2..a1f8641ae268da7e58a2f97da561812f23e98458 100644 (file)
@@ -1022,7 +1022,7 @@ static const init_fnc_t init_sequence_f[] = {
 void board_init_f(ulong boot_flags)
 {
        gd->flags = boot_flags;
-       gd->have_console = 0;
+       gd->flags &= ~GD_FLG_HAVE_CONSOLE;
 
        if (initcall_run_list(init_sequence_f))
                hang();
index 63f78004fdbc95f9453f42ca1cf063747e0c1ab8..30ddefef6b1cb3bab5e812419830cf76c8b27d3c 100644 (file)
@@ -586,7 +586,7 @@ int getchar(void)
        if (IS_ENABLED(CONFIG_DISABLE_CONSOLE) && (gd->flags & GD_FLG_DISABLE_CONSOLE))
                return 0;
 
-       if (!gd->have_console)
+       if (!(gd->flags & GD_FLG_HAVE_CONSOLE))
                return 0;
 
        ch = console_record_getc();
@@ -607,7 +607,7 @@ int tstc(void)
        if (IS_ENABLED(CONFIG_DISABLE_CONSOLE) && (gd->flags & GD_FLG_DISABLE_CONSOLE))
                return 0;
 
-       if (!gd->have_console)
+       if (!(gd->flags & GD_FLG_HAVE_CONSOLE))
                return 0;
 
        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))
                return;
 
-       if (!gd->have_console)
+       if (!(gd->flags & GD_FLG_HAVE_CONSOLE))
                return pre_console_putc(c);
 
        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))
                return;
 
-       if (!gd->have_console)
+       if (!(gd->flags & GD_FLG_HAVE_CONSOLE))
                return pre_console_puts(s);
 
        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))
                return;
 
-       if (!gd->have_console)
+       if (!(gd->flags & GD_FLG_HAVE_CONSOLE))
                return;
 
        if (gd->flags & GD_FLG_DEVINIT) {
@@ -872,7 +872,7 @@ static int ctrlc_disabled = 0;      /* see disable_ctrl() */
 static int ctrlc_was_pressed = 0;
 int ctrlc(void)
 {
-       if (!ctrlc_disabled && gd->have_console) {
+       if (!ctrlc_disabled && (gd->flags & GD_FLG_HAVE_CONSOLE)) {
                if (tstc()) {
                        switch (getchar()) {
                        case 0x03:              /* ^C - Control C */
@@ -1011,7 +1011,7 @@ int console_announce_r(void)
 /* Called before relocation - use serial functions */
 int console_init_f(void)
 {
-       gd->have_console = 1;
+       gd->flags |= GD_FLG_HAVE_CONSOLE;
 
        console_update_silent();
 
index 7c6e322ffd7fdb6f48c109e59374d24855202ade..d4ec86ace16ea0a0a94a0d312d4933ed25fe11ab 100644 (file)
@@ -838,7 +838,7 @@ void preloader_console_init(void)
 
        serial_init();          /* serial communications setup */
 
-       gd->have_console = 1;
+       gd->flags |= GD_FLG_HAVE_CONSOLE;
 
 #if CONFIG_IS_ENABLED(BANNER_PRINT)
        puts("\nU-Boot " SPL_TPL_NAME " " PLAIN_VERSION " (" U_BOOT_DATE " - "
index a06b508bebb14f61ecbf6f8416c647600e7da7c7..7b6c5223e72b1f5688ae103147c1b04066b1f58f 100644 (file)
@@ -93,15 +93,6 @@ struct global_data {
         */
        unsigned long board_type;
 #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)
        /**
         * @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 = 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__ */