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