blob: 8a1a4e298acac29e081b8152690e1acf75e1775a [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Simon Glass0e724032012-12-13 20:49:12 +00002/*
3 * Copyright (c) 2012 The Chromium OS Authors.
4 * (C) Copyright 2002-2010
5 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
Simon Glass0e724032012-12-13 20:49:12 +00006 */
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__
Simon Glass7f67b372024-08-21 10:19:09 -060023#include <board_f.h>
Stefan Roese036f89a2022-09-02 13:57:48 +020024#include <cyclic.h>
Simon Glassaa4bce92022-03-04 08:43:00 -070025#include <event_internal.h>
Stefan Roese85bddff2019-04-12 16:42:28 +020026#include <fdtdec.h>
Simon Glass1bb49232015-11-08 23:47:48 -070027#include <membuff.h>
Simon Glassdd6ab882014-02-26 15:59:18 -070028#include <linux/list.h>
Rasmus Villemoesb8cfd9e2021-05-18 11:19:47 +020029#include <linux/build_bug.h>
30#include <asm-offsets.h>
Simon Glassdd6ab882014-02-26 15:59:18 -070031
Simon Glassde0115a2020-11-04 09:57:19 -070032struct acpi_ctx;
Simon Glasscfd6a002020-10-03 11:31:33 -060033struct driver_rt;
Simon Glass3a028c22024-08-07 16:47:30 -060034struct upl;
Simon Glasscfd6a002020-10-03 11:31:33 -060035
Heinrich Schuchardt50d92862020-10-05 08:30:09 +020036typedef struct global_data gd_t;
37
38/**
39 * struct global_data - global data structure
40 */
41struct global_data {
42 /**
43 * @bd: board information
44 */
Masahiro Yamadad788bba2020-02-25 02:22:27 +090045 struct bd_info *bd;
Simon Glass7f67b372024-08-21 10:19:09 -060046#ifndef CONFIG_SPL_BUILD
47 /**
48 * @boardf: information only used before relocation
49 */
50 struct board_f *boardf;
51#endif
Heinrich Schuchardt50d92862020-10-05 08:30:09 +020052 /**
53 * @flags: global data flags
54 *
55 * See &enum gd_flags
56 */
Simon Glass0e724032012-12-13 20:49:12 +000057 unsigned long flags;
Heinrich Schuchardt50d92862020-10-05 08:30:09 +020058 /**
59 * @baudrate: baud rate of the serial interface
60 */
Simon Glass059c54f2013-03-05 14:40:05 +000061 unsigned int baudrate;
Heinrich Schuchardt50d92862020-10-05 08:30:09 +020062 /**
63 * @cpu_clk: CPU clock rate in Hz
64 */
65 unsigned long cpu_clk;
66 /**
67 * @bus_clk: platform clock rate in Hz
68 */
Simon Glass0e724032012-12-13 20:49:12 +000069 unsigned long bus_clk;
Heinrich Schuchardt50d92862020-10-05 08:30:09 +020070 /**
Heinrich Schuchardt50d92862020-10-05 08:30:09 +020071 * @mem_clk: memory clock rate in Hz
72 */
Simon Glass0e724032012-12-13 20:49:12 +000073 unsigned long mem_clk;
Simon Glass49badb92017-12-04 13:48:23 -070074#if defined(CONFIG_POST)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +020075 /**
76 * @post_log_word: active POST tests
77 *
78 * @post_log_word is a bit mask defining which POST tests are recorded
79 * (see constants POST_*).
80 */
81 unsigned long post_log_word;
82 /**
83 * @post_log_res: POST results
84 *
85 * @post_log_res is a bit mask with the POST results. A bit with value 1
86 * indicates successful execution.
87 */
88 unsigned long post_log_res;
89 /**
90 * @post_init_f_time: time in ms when post_init_f() started
91 */
92 unsigned long post_init_f_time;
Simon Glass0e724032012-12-13 20:49:12 +000093#endif
94#ifdef CONFIG_BOARD_TYPES
Heinrich Schuchardt50d92862020-10-05 08:30:09 +020095 /**
96 * @board_type: board type
97 *
98 * If a U-Boot configuration supports multiple board types, the actual
99 * board type may be stored in this field.
100 */
Simon Glass0e724032012-12-13 20:49:12 +0000101 unsigned long board_type;
102#endif
Simon Glasse304a5e2016-10-17 20:12:36 -0600103#if CONFIG_IS_ENABLED(PRE_CONSOLE_BUFFER)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200104 /**
105 * @precon_buf_idx: pre-console buffer index
106 *
Rasmus Villemoese406a612022-05-03 15:13:27 +0200107 * @precon_buf_idx indicates the current position of the
108 * buffer used to collect output before the console becomes
109 * available. When negative, the pre-console buffer is
110 * temporarily disabled (used when the pre-console buffer is
111 * being written out, to prevent adding its contents to
112 * itself).
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200113 */
Rasmus Villemoese406a612022-05-03 15:13:27 +0200114 long precon_buf_idx;
Simon Glass0e724032012-12-13 20:49:12 +0000115#endif
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200116 /**
117 * @env_addr: address of environment structure
118 *
119 * @env_addr contains the address of the structure holding the
120 * environment variables.
121 */
122 unsigned long env_addr;
123 /**
Simon Glassc726f282024-08-21 10:19:08 -0600124 * @env_has_init: bit mask indicating environment locations
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200125 *
Simon Glassc726f282024-08-21 10:19:08 -0600126 * &enum env_location defines which bit relates to which location
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200127 */
Simon Glassc726f282024-08-21 10:19:08 -0600128 unsigned short env_has_init;
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200129 /**
Simon Glassc726f282024-08-21 10:19:08 -0600130 * @env_valid: environment is valid
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200131 *
Simon Glassc726f282024-08-21 10:19:08 -0600132 * See &enum env_valid
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200133 */
Simon Glassc726f282024-08-21 10:19:08 -0600134 unsigned char env_valid;
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200135 /**
136 * @env_load_prio: priority of the loaded environment
137 */
Simon Glassc726f282024-08-21 10:19:08 -0600138 char env_load_prio;
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200139 /**
140 * @ram_base: base address of RAM used by U-Boot
141 */
142 unsigned long ram_base;
143 /**
144 * @ram_top: top address of RAM used by U-Boot
145 */
Bin Mengf936cf62021-01-31 20:35:59 +0800146 phys_addr_t ram_top;
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200147 /**
148 * @relocaddr: start address of U-Boot in RAM
149 *
150 * After relocation this field indicates the address to which U-Boot
151 * has been relocated. It can be displayed using the bdinfo command.
152 * Its value is needed to display the source code when debugging with
153 * GDB using the 'add-symbol-file u-boot <relocaddr>' command.
154 */
155 unsigned long relocaddr;
156 /**
157 * @ram_size: RAM size in bytes
158 */
159 phys_size_t ram_size;
160 /**
161 * @mon_len: monitor length in bytes
162 */
163 unsigned long mon_len;
164 /**
165 * @irq_sp: IRQ stack pointer
166 */
167 unsigned long irq_sp;
168 /**
169 * @start_addr_sp: initial stack pointer address
170 */
171 unsigned long start_addr_sp;
172 /**
173 * @reloc_off: relocation offset
174 */
Simon Glass0e724032012-12-13 20:49:12 +0000175 unsigned long reloc_off;
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200176 /**
177 * @new_gd: pointer to relocated global data
178 */
179 struct global_data *new_gd;
Simon Glassdd6ab882014-02-26 15:59:18 -0700180
181#ifdef CONFIG_DM
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200182 /**
183 * @dm_root: root instance for Driver Model
184 */
185 struct udevice *dm_root;
186 /**
Heinrich Schuchardt18000fe2021-01-24 21:48:00 +0100187 * @uclass_root_s:
188 * head of core tree when uclasses are not in read-only memory.
189 *
190 * When uclasses are in read-only memory, @uclass_root_s is not used and
191 * @uclass_root points to the root node generated by dtoc.
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200192 */
Simon Glass784cd9e2020-12-19 10:40:17 -0700193 struct list_head uclass_root_s;
194 /**
Heinrich Schuchardt18000fe2021-01-24 21:48:00 +0100195 * @uclass_root:
196 * pointer to head of core tree, if uclasses are in read-only memory and
197 * cannot be adjusted to use @uclass_root as a list head.
198 *
199 * When not in read-only memory, @uclass_root_s is used to hold the
200 * uclass root, and @uclass_root points to the address of
201 * @uclass_root_s.
Simon Glass784cd9e2020-12-19 10:40:17 -0700202 */
203 struct list_head *uclass_root;
Simon Glass8beeb282021-03-15 17:25:36 +1300204# if CONFIG_IS_ENABLED(OF_PLATDATA_DRIVER_RT)
Simon Glass9286eb92020-11-29 17:07:05 -0700205 /** @dm_driver_rt: Dynamic info about the driver */
Simon Glasscfd6a002020-10-03 11:31:33 -0600206 struct driver_rt *dm_driver_rt;
207# endif
Simon Glass8beeb282021-03-15 17:25:36 +1300208#if CONFIG_IS_ENABLED(OF_PLATDATA_RT)
209 /** @dm_udevice_rt: Dynamic info about the udevice */
210 struct udevice_rt *dm_udevice_rt;
Simon Glass8dee67a2021-03-15 17:25:38 +1300211 /**
212 * @dm_priv_base: Base address of the priv/plat region used when
213 * udevices and uclasses are in read-only memory. This is NULL if not
214 * used
215 */
216 void *dm_priv_base;
Simon Glass8beeb282021-03-15 17:25:36 +1300217# endif
Simon Glassdd6ab882014-02-26 15:59:18 -0700218#endif
Thomas Choufb798b12015-10-09 13:46:34 +0800219#ifdef CONFIG_TIMER
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200220 /**
221 * @timer: timer instance for Driver Model
222 */
223 struct udevice *timer;
Thomas Choufb798b12015-10-09 13:46:34 +0800224#endif
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200225 /**
226 * @fdt_blob: U-Boot's own device tree, NULL if none
227 */
228 const void *fdt_blob;
229 /**
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200230 * @fdt_size: space reserved for relocated device space
231 */
232 unsigned long fdt_size;
Simon Glassbed6bc72021-12-16 20:59:33 -0700233 /**
234 * @fdt_src: Source of FDT
235 */
236 enum fdt_source_t fdt_src;
Simon Glass40916e62020-10-03 09:25:22 -0600237#if CONFIG_IS_ENABLED(OF_LIVE)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200238 /**
239 * @of_root: root node of the live tree
240 */
Simon Glassa6eedb82017-05-18 20:08:53 -0600241 struct device_node *of_root;
242#endif
Jean-Jacques Hiblot7c530e32018-12-07 14:50:52 +0100243
244#if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200245 /**
246 * @multi_dtb_fit: pointer to uncompressed multi-dtb FIT image
247 */
248 const void *multi_dtb_fit;
Jean-Jacques Hiblot7c530e32018-12-07 14:50:52 +0100249#endif
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200250 /**
251 * @jt: jump table
252 *
253 * The jump table contains pointers to exported functions. A pointer to
254 * the jump table is passed to standalone applications.
255 */
256 struct jt_funcs *jt;
257 /**
258 * @env_buf: buffer for env_get() before reloc
259 */
260 char env_buf[32];
Simon Glass209a1a62013-06-11 11:14:42 -0700261#ifdef CONFIG_TRACE
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200262 /**
263 * @trace_buff: trace buffer
264 *
265 * When tracing function in U-Boot this field points to the buffer
266 * recording the function calls.
267 */
268 void *trace_buff;
Simon Glass209a1a62013-06-11 11:14:42 -0700269#endif
Tom Rini52b2e262021-08-18 23:12:24 -0400270#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200271 /**
272 * @cur_i2c_bus: currently used I2C bus
273 */
274 int cur_i2c_bus;
Heiko Schochere7d9c4f2012-01-16 21:12:23 +0000275#endif
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200276 /**
277 * @timebase_h: high 32 bits of timer
278 */
Peng Fan9a60a9e2017-05-09 10:32:03 +0800279 unsigned int timebase_h;
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200280 /**
281 * @timebase_l: low 32 bits of timer
282 */
Peng Fan9a60a9e2017-05-09 10:32:03 +0800283 unsigned int timebase_l;
Simon Glass345c9742023-07-15 21:38:53 -0600284 /**
285 * @malloc_start: start of malloc() region
286 */
287#if CONFIG_IS_ENABLED(CMD_BDINFO_EXTRA)
288 unsigned long malloc_start;
289#endif
Simon Glassadad2d02023-09-26 08:14:27 -0600290#if CONFIG_IS_ENABLED(SYS_MALLOC_F)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200291 /**
292 * @malloc_base: base address of early malloc()
293 */
294 unsigned long malloc_base;
295 /**
296 * @malloc_limit: limit address of early malloc()
297 */
298 unsigned long malloc_limit;
299 /**
300 * @malloc_ptr: current address of early malloc()
301 */
302 unsigned long malloc_ptr;
Simon Glass863e4042014-07-10 22:23:28 -0600303#endif
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200304 /**
305 * @cur_serial_dev: current serial device
306 */
307 struct udevice *cur_serial_dev;
308 /**
309 * @arch: architecture-specific data
310 */
311 struct arch_global_data arch;
Simon Glass1bb49232015-11-08 23:47:48 -0700312#ifdef CONFIG_CONSOLE_RECORD
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200313 /**
314 * @console_out: output buffer for console recording
315 *
316 * This buffer is used to collect output during console recording.
317 */
318 struct membuff console_out;
319 /**
320 * @console_in: input buffer for console recording
321 *
322 * If console recording is activated, this buffer can be used to
323 * emulate input.
324 */
325 struct membuff console_in;
Simon Glass1bb49232015-11-08 23:47:48 -0700326#endif
Nikhil M Jain7f561e12023-04-20 17:41:10 +0530327#if CONFIG_IS_ENABLED(VIDEO)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200328 /**
329 * @video_top: top of video frame buffer area
330 */
331 ulong video_top;
332 /**
333 * @video_bottom: bottom of video frame buffer area
334 */
335 ulong video_bottom;
Simon Glassfce58f52016-01-18 19:52:21 -0700336#endif
Simon Glass88200332017-05-22 05:05:25 -0600337#ifdef CONFIG_BOOTSTAGE
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200338 /**
339 * @bootstage: boot stage information
340 */
341 struct bootstage_data *bootstage;
342 /**
343 * @new_bootstage: relocated boot stage information
344 */
345 struct bootstage_data *new_bootstage;
Simon Glass88200332017-05-22 05:05:25 -0600346#endif
Simon Glassd95645d2017-12-04 13:48:24 -0700347#ifdef CONFIG_LOG
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200348 /**
349 * @log_drop_count: number of dropped log messages
350 *
351 * This counter is incremented for each log message which can not
352 * be processed because logging is not yet available as signaled by
353 * flag %GD_FLG_LOG_READY in @flags.
354 */
355 int log_drop_count;
356 /**
357 * @default_log_level: default logging level
358 *
359 * For logging devices without filters @default_log_level defines the
360 * logging level, cf. &enum log_level_t.
361 */
362 int default_log_level;
363 /**
364 * @log_head: list of logging devices
365 */
366 struct list_head log_head;
367 /**
368 * @log_fmt: bit mask for logging format
369 *
370 * The @log_fmt bit mask selects the fields to be shown in log messages.
371 * &enum log_fmt defines the bits of the bit mask.
372 */
373 int log_fmt;
Heinrich Schuchardtfdf55992020-10-17 14:31:57 +0200374
375 /**
376 * @processing_msg: a log message is being processed
377 *
378 * This flag is used to suppress the creation of additional messages
379 * while another message is being processed.
380 */
381 bool processing_msg;
Heinrich Schuchardt0fc9f4f2020-10-17 14:31:58 +0200382 /**
383 * @logc_prev: logging category of previous message
384 *
385 * This value is used as logging category for continuation messages.
386 */
387 int logc_prev;
388 /**
Heinrich Schuchardt14e77222020-10-30 18:50:31 +0100389 * @logl_prev: logging level of the previous message
Heinrich Schuchardt0fc9f4f2020-10-17 14:31:58 +0200390 *
391 * This value is used as logging level for continuation messages.
392 */
393 int logl_prev;
Simon Glass5fc47e32021-01-20 20:10:53 -0700394 /**
395 * @log_cont: Previous log line did not finished wtih \n
396 *
397 * This allows for chained log messages on the same line
398 */
399 bool log_cont;
Simon Glassd95645d2017-12-04 13:48:24 -0700400#endif
Simon Glassa815dab2018-11-15 18:43:52 -0700401#if CONFIG_IS_ENABLED(BLOBLIST)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200402 /**
403 * @bloblist: blob list information
404 */
405 struct bloblist_hdr *bloblist;
406 /**
407 * @new_bloblist: relocated blob list information
408 */
409 struct bloblist_hdr *new_bloblist;
Ovidiu Panaitc1b30d52020-11-28 10:43:20 +0200410#endif
411#if CONFIG_IS_ENABLED(HANDOFF)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200412 /**
413 * @spl_handoff: SPL hand-off information
414 */
Simon Glasse14f1a22018-11-15 18:44:09 -0700415 struct spl_handoff *spl_handoff;
Simon Glassa815dab2018-11-15 18:43:52 -0700416#endif
Stefan Roese85bddff2019-04-12 16:42:28 +0200417#if defined(CONFIG_TRANSLATION_OFFSET)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200418 /**
419 * @translation_offset: optional translation offset
420 *
421 * See CONFIG_TRANSLATION_OFFSET.
422 */
423 fdt_addr_t translation_offset;
Stefan Roese85bddff2019-04-12 16:42:28 +0200424#endif
Simon Glasscf1f4bb2023-05-04 16:54:59 -0600425#ifdef CONFIG_ACPI
Simon Glassde0115a2020-11-04 09:57:19 -0700426 /**
427 * @acpi_ctx: ACPI context pointer
428 */
429 struct acpi_ctx *acpi_ctx;
Simon Glassb33f2f92021-12-01 09:02:37 -0700430 /**
431 * @acpi_start: Start address of ACPI tables
432 */
433 ulong acpi_start;
Simon Glassde0115a2020-11-04 09:57:19 -0700434#endif
Simon Glassa05eb042021-02-04 21:17:20 -0700435#if CONFIG_IS_ENABLED(GENERATE_SMBIOS_TABLE)
436 /**
437 * @smbios_version: Points to SMBIOS type 0 version
438 */
439 char *smbios_version;
440#endif
Simon Glassaa4bce92022-03-04 08:43:00 -0700441#if CONFIG_IS_ENABLED(EVENT)
442 /**
443 * @event_state: Points to the current state of events
444 */
445 struct event_state event_state;
446#endif
Simon Glass0b385222024-07-31 08:44:08 -0600447#if CONFIG_IS_ENABLED(CYCLIC)
Stefan Roese036f89a2022-09-02 13:57:48 +0200448 /**
Rasmus Villemoesc794e492022-10-28 13:50:54 +0200449 * @cyclic_list: list of registered cyclic functions
Stefan Roese036f89a2022-09-02 13:57:48 +0200450 */
Rasmus Villemoesc794e492022-10-28 13:50:54 +0200451 struct hlist_head cyclic_list;
Stefan Roese036f89a2022-09-02 13:57:48 +0200452#endif
AKASHI Takahiroe04f4fb2022-03-08 20:36:46 +0900453 /**
454 * @dmtag_list: List of DM tags
455 */
456 struct list_head dmtag_list;
Simon Glass3a028c22024-08-07 16:47:30 -0600457#if CONFIG_IS_ENABLED(UPL)
458 /**
459 * @upl: Universal Payload-handoff information
460 */
461 struct upl *upl;
462#endif
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200463};
Rasmus Villemoesb8cfd9e2021-05-18 11:19:47 +0200464#ifndef DO_DEPS_ONLY
465static_assert(sizeof(struct global_data) == GD_SIZE);
466#endif
Simon Glass0e724032012-12-13 20:49:12 +0000467
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200468/**
469 * gd_board_type() - retrieve board type
470 *
471 * Return: global board type
472 */
Simon Glassb4de3f32017-03-31 08:40:24 -0600473#ifdef CONFIG_BOARD_TYPES
474#define gd_board_type() gd->board_type
475#else
476#define gd_board_type() 0
477#endif
478
Simon Glass40916e62020-10-03 09:25:22 -0600479/* These macros help avoid #ifdefs in the code */
480#if CONFIG_IS_ENABLED(OF_LIVE)
481#define gd_of_root() gd->of_root
482#define gd_of_root_ptr() &gd->of_root
483#define gd_set_of_root(_root) gd->of_root = (_root)
484#else
485#define gd_of_root() NULL
486#define gd_of_root_ptr() NULL
487#define gd_set_of_root(_root)
488#endif
489
Simon Glass8beeb282021-03-15 17:25:36 +1300490#if CONFIG_IS_ENABLED(OF_PLATDATA_DRIVER_RT)
Simon Glasscfd6a002020-10-03 11:31:33 -0600491#define gd_set_dm_driver_rt(dyn) gd->dm_driver_rt = dyn
492#define gd_dm_driver_rt() gd->dm_driver_rt
493#else
494#define gd_set_dm_driver_rt(dyn)
495#define gd_dm_driver_rt() NULL
496#endif
497
Simon Glass8beeb282021-03-15 17:25:36 +1300498#if CONFIG_IS_ENABLED(OF_PLATDATA_RT)
499#define gd_set_dm_udevice_rt(dyn) gd->dm_udevice_rt = dyn
500#define gd_dm_udevice_rt() gd->dm_udevice_rt
Simon Glass8dee67a2021-03-15 17:25:38 +1300501#define gd_set_dm_priv_base(dyn) gd->dm_priv_base = dyn
502#define gd_dm_priv_base() gd->dm_priv_base
Simon Glass8beeb282021-03-15 17:25:36 +1300503#else
504#define gd_set_dm_udevice_rt(dyn)
505#define gd_dm_udevice_rt() NULL
Simon Glass8dee67a2021-03-15 17:25:38 +1300506#define gd_set_dm_priv_base(dyn)
507#define gd_dm_priv_base() NULL
Simon Glass8beeb282021-03-15 17:25:36 +1300508#endif
509
Simon Glasscf1f4bb2023-05-04 16:54:59 -0600510#ifdef CONFIG_ACPI
Simon Glassde0115a2020-11-04 09:57:19 -0700511#define gd_acpi_ctx() gd->acpi_ctx
Simon Glassb33f2f92021-12-01 09:02:37 -0700512#define gd_acpi_start() gd->acpi_start
513#define gd_set_acpi_start(addr) gd->acpi_start = addr
Simon Glassde0115a2020-11-04 09:57:19 -0700514#else
515#define gd_acpi_ctx() NULL
Simon Glassb33f2f92021-12-01 09:02:37 -0700516#define gd_acpi_start() 0UL
517#define gd_set_acpi_start(addr)
Simon Glassde0115a2020-11-04 09:57:19 -0700518#endif
519
Simon Glass9b388102023-09-19 21:00:15 -0600520#ifdef CONFIG_SMBIOS
Simon Glass42b7da52023-12-31 08:25:48 -0700521#define gd_smbios_start() gd->arch.smbios_start
Simon Glass9b388102023-09-19 21:00:15 -0600522#define gd_set_smbios_start(addr) gd->arch.smbios_start = addr
523#else
524#define gd_smbios_start() 0UL
525#define gd_set_smbios_start(addr)
526#endif
527
Simon Glass69daf5a2021-12-16 20:59:25 -0700528#if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
529#define gd_multi_dtb_fit() gd->multi_dtb_fit
530#define gd_set_multi_dtb_fit(_dtb) gd->multi_dtb_fit = _dtb
531#else
532#define gd_multi_dtb_fit() NULL
533#define gd_set_multi_dtb_fit(_dtb)
534#endif
535
Simon Glassaa4bce92022-03-04 08:43:00 -0700536#if CONFIG_IS_ENABLED(EVENT_DYNAMIC)
537#define gd_event_state() ((struct event_state *)&gd->event_state)
538#else
539#define gd_event_state() NULL
540#endif
541
Simon Glass345c9742023-07-15 21:38:53 -0600542#if CONFIG_IS_ENABLED(CMD_BDINFO_EXTRA)
543#define gd_malloc_start() gd->malloc_start
544#define gd_set_malloc_start(_val) gd->malloc_start = (_val)
545#else
546#define gd_malloc_start() 0
547#define gd_set_malloc_start(val)
548#endif
Troy Kiskye143c272023-03-13 14:31:43 -0700549
Simon Glasse8804d72023-09-26 08:14:31 -0600550#if CONFIG_VAL(SYS_MALLOC_F_LEN)
551#define gd_malloc_ptr() gd->malloc_ptr
552#else
553#define gd_malloc_ptr() 0L
554#endif
555
Simon Glass3a028c22024-08-07 16:47:30 -0600556#if CONFIG_IS_ENABLED(UPL)
557#define gd_upl() gd->upl
558#define gd_set_upl(_val) gd->upl = (_val)
559#else
560#define gd_upl() NULL
561#define gd_set_upl(val)
562#endif
563
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200564/**
565 * enum gd_flags - global data flags
566 *
567 * See field flags of &struct global_data.
Simon Glass0e724032012-12-13 20:49:12 +0000568 */
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200569enum gd_flags {
570 /**
571 * @GD_FLG_RELOC: code was relocated to RAM
572 */
573 GD_FLG_RELOC = 0x00001,
574 /**
575 * @GD_FLG_DEVINIT: devices have been initialized
576 */
577 GD_FLG_DEVINIT = 0x00002,
578 /**
579 * @GD_FLG_SILENT: silent mode
580 */
581 GD_FLG_SILENT = 0x00004,
582 /**
583 * @GD_FLG_POSTFAIL: critical POST test failed
584 */
585 GD_FLG_POSTFAIL = 0x00008,
586 /**
587 * @GD_FLG_POSTSTOP: POST sequence aborted
588 */
589 GD_FLG_POSTSTOP = 0x00010,
590 /**
591 * @GD_FLG_LOGINIT: log Buffer has been initialized
592 */
593 GD_FLG_LOGINIT = 0x00020,
594 /**
595 * @GD_FLG_DISABLE_CONSOLE: disable console (in & out)
596 */
597 GD_FLG_DISABLE_CONSOLE = 0x00040,
598 /**
599 * @GD_FLG_ENV_READY: environment imported into hash table
600 */
601 GD_FLG_ENV_READY = 0x00080,
602 /**
603 * @GD_FLG_SERIAL_READY: pre-relocation serial console ready
604 */
605 GD_FLG_SERIAL_READY = 0x00100,
606 /**
607 * @GD_FLG_FULL_MALLOC_INIT: full malloc() is ready
608 */
609 GD_FLG_FULL_MALLOC_INIT = 0x00200,
610 /**
611 * @GD_FLG_SPL_INIT: spl_init() has been called
612 */
613 GD_FLG_SPL_INIT = 0x00400,
614 /**
615 * @GD_FLG_SKIP_RELOC: don't relocate
616 */
617 GD_FLG_SKIP_RELOC = 0x00800,
618 /**
619 * @GD_FLG_RECORD: record console
620 */
621 GD_FLG_RECORD = 0x01000,
622 /**
Simon Glassd6ed4af2021-05-08 06:59:56 -0600623 * @GD_FLG_RECORD_OVF: record console overflow
624 */
625 GD_FLG_RECORD_OVF = 0x02000,
626 /**
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200627 * @GD_FLG_ENV_DEFAULT: default variable flag
628 */
Simon Glassd6ed4af2021-05-08 06:59:56 -0600629 GD_FLG_ENV_DEFAULT = 0x04000,
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200630 /**
631 * @GD_FLG_SPL_EARLY_INIT: early SPL initialization is done
632 */
Simon Glassd6ed4af2021-05-08 06:59:56 -0600633 GD_FLG_SPL_EARLY_INIT = 0x08000,
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200634 /**
635 * @GD_FLG_LOG_READY: log system is ready for use
636 */
Simon Glassd6ed4af2021-05-08 06:59:56 -0600637 GD_FLG_LOG_READY = 0x10000,
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200638 /**
Stefan Roese5128a872022-11-17 09:20:34 +0100639 * @GD_FLG_CYCLIC_RUNNING: cyclic_run is in progress
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200640 */
Stefan Roese5128a872022-11-17 09:20:34 +0100641 GD_FLG_CYCLIC_RUNNING = 0x20000,
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200642 /**
643 * @GD_FLG_SKIP_LL_INIT: don't perform low-level initialization
644 */
Simon Glassd6ed4af2021-05-08 06:59:56 -0600645 GD_FLG_SKIP_LL_INIT = 0x40000,
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200646 /**
647 * @GD_FLG_SMP_READY: SMP initialization is complete
648 */
Simon Glassd6ed4af2021-05-08 06:59:56 -0600649 GD_FLG_SMP_READY = 0x80000,
Simon Glass60f08992022-09-06 20:27:06 -0600650 /**
651 * @GD_FLG_FDT_CHANGED: Device tree change has been detected by tests
652 */
653 GD_FLG_FDT_CHANGED = 0x100000,
Simon Glassc2727e52023-02-13 08:56:32 -0700654 /**
655 * @GD_FLG_OF_TAG_MIGRATE: Device tree has old u-boot,dm- tags
656 */
657 GD_FLG_OF_TAG_MIGRATE = 0x200000,
Simon Glass31ef8342023-09-07 09:58:13 -0600658 /**
659 * @GD_FLG_DM_DEAD: Driver model is not accessible. This can be set when
660 * the memory used to holds its tables has been mapped out.
661 */
662 GD_FLG_DM_DEAD = 0x400000,
Simon Glassa28f39c2023-09-26 08:14:51 -0600663 /**
664 * @GD_FLG_BLOBLIST_READY: bloblist is ready for use
665 */
666 GD_FLG_BLOBLIST_READY = 0x800000,
Francis Laniel1239d232023-12-22 22:02:30 +0100667 /**
668 * @GD_FLG_HUSH_OLD_PARSER: Use hush old parser.
669 */
670 GD_FLG_HUSH_OLD_PARSER = 0x1000000,
Francis Laniel3b66e572023-12-22 22:02:32 +0100671 /**
672 * @GD_FLG_HUSH_MODERN_PARSER: Use hush 2021 parser.
673 */
674 GD_FLG_HUSH_MODERN_PARSER = 0x2000000,
Simon Glass9b5bfba2024-08-07 16:47:33 -0600675 /**
676 * @GD_FLG_UPL: Read/write a Universal Payload (UPL) handoff
677 */
678 GD_FLG_UPL = 0x4000000,
Simon Glassd4b0fdb2024-08-21 10:19:04 -0600679 /**
680 * @GD_FLG_HAVE_CONSOLE: serial_init() was called and a console
681 * is available. When not set, indicates that console input and output
682 * drivers shall not be called.
683 */
684 GD_FLG_HAVE_CONSOLE = 0x8000000,
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200685};
686
687#endif /* __ASSEMBLY__ */
Simon Glass0e724032012-12-13 20:49:12 +0000688
689#endif /* __ASM_GENERIC_GBL_DATA_H */