[PATCH v3 1/3] global_data.h: convert GD_FLG_* to enum
Heinrich Schuchardt
xypron.glpk at gmx.de
Mon Oct 5 08:30:08 CEST 2020
Sphinx documentation is only available for enums not for #defines.
Anyway it is better to keep related definitions in an enum.
Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
Reviewed-by: Simon Glass <sjg at chromium.org>
---
v3:
no change
v2:
enum gd_flags must not be exposed to assembler code
---
include/asm-generic/global_data.h | 106 +++++++++++++++++++++++-------
1 file changed, 84 insertions(+), 22 deletions(-)
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index d4a4e2215d..e4a68e0d91 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -138,7 +138,6 @@ typedef struct global_data {
struct udevice *watchdog_dev;
#endif
} gd_t;
-#endif
#ifdef CONFIG_BOARD_TYPES
#define gd_board_type() gd->board_type
@@ -146,27 +145,90 @@ typedef struct global_data {
#define gd_board_type() 0
#endif
-/*
- * Global Data Flags
+/**
+ * enum gd_flags - global data flags
+ *
+ * See field flags of &struct global_data.
*/
-#define GD_FLG_RELOC 0x00001 /* Code was relocated to RAM */
-#define GD_FLG_DEVINIT 0x00002 /* Devices have been initialized */
-#define GD_FLG_SILENT 0x00004 /* Silent mode */
-#define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */
-#define GD_FLG_POSTSTOP 0x00010 /* POST seqeunce aborted */
-#define GD_FLG_LOGINIT 0x00020 /* Log Buffer has been initialized */
-#define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out) */
-#define GD_FLG_ENV_READY 0x00080 /* Env. imported into hash table */
-#define GD_FLG_SERIAL_READY 0x00100 /* Pre-reloc serial console ready */
-#define GD_FLG_FULL_MALLOC_INIT 0x00200 /* Full malloc() is ready */
-#define GD_FLG_SPL_INIT 0x00400 /* spl_init() has been called */
-#define GD_FLG_SKIP_RELOC 0x00800 /* Don't relocate */
-#define GD_FLG_RECORD 0x01000 /* Record console */
-#define GD_FLG_ENV_DEFAULT 0x02000 /* Default variable flag */
-#define GD_FLG_SPL_EARLY_INIT 0x04000 /* Early SPL init is done */
-#define GD_FLG_LOG_READY 0x08000 /* Log system is ready for use */
-#define GD_FLG_WDT_READY 0x10000 /* Watchdog is ready for use */
-#define GD_FLG_SKIP_LL_INIT 0x20000 /* Don't perform low-level init */
-#define GD_FLG_SMP_READY 0x40000 /* SMP init is complete */
+enum gd_flags {
+ /**
+ * @GD_FLG_RELOC: code was relocated to RAM
+ */
+ GD_FLG_RELOC = 0x00001,
+ /**
+ * @GD_FLG_DEVINIT: devices have been initialized
+ */
+ GD_FLG_DEVINIT = 0x00002,
+ /**
+ * @GD_FLG_SILENT: silent mode
+ */
+ GD_FLG_SILENT = 0x00004,
+ /**
+ * @GD_FLG_POSTFAIL: critical POST test failed
+ */
+ GD_FLG_POSTFAIL = 0x00008,
+ /**
+ * @GD_FLG_POSTSTOP: POST sequence aborted
+ */
+ GD_FLG_POSTSTOP = 0x00010,
+ /**
+ * @GD_FLG_LOGINIT: log Buffer has been initialized
+ */
+ GD_FLG_LOGINIT = 0x00020,
+ /**
+ * @GD_FLG_DISABLE_CONSOLE: disable console (in & out)
+ */
+ GD_FLG_DISABLE_CONSOLE = 0x00040,
+ /**
+ * @GD_FLG_ENV_READY: environment imported into hash table
+ */
+ GD_FLG_ENV_READY = 0x00080,
+ /**
+ * @GD_FLG_SERIAL_READY: pre-relocation serial console ready
+ */
+ GD_FLG_SERIAL_READY = 0x00100,
+ /**
+ * @GD_FLG_FULL_MALLOC_INIT: full malloc() is ready
+ */
+ GD_FLG_FULL_MALLOC_INIT = 0x00200,
+ /**
+ * @GD_FLG_SPL_INIT: spl_init() has been called
+ */
+ GD_FLG_SPL_INIT = 0x00400,
+ /**
+ * @GD_FLG_SKIP_RELOC: don't relocate
+ */
+ GD_FLG_SKIP_RELOC = 0x00800,
+ /**
+ * @GD_FLG_RECORD: record console
+ */
+ GD_FLG_RECORD = 0x01000,
+ /**
+ * @GD_FLG_ENV_DEFAULT: default variable flag
+ */
+ GD_FLG_ENV_DEFAULT = 0x02000,
+ /**
+ * @GD_FLG_SPL_EARLY_INIT: early SPL initialization is done
+ */
+ GD_FLG_SPL_EARLY_INIT = 0x04000,
+ /**
+ * @GD_FLG_LOG_READY: log system is ready for use
+ */
+ GD_FLG_LOG_READY = 0x08000,
+ /**
+ * @GD_FLG_WDT_READY: watchdog is ready for use
+ */
+ GD_FLG_WDT_READY = 0x10000,
+ /**
+ * @GD_FLG_SKIP_LL_INIT: don't perform low-level initialization
+ */
+ GD_FLG_SKIP_LL_INIT = 0x20000,
+ /**
+ * @GD_FLG_SMP_READY: SMP initialization is complete
+ */
+ GD_FLG_SMP_READY = 0x40000,
+};
+
+#endif /* __ASSEMBLY__ */
#endif /* __ASM_GENERIC_GBL_DATA_H */
--
2.28.0
More information about the U-Boot
mailing list