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