Merge branch 'master' into next
[platform/kernel/u-boot.git] / include / asm-generic / global_data.h
index 887b5c2..4aeb61f 100644 (file)
  */
 
 #ifndef __ASSEMBLY__
+#include <cyclic.h>
+#include <event_internal.h>
 #include <fdtdec.h>
 #include <membuff.h>
 #include <linux/list.h>
+#include <linux/build_bug.h>
+#include <asm-offsets.h>
 
 struct acpi_ctx;
 struct driver_rt;
@@ -64,7 +68,7 @@ struct global_data {
         * @mem_clk: memory clock rate in Hz
         */
        unsigned long mem_clk;
-#if defined(CONFIG_LCD) || defined(CONFIG_VIDEO) || defined(CONFIG_DM_VIDEO)
+#if defined(CONFIG_LCD) || defined(CONFIG_DM_VIDEO)
        /**
         * @fb_base: base address of frame buffer memory
         */
@@ -112,10 +116,14 @@ struct global_data {
        /**
         * @precon_buf_idx: pre-console buffer index
         *
-        * @precon_buf_idx indicates the current position of the buffer used to
-        * collect output before the console becomes available
-        */
-       unsigned long precon_buf_idx;
+        * @precon_buf_idx indicates the current position of the
+        * buffer used to collect output before the console becomes
+        * available. When negative, the pre-console buffer is
+        * temporarily disabled (used when the pre-console buffer is
+        * being written out, to prevent adding its contents to
+        * itself).
+        */
+       long precon_buf_idx;
 #endif
        /**
         * @env_addr: address of environment structure
@@ -147,7 +155,7 @@ struct global_data {
        /**
         * @ram_top: top address of RAM used by U-Boot
         */
-       unsigned long ram_top;
+       phys_addr_t ram_top;
        /**
         * @relocaddr: start address of U-Boot in RAM
         *
@@ -192,13 +200,37 @@ struct global_data {
         */
        struct udevice *dm_root_f;
        /**
-        * @uclass_root: head of core tree
+        * @uclass_root_s:
+        * head of core tree when uclasses are not in read-only memory.
+        *
+        * When uclasses are in read-only memory, @uclass_root_s is not used and
+        * @uclass_root points to the root node generated by dtoc.
+        */
+       struct list_head uclass_root_s;
+       /**
+        * @uclass_root:
+        * pointer to head of core tree, if uclasses are in read-only memory and
+        * cannot be adjusted to use @uclass_root as a list head.
+        *
+        * When not in read-only memory, @uclass_root_s is used to hold the
+        * uclass root, and @uclass_root points to the address of
+        * @uclass_root_s.
         */
-       struct list_head uclass_root;
-# if CONFIG_IS_ENABLED(OF_PLATDATA)
+       struct list_head *uclass_root;
+# if CONFIG_IS_ENABLED(OF_PLATDATA_DRIVER_RT)
        /** @dm_driver_rt: Dynamic info about the driver */
        struct driver_rt *dm_driver_rt;
 # endif
+#if CONFIG_IS_ENABLED(OF_PLATDATA_RT)
+       /** @dm_udevice_rt: Dynamic info about the udevice */
+       struct udevice_rt *dm_udevice_rt;
+       /**
+        * @dm_priv_base: Base address of the priv/plat region used when
+        * udevices and uclasses are in read-only memory. This is NULL if not
+        * used
+        */
+       void *dm_priv_base;
+# endif
 #endif
 #ifdef CONFIG_TIMER
        /**
@@ -218,6 +250,10 @@ struct global_data {
         * @fdt_size: space reserved for relocated device space
         */
        unsigned long fdt_size;
+       /**
+        * @fdt_src: Source of FDT
+        */
+       enum fdt_source_t fdt_src;
 #if CONFIG_IS_ENABLED(OF_LIVE)
        /**
         * @of_root: root node of the live tree
@@ -251,7 +287,7 @@ struct global_data {
         */
        void *trace_buff;
 #endif
-#if defined(CONFIG_SYS_I2C)
+#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY)
        /**
         * @cur_i2c_bus: currently used I2C bus
         */
@@ -390,6 +426,12 @@ struct global_data {
         * This value is used as logging level for continuation messages.
         */
        int logl_prev;
+       /**
+        * @log_cont: Previous log line did not finished wtih \n
+        *
+        * This allows for chained log messages on the same line
+        */
+       bool log_cont;
 #endif
 #if CONFIG_IS_ENABLED(BLOBLIST)
        /**
@@ -400,12 +442,12 @@ struct global_data {
         * @new_bloblist: relocated blob list information
         */
        struct bloblist_hdr *new_bloblist;
-# ifdef CONFIG_SPL
+#endif
+#if CONFIG_IS_ENABLED(HANDOFF)
        /**
         * @spl_handoff: SPL hand-off information
         */
        struct spl_handoff *spl_handoff;
-# endif
 #endif
 #if defined(CONFIG_TRANSLATION_OFFSET)
        /**
@@ -415,19 +457,42 @@ struct global_data {
         */
        fdt_addr_t translation_offset;
 #endif
-#if CONFIG_IS_ENABLED(WDT)
-       /**
-        * @watchdog_dev: watchdog device
-        */
-       struct udevice *watchdog_dev;
-#endif
 #ifdef CONFIG_GENERATE_ACPI_TABLE
        /**
         * @acpi_ctx: ACPI context pointer
         */
        struct acpi_ctx *acpi_ctx;
+       /**
+        * @acpi_start: Start address of ACPI tables
+        */
+       ulong acpi_start;
+#endif
+#if CONFIG_IS_ENABLED(GENERATE_SMBIOS_TABLE)
+       /**
+        * @smbios_version: Points to SMBIOS type 0 version
+        */
+       char *smbios_version;
+#endif
+#if CONFIG_IS_ENABLED(EVENT)
+       /**
+        * @event_state: Points to the current state of events
+        */
+       struct event_state event_state;
 #endif
+#ifdef CONFIG_CYCLIC
+       /**
+        * @cyclic: cyclic driver data
+        */
+       struct cyclic_drv *cyclic;
+#endif
+       /**
+        * @dmtag_list: List of DM tags
+        */
+       struct list_head dmtag_list;
 };
+#ifndef DO_DEPS_ONLY
+static_assert(sizeof(struct global_data) == GD_SIZE);
+#endif
 
 /**
  * gd_board_type() - retrieve board type
@@ -451,7 +516,7 @@ struct global_data {
 #define gd_set_of_root(_root)
 #endif
 
-#if CONFIG_IS_ENABLED(OF_PLATDATA)
+#if CONFIG_IS_ENABLED(OF_PLATDATA_DRIVER_RT)
 #define gd_set_dm_driver_rt(dyn)       gd->dm_driver_rt = dyn
 #define gd_dm_driver_rt()              gd->dm_driver_rt
 #else
@@ -459,10 +524,40 @@ struct global_data {
 #define gd_dm_driver_rt()              NULL
 #endif
 
+#if CONFIG_IS_ENABLED(OF_PLATDATA_RT)
+#define gd_set_dm_udevice_rt(dyn)      gd->dm_udevice_rt = dyn
+#define gd_dm_udevice_rt()             gd->dm_udevice_rt
+#define gd_set_dm_priv_base(dyn)       gd->dm_priv_base = dyn
+#define gd_dm_priv_base()              gd->dm_priv_base
+#else
+#define gd_set_dm_udevice_rt(dyn)
+#define gd_dm_udevice_rt()             NULL
+#define gd_set_dm_priv_base(dyn)
+#define gd_dm_priv_base()              NULL
+#endif
+
 #ifdef CONFIG_GENERATE_ACPI_TABLE
 #define gd_acpi_ctx()          gd->acpi_ctx
+#define gd_acpi_start()                gd->acpi_start
+#define gd_set_acpi_start(addr)        gd->acpi_start = addr
 #else
 #define gd_acpi_ctx()          NULL
+#define gd_acpi_start()                0UL
+#define gd_set_acpi_start(addr)
+#endif
+
+#if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
+#define gd_multi_dtb_fit()     gd->multi_dtb_fit
+#define gd_set_multi_dtb_fit(_dtb)     gd->multi_dtb_fit = _dtb
+#else
+#define gd_multi_dtb_fit()     NULL
+#define gd_set_multi_dtb_fit(_dtb)
+#endif
+
+#if CONFIG_IS_ENABLED(EVENT_DYNAMIC)
+#define gd_event_state()       ((struct event_state *)&gd->event_state)
+#else
+#define gd_event_state()       NULL
 #endif
 
 /**
@@ -524,29 +619,33 @@ enum gd_flags {
         */
        GD_FLG_RECORD = 0x01000,
        /**
+        * @GD_FLG_RECORD_OVF: record console overflow
+        */
+       GD_FLG_RECORD_OVF = 0x02000,
+       /**
         * @GD_FLG_ENV_DEFAULT: default variable flag
         */
-       GD_FLG_ENV_DEFAULT = 0x02000,
+       GD_FLG_ENV_DEFAULT = 0x04000,
        /**
         * @GD_FLG_SPL_EARLY_INIT: early SPL initialization is done
         */
-       GD_FLG_SPL_EARLY_INIT = 0x04000,
+       GD_FLG_SPL_EARLY_INIT = 0x08000,
        /**
         * @GD_FLG_LOG_READY: log system is ready for use
         */
-       GD_FLG_LOG_READY = 0x08000,
+       GD_FLG_LOG_READY = 0x10000,
        /**
         * @GD_FLG_WDT_READY: watchdog is ready for use
         */
-       GD_FLG_WDT_READY = 0x10000,
+       GD_FLG_WDT_READY = 0x20000,
        /**
         * @GD_FLG_SKIP_LL_INIT: don't perform low-level initialization
         */
-       GD_FLG_SKIP_LL_INIT = 0x20000,
+       GD_FLG_SKIP_LL_INIT = 0x40000,
        /**
         * @GD_FLG_SMP_READY: SMP initialization is complete
         */
-       GD_FLG_SMP_READY = 0x40000,
+       GD_FLG_SMP_READY = 0x80000,
 };
 
 #endif /* __ASSEMBLY__ */