blob: 19c66e1fe5d83094de0ef8099e44f104ba0bd8a1 [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__
Stefan Roese036f89a2022-09-02 13:57:48 +020023#include <cyclic.h>
Simon Glassaa4bce92022-03-04 08:43:00 -070024#include <event_internal.h>
Stefan Roese85bddff2019-04-12 16:42:28 +020025#include <fdtdec.h>
Simon Glass1bb49232015-11-08 23:47:48 -070026#include <membuff.h>
Simon Glassdd6ab882014-02-26 15:59:18 -070027#include <linux/list.h>
Rasmus Villemoesb8cfd9e2021-05-18 11:19:47 +020028#include <linux/build_bug.h>
29#include <asm-offsets.h>
Simon Glassdd6ab882014-02-26 15:59:18 -070030
Simon Glassde0115a2020-11-04 09:57:19 -070031struct acpi_ctx;
Simon Glasscfd6a002020-10-03 11:31:33 -060032struct driver_rt;
Simon Glass3a028c22024-08-07 16:47:30 -060033struct upl;
Simon Glasscfd6a002020-10-03 11:31:33 -060034
Heinrich Schuchardt50d92862020-10-05 08:30:09 +020035typedef struct global_data gd_t;
36
37/**
38 * struct global_data - global data structure
39 */
40struct global_data {
41 /**
42 * @bd: board information
43 */
Masahiro Yamadad788bba2020-02-25 02:22:27 +090044 struct bd_info *bd;
Heinrich Schuchardt50d92862020-10-05 08:30:09 +020045 /**
46 * @flags: global data flags
47 *
48 * See &enum gd_flags
49 */
Simon Glass0e724032012-12-13 20:49:12 +000050 unsigned long flags;
Heinrich Schuchardt50d92862020-10-05 08:30:09 +020051 /**
52 * @baudrate: baud rate of the serial interface
53 */
Simon Glass059c54f2013-03-05 14:40:05 +000054 unsigned int baudrate;
Heinrich Schuchardt50d92862020-10-05 08:30:09 +020055 /**
56 * @cpu_clk: CPU clock rate in Hz
57 */
58 unsigned long cpu_clk;
59 /**
60 * @bus_clk: platform clock rate in Hz
61 */
Simon Glass0e724032012-12-13 20:49:12 +000062 unsigned long bus_clk;
Heinrich Schuchardt50d92862020-10-05 08:30:09 +020063 /**
64 * @pci_clk: PCI clock rate in Hz
65 */
Simon Glass0e724032012-12-13 20:49:12 +000066 /* We cannot bracket this with CONFIG_PCI due to mpc5xxx */
67 unsigned long pci_clk;
Heinrich Schuchardt50d92862020-10-05 08:30:09 +020068 /**
69 * @mem_clk: memory clock rate in Hz
70 */
Simon Glass0e724032012-12-13 20:49:12 +000071 unsigned long mem_clk;
Nikhil M Jain7f561e12023-04-20 17:41:10 +053072#if CONFIG_IS_ENABLED(VIDEO)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +020073 /**
74 * @fb_base: base address of frame buffer memory
75 */
76 unsigned long fb_base;
Simon Glass0e724032012-12-13 20:49:12 +000077#endif
Simon Glass49badb92017-12-04 13:48:23 -070078#if defined(CONFIG_POST)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +020079 /**
80 * @post_log_word: active POST tests
81 *
82 * @post_log_word is a bit mask defining which POST tests are recorded
83 * (see constants POST_*).
84 */
85 unsigned long post_log_word;
86 /**
87 * @post_log_res: POST results
88 *
89 * @post_log_res is a bit mask with the POST results. A bit with value 1
90 * indicates successful execution.
91 */
92 unsigned long post_log_res;
93 /**
94 * @post_init_f_time: time in ms when post_init_f() started
95 */
96 unsigned long post_init_f_time;
Simon Glass0e724032012-12-13 20:49:12 +000097#endif
98#ifdef CONFIG_BOARD_TYPES
Heinrich Schuchardt50d92862020-10-05 08:30:09 +020099 /**
100 * @board_type: board type
101 *
102 * If a U-Boot configuration supports multiple board types, the actual
103 * board type may be stored in this field.
104 */
Simon Glass0e724032012-12-13 20:49:12 +0000105 unsigned long board_type;
106#endif
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200107 /**
108 * @have_console: console is available
109 *
110 * A value of 1 indicates that serial_init() was called and a console
111 * is available.
112 * A value of 0 indicates that console input and output drivers shall
113 * not be called.
114 */
115 unsigned long have_console;
Simon Glasse304a5e2016-10-17 20:12:36 -0600116#if CONFIG_IS_ENABLED(PRE_CONSOLE_BUFFER)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200117 /**
118 * @precon_buf_idx: pre-console buffer index
119 *
Rasmus Villemoese406a612022-05-03 15:13:27 +0200120 * @precon_buf_idx indicates the current position of the
121 * buffer used to collect output before the console becomes
122 * available. When negative, the pre-console buffer is
123 * temporarily disabled (used when the pre-console buffer is
124 * being written out, to prevent adding its contents to
125 * itself).
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200126 */
Rasmus Villemoese406a612022-05-03 15:13:27 +0200127 long precon_buf_idx;
Simon Glass0e724032012-12-13 20:49:12 +0000128#endif
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200129 /**
130 * @env_addr: address of environment structure
131 *
132 * @env_addr contains the address of the structure holding the
133 * environment variables.
134 */
135 unsigned long env_addr;
136 /**
137 * @env_valid: environment is valid
138 *
139 * See &enum env_valid
140 */
141 unsigned long env_valid;
142 /**
143 * @env_has_init: bit mask indicating environment locations
144 *
145 * &enum env_location defines which bit relates to which location
146 */
147 unsigned long env_has_init;
148 /**
149 * @env_load_prio: priority of the loaded environment
150 */
151 int env_load_prio;
152 /**
153 * @ram_base: base address of RAM used by U-Boot
154 */
155 unsigned long ram_base;
156 /**
157 * @ram_top: top address of RAM used by U-Boot
158 */
Bin Mengf936cf62021-01-31 20:35:59 +0800159 phys_addr_t ram_top;
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200160 /**
161 * @relocaddr: start address of U-Boot in RAM
162 *
163 * After relocation this field indicates the address to which U-Boot
164 * has been relocated. It can be displayed using the bdinfo command.
165 * Its value is needed to display the source code when debugging with
166 * GDB using the 'add-symbol-file u-boot <relocaddr>' command.
167 */
168 unsigned long relocaddr;
169 /**
170 * @ram_size: RAM size in bytes
171 */
172 phys_size_t ram_size;
173 /**
174 * @mon_len: monitor length in bytes
175 */
176 unsigned long mon_len;
177 /**
178 * @irq_sp: IRQ stack pointer
179 */
180 unsigned long irq_sp;
181 /**
182 * @start_addr_sp: initial stack pointer address
183 */
184 unsigned long start_addr_sp;
185 /**
186 * @reloc_off: relocation offset
187 */
Simon Glass0e724032012-12-13 20:49:12 +0000188 unsigned long reloc_off;
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200189 /**
190 * @new_gd: pointer to relocated global data
191 */
192 struct global_data *new_gd;
Simon Glassdd6ab882014-02-26 15:59:18 -0700193
194#ifdef CONFIG_DM
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200195 /**
196 * @dm_root: root instance for Driver Model
197 */
198 struct udevice *dm_root;
199 /**
Heinrich Schuchardt18000fe2021-01-24 21:48:00 +0100200 * @uclass_root_s:
201 * head of core tree when uclasses are not in read-only memory.
202 *
203 * When uclasses are in read-only memory, @uclass_root_s is not used and
204 * @uclass_root points to the root node generated by dtoc.
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200205 */
Simon Glass784cd9e2020-12-19 10:40:17 -0700206 struct list_head uclass_root_s;
207 /**
Heinrich Schuchardt18000fe2021-01-24 21:48:00 +0100208 * @uclass_root:
209 * pointer to head of core tree, if uclasses are in read-only memory and
210 * cannot be adjusted to use @uclass_root as a list head.
211 *
212 * When not in read-only memory, @uclass_root_s is used to hold the
213 * uclass root, and @uclass_root points to the address of
214 * @uclass_root_s.
Simon Glass784cd9e2020-12-19 10:40:17 -0700215 */
216 struct list_head *uclass_root;
Simon Glass8beeb282021-03-15 17:25:36 +1300217# if CONFIG_IS_ENABLED(OF_PLATDATA_DRIVER_RT)
Simon Glass9286eb92020-11-29 17:07:05 -0700218 /** @dm_driver_rt: Dynamic info about the driver */
Simon Glasscfd6a002020-10-03 11:31:33 -0600219 struct driver_rt *dm_driver_rt;
220# endif
Simon Glass8beeb282021-03-15 17:25:36 +1300221#if CONFIG_IS_ENABLED(OF_PLATDATA_RT)
222 /** @dm_udevice_rt: Dynamic info about the udevice */
223 struct udevice_rt *dm_udevice_rt;
Simon Glass8dee67a2021-03-15 17:25:38 +1300224 /**
225 * @dm_priv_base: Base address of the priv/plat region used when
226 * udevices and uclasses are in read-only memory. This is NULL if not
227 * used
228 */
229 void *dm_priv_base;
Simon Glass8beeb282021-03-15 17:25:36 +1300230# endif
Simon Glassdd6ab882014-02-26 15:59:18 -0700231#endif
Thomas Choufb798b12015-10-09 13:46:34 +0800232#ifdef CONFIG_TIMER
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200233 /**
234 * @timer: timer instance for Driver Model
235 */
236 struct udevice *timer;
Thomas Choufb798b12015-10-09 13:46:34 +0800237#endif
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200238 /**
239 * @fdt_blob: U-Boot's own device tree, NULL if none
240 */
241 const void *fdt_blob;
242 /**
243 * @new_fdt: relocated device tree
244 */
245 void *new_fdt;
246 /**
247 * @fdt_size: space reserved for relocated device space
248 */
249 unsigned long fdt_size;
Simon Glassbed6bc72021-12-16 20:59:33 -0700250 /**
251 * @fdt_src: Source of FDT
252 */
253 enum fdt_source_t fdt_src;
Simon Glass40916e62020-10-03 09:25:22 -0600254#if CONFIG_IS_ENABLED(OF_LIVE)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200255 /**
256 * @of_root: root node of the live tree
257 */
Simon Glassa6eedb82017-05-18 20:08:53 -0600258 struct device_node *of_root;
259#endif
Jean-Jacques Hiblot7c530e32018-12-07 14:50:52 +0100260
261#if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200262 /**
263 * @multi_dtb_fit: pointer to uncompressed multi-dtb FIT image
264 */
265 const void *multi_dtb_fit;
Jean-Jacques Hiblot7c530e32018-12-07 14:50:52 +0100266#endif
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200267 /**
268 * @jt: jump table
269 *
270 * The jump table contains pointers to exported functions. A pointer to
271 * the jump table is passed to standalone applications.
272 */
273 struct jt_funcs *jt;
274 /**
275 * @env_buf: buffer for env_get() before reloc
276 */
277 char env_buf[32];
Simon Glass209a1a62013-06-11 11:14:42 -0700278#ifdef CONFIG_TRACE
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200279 /**
280 * @trace_buff: trace buffer
281 *
282 * When tracing function in U-Boot this field points to the buffer
283 * recording the function calls.
284 */
285 void *trace_buff;
Simon Glass209a1a62013-06-11 11:14:42 -0700286#endif
Tom Rini52b2e262021-08-18 23:12:24 -0400287#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200288 /**
289 * @cur_i2c_bus: currently used I2C bus
290 */
291 int cur_i2c_bus;
Heiko Schochere7d9c4f2012-01-16 21:12:23 +0000292#endif
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200293 /**
294 * @timebase_h: high 32 bits of timer
295 */
Peng Fan9a60a9e2017-05-09 10:32:03 +0800296 unsigned int timebase_h;
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200297 /**
298 * @timebase_l: low 32 bits of timer
299 */
Peng Fan9a60a9e2017-05-09 10:32:03 +0800300 unsigned int timebase_l;
Simon Glass345c9742023-07-15 21:38:53 -0600301 /**
302 * @malloc_start: start of malloc() region
303 */
304#if CONFIG_IS_ENABLED(CMD_BDINFO_EXTRA)
305 unsigned long malloc_start;
306#endif
Simon Glassadad2d02023-09-26 08:14:27 -0600307#if CONFIG_IS_ENABLED(SYS_MALLOC_F)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200308 /**
309 * @malloc_base: base address of early malloc()
310 */
311 unsigned long malloc_base;
312 /**
313 * @malloc_limit: limit address of early malloc()
314 */
315 unsigned long malloc_limit;
316 /**
317 * @malloc_ptr: current address of early malloc()
318 */
319 unsigned long malloc_ptr;
Simon Glass863e4042014-07-10 22:23:28 -0600320#endif
Bin Mengf1b81fc2014-12-30 22:53:21 +0800321#ifdef CONFIG_PCI
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200322 /**
323 * @hose: PCI hose for early use
324 */
325 struct pci_controller *hose;
326 /**
327 * @pci_ram_top: top of region accessible to PCI
328 */
329 phys_addr_t pci_ram_top;
Bin Mengf1b81fc2014-12-30 22:53:21 +0800330#endif
331#ifdef CONFIG_PCI_BOOTDELAY
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200332 /**
333 * @pcidelay_done: delay time before scanning of PIC hose expired
334 *
335 * If CONFIG_PCI_BOOTDELAY=y, pci_hose_scan() waits for the number of
336 * milliseconds defined by environment variable pcidelay before
337 * scanning. Once this delay has expired the flag @pcidelay_done
338 * is set to 1.
339 */
Bin Mengf1b81fc2014-12-30 22:53:21 +0800340 int pcidelay_done;
341#endif
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200342 /**
343 * @cur_serial_dev: current serial device
344 */
345 struct udevice *cur_serial_dev;
346 /**
347 * @arch: architecture-specific data
348 */
349 struct arch_global_data arch;
Simon Glass1bb49232015-11-08 23:47:48 -0700350#ifdef CONFIG_CONSOLE_RECORD
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200351 /**
352 * @console_out: output buffer for console recording
353 *
354 * This buffer is used to collect output during console recording.
355 */
356 struct membuff console_out;
357 /**
358 * @console_in: input buffer for console recording
359 *
360 * If console recording is activated, this buffer can be used to
361 * emulate input.
362 */
363 struct membuff console_in;
Simon Glass1bb49232015-11-08 23:47:48 -0700364#endif
Nikhil M Jain7f561e12023-04-20 17:41:10 +0530365#if CONFIG_IS_ENABLED(VIDEO)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200366 /**
367 * @video_top: top of video frame buffer area
368 */
369 ulong video_top;
370 /**
371 * @video_bottom: bottom of video frame buffer area
372 */
373 ulong video_bottom;
Simon Glassfce58f52016-01-18 19:52:21 -0700374#endif
Simon Glass88200332017-05-22 05:05:25 -0600375#ifdef CONFIG_BOOTSTAGE
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200376 /**
377 * @bootstage: boot stage information
378 */
379 struct bootstage_data *bootstage;
380 /**
381 * @new_bootstage: relocated boot stage information
382 */
383 struct bootstage_data *new_bootstage;
Simon Glass88200332017-05-22 05:05:25 -0600384#endif
Simon Glassd95645d2017-12-04 13:48:24 -0700385#ifdef CONFIG_LOG
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200386 /**
387 * @log_drop_count: number of dropped log messages
388 *
389 * This counter is incremented for each log message which can not
390 * be processed because logging is not yet available as signaled by
391 * flag %GD_FLG_LOG_READY in @flags.
392 */
393 int log_drop_count;
394 /**
395 * @default_log_level: default logging level
396 *
397 * For logging devices without filters @default_log_level defines the
398 * logging level, cf. &enum log_level_t.
399 */
400 int default_log_level;
401 /**
402 * @log_head: list of logging devices
403 */
404 struct list_head log_head;
405 /**
406 * @log_fmt: bit mask for logging format
407 *
408 * The @log_fmt bit mask selects the fields to be shown in log messages.
409 * &enum log_fmt defines the bits of the bit mask.
410 */
411 int log_fmt;
Heinrich Schuchardtfdf55992020-10-17 14:31:57 +0200412
413 /**
414 * @processing_msg: a log message is being processed
415 *
416 * This flag is used to suppress the creation of additional messages
417 * while another message is being processed.
418 */
419 bool processing_msg;
Heinrich Schuchardt0fc9f4f2020-10-17 14:31:58 +0200420 /**
421 * @logc_prev: logging category of previous message
422 *
423 * This value is used as logging category for continuation messages.
424 */
425 int logc_prev;
426 /**
Heinrich Schuchardt14e77222020-10-30 18:50:31 +0100427 * @logl_prev: logging level of the previous message
Heinrich Schuchardt0fc9f4f2020-10-17 14:31:58 +0200428 *
429 * This value is used as logging level for continuation messages.
430 */
431 int logl_prev;
Simon Glass5fc47e32021-01-20 20:10:53 -0700432 /**
433 * @log_cont: Previous log line did not finished wtih \n
434 *
435 * This allows for chained log messages on the same line
436 */
437 bool log_cont;
Simon Glassd95645d2017-12-04 13:48:24 -0700438#endif
Simon Glassa815dab2018-11-15 18:43:52 -0700439#if CONFIG_IS_ENABLED(BLOBLIST)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200440 /**
441 * @bloblist: blob list information
442 */
443 struct bloblist_hdr *bloblist;
444 /**
445 * @new_bloblist: relocated blob list information
446 */
447 struct bloblist_hdr *new_bloblist;
Ovidiu Panaitc1b30d52020-11-28 10:43:20 +0200448#endif
449#if CONFIG_IS_ENABLED(HANDOFF)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200450 /**
451 * @spl_handoff: SPL hand-off information
452 */
Simon Glasse14f1a22018-11-15 18:44:09 -0700453 struct spl_handoff *spl_handoff;
Simon Glassa815dab2018-11-15 18:43:52 -0700454#endif
Stefan Roese85bddff2019-04-12 16:42:28 +0200455#if defined(CONFIG_TRANSLATION_OFFSET)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200456 /**
457 * @translation_offset: optional translation offset
458 *
459 * See CONFIG_TRANSLATION_OFFSET.
460 */
461 fdt_addr_t translation_offset;
Stefan Roese85bddff2019-04-12 16:42:28 +0200462#endif
Simon Glasscf1f4bb2023-05-04 16:54:59 -0600463#ifdef CONFIG_ACPI
Simon Glassde0115a2020-11-04 09:57:19 -0700464 /**
465 * @acpi_ctx: ACPI context pointer
466 */
467 struct acpi_ctx *acpi_ctx;
Simon Glassb33f2f92021-12-01 09:02:37 -0700468 /**
469 * @acpi_start: Start address of ACPI tables
470 */
471 ulong acpi_start;
Simon Glassde0115a2020-11-04 09:57:19 -0700472#endif
Simon Glassa05eb042021-02-04 21:17:20 -0700473#if CONFIG_IS_ENABLED(GENERATE_SMBIOS_TABLE)
474 /**
475 * @smbios_version: Points to SMBIOS type 0 version
476 */
477 char *smbios_version;
478#endif
Simon Glassaa4bce92022-03-04 08:43:00 -0700479#if CONFIG_IS_ENABLED(EVENT)
480 /**
481 * @event_state: Points to the current state of events
482 */
483 struct event_state event_state;
484#endif
Simon Glass0b385222024-07-31 08:44:08 -0600485#if CONFIG_IS_ENABLED(CYCLIC)
Stefan Roese036f89a2022-09-02 13:57:48 +0200486 /**
Rasmus Villemoesc794e492022-10-28 13:50:54 +0200487 * @cyclic_list: list of registered cyclic functions
Stefan Roese036f89a2022-09-02 13:57:48 +0200488 */
Rasmus Villemoesc794e492022-10-28 13:50:54 +0200489 struct hlist_head cyclic_list;
Stefan Roese036f89a2022-09-02 13:57:48 +0200490#endif
AKASHI Takahiroe04f4fb2022-03-08 20:36:46 +0900491 /**
492 * @dmtag_list: List of DM tags
493 */
494 struct list_head dmtag_list;
Simon Glass3a028c22024-08-07 16:47:30 -0600495#if CONFIG_IS_ENABLED(UPL)
496 /**
497 * @upl: Universal Payload-handoff information
498 */
499 struct upl *upl;
500#endif
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200501};
Rasmus Villemoesb8cfd9e2021-05-18 11:19:47 +0200502#ifndef DO_DEPS_ONLY
503static_assert(sizeof(struct global_data) == GD_SIZE);
504#endif
Simon Glass0e724032012-12-13 20:49:12 +0000505
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200506/**
507 * gd_board_type() - retrieve board type
508 *
509 * Return: global board type
510 */
Simon Glassb4de3f32017-03-31 08:40:24 -0600511#ifdef CONFIG_BOARD_TYPES
512#define gd_board_type() gd->board_type
513#else
514#define gd_board_type() 0
515#endif
516
Simon Glass40916e62020-10-03 09:25:22 -0600517/* These macros help avoid #ifdefs in the code */
518#if CONFIG_IS_ENABLED(OF_LIVE)
519#define gd_of_root() gd->of_root
520#define gd_of_root_ptr() &gd->of_root
521#define gd_set_of_root(_root) gd->of_root = (_root)
522#else
523#define gd_of_root() NULL
524#define gd_of_root_ptr() NULL
525#define gd_set_of_root(_root)
526#endif
527
Simon Glass8beeb282021-03-15 17:25:36 +1300528#if CONFIG_IS_ENABLED(OF_PLATDATA_DRIVER_RT)
Simon Glasscfd6a002020-10-03 11:31:33 -0600529#define gd_set_dm_driver_rt(dyn) gd->dm_driver_rt = dyn
530#define gd_dm_driver_rt() gd->dm_driver_rt
531#else
532#define gd_set_dm_driver_rt(dyn)
533#define gd_dm_driver_rt() NULL
534#endif
535
Simon Glass8beeb282021-03-15 17:25:36 +1300536#if CONFIG_IS_ENABLED(OF_PLATDATA_RT)
537#define gd_set_dm_udevice_rt(dyn) gd->dm_udevice_rt = dyn
538#define gd_dm_udevice_rt() gd->dm_udevice_rt
Simon Glass8dee67a2021-03-15 17:25:38 +1300539#define gd_set_dm_priv_base(dyn) gd->dm_priv_base = dyn
540#define gd_dm_priv_base() gd->dm_priv_base
Simon Glass8beeb282021-03-15 17:25:36 +1300541#else
542#define gd_set_dm_udevice_rt(dyn)
543#define gd_dm_udevice_rt() NULL
Simon Glass8dee67a2021-03-15 17:25:38 +1300544#define gd_set_dm_priv_base(dyn)
545#define gd_dm_priv_base() NULL
Simon Glass8beeb282021-03-15 17:25:36 +1300546#endif
547
Simon Glasscf1f4bb2023-05-04 16:54:59 -0600548#ifdef CONFIG_ACPI
Simon Glassde0115a2020-11-04 09:57:19 -0700549#define gd_acpi_ctx() gd->acpi_ctx
Simon Glassb33f2f92021-12-01 09:02:37 -0700550#define gd_acpi_start() gd->acpi_start
551#define gd_set_acpi_start(addr) gd->acpi_start = addr
Simon Glassde0115a2020-11-04 09:57:19 -0700552#else
553#define gd_acpi_ctx() NULL
Simon Glassb33f2f92021-12-01 09:02:37 -0700554#define gd_acpi_start() 0UL
555#define gd_set_acpi_start(addr)
Simon Glassde0115a2020-11-04 09:57:19 -0700556#endif
557
Simon Glass9b388102023-09-19 21:00:15 -0600558#ifdef CONFIG_SMBIOS
Simon Glass42b7da52023-12-31 08:25:48 -0700559#define gd_smbios_start() gd->arch.smbios_start
Simon Glass9b388102023-09-19 21:00:15 -0600560#define gd_set_smbios_start(addr) gd->arch.smbios_start = addr
561#else
562#define gd_smbios_start() 0UL
563#define gd_set_smbios_start(addr)
564#endif
565
Simon Glass69daf5a2021-12-16 20:59:25 -0700566#if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
567#define gd_multi_dtb_fit() gd->multi_dtb_fit
568#define gd_set_multi_dtb_fit(_dtb) gd->multi_dtb_fit = _dtb
569#else
570#define gd_multi_dtb_fit() NULL
571#define gd_set_multi_dtb_fit(_dtb)
572#endif
573
Simon Glassaa4bce92022-03-04 08:43:00 -0700574#if CONFIG_IS_ENABLED(EVENT_DYNAMIC)
575#define gd_event_state() ((struct event_state *)&gd->event_state)
576#else
577#define gd_event_state() NULL
578#endif
579
Simon Glass345c9742023-07-15 21:38:53 -0600580#if CONFIG_IS_ENABLED(CMD_BDINFO_EXTRA)
581#define gd_malloc_start() gd->malloc_start
582#define gd_set_malloc_start(_val) gd->malloc_start = (_val)
583#else
584#define gd_malloc_start() 0
585#define gd_set_malloc_start(val)
586#endif
Troy Kiskye143c272023-03-13 14:31:43 -0700587
588#if CONFIG_IS_ENABLED(PCI)
589#define gd_set_pci_ram_top(val) gd->pci_ram_top = val
590#else
591#define gd_set_pci_ram_top(val)
592#endif
593
Simon Glasse8804d72023-09-26 08:14:31 -0600594#if CONFIG_VAL(SYS_MALLOC_F_LEN)
595#define gd_malloc_ptr() gd->malloc_ptr
596#else
597#define gd_malloc_ptr() 0L
598#endif
599
Simon Glass3a028c22024-08-07 16:47:30 -0600600#if CONFIG_IS_ENABLED(UPL)
601#define gd_upl() gd->upl
602#define gd_set_upl(_val) gd->upl = (_val)
603#else
604#define gd_upl() NULL
605#define gd_set_upl(val)
606#endif
607
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200608/**
609 * enum gd_flags - global data flags
610 *
611 * See field flags of &struct global_data.
Simon Glass0e724032012-12-13 20:49:12 +0000612 */
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200613enum gd_flags {
614 /**
615 * @GD_FLG_RELOC: code was relocated to RAM
616 */
617 GD_FLG_RELOC = 0x00001,
618 /**
619 * @GD_FLG_DEVINIT: devices have been initialized
620 */
621 GD_FLG_DEVINIT = 0x00002,
622 /**
623 * @GD_FLG_SILENT: silent mode
624 */
625 GD_FLG_SILENT = 0x00004,
626 /**
627 * @GD_FLG_POSTFAIL: critical POST test failed
628 */
629 GD_FLG_POSTFAIL = 0x00008,
630 /**
631 * @GD_FLG_POSTSTOP: POST sequence aborted
632 */
633 GD_FLG_POSTSTOP = 0x00010,
634 /**
635 * @GD_FLG_LOGINIT: log Buffer has been initialized
636 */
637 GD_FLG_LOGINIT = 0x00020,
638 /**
639 * @GD_FLG_DISABLE_CONSOLE: disable console (in & out)
640 */
641 GD_FLG_DISABLE_CONSOLE = 0x00040,
642 /**
643 * @GD_FLG_ENV_READY: environment imported into hash table
644 */
645 GD_FLG_ENV_READY = 0x00080,
646 /**
647 * @GD_FLG_SERIAL_READY: pre-relocation serial console ready
648 */
649 GD_FLG_SERIAL_READY = 0x00100,
650 /**
651 * @GD_FLG_FULL_MALLOC_INIT: full malloc() is ready
652 */
653 GD_FLG_FULL_MALLOC_INIT = 0x00200,
654 /**
655 * @GD_FLG_SPL_INIT: spl_init() has been called
656 */
657 GD_FLG_SPL_INIT = 0x00400,
658 /**
659 * @GD_FLG_SKIP_RELOC: don't relocate
660 */
661 GD_FLG_SKIP_RELOC = 0x00800,
662 /**
663 * @GD_FLG_RECORD: record console
664 */
665 GD_FLG_RECORD = 0x01000,
666 /**
Simon Glassd6ed4af2021-05-08 06:59:56 -0600667 * @GD_FLG_RECORD_OVF: record console overflow
668 */
669 GD_FLG_RECORD_OVF = 0x02000,
670 /**
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200671 * @GD_FLG_ENV_DEFAULT: default variable flag
672 */
Simon Glassd6ed4af2021-05-08 06:59:56 -0600673 GD_FLG_ENV_DEFAULT = 0x04000,
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200674 /**
675 * @GD_FLG_SPL_EARLY_INIT: early SPL initialization is done
676 */
Simon Glassd6ed4af2021-05-08 06:59:56 -0600677 GD_FLG_SPL_EARLY_INIT = 0x08000,
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200678 /**
679 * @GD_FLG_LOG_READY: log system is ready for use
680 */
Simon Glassd6ed4af2021-05-08 06:59:56 -0600681 GD_FLG_LOG_READY = 0x10000,
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200682 /**
Stefan Roese5128a872022-11-17 09:20:34 +0100683 * @GD_FLG_CYCLIC_RUNNING: cyclic_run is in progress
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200684 */
Stefan Roese5128a872022-11-17 09:20:34 +0100685 GD_FLG_CYCLIC_RUNNING = 0x20000,
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200686 /**
687 * @GD_FLG_SKIP_LL_INIT: don't perform low-level initialization
688 */
Simon Glassd6ed4af2021-05-08 06:59:56 -0600689 GD_FLG_SKIP_LL_INIT = 0x40000,
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200690 /**
691 * @GD_FLG_SMP_READY: SMP initialization is complete
692 */
Simon Glassd6ed4af2021-05-08 06:59:56 -0600693 GD_FLG_SMP_READY = 0x80000,
Simon Glass60f08992022-09-06 20:27:06 -0600694 /**
695 * @GD_FLG_FDT_CHANGED: Device tree change has been detected by tests
696 */
697 GD_FLG_FDT_CHANGED = 0x100000,
Simon Glassc2727e52023-02-13 08:56:32 -0700698 /**
699 * @GD_FLG_OF_TAG_MIGRATE: Device tree has old u-boot,dm- tags
700 */
701 GD_FLG_OF_TAG_MIGRATE = 0x200000,
Simon Glass31ef8342023-09-07 09:58:13 -0600702 /**
703 * @GD_FLG_DM_DEAD: Driver model is not accessible. This can be set when
704 * the memory used to holds its tables has been mapped out.
705 */
706 GD_FLG_DM_DEAD = 0x400000,
Simon Glassa28f39c2023-09-26 08:14:51 -0600707 /**
708 * @GD_FLG_BLOBLIST_READY: bloblist is ready for use
709 */
710 GD_FLG_BLOBLIST_READY = 0x800000,
Francis Laniel1239d232023-12-22 22:02:30 +0100711 /**
712 * @GD_FLG_HUSH_OLD_PARSER: Use hush old parser.
713 */
714 GD_FLG_HUSH_OLD_PARSER = 0x1000000,
Francis Laniel3b66e572023-12-22 22:02:32 +0100715 /**
716 * @GD_FLG_HUSH_MODERN_PARSER: Use hush 2021 parser.
717 */
718 GD_FLG_HUSH_MODERN_PARSER = 0x2000000,
Simon Glass9b5bfba2024-08-07 16:47:33 -0600719 /**
720 * @GD_FLG_UPL: Read/write a Universal Payload (UPL) handoff
721 */
722 GD_FLG_UPL = 0x4000000,
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200723};
724
725#endif /* __ASSEMBLY__ */
Simon Glass0e724032012-12-13 20:49:12 +0000726
727#endif /* __ASM_GENERIC_GBL_DATA_H */