Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Simon Glass | 50b1fa3 | 2012-12-13 20:49:12 +0000 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2012 The Chromium OS Authors. |
| 4 | * (C) Copyright 2002-2010 |
| 5 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
Simon Glass | 50b1fa3 | 2012-12-13 20:49:12 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #ifndef __ASM_GENERIC_GBL_DATA_H |
| 9 | #define __ASM_GENERIC_GBL_DATA_H |
| 10 | /* |
| 11 | * The following data structure is placed in some memory which is |
| 12 | * available very early after boot (like DPRAM on MPC8xx/MPC82xx, or |
| 13 | * some locked parts of the data cache) to allow for a minimum set of |
| 14 | * global variables during system initialization (until we have set |
| 15 | * up the memory controller so that we can use RAM). |
| 16 | * |
| 17 | * Keep it *SMALL* and remember to set GENERATED_GBL_DATA_SIZE > sizeof(gd_t) |
| 18 | * |
| 19 | * Each architecture has its own private fields. For now all are private |
| 20 | */ |
| 21 | |
| 22 | #ifndef __ASSEMBLY__ |
Stefan Roese | c2c6971 | 2022-09-02 13:57:48 +0200 | [diff] [blame] | 23 | #include <cyclic.h> |
Simon Glass | 87a5d1b | 2022-03-04 08:43:00 -0700 | [diff] [blame] | 24 | #include <event_internal.h> |
Stefan Roese | f2100f6 | 2019-04-12 16:42:28 +0200 | [diff] [blame] | 25 | #include <fdtdec.h> |
Simon Glass | 9854a87 | 2015-11-08 23:47:48 -0700 | [diff] [blame] | 26 | #include <membuff.h> |
Simon Glass | 6494d70 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 27 | #include <linux/list.h> |
Rasmus Villemoes | ee3a46a | 2021-05-18 11:19:47 +0200 | [diff] [blame] | 28 | #include <linux/build_bug.h> |
| 29 | #include <asm-offsets.h> |
Simon Glass | 6494d70 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 30 | |
Bo Lv | 96a66d0 | 2023-05-12 19:18:22 +0800 | [diff] [blame] | 31 | #ifdef CONFIG_AML_UASAN |
| 32 | #include <amlogic/uasan.h> |
| 33 | #endif |
| 34 | |
benlong.zhou | f0969fb | 2023-10-26 16:42:01 +0800 | [diff] [blame] | 35 | #ifdef CONFIG_AMLOGIC_MODIFY |
| 36 | #ifdef CONFIG_AMLOGIC_TIME_PROFILE |
| 37 | #define INITCALL_CNT 128 |
| 38 | struct init_call_time { |
| 39 | void *func; |
| 40 | unsigned int time; |
| 41 | }; |
| 42 | #endif |
| 43 | #endif |
| 44 | |
Simon Glass | 5019e20 | 2020-11-04 09:57:19 -0700 | [diff] [blame] | 45 | struct acpi_ctx; |
Simon Glass | a294ead | 2020-10-03 11:31:33 -0600 | [diff] [blame] | 46 | struct driver_rt; |
| 47 | |
Heinrich Schuchardt | 0c7cd15 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 48 | typedef struct global_data gd_t; |
| 49 | |
| 50 | /** |
| 51 | * struct global_data - global data structure |
| 52 | */ |
| 53 | struct global_data { |
| 54 | /** |
| 55 | * @bd: board information |
| 56 | */ |
Masahiro Yamada | b36992f | 2020-02-25 02:22:27 +0900 | [diff] [blame] | 57 | struct bd_info *bd; |
Heinrich Schuchardt | 0c7cd15 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 58 | /** |
| 59 | * @flags: global data flags |
| 60 | * |
| 61 | * See &enum gd_flags |
| 62 | */ |
Simon Glass | 50b1fa3 | 2012-12-13 20:49:12 +0000 | [diff] [blame] | 63 | unsigned long flags; |
Heinrich Schuchardt | 0c7cd15 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 64 | /** |
| 65 | * @baudrate: baud rate of the serial interface |
| 66 | */ |
Simon Glass | b5bec88 | 2013-03-05 14:40:05 +0000 | [diff] [blame] | 67 | unsigned int baudrate; |
Heinrich Schuchardt | 0c7cd15 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 68 | /** |
| 69 | * @cpu_clk: CPU clock rate in Hz |
| 70 | */ |
| 71 | unsigned long cpu_clk; |
| 72 | /** |
| 73 | * @bus_clk: platform clock rate in Hz |
| 74 | */ |
Simon Glass | 50b1fa3 | 2012-12-13 20:49:12 +0000 | [diff] [blame] | 75 | unsigned long bus_clk; |
Heinrich Schuchardt | 0c7cd15 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 76 | /** |
| 77 | * @pci_clk: PCI clock rate in Hz |
| 78 | */ |
Simon Glass | 50b1fa3 | 2012-12-13 20:49:12 +0000 | [diff] [blame] | 79 | /* We cannot bracket this with CONFIG_PCI due to mpc5xxx */ |
| 80 | unsigned long pci_clk; |
Heinrich Schuchardt | 0c7cd15 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 81 | /** |
| 82 | * @mem_clk: memory clock rate in Hz |
| 83 | */ |
Simon Glass | 50b1fa3 | 2012-12-13 20:49:12 +0000 | [diff] [blame] | 84 | unsigned long mem_clk; |
Simon Glass | b86986c | 2022-10-18 07:46:31 -0600 | [diff] [blame] | 85 | #if defined(CONFIG_VIDEO) |
Heinrich Schuchardt | 0c7cd15 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 86 | /** |
| 87 | * @fb_base: base address of frame buffer memory |
| 88 | */ |
| 89 | unsigned long fb_base; |
Simon Glass | 50b1fa3 | 2012-12-13 20:49:12 +0000 | [diff] [blame] | 90 | #endif |
Simon Glass | c5404b6 | 2017-12-04 13:48:23 -0700 | [diff] [blame] | 91 | #if defined(CONFIG_POST) |
Heinrich Schuchardt | 0c7cd15 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 92 | /** |
| 93 | * @post_log_word: active POST tests |
| 94 | * |
| 95 | * @post_log_word is a bit mask defining which POST tests are recorded |
| 96 | * (see constants POST_*). |
| 97 | */ |
| 98 | unsigned long post_log_word; |
| 99 | /** |
| 100 | * @post_log_res: POST results |
| 101 | * |
| 102 | * @post_log_res is a bit mask with the POST results. A bit with value 1 |
| 103 | * indicates successful execution. |
| 104 | */ |
| 105 | unsigned long post_log_res; |
| 106 | /** |
| 107 | * @post_init_f_time: time in ms when post_init_f() started |
| 108 | */ |
| 109 | unsigned long post_init_f_time; |
Simon Glass | 50b1fa3 | 2012-12-13 20:49:12 +0000 | [diff] [blame] | 110 | #endif |
| 111 | #ifdef CONFIG_BOARD_TYPES |
Heinrich Schuchardt | 0c7cd15 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 112 | /** |
| 113 | * @board_type: board type |
| 114 | * |
| 115 | * If a U-Boot configuration supports multiple board types, the actual |
| 116 | * board type may be stored in this field. |
| 117 | */ |
Simon Glass | 50b1fa3 | 2012-12-13 20:49:12 +0000 | [diff] [blame] | 118 | unsigned long board_type; |
| 119 | #endif |
Heinrich Schuchardt | 0c7cd15 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 120 | /** |
| 121 | * @have_console: console is available |
| 122 | * |
| 123 | * A value of 1 indicates that serial_init() was called and a console |
| 124 | * is available. |
| 125 | * A value of 0 indicates that console input and output drivers shall |
| 126 | * not be called. |
| 127 | */ |
| 128 | unsigned long have_console; |
Simon Glass | 8f92558 | 2016-10-17 20:12:36 -0600 | [diff] [blame] | 129 | #if CONFIG_IS_ENABLED(PRE_CONSOLE_BUFFER) |
Heinrich Schuchardt | 0c7cd15 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 130 | /** |
| 131 | * @precon_buf_idx: pre-console buffer index |
| 132 | * |
Rasmus Villemoes | 04a20ca | 2022-05-03 15:13:27 +0200 | [diff] [blame] | 133 | * @precon_buf_idx indicates the current position of the |
| 134 | * buffer used to collect output before the console becomes |
| 135 | * available. When negative, the pre-console buffer is |
| 136 | * temporarily disabled (used when the pre-console buffer is |
| 137 | * being written out, to prevent adding its contents to |
| 138 | * itself). |
Heinrich Schuchardt | 0c7cd15 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 139 | */ |
Rasmus Villemoes | 04a20ca | 2022-05-03 15:13:27 +0200 | [diff] [blame] | 140 | long precon_buf_idx; |
Simon Glass | 50b1fa3 | 2012-12-13 20:49:12 +0000 | [diff] [blame] | 141 | #endif |
Heinrich Schuchardt | 0c7cd15 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 142 | /** |
| 143 | * @env_addr: address of environment structure |
| 144 | * |
| 145 | * @env_addr contains the address of the structure holding the |
| 146 | * environment variables. |
| 147 | */ |
| 148 | unsigned long env_addr; |
| 149 | /** |
| 150 | * @env_valid: environment is valid |
| 151 | * |
| 152 | * See &enum env_valid |
| 153 | */ |
| 154 | unsigned long env_valid; |
| 155 | /** |
| 156 | * @env_has_init: bit mask indicating environment locations |
| 157 | * |
| 158 | * &enum env_location defines which bit relates to which location |
| 159 | */ |
| 160 | unsigned long env_has_init; |
| 161 | /** |
| 162 | * @env_load_prio: priority of the loaded environment |
| 163 | */ |
| 164 | int env_load_prio; |
| 165 | /** |
| 166 | * @ram_base: base address of RAM used by U-Boot |
| 167 | */ |
| 168 | unsigned long ram_base; |
| 169 | /** |
| 170 | * @ram_top: top address of RAM used by U-Boot |
| 171 | */ |
Bin Meng | 37dc958 | 2021-01-31 20:35:59 +0800 | [diff] [blame] | 172 | phys_addr_t ram_top; |
Heinrich Schuchardt | 0c7cd15 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 173 | /** |
| 174 | * @relocaddr: start address of U-Boot in RAM |
| 175 | * |
| 176 | * After relocation this field indicates the address to which U-Boot |
| 177 | * has been relocated. It can be displayed using the bdinfo command. |
| 178 | * Its value is needed to display the source code when debugging with |
| 179 | * GDB using the 'add-symbol-file u-boot <relocaddr>' command. |
| 180 | */ |
| 181 | unsigned long relocaddr; |
| 182 | /** |
| 183 | * @ram_size: RAM size in bytes |
| 184 | */ |
| 185 | phys_size_t ram_size; |
| 186 | /** |
| 187 | * @mon_len: monitor length in bytes |
| 188 | */ |
| 189 | unsigned long mon_len; |
| 190 | /** |
| 191 | * @irq_sp: IRQ stack pointer |
| 192 | */ |
| 193 | unsigned long irq_sp; |
| 194 | /** |
| 195 | * @start_addr_sp: initial stack pointer address |
| 196 | */ |
| 197 | unsigned long start_addr_sp; |
| 198 | /** |
| 199 | * @reloc_off: relocation offset |
| 200 | */ |
Simon Glass | 50b1fa3 | 2012-12-13 20:49:12 +0000 | [diff] [blame] | 201 | unsigned long reloc_off; |
Heinrich Schuchardt | 0c7cd15 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 202 | /** |
| 203 | * @new_gd: pointer to relocated global data |
| 204 | */ |
| 205 | struct global_data *new_gd; |
Simon Glass | 6494d70 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 206 | |
| 207 | #ifdef CONFIG_DM |
Heinrich Schuchardt | 0c7cd15 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 208 | /** |
| 209 | * @dm_root: root instance for Driver Model |
| 210 | */ |
| 211 | struct udevice *dm_root; |
| 212 | /** |
| 213 | * @dm_root_f: pre-relocation root instance |
| 214 | */ |
| 215 | struct udevice *dm_root_f; |
| 216 | /** |
Heinrich Schuchardt | a03185a | 2021-01-24 21:48:00 +0100 | [diff] [blame] | 217 | * @uclass_root_s: |
| 218 | * head of core tree when uclasses are not in read-only memory. |
| 219 | * |
| 220 | * When uclasses are in read-only memory, @uclass_root_s is not used and |
| 221 | * @uclass_root points to the root node generated by dtoc. |
Heinrich Schuchardt | 0c7cd15 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 222 | */ |
Simon Glass | 8a71553 | 2020-12-19 10:40:17 -0700 | [diff] [blame] | 223 | struct list_head uclass_root_s; |
| 224 | /** |
Heinrich Schuchardt | a03185a | 2021-01-24 21:48:00 +0100 | [diff] [blame] | 225 | * @uclass_root: |
| 226 | * pointer to head of core tree, if uclasses are in read-only memory and |
| 227 | * cannot be adjusted to use @uclass_root as a list head. |
| 228 | * |
| 229 | * When not in read-only memory, @uclass_root_s is used to hold the |
| 230 | * uclass root, and @uclass_root points to the address of |
| 231 | * @uclass_root_s. |
Simon Glass | 8a71553 | 2020-12-19 10:40:17 -0700 | [diff] [blame] | 232 | */ |
| 233 | struct list_head *uclass_root; |
Simon Glass | ab933d8 | 2021-03-15 17:25:36 +1300 | [diff] [blame] | 234 | # if CONFIG_IS_ENABLED(OF_PLATDATA_DRIVER_RT) |
Simon Glass | d211e04 | 2020-11-29 17:07:05 -0700 | [diff] [blame] | 235 | /** @dm_driver_rt: Dynamic info about the driver */ |
Simon Glass | a294ead | 2020-10-03 11:31:33 -0600 | [diff] [blame] | 236 | struct driver_rt *dm_driver_rt; |
| 237 | # endif |
Simon Glass | ab933d8 | 2021-03-15 17:25:36 +1300 | [diff] [blame] | 238 | #if CONFIG_IS_ENABLED(OF_PLATDATA_RT) |
| 239 | /** @dm_udevice_rt: Dynamic info about the udevice */ |
| 240 | struct udevice_rt *dm_udevice_rt; |
Simon Glass | baf0371 | 2021-03-15 17:25:38 +1300 | [diff] [blame] | 241 | /** |
| 242 | * @dm_priv_base: Base address of the priv/plat region used when |
| 243 | * udevices and uclasses are in read-only memory. This is NULL if not |
| 244 | * used |
| 245 | */ |
| 246 | void *dm_priv_base; |
Simon Glass | ab933d8 | 2021-03-15 17:25:36 +1300 | [diff] [blame] | 247 | # endif |
Simon Glass | 6494d70 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 248 | #endif |
Thomas Chou | c8a7ba9 | 2015-10-09 13:46:34 +0800 | [diff] [blame] | 249 | #ifdef CONFIG_TIMER |
Heinrich Schuchardt | 0c7cd15 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 250 | /** |
| 251 | * @timer: timer instance for Driver Model |
| 252 | */ |
| 253 | struct udevice *timer; |
Thomas Chou | c8a7ba9 | 2015-10-09 13:46:34 +0800 | [diff] [blame] | 254 | #endif |
Heinrich Schuchardt | 0c7cd15 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 255 | /** |
| 256 | * @fdt_blob: U-Boot's own device tree, NULL if none |
| 257 | */ |
| 258 | const void *fdt_blob; |
| 259 | /** |
| 260 | * @new_fdt: relocated device tree |
| 261 | */ |
| 262 | void *new_fdt; |
| 263 | /** |
| 264 | * @fdt_size: space reserved for relocated device space |
| 265 | */ |
| 266 | unsigned long fdt_size; |
Simon Glass | 39605c6 | 2021-12-16 20:59:33 -0700 | [diff] [blame] | 267 | /** |
| 268 | * @fdt_src: Source of FDT |
| 269 | */ |
| 270 | enum fdt_source_t fdt_src; |
Simon Glass | a652d9c | 2020-10-03 09:25:22 -0600 | [diff] [blame] | 271 | #if CONFIG_IS_ENABLED(OF_LIVE) |
Heinrich Schuchardt | 0c7cd15 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 272 | /** |
| 273 | * @of_root: root node of the live tree |
| 274 | */ |
Simon Glass | 5e060d8 | 2017-05-18 20:08:53 -0600 | [diff] [blame] | 275 | struct device_node *of_root; |
| 276 | #endif |
Jean-Jacques Hiblot | f1d2bc9 | 2018-12-07 14:50:52 +0100 | [diff] [blame] | 277 | |
| 278 | #if CONFIG_IS_ENABLED(MULTI_DTB_FIT) |
Heinrich Schuchardt | 0c7cd15 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 279 | /** |
| 280 | * @multi_dtb_fit: pointer to uncompressed multi-dtb FIT image |
| 281 | */ |
| 282 | const void *multi_dtb_fit; |
Jean-Jacques Hiblot | f1d2bc9 | 2018-12-07 14:50:52 +0100 | [diff] [blame] | 283 | #endif |
Heinrich Schuchardt | 0c7cd15 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 284 | /** |
| 285 | * @jt: jump table |
| 286 | * |
| 287 | * The jump table contains pointers to exported functions. A pointer to |
| 288 | * the jump table is passed to standalone applications. |
| 289 | */ |
| 290 | struct jt_funcs *jt; |
| 291 | /** |
| 292 | * @env_buf: buffer for env_get() before reloc |
| 293 | */ |
| 294 | char env_buf[32]; |
Simon Glass | 71c52db | 2013-06-11 11:14:42 -0700 | [diff] [blame] | 295 | #ifdef CONFIG_TRACE |
Heinrich Schuchardt | 0c7cd15 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 296 | /** |
| 297 | * @trace_buff: trace buffer |
| 298 | * |
| 299 | * When tracing function in U-Boot this field points to the buffer |
| 300 | * recording the function calls. |
| 301 | */ |
| 302 | void *trace_buff; |
Simon Glass | 71c52db | 2013-06-11 11:14:42 -0700 | [diff] [blame] | 303 | #endif |
Tom Rini | 55dabcc | 2021-08-18 23:12:24 -0400 | [diff] [blame] | 304 | #if CONFIG_IS_ENABLED(SYS_I2C_LEGACY) |
Heinrich Schuchardt | 0c7cd15 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 305 | /** |
| 306 | * @cur_i2c_bus: currently used I2C bus |
| 307 | */ |
| 308 | int cur_i2c_bus; |
Heiko Schocher | 385c9ef | 2012-01-16 21:12:23 +0000 | [diff] [blame] | 309 | #endif |
Heinrich Schuchardt | 0c7cd15 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 310 | /** |
| 311 | * @timebase_h: high 32 bits of timer |
| 312 | */ |
Peng Fan | 2511210 | 2017-05-09 10:32:03 +0800 | [diff] [blame] | 313 | unsigned int timebase_h; |
Heinrich Schuchardt | 0c7cd15 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 314 | /** |
| 315 | * @timebase_l: low 32 bits of timer |
| 316 | */ |
Peng Fan | 2511210 | 2017-05-09 10:32:03 +0800 | [diff] [blame] | 317 | unsigned int timebase_l; |
Andy Yan | f1896c4 | 2017-07-24 17:43:34 +0800 | [diff] [blame] | 318 | #if CONFIG_VAL(SYS_MALLOC_F_LEN) |
Heinrich Schuchardt | 0c7cd15 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 319 | /** |
| 320 | * @malloc_base: base address of early malloc() |
| 321 | */ |
| 322 | unsigned long malloc_base; |
| 323 | /** |
| 324 | * @malloc_limit: limit address of early malloc() |
| 325 | */ |
| 326 | unsigned long malloc_limit; |
| 327 | /** |
| 328 | * @malloc_ptr: current address of early malloc() |
| 329 | */ |
| 330 | unsigned long malloc_ptr; |
Simon Glass | d59476b | 2014-07-10 22:23:28 -0600 | [diff] [blame] | 331 | #endif |
Bin Meng | 8f9052f | 2014-12-30 22:53:21 +0800 | [diff] [blame] | 332 | #ifdef CONFIG_PCI |
Heinrich Schuchardt | 0c7cd15 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 333 | /** |
| 334 | * @hose: PCI hose for early use |
| 335 | */ |
| 336 | struct pci_controller *hose; |
| 337 | /** |
| 338 | * @pci_ram_top: top of region accessible to PCI |
| 339 | */ |
| 340 | phys_addr_t pci_ram_top; |
Bin Meng | 8f9052f | 2014-12-30 22:53:21 +0800 | [diff] [blame] | 341 | #endif |
| 342 | #ifdef CONFIG_PCI_BOOTDELAY |
Heinrich Schuchardt | 0c7cd15 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 343 | /** |
| 344 | * @pcidelay_done: delay time before scanning of PIC hose expired |
| 345 | * |
| 346 | * If CONFIG_PCI_BOOTDELAY=y, pci_hose_scan() waits for the number of |
| 347 | * milliseconds defined by environment variable pcidelay before |
| 348 | * scanning. Once this delay has expired the flag @pcidelay_done |
| 349 | * is set to 1. |
| 350 | */ |
Bin Meng | 8f9052f | 2014-12-30 22:53:21 +0800 | [diff] [blame] | 351 | int pcidelay_done; |
| 352 | #endif |
Heinrich Schuchardt | 0c7cd15 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 353 | /** |
| 354 | * @cur_serial_dev: current serial device |
| 355 | */ |
| 356 | struct udevice *cur_serial_dev; |
| 357 | /** |
| 358 | * @arch: architecture-specific data |
| 359 | */ |
| 360 | struct arch_global_data arch; |
Simon Glass | 9854a87 | 2015-11-08 23:47:48 -0700 | [diff] [blame] | 361 | #ifdef CONFIG_CONSOLE_RECORD |
Heinrich Schuchardt | 0c7cd15 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 362 | /** |
| 363 | * @console_out: output buffer for console recording |
| 364 | * |
| 365 | * This buffer is used to collect output during console recording. |
| 366 | */ |
| 367 | struct membuff console_out; |
| 368 | /** |
| 369 | * @console_in: input buffer for console recording |
| 370 | * |
| 371 | * If console recording is activated, this buffer can be used to |
| 372 | * emulate input. |
| 373 | */ |
| 374 | struct membuff console_in; |
Simon Glass | 9854a87 | 2015-11-08 23:47:48 -0700 | [diff] [blame] | 375 | #endif |
Simon Glass | b86986c | 2022-10-18 07:46:31 -0600 | [diff] [blame] | 376 | #ifdef CONFIG_VIDEO |
Heinrich Schuchardt | 0c7cd15 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 377 | /** |
| 378 | * @video_top: top of video frame buffer area |
| 379 | */ |
| 380 | ulong video_top; |
| 381 | /** |
| 382 | * @video_bottom: bottom of video frame buffer area |
| 383 | */ |
| 384 | ulong video_bottom; |
Simon Glass | 5a54194 | 2016-01-18 19:52:21 -0700 | [diff] [blame] | 385 | #endif |
Simon Glass | b383d6c | 2017-05-22 05:05:25 -0600 | [diff] [blame] | 386 | #ifdef CONFIG_BOOTSTAGE |
Heinrich Schuchardt | 0c7cd15 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 387 | /** |
| 388 | * @bootstage: boot stage information |
| 389 | */ |
| 390 | struct bootstage_data *bootstage; |
| 391 | /** |
| 392 | * @new_bootstage: relocated boot stage information |
| 393 | */ |
| 394 | struct bootstage_data *new_bootstage; |
Simon Glass | b383d6c | 2017-05-22 05:05:25 -0600 | [diff] [blame] | 395 | #endif |
Simon Glass | e9c8d49 | 2017-12-04 13:48:24 -0700 | [diff] [blame] | 396 | #ifdef CONFIG_LOG |
Heinrich Schuchardt | 0c7cd15 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 397 | /** |
| 398 | * @log_drop_count: number of dropped log messages |
| 399 | * |
| 400 | * This counter is incremented for each log message which can not |
| 401 | * be processed because logging is not yet available as signaled by |
| 402 | * flag %GD_FLG_LOG_READY in @flags. |
| 403 | */ |
| 404 | int log_drop_count; |
| 405 | /** |
| 406 | * @default_log_level: default logging level |
| 407 | * |
| 408 | * For logging devices without filters @default_log_level defines the |
| 409 | * logging level, cf. &enum log_level_t. |
| 410 | */ |
| 411 | int default_log_level; |
| 412 | /** |
| 413 | * @log_head: list of logging devices |
| 414 | */ |
| 415 | struct list_head log_head; |
| 416 | /** |
| 417 | * @log_fmt: bit mask for logging format |
| 418 | * |
| 419 | * The @log_fmt bit mask selects the fields to be shown in log messages. |
| 420 | * &enum log_fmt defines the bits of the bit mask. |
| 421 | */ |
| 422 | int log_fmt; |
Heinrich Schuchardt | 993a06b | 2020-10-17 14:31:57 +0200 | [diff] [blame] | 423 | |
| 424 | /** |
| 425 | * @processing_msg: a log message is being processed |
| 426 | * |
| 427 | * This flag is used to suppress the creation of additional messages |
| 428 | * while another message is being processed. |
| 429 | */ |
| 430 | bool processing_msg; |
Heinrich Schuchardt | d094a07 | 2020-10-17 14:31:58 +0200 | [diff] [blame] | 431 | /** |
| 432 | * @logc_prev: logging category of previous message |
| 433 | * |
| 434 | * This value is used as logging category for continuation messages. |
| 435 | */ |
| 436 | int logc_prev; |
| 437 | /** |
Heinrich Schuchardt | 096912b | 2020-10-30 18:50:31 +0100 | [diff] [blame] | 438 | * @logl_prev: logging level of the previous message |
Heinrich Schuchardt | d094a07 | 2020-10-17 14:31:58 +0200 | [diff] [blame] | 439 | * |
| 440 | * This value is used as logging level for continuation messages. |
| 441 | */ |
| 442 | int logl_prev; |
Simon Glass | 9ad7a6c | 2021-01-20 20:10:53 -0700 | [diff] [blame] | 443 | /** |
| 444 | * @log_cont: Previous log line did not finished wtih \n |
| 445 | * |
| 446 | * This allows for chained log messages on the same line |
| 447 | */ |
| 448 | bool log_cont; |
Simon Glass | e9c8d49 | 2017-12-04 13:48:24 -0700 | [diff] [blame] | 449 | #endif |
Simon Glass | f0293d3 | 2018-11-15 18:43:52 -0700 | [diff] [blame] | 450 | #if CONFIG_IS_ENABLED(BLOBLIST) |
Heinrich Schuchardt | 0c7cd15 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 451 | /** |
| 452 | * @bloblist: blob list information |
| 453 | */ |
| 454 | struct bloblist_hdr *bloblist; |
| 455 | /** |
| 456 | * @new_bloblist: relocated blob list information |
| 457 | */ |
| 458 | struct bloblist_hdr *new_bloblist; |
Ovidiu Panait | 13e0f02 | 2020-11-28 10:43:20 +0200 | [diff] [blame] | 459 | #endif |
| 460 | #if CONFIG_IS_ENABLED(HANDOFF) |
Heinrich Schuchardt | 0c7cd15 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 461 | /** |
| 462 | * @spl_handoff: SPL hand-off information |
| 463 | */ |
Simon Glass | b0edea3 | 2018-11-15 18:44:09 -0700 | [diff] [blame] | 464 | struct spl_handoff *spl_handoff; |
Simon Glass | f0293d3 | 2018-11-15 18:43:52 -0700 | [diff] [blame] | 465 | #endif |
Stefan Roese | f2100f6 | 2019-04-12 16:42:28 +0200 | [diff] [blame] | 466 | #if defined(CONFIG_TRANSLATION_OFFSET) |
Heinrich Schuchardt | 0c7cd15 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 467 | /** |
| 468 | * @translation_offset: optional translation offset |
| 469 | * |
| 470 | * See CONFIG_TRANSLATION_OFFSET. |
| 471 | */ |
| 472 | fdt_addr_t translation_offset; |
Stefan Roese | f2100f6 | 2019-04-12 16:42:28 +0200 | [diff] [blame] | 473 | #endif |
Simon Glass | 5019e20 | 2020-11-04 09:57:19 -0700 | [diff] [blame] | 474 | #ifdef CONFIG_GENERATE_ACPI_TABLE |
| 475 | /** |
| 476 | * @acpi_ctx: ACPI context pointer |
| 477 | */ |
| 478 | struct acpi_ctx *acpi_ctx; |
Simon Glass | 233f0e3 | 2021-12-01 09:02:37 -0700 | [diff] [blame] | 479 | /** |
| 480 | * @acpi_start: Start address of ACPI tables |
| 481 | */ |
| 482 | ulong acpi_start; |
Simon Glass | 5019e20 | 2020-11-04 09:57:19 -0700 | [diff] [blame] | 483 | #endif |
Simon Glass | e9adaa7 | 2021-02-04 21:17:20 -0700 | [diff] [blame] | 484 | #if CONFIG_IS_ENABLED(GENERATE_SMBIOS_TABLE) |
| 485 | /** |
| 486 | * @smbios_version: Points to SMBIOS type 0 version |
| 487 | */ |
| 488 | char *smbios_version; |
| 489 | #endif |
Simon Glass | 87a5d1b | 2022-03-04 08:43:00 -0700 | [diff] [blame] | 490 | #if CONFIG_IS_ENABLED(EVENT) |
| 491 | /** |
| 492 | * @event_state: Points to the current state of events |
| 493 | */ |
| 494 | struct event_state event_state; |
| 495 | #endif |
Stefan Roese | c2c6971 | 2022-09-02 13:57:48 +0200 | [diff] [blame] | 496 | #ifdef CONFIG_CYCLIC |
| 497 | /** |
Rasmus Villemoes | 50128ae | 2022-10-28 13:50:54 +0200 | [diff] [blame] | 498 | * @cyclic_list: list of registered cyclic functions |
Stefan Roese | c2c6971 | 2022-09-02 13:57:48 +0200 | [diff] [blame] | 499 | */ |
Rasmus Villemoes | 50128ae | 2022-10-28 13:50:54 +0200 | [diff] [blame] | 500 | struct hlist_head cyclic_list; |
Stefan Roese | c2c6971 | 2022-09-02 13:57:48 +0200 | [diff] [blame] | 501 | #endif |
AKASHI Takahiro | 6b7a621 | 2022-03-08 20:36:46 +0900 | [diff] [blame] | 502 | /** |
| 503 | * @dmtag_list: List of DM tags |
| 504 | */ |
| 505 | struct list_head dmtag_list; |
Bo Lv | 96a66d0 | 2023-05-12 19:18:22 +0800 | [diff] [blame] | 506 | #ifdef CONFIG_AML_UASAN |
| 507 | int uasan_enabled; |
| 508 | int in_asan_report; |
| 509 | unsigned long use_mem_end; |
| 510 | unsigned long use_mem_size; |
| 511 | unsigned long phy_mem_low; |
| 512 | unsigned long phy_mem_high; |
| 513 | unsigned long shadow_addr; |
| 514 | unsigned long shadow_size; |
| 515 | unsigned long section_red_zones[SECTION_RED_ZONE_NUM]; |
| 516 | #endif |
benlong.zhou | f0969fb | 2023-10-26 16:42:01 +0800 | [diff] [blame] | 517 | #ifdef CONFIG_AMLOGIC_MODIFY |
| 518 | #ifdef CONFIG_AMLOGIC_TIME_PROFILE |
| 519 | struct init_call_time ict[INITCALL_CNT]; |
| 520 | unsigned int time_print_flag; |
| 521 | #endif |
| 522 | #endif |
Heinrich Schuchardt | 0c7cd15 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 523 | }; |
Rasmus Villemoes | ee3a46a | 2021-05-18 11:19:47 +0200 | [diff] [blame] | 524 | #ifndef DO_DEPS_ONLY |
| 525 | static_assert(sizeof(struct global_data) == GD_SIZE); |
| 526 | #endif |
Simon Glass | 50b1fa3 | 2012-12-13 20:49:12 +0000 | [diff] [blame] | 527 | |
Heinrich Schuchardt | 0c7cd15 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 528 | /** |
| 529 | * gd_board_type() - retrieve board type |
| 530 | * |
| 531 | * Return: global board type |
| 532 | */ |
Simon Glass | 52c4118 | 2017-03-31 08:40:24 -0600 | [diff] [blame] | 533 | #ifdef CONFIG_BOARD_TYPES |
| 534 | #define gd_board_type() gd->board_type |
| 535 | #else |
| 536 | #define gd_board_type() 0 |
| 537 | #endif |
| 538 | |
Simon Glass | a652d9c | 2020-10-03 09:25:22 -0600 | [diff] [blame] | 539 | /* These macros help avoid #ifdefs in the code */ |
| 540 | #if CONFIG_IS_ENABLED(OF_LIVE) |
| 541 | #define gd_of_root() gd->of_root |
| 542 | #define gd_of_root_ptr() &gd->of_root |
| 543 | #define gd_set_of_root(_root) gd->of_root = (_root) |
| 544 | #else |
| 545 | #define gd_of_root() NULL |
| 546 | #define gd_of_root_ptr() NULL |
| 547 | #define gd_set_of_root(_root) |
| 548 | #endif |
| 549 | |
Simon Glass | ab933d8 | 2021-03-15 17:25:36 +1300 | [diff] [blame] | 550 | #if CONFIG_IS_ENABLED(OF_PLATDATA_DRIVER_RT) |
Simon Glass | a294ead | 2020-10-03 11:31:33 -0600 | [diff] [blame] | 551 | #define gd_set_dm_driver_rt(dyn) gd->dm_driver_rt = dyn |
| 552 | #define gd_dm_driver_rt() gd->dm_driver_rt |
| 553 | #else |
| 554 | #define gd_set_dm_driver_rt(dyn) |
| 555 | #define gd_dm_driver_rt() NULL |
| 556 | #endif |
| 557 | |
Simon Glass | ab933d8 | 2021-03-15 17:25:36 +1300 | [diff] [blame] | 558 | #if CONFIG_IS_ENABLED(OF_PLATDATA_RT) |
| 559 | #define gd_set_dm_udevice_rt(dyn) gd->dm_udevice_rt = dyn |
| 560 | #define gd_dm_udevice_rt() gd->dm_udevice_rt |
Simon Glass | baf0371 | 2021-03-15 17:25:38 +1300 | [diff] [blame] | 561 | #define gd_set_dm_priv_base(dyn) gd->dm_priv_base = dyn |
| 562 | #define gd_dm_priv_base() gd->dm_priv_base |
Simon Glass | ab933d8 | 2021-03-15 17:25:36 +1300 | [diff] [blame] | 563 | #else |
| 564 | #define gd_set_dm_udevice_rt(dyn) |
| 565 | #define gd_dm_udevice_rt() NULL |
Simon Glass | baf0371 | 2021-03-15 17:25:38 +1300 | [diff] [blame] | 566 | #define gd_set_dm_priv_base(dyn) |
| 567 | #define gd_dm_priv_base() NULL |
Simon Glass | ab933d8 | 2021-03-15 17:25:36 +1300 | [diff] [blame] | 568 | #endif |
| 569 | |
Simon Glass | 5019e20 | 2020-11-04 09:57:19 -0700 | [diff] [blame] | 570 | #ifdef CONFIG_GENERATE_ACPI_TABLE |
| 571 | #define gd_acpi_ctx() gd->acpi_ctx |
Simon Glass | 233f0e3 | 2021-12-01 09:02:37 -0700 | [diff] [blame] | 572 | #define gd_acpi_start() gd->acpi_start |
| 573 | #define gd_set_acpi_start(addr) gd->acpi_start = addr |
Simon Glass | 5019e20 | 2020-11-04 09:57:19 -0700 | [diff] [blame] | 574 | #else |
| 575 | #define gd_acpi_ctx() NULL |
Simon Glass | 233f0e3 | 2021-12-01 09:02:37 -0700 | [diff] [blame] | 576 | #define gd_acpi_start() 0UL |
| 577 | #define gd_set_acpi_start(addr) |
Simon Glass | 5019e20 | 2020-11-04 09:57:19 -0700 | [diff] [blame] | 578 | #endif |
| 579 | |
Simon Glass | b4b6daf | 2021-12-16 20:59:25 -0700 | [diff] [blame] | 580 | #if CONFIG_IS_ENABLED(MULTI_DTB_FIT) |
| 581 | #define gd_multi_dtb_fit() gd->multi_dtb_fit |
| 582 | #define gd_set_multi_dtb_fit(_dtb) gd->multi_dtb_fit = _dtb |
| 583 | #else |
| 584 | #define gd_multi_dtb_fit() NULL |
| 585 | #define gd_set_multi_dtb_fit(_dtb) |
| 586 | #endif |
| 587 | |
Simon Glass | 87a5d1b | 2022-03-04 08:43:00 -0700 | [diff] [blame] | 588 | #if CONFIG_IS_ENABLED(EVENT_DYNAMIC) |
| 589 | #define gd_event_state() ((struct event_state *)&gd->event_state) |
| 590 | #else |
| 591 | #define gd_event_state() NULL |
| 592 | #endif |
| 593 | |
Heinrich Schuchardt | c82a97b | 2020-10-05 08:30:08 +0200 | [diff] [blame] | 594 | /** |
| 595 | * enum gd_flags - global data flags |
| 596 | * |
| 597 | * See field flags of &struct global_data. |
Simon Glass | 50b1fa3 | 2012-12-13 20:49:12 +0000 | [diff] [blame] | 598 | */ |
Heinrich Schuchardt | c82a97b | 2020-10-05 08:30:08 +0200 | [diff] [blame] | 599 | enum gd_flags { |
| 600 | /** |
| 601 | * @GD_FLG_RELOC: code was relocated to RAM |
| 602 | */ |
| 603 | GD_FLG_RELOC = 0x00001, |
| 604 | /** |
| 605 | * @GD_FLG_DEVINIT: devices have been initialized |
| 606 | */ |
| 607 | GD_FLG_DEVINIT = 0x00002, |
| 608 | /** |
| 609 | * @GD_FLG_SILENT: silent mode |
| 610 | */ |
| 611 | GD_FLG_SILENT = 0x00004, |
| 612 | /** |
| 613 | * @GD_FLG_POSTFAIL: critical POST test failed |
| 614 | */ |
| 615 | GD_FLG_POSTFAIL = 0x00008, |
| 616 | /** |
| 617 | * @GD_FLG_POSTSTOP: POST sequence aborted |
| 618 | */ |
| 619 | GD_FLG_POSTSTOP = 0x00010, |
| 620 | /** |
| 621 | * @GD_FLG_LOGINIT: log Buffer has been initialized |
| 622 | */ |
| 623 | GD_FLG_LOGINIT = 0x00020, |
| 624 | /** |
| 625 | * @GD_FLG_DISABLE_CONSOLE: disable console (in & out) |
| 626 | */ |
| 627 | GD_FLG_DISABLE_CONSOLE = 0x00040, |
| 628 | /** |
| 629 | * @GD_FLG_ENV_READY: environment imported into hash table |
| 630 | */ |
| 631 | GD_FLG_ENV_READY = 0x00080, |
| 632 | /** |
| 633 | * @GD_FLG_SERIAL_READY: pre-relocation serial console ready |
| 634 | */ |
| 635 | GD_FLG_SERIAL_READY = 0x00100, |
| 636 | /** |
| 637 | * @GD_FLG_FULL_MALLOC_INIT: full malloc() is ready |
| 638 | */ |
| 639 | GD_FLG_FULL_MALLOC_INIT = 0x00200, |
| 640 | /** |
| 641 | * @GD_FLG_SPL_INIT: spl_init() has been called |
| 642 | */ |
| 643 | GD_FLG_SPL_INIT = 0x00400, |
| 644 | /** |
| 645 | * @GD_FLG_SKIP_RELOC: don't relocate |
| 646 | */ |
| 647 | GD_FLG_SKIP_RELOC = 0x00800, |
| 648 | /** |
| 649 | * @GD_FLG_RECORD: record console |
| 650 | */ |
| 651 | GD_FLG_RECORD = 0x01000, |
| 652 | /** |
Simon Glass | c1a2bb4 | 2021-05-08 06:59:56 -0600 | [diff] [blame] | 653 | * @GD_FLG_RECORD_OVF: record console overflow |
| 654 | */ |
| 655 | GD_FLG_RECORD_OVF = 0x02000, |
| 656 | /** |
Heinrich Schuchardt | c82a97b | 2020-10-05 08:30:08 +0200 | [diff] [blame] | 657 | * @GD_FLG_ENV_DEFAULT: default variable flag |
| 658 | */ |
Simon Glass | c1a2bb4 | 2021-05-08 06:59:56 -0600 | [diff] [blame] | 659 | GD_FLG_ENV_DEFAULT = 0x04000, |
Heinrich Schuchardt | c82a97b | 2020-10-05 08:30:08 +0200 | [diff] [blame] | 660 | /** |
| 661 | * @GD_FLG_SPL_EARLY_INIT: early SPL initialization is done |
| 662 | */ |
Simon Glass | c1a2bb4 | 2021-05-08 06:59:56 -0600 | [diff] [blame] | 663 | GD_FLG_SPL_EARLY_INIT = 0x08000, |
Heinrich Schuchardt | c82a97b | 2020-10-05 08:30:08 +0200 | [diff] [blame] | 664 | /** |
| 665 | * @GD_FLG_LOG_READY: log system is ready for use |
| 666 | */ |
Simon Glass | c1a2bb4 | 2021-05-08 06:59:56 -0600 | [diff] [blame] | 667 | GD_FLG_LOG_READY = 0x10000, |
Heinrich Schuchardt | c82a97b | 2020-10-05 08:30:08 +0200 | [diff] [blame] | 668 | /** |
Stefan Roese | 5cbd029 | 2022-11-17 09:20:34 +0100 | [diff] [blame] | 669 | * @GD_FLG_CYCLIC_RUNNING: cyclic_run is in progress |
Heinrich Schuchardt | c82a97b | 2020-10-05 08:30:08 +0200 | [diff] [blame] | 670 | */ |
Stefan Roese | 5cbd029 | 2022-11-17 09:20:34 +0100 | [diff] [blame] | 671 | GD_FLG_CYCLIC_RUNNING = 0x20000, |
Heinrich Schuchardt | c82a97b | 2020-10-05 08:30:08 +0200 | [diff] [blame] | 672 | /** |
| 673 | * @GD_FLG_SKIP_LL_INIT: don't perform low-level initialization |
| 674 | */ |
Simon Glass | c1a2bb4 | 2021-05-08 06:59:56 -0600 | [diff] [blame] | 675 | GD_FLG_SKIP_LL_INIT = 0x40000, |
Heinrich Schuchardt | c82a97b | 2020-10-05 08:30:08 +0200 | [diff] [blame] | 676 | /** |
| 677 | * @GD_FLG_SMP_READY: SMP initialization is complete |
| 678 | */ |
Simon Glass | c1a2bb4 | 2021-05-08 06:59:56 -0600 | [diff] [blame] | 679 | GD_FLG_SMP_READY = 0x80000, |
Simon Glass | eb6e903 | 2022-09-06 20:27:06 -0600 | [diff] [blame] | 680 | /** |
| 681 | * @GD_FLG_FDT_CHANGED: Device tree change has been detected by tests |
| 682 | */ |
| 683 | GD_FLG_FDT_CHANGED = 0x100000, |
Zhongfu Luo | 76072e3 | 2023-03-08 11:24:18 +0800 | [diff] [blame] | 684 | |
| 685 | #ifdef CONFIG_AMLOGIC_MODIFY |
| 686 | /* Cache enabled */ |
| 687 | GD_FLG_CACHE_EN = 0x200000, |
| 688 | #endif |
xia.jin | 958d293 | 2024-06-07 03:12:53 +0000 | [diff] [blame] | 689 | #ifdef CONFIG_ARMV8_MULTIENTRY |
| 690 | GD_FLG_SMP = 0x400000, |
| 691 | #endif |
Heinrich Schuchardt | c82a97b | 2020-10-05 08:30:08 +0200 | [diff] [blame] | 692 | }; |
| 693 | |
xia.jin | 958d293 | 2024-06-07 03:12:53 +0000 | [diff] [blame] | 694 | #ifdef CONFIG_ARMV8_MULTIENTRY |
| 695 | #define in_smp() (gd->flags & GD_FLG_SMP) |
| 696 | #endif |
| 697 | |
Heinrich Schuchardt | c82a97b | 2020-10-05 08:30:08 +0200 | [diff] [blame] | 698 | #endif /* __ASSEMBLY__ */ |
Simon Glass | 50b1fa3 | 2012-12-13 20:49:12 +0000 | [diff] [blame] | 699 | |
| 700 | #endif /* __ASM_GENERIC_GBL_DATA_H */ |