Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Simon Glass | 0e72403 | 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 | 0e72403 | 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 | 036f89a | 2022-09-02 13:57:48 +0200 | [diff] [blame] | 23 | #include <cyclic.h> |
Simon Glass | aa4bce9 | 2022-03-04 08:43:00 -0700 | [diff] [blame] | 24 | #include <event_internal.h> |
Stefan Roese | 85bddff | 2019-04-12 16:42:28 +0200 | [diff] [blame] | 25 | #include <fdtdec.h> |
Simon Glass | 1bb4923 | 2015-11-08 23:47:48 -0700 | [diff] [blame] | 26 | #include <membuff.h> |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 27 | #include <linux/list.h> |
Rasmus Villemoes | b8cfd9e | 2021-05-18 11:19:47 +0200 | [diff] [blame] | 28 | #include <linux/build_bug.h> |
| 29 | #include <asm-offsets.h> |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 30 | |
Simon Glass | de0115a | 2020-11-04 09:57:19 -0700 | [diff] [blame] | 31 | struct acpi_ctx; |
Simon Glass | cfd6a00 | 2020-10-03 11:31:33 -0600 | [diff] [blame] | 32 | struct driver_rt; |
| 33 | |
Heinrich Schuchardt | 50d9286 | 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 | d788bba | 2020-02-25 02:22:27 +0900 | [diff] [blame] | 43 | struct bd_info *bd; |
Heinrich Schuchardt | 50d9286 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 44 | /** |
| 45 | * @flags: global data flags |
| 46 | * |
| 47 | * See &enum gd_flags |
| 48 | */ |
Simon Glass | 0e72403 | 2012-12-13 20:49:12 +0000 | [diff] [blame] | 49 | unsigned long flags; |
Heinrich Schuchardt | 50d9286 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 50 | /** |
| 51 | * @baudrate: baud rate of the serial interface |
| 52 | */ |
Simon Glass | 059c54f | 2013-03-05 14:40:05 +0000 | [diff] [blame] | 53 | unsigned int baudrate; |
Heinrich Schuchardt | 50d9286 | 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 | 0e72403 | 2012-12-13 20:49:12 +0000 | [diff] [blame] | 61 | unsigned long bus_clk; |
Heinrich Schuchardt | 50d9286 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 62 | /** |
| 63 | * @pci_clk: PCI clock rate in Hz |
| 64 | */ |
Simon Glass | 0e72403 | 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 | 50d9286 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 67 | /** |
| 68 | * @mem_clk: memory clock rate in Hz |
| 69 | */ |
Simon Glass | 0e72403 | 2012-12-13 20:49:12 +0000 | [diff] [blame] | 70 | unsigned long mem_clk; |
Nikhil M Jain | 7f561e1 | 2023-04-20 17:41:10 +0530 | [diff] [blame] | 71 | #if CONFIG_IS_ENABLED(VIDEO) |
Heinrich Schuchardt | 50d9286 | 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 | 0e72403 | 2012-12-13 20:49:12 +0000 | [diff] [blame] | 76 | #endif |
Simon Glass | 49badb9 | 2017-12-04 13:48:23 -0700 | [diff] [blame] | 77 | #if defined(CONFIG_POST) |
Heinrich Schuchardt | 50d9286 | 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 | 0e72403 | 2012-12-13 20:49:12 +0000 | [diff] [blame] | 96 | #endif |
| 97 | #ifdef CONFIG_BOARD_TYPES |
Heinrich Schuchardt | 50d9286 | 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 | 0e72403 | 2012-12-13 20:49:12 +0000 | [diff] [blame] | 104 | unsigned long board_type; |
| 105 | #endif |
Heinrich Schuchardt | 50d9286 | 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 | e304a5e | 2016-10-17 20:12:36 -0600 | [diff] [blame] | 115 | #if CONFIG_IS_ENABLED(PRE_CONSOLE_BUFFER) |
Heinrich Schuchardt | 50d9286 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 116 | /** |
| 117 | * @precon_buf_idx: pre-console buffer index |
| 118 | * |
Rasmus Villemoes | e406a61 | 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 | 50d9286 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 125 | */ |
Rasmus Villemoes | e406a61 | 2022-05-03 15:13:27 +0200 | [diff] [blame] | 126 | long precon_buf_idx; |
Simon Glass | 0e72403 | 2012-12-13 20:49:12 +0000 | [diff] [blame] | 127 | #endif |
Heinrich Schuchardt | 50d9286 | 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 | f936cf6 | 2021-01-31 20:35:59 +0800 | [diff] [blame] | 158 | phys_addr_t ram_top; |
Heinrich Schuchardt | 50d9286 | 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 | 0e72403 | 2012-12-13 20:49:12 +0000 | [diff] [blame] | 187 | unsigned long reloc_off; |
Heinrich Schuchardt | 50d9286 | 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 | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 192 | |
| 193 | #ifdef CONFIG_DM |
Heinrich Schuchardt | 50d9286 | 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 | /** |
Heinrich Schuchardt | 18000fe | 2021-01-24 21:48:00 +0100 | [diff] [blame] | 199 | * @uclass_root_s: |
| 200 | * head of core tree when uclasses are not in read-only memory. |
| 201 | * |
| 202 | * When uclasses are in read-only memory, @uclass_root_s is not used and |
| 203 | * @uclass_root points to the root node generated by dtoc. |
Heinrich Schuchardt | 50d9286 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 204 | */ |
Simon Glass | 784cd9e | 2020-12-19 10:40:17 -0700 | [diff] [blame] | 205 | struct list_head uclass_root_s; |
| 206 | /** |
Heinrich Schuchardt | 18000fe | 2021-01-24 21:48:00 +0100 | [diff] [blame] | 207 | * @uclass_root: |
| 208 | * pointer to head of core tree, if uclasses are in read-only memory and |
| 209 | * cannot be adjusted to use @uclass_root as a list head. |
| 210 | * |
| 211 | * When not in read-only memory, @uclass_root_s is used to hold the |
| 212 | * uclass root, and @uclass_root points to the address of |
| 213 | * @uclass_root_s. |
Simon Glass | 784cd9e | 2020-12-19 10:40:17 -0700 | [diff] [blame] | 214 | */ |
| 215 | struct list_head *uclass_root; |
Simon Glass | 8beeb28 | 2021-03-15 17:25:36 +1300 | [diff] [blame] | 216 | # if CONFIG_IS_ENABLED(OF_PLATDATA_DRIVER_RT) |
Simon Glass | 9286eb9 | 2020-11-29 17:07:05 -0700 | [diff] [blame] | 217 | /** @dm_driver_rt: Dynamic info about the driver */ |
Simon Glass | cfd6a00 | 2020-10-03 11:31:33 -0600 | [diff] [blame] | 218 | struct driver_rt *dm_driver_rt; |
| 219 | # endif |
Simon Glass | 8beeb28 | 2021-03-15 17:25:36 +1300 | [diff] [blame] | 220 | #if CONFIG_IS_ENABLED(OF_PLATDATA_RT) |
| 221 | /** @dm_udevice_rt: Dynamic info about the udevice */ |
| 222 | struct udevice_rt *dm_udevice_rt; |
Simon Glass | 8dee67a | 2021-03-15 17:25:38 +1300 | [diff] [blame] | 223 | /** |
| 224 | * @dm_priv_base: Base address of the priv/plat region used when |
| 225 | * udevices and uclasses are in read-only memory. This is NULL if not |
| 226 | * used |
| 227 | */ |
| 228 | void *dm_priv_base; |
Simon Glass | 8beeb28 | 2021-03-15 17:25:36 +1300 | [diff] [blame] | 229 | # endif |
Simon Glass | dd6ab88 | 2014-02-26 15:59:18 -0700 | [diff] [blame] | 230 | #endif |
Thomas Chou | fb798b1 | 2015-10-09 13:46:34 +0800 | [diff] [blame] | 231 | #ifdef CONFIG_TIMER |
Heinrich Schuchardt | 50d9286 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 232 | /** |
| 233 | * @timer: timer instance for Driver Model |
| 234 | */ |
| 235 | struct udevice *timer; |
Thomas Chou | fb798b1 | 2015-10-09 13:46:34 +0800 | [diff] [blame] | 236 | #endif |
Heinrich Schuchardt | 50d9286 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 237 | /** |
| 238 | * @fdt_blob: U-Boot's own device tree, NULL if none |
| 239 | */ |
| 240 | const void *fdt_blob; |
| 241 | /** |
| 242 | * @new_fdt: relocated device tree |
| 243 | */ |
| 244 | void *new_fdt; |
| 245 | /** |
| 246 | * @fdt_size: space reserved for relocated device space |
| 247 | */ |
| 248 | unsigned long fdt_size; |
Simon Glass | bed6bc7 | 2021-12-16 20:59:33 -0700 | [diff] [blame] | 249 | /** |
| 250 | * @fdt_src: Source of FDT |
| 251 | */ |
| 252 | enum fdt_source_t fdt_src; |
Simon Glass | 40916e6 | 2020-10-03 09:25:22 -0600 | [diff] [blame] | 253 | #if CONFIG_IS_ENABLED(OF_LIVE) |
Heinrich Schuchardt | 50d9286 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 254 | /** |
| 255 | * @of_root: root node of the live tree |
| 256 | */ |
Simon Glass | a6eedb8 | 2017-05-18 20:08:53 -0600 | [diff] [blame] | 257 | struct device_node *of_root; |
| 258 | #endif |
Jean-Jacques Hiblot | 7c530e3 | 2018-12-07 14:50:52 +0100 | [diff] [blame] | 259 | |
| 260 | #if CONFIG_IS_ENABLED(MULTI_DTB_FIT) |
Heinrich Schuchardt | 50d9286 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 261 | /** |
| 262 | * @multi_dtb_fit: pointer to uncompressed multi-dtb FIT image |
| 263 | */ |
| 264 | const void *multi_dtb_fit; |
Jean-Jacques Hiblot | 7c530e3 | 2018-12-07 14:50:52 +0100 | [diff] [blame] | 265 | #endif |
Heinrich Schuchardt | 50d9286 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 266 | /** |
| 267 | * @jt: jump table |
| 268 | * |
| 269 | * The jump table contains pointers to exported functions. A pointer to |
| 270 | * the jump table is passed to standalone applications. |
| 271 | */ |
| 272 | struct jt_funcs *jt; |
| 273 | /** |
| 274 | * @env_buf: buffer for env_get() before reloc |
| 275 | */ |
| 276 | char env_buf[32]; |
Simon Glass | 209a1a6 | 2013-06-11 11:14:42 -0700 | [diff] [blame] | 277 | #ifdef CONFIG_TRACE |
Heinrich Schuchardt | 50d9286 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 278 | /** |
| 279 | * @trace_buff: trace buffer |
| 280 | * |
| 281 | * When tracing function in U-Boot this field points to the buffer |
| 282 | * recording the function calls. |
| 283 | */ |
| 284 | void *trace_buff; |
Simon Glass | 209a1a6 | 2013-06-11 11:14:42 -0700 | [diff] [blame] | 285 | #endif |
Tom Rini | 52b2e26 | 2021-08-18 23:12:24 -0400 | [diff] [blame] | 286 | #if CONFIG_IS_ENABLED(SYS_I2C_LEGACY) |
Heinrich Schuchardt | 50d9286 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 287 | /** |
| 288 | * @cur_i2c_bus: currently used I2C bus |
| 289 | */ |
| 290 | int cur_i2c_bus; |
Heiko Schocher | e7d9c4f | 2012-01-16 21:12:23 +0000 | [diff] [blame] | 291 | #endif |
Heinrich Schuchardt | 50d9286 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 292 | /** |
| 293 | * @timebase_h: high 32 bits of timer |
| 294 | */ |
Peng Fan | 9a60a9e | 2017-05-09 10:32:03 +0800 | [diff] [blame] | 295 | unsigned int timebase_h; |
Heinrich Schuchardt | 50d9286 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 296 | /** |
| 297 | * @timebase_l: low 32 bits of timer |
| 298 | */ |
Peng Fan | 9a60a9e | 2017-05-09 10:32:03 +0800 | [diff] [blame] | 299 | unsigned int timebase_l; |
Simon Glass | 345c974 | 2023-07-15 21:38:53 -0600 | [diff] [blame] | 300 | /** |
| 301 | * @malloc_start: start of malloc() region |
| 302 | */ |
| 303 | #if CONFIG_IS_ENABLED(CMD_BDINFO_EXTRA) |
| 304 | unsigned long malloc_start; |
| 305 | #endif |
Simon Glass | adad2d0 | 2023-09-26 08:14:27 -0600 | [diff] [blame] | 306 | #if CONFIG_IS_ENABLED(SYS_MALLOC_F) |
Heinrich Schuchardt | 50d9286 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 307 | /** |
| 308 | * @malloc_base: base address of early malloc() |
| 309 | */ |
| 310 | unsigned long malloc_base; |
| 311 | /** |
| 312 | * @malloc_limit: limit address of early malloc() |
| 313 | */ |
| 314 | unsigned long malloc_limit; |
| 315 | /** |
| 316 | * @malloc_ptr: current address of early malloc() |
| 317 | */ |
| 318 | unsigned long malloc_ptr; |
Simon Glass | 863e404 | 2014-07-10 22:23:28 -0600 | [diff] [blame] | 319 | #endif |
Bin Meng | f1b81fc | 2014-12-30 22:53:21 +0800 | [diff] [blame] | 320 | #ifdef CONFIG_PCI |
Heinrich Schuchardt | 50d9286 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 321 | /** |
| 322 | * @hose: PCI hose for early use |
| 323 | */ |
| 324 | struct pci_controller *hose; |
| 325 | /** |
| 326 | * @pci_ram_top: top of region accessible to PCI |
| 327 | */ |
| 328 | phys_addr_t pci_ram_top; |
Bin Meng | f1b81fc | 2014-12-30 22:53:21 +0800 | [diff] [blame] | 329 | #endif |
| 330 | #ifdef CONFIG_PCI_BOOTDELAY |
Heinrich Schuchardt | 50d9286 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 331 | /** |
| 332 | * @pcidelay_done: delay time before scanning of PIC hose expired |
| 333 | * |
| 334 | * If CONFIG_PCI_BOOTDELAY=y, pci_hose_scan() waits for the number of |
| 335 | * milliseconds defined by environment variable pcidelay before |
| 336 | * scanning. Once this delay has expired the flag @pcidelay_done |
| 337 | * is set to 1. |
| 338 | */ |
Bin Meng | f1b81fc | 2014-12-30 22:53:21 +0800 | [diff] [blame] | 339 | int pcidelay_done; |
| 340 | #endif |
Heinrich Schuchardt | 50d9286 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 341 | /** |
| 342 | * @cur_serial_dev: current serial device |
| 343 | */ |
| 344 | struct udevice *cur_serial_dev; |
| 345 | /** |
| 346 | * @arch: architecture-specific data |
| 347 | */ |
| 348 | struct arch_global_data arch; |
Simon Glass | 1bb4923 | 2015-11-08 23:47:48 -0700 | [diff] [blame] | 349 | #ifdef CONFIG_CONSOLE_RECORD |
Heinrich Schuchardt | 50d9286 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 350 | /** |
| 351 | * @console_out: output buffer for console recording |
| 352 | * |
| 353 | * This buffer is used to collect output during console recording. |
| 354 | */ |
| 355 | struct membuff console_out; |
| 356 | /** |
| 357 | * @console_in: input buffer for console recording |
| 358 | * |
| 359 | * If console recording is activated, this buffer can be used to |
| 360 | * emulate input. |
| 361 | */ |
| 362 | struct membuff console_in; |
Simon Glass | 1bb4923 | 2015-11-08 23:47:48 -0700 | [diff] [blame] | 363 | #endif |
Nikhil M Jain | 7f561e1 | 2023-04-20 17:41:10 +0530 | [diff] [blame] | 364 | #if CONFIG_IS_ENABLED(VIDEO) |
Heinrich Schuchardt | 50d9286 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 365 | /** |
| 366 | * @video_top: top of video frame buffer area |
| 367 | */ |
| 368 | ulong video_top; |
| 369 | /** |
| 370 | * @video_bottom: bottom of video frame buffer area |
| 371 | */ |
| 372 | ulong video_bottom; |
Simon Glass | fce58f5 | 2016-01-18 19:52:21 -0700 | [diff] [blame] | 373 | #endif |
Simon Glass | 8820033 | 2017-05-22 05:05:25 -0600 | [diff] [blame] | 374 | #ifdef CONFIG_BOOTSTAGE |
Heinrich Schuchardt | 50d9286 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 375 | /** |
| 376 | * @bootstage: boot stage information |
| 377 | */ |
| 378 | struct bootstage_data *bootstage; |
| 379 | /** |
| 380 | * @new_bootstage: relocated boot stage information |
| 381 | */ |
| 382 | struct bootstage_data *new_bootstage; |
Simon Glass | 8820033 | 2017-05-22 05:05:25 -0600 | [diff] [blame] | 383 | #endif |
Simon Glass | d95645d | 2017-12-04 13:48:24 -0700 | [diff] [blame] | 384 | #ifdef CONFIG_LOG |
Heinrich Schuchardt | 50d9286 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 385 | /** |
| 386 | * @log_drop_count: number of dropped log messages |
| 387 | * |
| 388 | * This counter is incremented for each log message which can not |
| 389 | * be processed because logging is not yet available as signaled by |
| 390 | * flag %GD_FLG_LOG_READY in @flags. |
| 391 | */ |
| 392 | int log_drop_count; |
| 393 | /** |
| 394 | * @default_log_level: default logging level |
| 395 | * |
| 396 | * For logging devices without filters @default_log_level defines the |
| 397 | * logging level, cf. &enum log_level_t. |
| 398 | */ |
| 399 | int default_log_level; |
| 400 | /** |
| 401 | * @log_head: list of logging devices |
| 402 | */ |
| 403 | struct list_head log_head; |
| 404 | /** |
| 405 | * @log_fmt: bit mask for logging format |
| 406 | * |
| 407 | * The @log_fmt bit mask selects the fields to be shown in log messages. |
| 408 | * &enum log_fmt defines the bits of the bit mask. |
| 409 | */ |
| 410 | int log_fmt; |
Heinrich Schuchardt | fdf5599 | 2020-10-17 14:31:57 +0200 | [diff] [blame] | 411 | |
| 412 | /** |
| 413 | * @processing_msg: a log message is being processed |
| 414 | * |
| 415 | * This flag is used to suppress the creation of additional messages |
| 416 | * while another message is being processed. |
| 417 | */ |
| 418 | bool processing_msg; |
Heinrich Schuchardt | 0fc9f4f | 2020-10-17 14:31:58 +0200 | [diff] [blame] | 419 | /** |
| 420 | * @logc_prev: logging category of previous message |
| 421 | * |
| 422 | * This value is used as logging category for continuation messages. |
| 423 | */ |
| 424 | int logc_prev; |
| 425 | /** |
Heinrich Schuchardt | 14e7722 | 2020-10-30 18:50:31 +0100 | [diff] [blame] | 426 | * @logl_prev: logging level of the previous message |
Heinrich Schuchardt | 0fc9f4f | 2020-10-17 14:31:58 +0200 | [diff] [blame] | 427 | * |
| 428 | * This value is used as logging level for continuation messages. |
| 429 | */ |
| 430 | int logl_prev; |
Simon Glass | 5fc47e3 | 2021-01-20 20:10:53 -0700 | [diff] [blame] | 431 | /** |
| 432 | * @log_cont: Previous log line did not finished wtih \n |
| 433 | * |
| 434 | * This allows for chained log messages on the same line |
| 435 | */ |
| 436 | bool log_cont; |
Simon Glass | d95645d | 2017-12-04 13:48:24 -0700 | [diff] [blame] | 437 | #endif |
Simon Glass | a815dab | 2018-11-15 18:43:52 -0700 | [diff] [blame] | 438 | #if CONFIG_IS_ENABLED(BLOBLIST) |
Heinrich Schuchardt | 50d9286 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 439 | /** |
| 440 | * @bloblist: blob list information |
| 441 | */ |
| 442 | struct bloblist_hdr *bloblist; |
| 443 | /** |
| 444 | * @new_bloblist: relocated blob list information |
| 445 | */ |
| 446 | struct bloblist_hdr *new_bloblist; |
Ovidiu Panait | c1b30d5 | 2020-11-28 10:43:20 +0200 | [diff] [blame] | 447 | #endif |
| 448 | #if CONFIG_IS_ENABLED(HANDOFF) |
Heinrich Schuchardt | 50d9286 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 449 | /** |
| 450 | * @spl_handoff: SPL hand-off information |
| 451 | */ |
Simon Glass | e14f1a2 | 2018-11-15 18:44:09 -0700 | [diff] [blame] | 452 | struct spl_handoff *spl_handoff; |
Simon Glass | a815dab | 2018-11-15 18:43:52 -0700 | [diff] [blame] | 453 | #endif |
Stefan Roese | 85bddff | 2019-04-12 16:42:28 +0200 | [diff] [blame] | 454 | #if defined(CONFIG_TRANSLATION_OFFSET) |
Heinrich Schuchardt | 50d9286 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 455 | /** |
| 456 | * @translation_offset: optional translation offset |
| 457 | * |
| 458 | * See CONFIG_TRANSLATION_OFFSET. |
| 459 | */ |
| 460 | fdt_addr_t translation_offset; |
Stefan Roese | 85bddff | 2019-04-12 16:42:28 +0200 | [diff] [blame] | 461 | #endif |
Simon Glass | cf1f4bb | 2023-05-04 16:54:59 -0600 | [diff] [blame] | 462 | #ifdef CONFIG_ACPI |
Simon Glass | de0115a | 2020-11-04 09:57:19 -0700 | [diff] [blame] | 463 | /** |
| 464 | * @acpi_ctx: ACPI context pointer |
| 465 | */ |
| 466 | struct acpi_ctx *acpi_ctx; |
Simon Glass | b33f2f9 | 2021-12-01 09:02:37 -0700 | [diff] [blame] | 467 | /** |
| 468 | * @acpi_start: Start address of ACPI tables |
| 469 | */ |
| 470 | ulong acpi_start; |
Simon Glass | de0115a | 2020-11-04 09:57:19 -0700 | [diff] [blame] | 471 | #endif |
Simon Glass | a05eb04 | 2021-02-04 21:17:20 -0700 | [diff] [blame] | 472 | #if CONFIG_IS_ENABLED(GENERATE_SMBIOS_TABLE) |
| 473 | /** |
| 474 | * @smbios_version: Points to SMBIOS type 0 version |
| 475 | */ |
| 476 | char *smbios_version; |
| 477 | #endif |
Simon Glass | aa4bce9 | 2022-03-04 08:43:00 -0700 | [diff] [blame] | 478 | #if CONFIG_IS_ENABLED(EVENT) |
| 479 | /** |
| 480 | * @event_state: Points to the current state of events |
| 481 | */ |
| 482 | struct event_state event_state; |
| 483 | #endif |
Stefan Roese | 036f89a | 2022-09-02 13:57:48 +0200 | [diff] [blame] | 484 | #ifdef CONFIG_CYCLIC |
| 485 | /** |
Rasmus Villemoes | c794e49 | 2022-10-28 13:50:54 +0200 | [diff] [blame] | 486 | * @cyclic_list: list of registered cyclic functions |
Stefan Roese | 036f89a | 2022-09-02 13:57:48 +0200 | [diff] [blame] | 487 | */ |
Rasmus Villemoes | c794e49 | 2022-10-28 13:50:54 +0200 | [diff] [blame] | 488 | struct hlist_head cyclic_list; |
Stefan Roese | 036f89a | 2022-09-02 13:57:48 +0200 | [diff] [blame] | 489 | #endif |
AKASHI Takahiro | e04f4fb | 2022-03-08 20:36:46 +0900 | [diff] [blame] | 490 | /** |
| 491 | * @dmtag_list: List of DM tags |
| 492 | */ |
| 493 | struct list_head dmtag_list; |
Heinrich Schuchardt | 50d9286 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 494 | }; |
Rasmus Villemoes | b8cfd9e | 2021-05-18 11:19:47 +0200 | [diff] [blame] | 495 | #ifndef DO_DEPS_ONLY |
| 496 | static_assert(sizeof(struct global_data) == GD_SIZE); |
| 497 | #endif |
Simon Glass | 0e72403 | 2012-12-13 20:49:12 +0000 | [diff] [blame] | 498 | |
Heinrich Schuchardt | 50d9286 | 2020-10-05 08:30:09 +0200 | [diff] [blame] | 499 | /** |
| 500 | * gd_board_type() - retrieve board type |
| 501 | * |
| 502 | * Return: global board type |
| 503 | */ |
Simon Glass | b4de3f3 | 2017-03-31 08:40:24 -0600 | [diff] [blame] | 504 | #ifdef CONFIG_BOARD_TYPES |
| 505 | #define gd_board_type() gd->board_type |
| 506 | #else |
| 507 | #define gd_board_type() 0 |
| 508 | #endif |
| 509 | |
Simon Glass | 40916e6 | 2020-10-03 09:25:22 -0600 | [diff] [blame] | 510 | /* These macros help avoid #ifdefs in the code */ |
| 511 | #if CONFIG_IS_ENABLED(OF_LIVE) |
| 512 | #define gd_of_root() gd->of_root |
| 513 | #define gd_of_root_ptr() &gd->of_root |
| 514 | #define gd_set_of_root(_root) gd->of_root = (_root) |
| 515 | #else |
| 516 | #define gd_of_root() NULL |
| 517 | #define gd_of_root_ptr() NULL |
| 518 | #define gd_set_of_root(_root) |
| 519 | #endif |
| 520 | |
Simon Glass | 8beeb28 | 2021-03-15 17:25:36 +1300 | [diff] [blame] | 521 | #if CONFIG_IS_ENABLED(OF_PLATDATA_DRIVER_RT) |
Simon Glass | cfd6a00 | 2020-10-03 11:31:33 -0600 | [diff] [blame] | 522 | #define gd_set_dm_driver_rt(dyn) gd->dm_driver_rt = dyn |
| 523 | #define gd_dm_driver_rt() gd->dm_driver_rt |
| 524 | #else |
| 525 | #define gd_set_dm_driver_rt(dyn) |
| 526 | #define gd_dm_driver_rt() NULL |
| 527 | #endif |
| 528 | |
Simon Glass | 8beeb28 | 2021-03-15 17:25:36 +1300 | [diff] [blame] | 529 | #if CONFIG_IS_ENABLED(OF_PLATDATA_RT) |
| 530 | #define gd_set_dm_udevice_rt(dyn) gd->dm_udevice_rt = dyn |
| 531 | #define gd_dm_udevice_rt() gd->dm_udevice_rt |
Simon Glass | 8dee67a | 2021-03-15 17:25:38 +1300 | [diff] [blame] | 532 | #define gd_set_dm_priv_base(dyn) gd->dm_priv_base = dyn |
| 533 | #define gd_dm_priv_base() gd->dm_priv_base |
Simon Glass | 8beeb28 | 2021-03-15 17:25:36 +1300 | [diff] [blame] | 534 | #else |
| 535 | #define gd_set_dm_udevice_rt(dyn) |
| 536 | #define gd_dm_udevice_rt() NULL |
Simon Glass | 8dee67a | 2021-03-15 17:25:38 +1300 | [diff] [blame] | 537 | #define gd_set_dm_priv_base(dyn) |
| 538 | #define gd_dm_priv_base() NULL |
Simon Glass | 8beeb28 | 2021-03-15 17:25:36 +1300 | [diff] [blame] | 539 | #endif |
| 540 | |
Simon Glass | cf1f4bb | 2023-05-04 16:54:59 -0600 | [diff] [blame] | 541 | #ifdef CONFIG_ACPI |
Simon Glass | de0115a | 2020-11-04 09:57:19 -0700 | [diff] [blame] | 542 | #define gd_acpi_ctx() gd->acpi_ctx |
Simon Glass | b33f2f9 | 2021-12-01 09:02:37 -0700 | [diff] [blame] | 543 | #define gd_acpi_start() gd->acpi_start |
| 544 | #define gd_set_acpi_start(addr) gd->acpi_start = addr |
Simon Glass | de0115a | 2020-11-04 09:57:19 -0700 | [diff] [blame] | 545 | #else |
| 546 | #define gd_acpi_ctx() NULL |
Simon Glass | b33f2f9 | 2021-12-01 09:02:37 -0700 | [diff] [blame] | 547 | #define gd_acpi_start() 0UL |
| 548 | #define gd_set_acpi_start(addr) |
Simon Glass | de0115a | 2020-11-04 09:57:19 -0700 | [diff] [blame] | 549 | #endif |
| 550 | |
Simon Glass | 9b38810 | 2023-09-19 21:00:15 -0600 | [diff] [blame] | 551 | #ifdef CONFIG_SMBIOS |
Simon Glass | 42b7da5 | 2023-12-31 08:25:48 -0700 | [diff] [blame] | 552 | #define gd_smbios_start() gd->arch.smbios_start |
Simon Glass | 9b38810 | 2023-09-19 21:00:15 -0600 | [diff] [blame] | 553 | #define gd_set_smbios_start(addr) gd->arch.smbios_start = addr |
| 554 | #else |
| 555 | #define gd_smbios_start() 0UL |
| 556 | #define gd_set_smbios_start(addr) |
| 557 | #endif |
| 558 | |
Simon Glass | 69daf5a | 2021-12-16 20:59:25 -0700 | [diff] [blame] | 559 | #if CONFIG_IS_ENABLED(MULTI_DTB_FIT) |
| 560 | #define gd_multi_dtb_fit() gd->multi_dtb_fit |
| 561 | #define gd_set_multi_dtb_fit(_dtb) gd->multi_dtb_fit = _dtb |
| 562 | #else |
| 563 | #define gd_multi_dtb_fit() NULL |
| 564 | #define gd_set_multi_dtb_fit(_dtb) |
| 565 | #endif |
| 566 | |
Simon Glass | aa4bce9 | 2022-03-04 08:43:00 -0700 | [diff] [blame] | 567 | #if CONFIG_IS_ENABLED(EVENT_DYNAMIC) |
| 568 | #define gd_event_state() ((struct event_state *)&gd->event_state) |
| 569 | #else |
| 570 | #define gd_event_state() NULL |
| 571 | #endif |
| 572 | |
Simon Glass | 345c974 | 2023-07-15 21:38:53 -0600 | [diff] [blame] | 573 | #if CONFIG_IS_ENABLED(CMD_BDINFO_EXTRA) |
| 574 | #define gd_malloc_start() gd->malloc_start |
| 575 | #define gd_set_malloc_start(_val) gd->malloc_start = (_val) |
| 576 | #else |
| 577 | #define gd_malloc_start() 0 |
| 578 | #define gd_set_malloc_start(val) |
| 579 | #endif |
Troy Kisky | e143c27 | 2023-03-13 14:31:43 -0700 | [diff] [blame] | 580 | |
| 581 | #if CONFIG_IS_ENABLED(PCI) |
| 582 | #define gd_set_pci_ram_top(val) gd->pci_ram_top = val |
| 583 | #else |
| 584 | #define gd_set_pci_ram_top(val) |
| 585 | #endif |
| 586 | |
Simon Glass | e8804d7 | 2023-09-26 08:14:31 -0600 | [diff] [blame] | 587 | #if CONFIG_VAL(SYS_MALLOC_F_LEN) |
| 588 | #define gd_malloc_ptr() gd->malloc_ptr |
| 589 | #else |
| 590 | #define gd_malloc_ptr() 0L |
| 591 | #endif |
| 592 | |
Heinrich Schuchardt | 1e5c4fe | 2020-10-05 08:30:08 +0200 | [diff] [blame] | 593 | /** |
| 594 | * enum gd_flags - global data flags |
| 595 | * |
| 596 | * See field flags of &struct global_data. |
Simon Glass | 0e72403 | 2012-12-13 20:49:12 +0000 | [diff] [blame] | 597 | */ |
Heinrich Schuchardt | 1e5c4fe | 2020-10-05 08:30:08 +0200 | [diff] [blame] | 598 | enum gd_flags { |
| 599 | /** |
| 600 | * @GD_FLG_RELOC: code was relocated to RAM |
| 601 | */ |
| 602 | GD_FLG_RELOC = 0x00001, |
| 603 | /** |
| 604 | * @GD_FLG_DEVINIT: devices have been initialized |
| 605 | */ |
| 606 | GD_FLG_DEVINIT = 0x00002, |
| 607 | /** |
| 608 | * @GD_FLG_SILENT: silent mode |
| 609 | */ |
| 610 | GD_FLG_SILENT = 0x00004, |
| 611 | /** |
| 612 | * @GD_FLG_POSTFAIL: critical POST test failed |
| 613 | */ |
| 614 | GD_FLG_POSTFAIL = 0x00008, |
| 615 | /** |
| 616 | * @GD_FLG_POSTSTOP: POST sequence aborted |
| 617 | */ |
| 618 | GD_FLG_POSTSTOP = 0x00010, |
| 619 | /** |
| 620 | * @GD_FLG_LOGINIT: log Buffer has been initialized |
| 621 | */ |
| 622 | GD_FLG_LOGINIT = 0x00020, |
| 623 | /** |
| 624 | * @GD_FLG_DISABLE_CONSOLE: disable console (in & out) |
| 625 | */ |
| 626 | GD_FLG_DISABLE_CONSOLE = 0x00040, |
| 627 | /** |
| 628 | * @GD_FLG_ENV_READY: environment imported into hash table |
| 629 | */ |
| 630 | GD_FLG_ENV_READY = 0x00080, |
| 631 | /** |
| 632 | * @GD_FLG_SERIAL_READY: pre-relocation serial console ready |
| 633 | */ |
| 634 | GD_FLG_SERIAL_READY = 0x00100, |
| 635 | /** |
| 636 | * @GD_FLG_FULL_MALLOC_INIT: full malloc() is ready |
| 637 | */ |
| 638 | GD_FLG_FULL_MALLOC_INIT = 0x00200, |
| 639 | /** |
| 640 | * @GD_FLG_SPL_INIT: spl_init() has been called |
| 641 | */ |
| 642 | GD_FLG_SPL_INIT = 0x00400, |
| 643 | /** |
| 644 | * @GD_FLG_SKIP_RELOC: don't relocate |
| 645 | */ |
| 646 | GD_FLG_SKIP_RELOC = 0x00800, |
| 647 | /** |
| 648 | * @GD_FLG_RECORD: record console |
| 649 | */ |
| 650 | GD_FLG_RECORD = 0x01000, |
| 651 | /** |
Simon Glass | d6ed4af | 2021-05-08 06:59:56 -0600 | [diff] [blame] | 652 | * @GD_FLG_RECORD_OVF: record console overflow |
| 653 | */ |
| 654 | GD_FLG_RECORD_OVF = 0x02000, |
| 655 | /** |
Heinrich Schuchardt | 1e5c4fe | 2020-10-05 08:30:08 +0200 | [diff] [blame] | 656 | * @GD_FLG_ENV_DEFAULT: default variable flag |
| 657 | */ |
Simon Glass | d6ed4af | 2021-05-08 06:59:56 -0600 | [diff] [blame] | 658 | GD_FLG_ENV_DEFAULT = 0x04000, |
Heinrich Schuchardt | 1e5c4fe | 2020-10-05 08:30:08 +0200 | [diff] [blame] | 659 | /** |
| 660 | * @GD_FLG_SPL_EARLY_INIT: early SPL initialization is done |
| 661 | */ |
Simon Glass | d6ed4af | 2021-05-08 06:59:56 -0600 | [diff] [blame] | 662 | GD_FLG_SPL_EARLY_INIT = 0x08000, |
Heinrich Schuchardt | 1e5c4fe | 2020-10-05 08:30:08 +0200 | [diff] [blame] | 663 | /** |
| 664 | * @GD_FLG_LOG_READY: log system is ready for use |
| 665 | */ |
Simon Glass | d6ed4af | 2021-05-08 06:59:56 -0600 | [diff] [blame] | 666 | GD_FLG_LOG_READY = 0x10000, |
Heinrich Schuchardt | 1e5c4fe | 2020-10-05 08:30:08 +0200 | [diff] [blame] | 667 | /** |
Stefan Roese | 5128a87 | 2022-11-17 09:20:34 +0100 | [diff] [blame] | 668 | * @GD_FLG_CYCLIC_RUNNING: cyclic_run is in progress |
Heinrich Schuchardt | 1e5c4fe | 2020-10-05 08:30:08 +0200 | [diff] [blame] | 669 | */ |
Stefan Roese | 5128a87 | 2022-11-17 09:20:34 +0100 | [diff] [blame] | 670 | GD_FLG_CYCLIC_RUNNING = 0x20000, |
Heinrich Schuchardt | 1e5c4fe | 2020-10-05 08:30:08 +0200 | [diff] [blame] | 671 | /** |
| 672 | * @GD_FLG_SKIP_LL_INIT: don't perform low-level initialization |
| 673 | */ |
Simon Glass | d6ed4af | 2021-05-08 06:59:56 -0600 | [diff] [blame] | 674 | GD_FLG_SKIP_LL_INIT = 0x40000, |
Heinrich Schuchardt | 1e5c4fe | 2020-10-05 08:30:08 +0200 | [diff] [blame] | 675 | /** |
| 676 | * @GD_FLG_SMP_READY: SMP initialization is complete |
| 677 | */ |
Simon Glass | d6ed4af | 2021-05-08 06:59:56 -0600 | [diff] [blame] | 678 | GD_FLG_SMP_READY = 0x80000, |
Simon Glass | 60f0899 | 2022-09-06 20:27:06 -0600 | [diff] [blame] | 679 | /** |
| 680 | * @GD_FLG_FDT_CHANGED: Device tree change has been detected by tests |
| 681 | */ |
| 682 | GD_FLG_FDT_CHANGED = 0x100000, |
Simon Glass | c2727e5 | 2023-02-13 08:56:32 -0700 | [diff] [blame] | 683 | /** |
| 684 | * @GD_FLG_OF_TAG_MIGRATE: Device tree has old u-boot,dm- tags |
| 685 | */ |
| 686 | GD_FLG_OF_TAG_MIGRATE = 0x200000, |
Simon Glass | 31ef834 | 2023-09-07 09:58:13 -0600 | [diff] [blame] | 687 | /** |
| 688 | * @GD_FLG_DM_DEAD: Driver model is not accessible. This can be set when |
| 689 | * the memory used to holds its tables has been mapped out. |
| 690 | */ |
| 691 | GD_FLG_DM_DEAD = 0x400000, |
Simon Glass | a28f39c | 2023-09-26 08:14:51 -0600 | [diff] [blame] | 692 | /** |
| 693 | * @GD_FLG_BLOBLIST_READY: bloblist is ready for use |
| 694 | */ |
| 695 | GD_FLG_BLOBLIST_READY = 0x800000, |
Francis Laniel | 1239d23 | 2023-12-22 22:02:30 +0100 | [diff] [blame] | 696 | /** |
| 697 | * @GD_FLG_HUSH_OLD_PARSER: Use hush old parser. |
| 698 | */ |
| 699 | GD_FLG_HUSH_OLD_PARSER = 0x1000000, |
Francis Laniel | 3b66e57 | 2023-12-22 22:02:32 +0100 | [diff] [blame] | 700 | /** |
| 701 | * @GD_FLG_HUSH_MODERN_PARSER: Use hush 2021 parser. |
| 702 | */ |
| 703 | GD_FLG_HUSH_MODERN_PARSER = 0x2000000, |
Heinrich Schuchardt | 1e5c4fe | 2020-10-05 08:30:08 +0200 | [diff] [blame] | 704 | }; |
| 705 | |
| 706 | #endif /* __ASSEMBLY__ */ |
Simon Glass | 0e72403 | 2012-12-13 20:49:12 +0000 | [diff] [blame] | 707 | |
| 708 | #endif /* __ASM_GENERIC_GBL_DATA_H */ |