blob: 987fb66c17a32c6c73b7ae5437c513040244741d [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Simon Glass50b1fa32012-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 Glass50b1fa32012-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__
Stefan Roesec2c69712022-09-02 13:57:48 +020023#include <cyclic.h>
Simon Glass87a5d1b2022-03-04 08:43:00 -070024#include <event_internal.h>
Stefan Roesef2100f62019-04-12 16:42:28 +020025#include <fdtdec.h>
Simon Glass9854a872015-11-08 23:47:48 -070026#include <membuff.h>
Simon Glass6494d702014-02-26 15:59:18 -070027#include <linux/list.h>
Rasmus Villemoesee3a46a2021-05-18 11:19:47 +020028#include <linux/build_bug.h>
29#include <asm-offsets.h>
Simon Glass6494d702014-02-26 15:59:18 -070030
Simon Glass5019e202020-11-04 09:57:19 -070031struct acpi_ctx;
Simon Glassa294ead2020-10-03 11:31:33 -060032struct driver_rt;
33
Heinrich Schuchardt0c7cd152020-10-05 08:30:09 +020034typedef struct global_data gd_t;
35
36/**
37 * struct global_data - global data structure
38 */
39struct global_data {
40 /**
41 * @bd: board information
42 */
Masahiro Yamadab36992f2020-02-25 02:22:27 +090043 struct bd_info *bd;
Heinrich Schuchardt0c7cd152020-10-05 08:30:09 +020044 /**
45 * @flags: global data flags
46 *
47 * See &enum gd_flags
48 */
Simon Glass50b1fa32012-12-13 20:49:12 +000049 unsigned long flags;
Heinrich Schuchardt0c7cd152020-10-05 08:30:09 +020050 /**
51 * @baudrate: baud rate of the serial interface
52 */
Simon Glassb5bec882013-03-05 14:40:05 +000053 unsigned int baudrate;
Heinrich Schuchardt0c7cd152020-10-05 08:30:09 +020054 /**
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 Glass50b1fa32012-12-13 20:49:12 +000061 unsigned long bus_clk;
Heinrich Schuchardt0c7cd152020-10-05 08:30:09 +020062 /**
63 * @pci_clk: PCI clock rate in Hz
64 */
Simon Glass50b1fa32012-12-13 20:49:12 +000065 /* We cannot bracket this with CONFIG_PCI due to mpc5xxx */
66 unsigned long pci_clk;
Heinrich Schuchardt0c7cd152020-10-05 08:30:09 +020067 /**
68 * @mem_clk: memory clock rate in Hz
69 */
Simon Glass50b1fa32012-12-13 20:49:12 +000070 unsigned long mem_clk;
Simon Glassb86986c2022-10-18 07:46:31 -060071#if defined(CONFIG_VIDEO)
Heinrich Schuchardt0c7cd152020-10-05 08:30:09 +020072 /**
73 * @fb_base: base address of frame buffer memory
74 */
75 unsigned long fb_base;
Simon Glass50b1fa32012-12-13 20:49:12 +000076#endif
Simon Glassc5404b62017-12-04 13:48:23 -070077#if defined(CONFIG_POST)
Heinrich Schuchardt0c7cd152020-10-05 08:30:09 +020078 /**
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 Glass50b1fa32012-12-13 20:49:12 +000096#endif
97#ifdef CONFIG_BOARD_TYPES
Heinrich Schuchardt0c7cd152020-10-05 08:30:09 +020098 /**
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 Glass50b1fa32012-12-13 20:49:12 +0000104 unsigned long board_type;
105#endif
Heinrich Schuchardt0c7cd152020-10-05 08:30:09 +0200106 /**
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 Glass8f925582016-10-17 20:12:36 -0600115#if CONFIG_IS_ENABLED(PRE_CONSOLE_BUFFER)
Heinrich Schuchardt0c7cd152020-10-05 08:30:09 +0200116 /**
117 * @precon_buf_idx: pre-console buffer index
118 *
Rasmus Villemoes04a20ca2022-05-03 15:13:27 +0200119 * @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 Schuchardt0c7cd152020-10-05 08:30:09 +0200125 */
Rasmus Villemoes04a20ca2022-05-03 15:13:27 +0200126 long precon_buf_idx;
Simon Glass50b1fa32012-12-13 20:49:12 +0000127#endif
Heinrich Schuchardt0c7cd152020-10-05 08:30:09 +0200128 /**
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 Meng37dc9582021-01-31 20:35:59 +0800158 phys_addr_t ram_top;
Heinrich Schuchardt0c7cd152020-10-05 08:30:09 +0200159 /**
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 Glass50b1fa32012-12-13 20:49:12 +0000187 unsigned long reloc_off;
Heinrich Schuchardt0c7cd152020-10-05 08:30:09 +0200188 /**
189 * @new_gd: pointer to relocated global data
190 */
191 struct global_data *new_gd;
Simon Glass6494d702014-02-26 15:59:18 -0700192
193#ifdef CONFIG_DM
Heinrich Schuchardt0c7cd152020-10-05 08:30:09 +0200194 /**
195 * @dm_root: root instance for Driver Model
196 */
197 struct udevice *dm_root;
198 /**
199 * @dm_root_f: pre-relocation root instance
200 */
201 struct udevice *dm_root_f;
202 /**
Heinrich Schuchardta03185a2021-01-24 21:48:00 +0100203 * @uclass_root_s:
204 * head of core tree when uclasses are not in read-only memory.
205 *
206 * When uclasses are in read-only memory, @uclass_root_s is not used and
207 * @uclass_root points to the root node generated by dtoc.
Heinrich Schuchardt0c7cd152020-10-05 08:30:09 +0200208 */
Simon Glass8a715532020-12-19 10:40:17 -0700209 struct list_head uclass_root_s;
210 /**
Heinrich Schuchardta03185a2021-01-24 21:48:00 +0100211 * @uclass_root:
212 * pointer to head of core tree, if uclasses are in read-only memory and
213 * cannot be adjusted to use @uclass_root as a list head.
214 *
215 * When not in read-only memory, @uclass_root_s is used to hold the
216 * uclass root, and @uclass_root points to the address of
217 * @uclass_root_s.
Simon Glass8a715532020-12-19 10:40:17 -0700218 */
219 struct list_head *uclass_root;
Simon Glassab933d82021-03-15 17:25:36 +1300220# if CONFIG_IS_ENABLED(OF_PLATDATA_DRIVER_RT)
Simon Glassd211e042020-11-29 17:07:05 -0700221 /** @dm_driver_rt: Dynamic info about the driver */
Simon Glassa294ead2020-10-03 11:31:33 -0600222 struct driver_rt *dm_driver_rt;
223# endif
Simon Glassab933d82021-03-15 17:25:36 +1300224#if CONFIG_IS_ENABLED(OF_PLATDATA_RT)
225 /** @dm_udevice_rt: Dynamic info about the udevice */
226 struct udevice_rt *dm_udevice_rt;
Simon Glassbaf03712021-03-15 17:25:38 +1300227 /**
228 * @dm_priv_base: Base address of the priv/plat region used when
229 * udevices and uclasses are in read-only memory. This is NULL if not
230 * used
231 */
232 void *dm_priv_base;
Simon Glassab933d82021-03-15 17:25:36 +1300233# endif
Simon Glass6494d702014-02-26 15:59:18 -0700234#endif
Thomas Chouc8a7ba92015-10-09 13:46:34 +0800235#ifdef CONFIG_TIMER
Heinrich Schuchardt0c7cd152020-10-05 08:30:09 +0200236 /**
237 * @timer: timer instance for Driver Model
238 */
239 struct udevice *timer;
Thomas Chouc8a7ba92015-10-09 13:46:34 +0800240#endif
Heinrich Schuchardt0c7cd152020-10-05 08:30:09 +0200241 /**
242 * @fdt_blob: U-Boot's own device tree, NULL if none
243 */
244 const void *fdt_blob;
245 /**
246 * @new_fdt: relocated device tree
247 */
248 void *new_fdt;
249 /**
250 * @fdt_size: space reserved for relocated device space
251 */
252 unsigned long fdt_size;
Simon Glass39605c62021-12-16 20:59:33 -0700253 /**
254 * @fdt_src: Source of FDT
255 */
256 enum fdt_source_t fdt_src;
Simon Glassa652d9c2020-10-03 09:25:22 -0600257#if CONFIG_IS_ENABLED(OF_LIVE)
Heinrich Schuchardt0c7cd152020-10-05 08:30:09 +0200258 /**
259 * @of_root: root node of the live tree
260 */
Simon Glass5e060d82017-05-18 20:08:53 -0600261 struct device_node *of_root;
262#endif
Jean-Jacques Hiblotf1d2bc92018-12-07 14:50:52 +0100263
264#if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
Heinrich Schuchardt0c7cd152020-10-05 08:30:09 +0200265 /**
266 * @multi_dtb_fit: pointer to uncompressed multi-dtb FIT image
267 */
268 const void *multi_dtb_fit;
Jean-Jacques Hiblotf1d2bc92018-12-07 14:50:52 +0100269#endif
Heinrich Schuchardt0c7cd152020-10-05 08:30:09 +0200270 /**
271 * @jt: jump table
272 *
273 * The jump table contains pointers to exported functions. A pointer to
274 * the jump table is passed to standalone applications.
275 */
276 struct jt_funcs *jt;
277 /**
278 * @env_buf: buffer for env_get() before reloc
279 */
280 char env_buf[32];
Simon Glass71c52db2013-06-11 11:14:42 -0700281#ifdef CONFIG_TRACE
Heinrich Schuchardt0c7cd152020-10-05 08:30:09 +0200282 /**
283 * @trace_buff: trace buffer
284 *
285 * When tracing function in U-Boot this field points to the buffer
286 * recording the function calls.
287 */
288 void *trace_buff;
Simon Glass71c52db2013-06-11 11:14:42 -0700289#endif
Tom Rini55dabcc2021-08-18 23:12:24 -0400290#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY)
Heinrich Schuchardt0c7cd152020-10-05 08:30:09 +0200291 /**
292 * @cur_i2c_bus: currently used I2C bus
293 */
294 int cur_i2c_bus;
Heiko Schocher385c9ef2012-01-16 21:12:23 +0000295#endif
Heinrich Schuchardt0c7cd152020-10-05 08:30:09 +0200296 /**
297 * @timebase_h: high 32 bits of timer
298 */
Peng Fan25112102017-05-09 10:32:03 +0800299 unsigned int timebase_h;
Heinrich Schuchardt0c7cd152020-10-05 08:30:09 +0200300 /**
301 * @timebase_l: low 32 bits of timer
302 */
Peng Fan25112102017-05-09 10:32:03 +0800303 unsigned int timebase_l;
Andy Yanf1896c42017-07-24 17:43:34 +0800304#if CONFIG_VAL(SYS_MALLOC_F_LEN)
Heinrich Schuchardt0c7cd152020-10-05 08:30:09 +0200305 /**
306 * @malloc_base: base address of early malloc()
307 */
308 unsigned long malloc_base;
309 /**
310 * @malloc_limit: limit address of early malloc()
311 */
312 unsigned long malloc_limit;
313 /**
314 * @malloc_ptr: current address of early malloc()
315 */
316 unsigned long malloc_ptr;
Simon Glassd59476b2014-07-10 22:23:28 -0600317#endif
Bin Meng8f9052f2014-12-30 22:53:21 +0800318#ifdef CONFIG_PCI
Heinrich Schuchardt0c7cd152020-10-05 08:30:09 +0200319 /**
320 * @hose: PCI hose for early use
321 */
322 struct pci_controller *hose;
323 /**
324 * @pci_ram_top: top of region accessible to PCI
325 */
326 phys_addr_t pci_ram_top;
Bin Meng8f9052f2014-12-30 22:53:21 +0800327#endif
328#ifdef CONFIG_PCI_BOOTDELAY
Heinrich Schuchardt0c7cd152020-10-05 08:30:09 +0200329 /**
330 * @pcidelay_done: delay time before scanning of PIC hose expired
331 *
332 * If CONFIG_PCI_BOOTDELAY=y, pci_hose_scan() waits for the number of
333 * milliseconds defined by environment variable pcidelay before
334 * scanning. Once this delay has expired the flag @pcidelay_done
335 * is set to 1.
336 */
Bin Meng8f9052f2014-12-30 22:53:21 +0800337 int pcidelay_done;
338#endif
Heinrich Schuchardt0c7cd152020-10-05 08:30:09 +0200339 /**
340 * @cur_serial_dev: current serial device
341 */
342 struct udevice *cur_serial_dev;
343 /**
344 * @arch: architecture-specific data
345 */
346 struct arch_global_data arch;
Simon Glass9854a872015-11-08 23:47:48 -0700347#ifdef CONFIG_CONSOLE_RECORD
Heinrich Schuchardt0c7cd152020-10-05 08:30:09 +0200348 /**
349 * @console_out: output buffer for console recording
350 *
351 * This buffer is used to collect output during console recording.
352 */
353 struct membuff console_out;
354 /**
355 * @console_in: input buffer for console recording
356 *
357 * If console recording is activated, this buffer can be used to
358 * emulate input.
359 */
360 struct membuff console_in;
Simon Glass9854a872015-11-08 23:47:48 -0700361#endif
Simon Glassb86986c2022-10-18 07:46:31 -0600362#ifdef CONFIG_VIDEO
Heinrich Schuchardt0c7cd152020-10-05 08:30:09 +0200363 /**
364 * @video_top: top of video frame buffer area
365 */
366 ulong video_top;
367 /**
368 * @video_bottom: bottom of video frame buffer area
369 */
370 ulong video_bottom;
Simon Glass5a541942016-01-18 19:52:21 -0700371#endif
Simon Glassb383d6c2017-05-22 05:05:25 -0600372#ifdef CONFIG_BOOTSTAGE
Heinrich Schuchardt0c7cd152020-10-05 08:30:09 +0200373 /**
374 * @bootstage: boot stage information
375 */
376 struct bootstage_data *bootstage;
377 /**
378 * @new_bootstage: relocated boot stage information
379 */
380 struct bootstage_data *new_bootstage;
Simon Glassb383d6c2017-05-22 05:05:25 -0600381#endif
Simon Glasse9c8d492017-12-04 13:48:24 -0700382#ifdef CONFIG_LOG
Heinrich Schuchardt0c7cd152020-10-05 08:30:09 +0200383 /**
384 * @log_drop_count: number of dropped log messages
385 *
386 * This counter is incremented for each log message which can not
387 * be processed because logging is not yet available as signaled by
388 * flag %GD_FLG_LOG_READY in @flags.
389 */
390 int log_drop_count;
391 /**
392 * @default_log_level: default logging level
393 *
394 * For logging devices without filters @default_log_level defines the
395 * logging level, cf. &enum log_level_t.
396 */
397 int default_log_level;
398 /**
399 * @log_head: list of logging devices
400 */
401 struct list_head log_head;
402 /**
403 * @log_fmt: bit mask for logging format
404 *
405 * The @log_fmt bit mask selects the fields to be shown in log messages.
406 * &enum log_fmt defines the bits of the bit mask.
407 */
408 int log_fmt;
Heinrich Schuchardt993a06b2020-10-17 14:31:57 +0200409
410 /**
411 * @processing_msg: a log message is being processed
412 *
413 * This flag is used to suppress the creation of additional messages
414 * while another message is being processed.
415 */
416 bool processing_msg;
Heinrich Schuchardtd094a072020-10-17 14:31:58 +0200417 /**
418 * @logc_prev: logging category of previous message
419 *
420 * This value is used as logging category for continuation messages.
421 */
422 int logc_prev;
423 /**
Heinrich Schuchardt096912b2020-10-30 18:50:31 +0100424 * @logl_prev: logging level of the previous message
Heinrich Schuchardtd094a072020-10-17 14:31:58 +0200425 *
426 * This value is used as logging level for continuation messages.
427 */
428 int logl_prev;
Simon Glass9ad7a6c2021-01-20 20:10:53 -0700429 /**
430 * @log_cont: Previous log line did not finished wtih \n
431 *
432 * This allows for chained log messages on the same line
433 */
434 bool log_cont;
Simon Glasse9c8d492017-12-04 13:48:24 -0700435#endif
Simon Glassf0293d32018-11-15 18:43:52 -0700436#if CONFIG_IS_ENABLED(BLOBLIST)
Heinrich Schuchardt0c7cd152020-10-05 08:30:09 +0200437 /**
438 * @bloblist: blob list information
439 */
440 struct bloblist_hdr *bloblist;
441 /**
442 * @new_bloblist: relocated blob list information
443 */
444 struct bloblist_hdr *new_bloblist;
Ovidiu Panait13e0f022020-11-28 10:43:20 +0200445#endif
446#if CONFIG_IS_ENABLED(HANDOFF)
Heinrich Schuchardt0c7cd152020-10-05 08:30:09 +0200447 /**
448 * @spl_handoff: SPL hand-off information
449 */
Simon Glassb0edea32018-11-15 18:44:09 -0700450 struct spl_handoff *spl_handoff;
Simon Glassf0293d32018-11-15 18:43:52 -0700451#endif
Stefan Roesef2100f62019-04-12 16:42:28 +0200452#if defined(CONFIG_TRANSLATION_OFFSET)
Heinrich Schuchardt0c7cd152020-10-05 08:30:09 +0200453 /**
454 * @translation_offset: optional translation offset
455 *
456 * See CONFIG_TRANSLATION_OFFSET.
457 */
458 fdt_addr_t translation_offset;
Stefan Roesef2100f62019-04-12 16:42:28 +0200459#endif
Simon Glass5019e202020-11-04 09:57:19 -0700460#ifdef CONFIG_GENERATE_ACPI_TABLE
461 /**
462 * @acpi_ctx: ACPI context pointer
463 */
464 struct acpi_ctx *acpi_ctx;
Simon Glass233f0e32021-12-01 09:02:37 -0700465 /**
466 * @acpi_start: Start address of ACPI tables
467 */
468 ulong acpi_start;
Simon Glass5019e202020-11-04 09:57:19 -0700469#endif
Simon Glasse9adaa72021-02-04 21:17:20 -0700470#if CONFIG_IS_ENABLED(GENERATE_SMBIOS_TABLE)
471 /**
472 * @smbios_version: Points to SMBIOS type 0 version
473 */
474 char *smbios_version;
475#endif
Simon Glass87a5d1b2022-03-04 08:43:00 -0700476#if CONFIG_IS_ENABLED(EVENT)
477 /**
478 * @event_state: Points to the current state of events
479 */
480 struct event_state event_state;
481#endif
Stefan Roesec2c69712022-09-02 13:57:48 +0200482#ifdef CONFIG_CYCLIC
483 /**
Rasmus Villemoes50128ae2022-10-28 13:50:54 +0200484 * @cyclic_list: list of registered cyclic functions
Stefan Roesec2c69712022-09-02 13:57:48 +0200485 */
Rasmus Villemoes50128ae2022-10-28 13:50:54 +0200486 struct hlist_head cyclic_list;
Stefan Roesec2c69712022-09-02 13:57:48 +0200487#endif
AKASHI Takahiro6b7a6212022-03-08 20:36:46 +0900488 /**
489 * @dmtag_list: List of DM tags
490 */
491 struct list_head dmtag_list;
Heinrich Schuchardt0c7cd152020-10-05 08:30:09 +0200492};
Rasmus Villemoesee3a46a2021-05-18 11:19:47 +0200493#ifndef DO_DEPS_ONLY
494static_assert(sizeof(struct global_data) == GD_SIZE);
495#endif
Simon Glass50b1fa32012-12-13 20:49:12 +0000496
Heinrich Schuchardt0c7cd152020-10-05 08:30:09 +0200497/**
498 * gd_board_type() - retrieve board type
499 *
500 * Return: global board type
501 */
Simon Glass52c41182017-03-31 08:40:24 -0600502#ifdef CONFIG_BOARD_TYPES
503#define gd_board_type() gd->board_type
504#else
505#define gd_board_type() 0
506#endif
507
Simon Glassa652d9c2020-10-03 09:25:22 -0600508/* These macros help avoid #ifdefs in the code */
509#if CONFIG_IS_ENABLED(OF_LIVE)
510#define gd_of_root() gd->of_root
511#define gd_of_root_ptr() &gd->of_root
512#define gd_set_of_root(_root) gd->of_root = (_root)
513#else
514#define gd_of_root() NULL
515#define gd_of_root_ptr() NULL
516#define gd_set_of_root(_root)
517#endif
518
Simon Glassab933d82021-03-15 17:25:36 +1300519#if CONFIG_IS_ENABLED(OF_PLATDATA_DRIVER_RT)
Simon Glassa294ead2020-10-03 11:31:33 -0600520#define gd_set_dm_driver_rt(dyn) gd->dm_driver_rt = dyn
521#define gd_dm_driver_rt() gd->dm_driver_rt
522#else
523#define gd_set_dm_driver_rt(dyn)
524#define gd_dm_driver_rt() NULL
525#endif
526
Simon Glassab933d82021-03-15 17:25:36 +1300527#if CONFIG_IS_ENABLED(OF_PLATDATA_RT)
528#define gd_set_dm_udevice_rt(dyn) gd->dm_udevice_rt = dyn
529#define gd_dm_udevice_rt() gd->dm_udevice_rt
Simon Glassbaf03712021-03-15 17:25:38 +1300530#define gd_set_dm_priv_base(dyn) gd->dm_priv_base = dyn
531#define gd_dm_priv_base() gd->dm_priv_base
Simon Glassab933d82021-03-15 17:25:36 +1300532#else
533#define gd_set_dm_udevice_rt(dyn)
534#define gd_dm_udevice_rt() NULL
Simon Glassbaf03712021-03-15 17:25:38 +1300535#define gd_set_dm_priv_base(dyn)
536#define gd_dm_priv_base() NULL
Simon Glassab933d82021-03-15 17:25:36 +1300537#endif
538
Simon Glass5019e202020-11-04 09:57:19 -0700539#ifdef CONFIG_GENERATE_ACPI_TABLE
540#define gd_acpi_ctx() gd->acpi_ctx
Simon Glass233f0e32021-12-01 09:02:37 -0700541#define gd_acpi_start() gd->acpi_start
542#define gd_set_acpi_start(addr) gd->acpi_start = addr
Simon Glass5019e202020-11-04 09:57:19 -0700543#else
544#define gd_acpi_ctx() NULL
Simon Glass233f0e32021-12-01 09:02:37 -0700545#define gd_acpi_start() 0UL
546#define gd_set_acpi_start(addr)
Simon Glass5019e202020-11-04 09:57:19 -0700547#endif
548
Simon Glassb4b6daf2021-12-16 20:59:25 -0700549#if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
550#define gd_multi_dtb_fit() gd->multi_dtb_fit
551#define gd_set_multi_dtb_fit(_dtb) gd->multi_dtb_fit = _dtb
552#else
553#define gd_multi_dtb_fit() NULL
554#define gd_set_multi_dtb_fit(_dtb)
555#endif
556
Simon Glass87a5d1b2022-03-04 08:43:00 -0700557#if CONFIG_IS_ENABLED(EVENT_DYNAMIC)
558#define gd_event_state() ((struct event_state *)&gd->event_state)
559#else
560#define gd_event_state() NULL
561#endif
562
Heinrich Schuchardtc82a97b2020-10-05 08:30:08 +0200563/**
564 * enum gd_flags - global data flags
565 *
566 * See field flags of &struct global_data.
Simon Glass50b1fa32012-12-13 20:49:12 +0000567 */
Heinrich Schuchardtc82a97b2020-10-05 08:30:08 +0200568enum gd_flags {
569 /**
570 * @GD_FLG_RELOC: code was relocated to RAM
571 */
572 GD_FLG_RELOC = 0x00001,
573 /**
574 * @GD_FLG_DEVINIT: devices have been initialized
575 */
576 GD_FLG_DEVINIT = 0x00002,
577 /**
578 * @GD_FLG_SILENT: silent mode
579 */
580 GD_FLG_SILENT = 0x00004,
581 /**
582 * @GD_FLG_POSTFAIL: critical POST test failed
583 */
584 GD_FLG_POSTFAIL = 0x00008,
585 /**
586 * @GD_FLG_POSTSTOP: POST sequence aborted
587 */
588 GD_FLG_POSTSTOP = 0x00010,
589 /**
590 * @GD_FLG_LOGINIT: log Buffer has been initialized
591 */
592 GD_FLG_LOGINIT = 0x00020,
593 /**
594 * @GD_FLG_DISABLE_CONSOLE: disable console (in & out)
595 */
596 GD_FLG_DISABLE_CONSOLE = 0x00040,
597 /**
598 * @GD_FLG_ENV_READY: environment imported into hash table
599 */
600 GD_FLG_ENV_READY = 0x00080,
601 /**
602 * @GD_FLG_SERIAL_READY: pre-relocation serial console ready
603 */
604 GD_FLG_SERIAL_READY = 0x00100,
605 /**
606 * @GD_FLG_FULL_MALLOC_INIT: full malloc() is ready
607 */
608 GD_FLG_FULL_MALLOC_INIT = 0x00200,
609 /**
610 * @GD_FLG_SPL_INIT: spl_init() has been called
611 */
612 GD_FLG_SPL_INIT = 0x00400,
613 /**
614 * @GD_FLG_SKIP_RELOC: don't relocate
615 */
616 GD_FLG_SKIP_RELOC = 0x00800,
617 /**
618 * @GD_FLG_RECORD: record console
619 */
620 GD_FLG_RECORD = 0x01000,
621 /**
Simon Glassc1a2bb42021-05-08 06:59:56 -0600622 * @GD_FLG_RECORD_OVF: record console overflow
623 */
624 GD_FLG_RECORD_OVF = 0x02000,
625 /**
Heinrich Schuchardtc82a97b2020-10-05 08:30:08 +0200626 * @GD_FLG_ENV_DEFAULT: default variable flag
627 */
Simon Glassc1a2bb42021-05-08 06:59:56 -0600628 GD_FLG_ENV_DEFAULT = 0x04000,
Heinrich Schuchardtc82a97b2020-10-05 08:30:08 +0200629 /**
630 * @GD_FLG_SPL_EARLY_INIT: early SPL initialization is done
631 */
Simon Glassc1a2bb42021-05-08 06:59:56 -0600632 GD_FLG_SPL_EARLY_INIT = 0x08000,
Heinrich Schuchardtc82a97b2020-10-05 08:30:08 +0200633 /**
634 * @GD_FLG_LOG_READY: log system is ready for use
635 */
Simon Glassc1a2bb42021-05-08 06:59:56 -0600636 GD_FLG_LOG_READY = 0x10000,
Heinrich Schuchardtc82a97b2020-10-05 08:30:08 +0200637 /**
Stefan Roese5cbd0292022-11-17 09:20:34 +0100638 * @GD_FLG_CYCLIC_RUNNING: cyclic_run is in progress
Heinrich Schuchardtc82a97b2020-10-05 08:30:08 +0200639 */
Stefan Roese5cbd0292022-11-17 09:20:34 +0100640 GD_FLG_CYCLIC_RUNNING = 0x20000,
Heinrich Schuchardtc82a97b2020-10-05 08:30:08 +0200641 /**
642 * @GD_FLG_SKIP_LL_INIT: don't perform low-level initialization
643 */
Simon Glassc1a2bb42021-05-08 06:59:56 -0600644 GD_FLG_SKIP_LL_INIT = 0x40000,
Heinrich Schuchardtc82a97b2020-10-05 08:30:08 +0200645 /**
646 * @GD_FLG_SMP_READY: SMP initialization is complete
647 */
Simon Glassc1a2bb42021-05-08 06:59:56 -0600648 GD_FLG_SMP_READY = 0x80000,
Simon Glasseb6e9032022-09-06 20:27:06 -0600649 /**
650 * @GD_FLG_FDT_CHANGED: Device tree change has been detected by tests
651 */
652 GD_FLG_FDT_CHANGED = 0x100000,
Simon Glassc74e0342023-02-13 08:56:32 -0700653 /**
654 * @GD_FLG_OF_TAG_MIGRATE: Device tree has old u-boot,dm- tags
655 */
656 GD_FLG_OF_TAG_MIGRATE = 0x200000,
Heinrich Schuchardtc82a97b2020-10-05 08:30:08 +0200657};
658
659#endif /* __ASSEMBLY__ */
Simon Glass50b1fa32012-12-13 20:49:12 +0000660
661#endif /* __ASM_GENERIC_GBL_DATA_H */