blob: 1252b8acefac3b52a06357668709d6d41ee53603 [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 /**
Heinrich Schuchardt50d92862020-10-05 08:30:09 +020064 * @mem_clk: memory clock rate in Hz
65 */
Simon Glass0e724032012-12-13 20:49:12 +000066 unsigned long mem_clk;
Simon Glass49badb92017-12-04 13:48:23 -070067#if defined(CONFIG_POST)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +020068 /**
69 * @post_log_word: active POST tests
70 *
71 * @post_log_word is a bit mask defining which POST tests are recorded
72 * (see constants POST_*).
73 */
74 unsigned long post_log_word;
75 /**
76 * @post_log_res: POST results
77 *
78 * @post_log_res is a bit mask with the POST results. A bit with value 1
79 * indicates successful execution.
80 */
81 unsigned long post_log_res;
82 /**
83 * @post_init_f_time: time in ms when post_init_f() started
84 */
85 unsigned long post_init_f_time;
Simon Glass0e724032012-12-13 20:49:12 +000086#endif
87#ifdef CONFIG_BOARD_TYPES
Heinrich Schuchardt50d92862020-10-05 08:30:09 +020088 /**
89 * @board_type: board type
90 *
91 * If a U-Boot configuration supports multiple board types, the actual
92 * board type may be stored in this field.
93 */
Simon Glass0e724032012-12-13 20:49:12 +000094 unsigned long board_type;
95#endif
Simon Glasse304a5e2016-10-17 20:12:36 -060096#if CONFIG_IS_ENABLED(PRE_CONSOLE_BUFFER)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +020097 /**
98 * @precon_buf_idx: pre-console buffer index
99 *
Rasmus Villemoese406a612022-05-03 15:13:27 +0200100 * @precon_buf_idx indicates the current position of the
101 * buffer used to collect output before the console becomes
102 * available. When negative, the pre-console buffer is
103 * temporarily disabled (used when the pre-console buffer is
104 * being written out, to prevent adding its contents to
105 * itself).
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200106 */
Rasmus Villemoese406a612022-05-03 15:13:27 +0200107 long precon_buf_idx;
Simon Glass0e724032012-12-13 20:49:12 +0000108#endif
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200109 /**
110 * @env_addr: address of environment structure
111 *
112 * @env_addr contains the address of the structure holding the
113 * environment variables.
114 */
115 unsigned long env_addr;
116 /**
Simon Glassc726f282024-08-21 10:19:08 -0600117 * @env_has_init: bit mask indicating environment locations
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200118 *
Simon Glassc726f282024-08-21 10:19:08 -0600119 * &enum env_location defines which bit relates to which location
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200120 */
Simon Glassc726f282024-08-21 10:19:08 -0600121 unsigned short env_has_init;
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200122 /**
Simon Glassc726f282024-08-21 10:19:08 -0600123 * @env_valid: environment is valid
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200124 *
Simon Glassc726f282024-08-21 10:19:08 -0600125 * See &enum env_valid
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200126 */
Simon Glassc726f282024-08-21 10:19:08 -0600127 unsigned char env_valid;
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200128 /**
129 * @env_load_prio: priority of the loaded environment
130 */
Simon Glassc726f282024-08-21 10:19:08 -0600131 char env_load_prio;
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200132 /**
133 * @ram_base: base address of RAM used by U-Boot
134 */
135 unsigned long ram_base;
136 /**
137 * @ram_top: top address of RAM used by U-Boot
138 */
Bin Mengf936cf62021-01-31 20:35:59 +0800139 phys_addr_t ram_top;
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200140 /**
141 * @relocaddr: start address of U-Boot in RAM
142 *
143 * After relocation this field indicates the address to which U-Boot
144 * has been relocated. It can be displayed using the bdinfo command.
145 * Its value is needed to display the source code when debugging with
146 * GDB using the 'add-symbol-file u-boot <relocaddr>' command.
147 */
148 unsigned long relocaddr;
149 /**
150 * @ram_size: RAM size in bytes
151 */
152 phys_size_t ram_size;
153 /**
154 * @mon_len: monitor length in bytes
155 */
156 unsigned long mon_len;
157 /**
158 * @irq_sp: IRQ stack pointer
159 */
160 unsigned long irq_sp;
161 /**
162 * @start_addr_sp: initial stack pointer address
163 */
164 unsigned long start_addr_sp;
165 /**
166 * @reloc_off: relocation offset
167 */
Simon Glass0e724032012-12-13 20:49:12 +0000168 unsigned long reloc_off;
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200169 /**
170 * @new_gd: pointer to relocated global data
171 */
172 struct global_data *new_gd;
Simon Glassdd6ab882014-02-26 15:59:18 -0700173
174#ifdef CONFIG_DM
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200175 /**
176 * @dm_root: root instance for Driver Model
177 */
178 struct udevice *dm_root;
179 /**
Heinrich Schuchardt18000fe2021-01-24 21:48:00 +0100180 * @uclass_root_s:
181 * head of core tree when uclasses are not in read-only memory.
182 *
183 * When uclasses are in read-only memory, @uclass_root_s is not used and
184 * @uclass_root points to the root node generated by dtoc.
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200185 */
Simon Glass784cd9e2020-12-19 10:40:17 -0700186 struct list_head uclass_root_s;
187 /**
Heinrich Schuchardt18000fe2021-01-24 21:48:00 +0100188 * @uclass_root:
189 * pointer to head of core tree, if uclasses are in read-only memory and
190 * cannot be adjusted to use @uclass_root as a list head.
191 *
192 * When not in read-only memory, @uclass_root_s is used to hold the
193 * uclass root, and @uclass_root points to the address of
194 * @uclass_root_s.
Simon Glass784cd9e2020-12-19 10:40:17 -0700195 */
196 struct list_head *uclass_root;
Simon Glass8beeb282021-03-15 17:25:36 +1300197# if CONFIG_IS_ENABLED(OF_PLATDATA_DRIVER_RT)
Simon Glass9286eb92020-11-29 17:07:05 -0700198 /** @dm_driver_rt: Dynamic info about the driver */
Simon Glasscfd6a002020-10-03 11:31:33 -0600199 struct driver_rt *dm_driver_rt;
200# endif
Simon Glass8beeb282021-03-15 17:25:36 +1300201#if CONFIG_IS_ENABLED(OF_PLATDATA_RT)
202 /** @dm_udevice_rt: Dynamic info about the udevice */
203 struct udevice_rt *dm_udevice_rt;
Simon Glass8dee67a2021-03-15 17:25:38 +1300204 /**
205 * @dm_priv_base: Base address of the priv/plat region used when
206 * udevices and uclasses are in read-only memory. This is NULL if not
207 * used
208 */
209 void *dm_priv_base;
Simon Glass8beeb282021-03-15 17:25:36 +1300210# endif
Simon Glassdd6ab882014-02-26 15:59:18 -0700211#endif
Thomas Choufb798b12015-10-09 13:46:34 +0800212#ifdef CONFIG_TIMER
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200213 /**
214 * @timer: timer instance for Driver Model
215 */
216 struct udevice *timer;
Thomas Choufb798b12015-10-09 13:46:34 +0800217#endif
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200218 /**
219 * @fdt_blob: U-Boot's own device tree, NULL if none
220 */
221 const void *fdt_blob;
222 /**
223 * @new_fdt: relocated device tree
224 */
225 void *new_fdt;
226 /**
227 * @fdt_size: space reserved for relocated device space
228 */
229 unsigned long fdt_size;
Simon Glassbed6bc72021-12-16 20:59:33 -0700230 /**
231 * @fdt_src: Source of FDT
232 */
233 enum fdt_source_t fdt_src;
Simon Glass40916e62020-10-03 09:25:22 -0600234#if CONFIG_IS_ENABLED(OF_LIVE)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200235 /**
236 * @of_root: root node of the live tree
237 */
Simon Glassa6eedb82017-05-18 20:08:53 -0600238 struct device_node *of_root;
239#endif
Jean-Jacques Hiblot7c530e32018-12-07 14:50:52 +0100240
241#if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200242 /**
243 * @multi_dtb_fit: pointer to uncompressed multi-dtb FIT image
244 */
245 const void *multi_dtb_fit;
Jean-Jacques Hiblot7c530e32018-12-07 14:50:52 +0100246#endif
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200247 /**
248 * @jt: jump table
249 *
250 * The jump table contains pointers to exported functions. A pointer to
251 * the jump table is passed to standalone applications.
252 */
253 struct jt_funcs *jt;
254 /**
255 * @env_buf: buffer for env_get() before reloc
256 */
257 char env_buf[32];
Simon Glass209a1a62013-06-11 11:14:42 -0700258#ifdef CONFIG_TRACE
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200259 /**
260 * @trace_buff: trace buffer
261 *
262 * When tracing function in U-Boot this field points to the buffer
263 * recording the function calls.
264 */
265 void *trace_buff;
Simon Glass209a1a62013-06-11 11:14:42 -0700266#endif
Tom Rini52b2e262021-08-18 23:12:24 -0400267#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200268 /**
269 * @cur_i2c_bus: currently used I2C bus
270 */
271 int cur_i2c_bus;
Heiko Schochere7d9c4f2012-01-16 21:12:23 +0000272#endif
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200273 /**
274 * @timebase_h: high 32 bits of timer
275 */
Peng Fan9a60a9e2017-05-09 10:32:03 +0800276 unsigned int timebase_h;
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200277 /**
278 * @timebase_l: low 32 bits of timer
279 */
Peng Fan9a60a9e2017-05-09 10:32:03 +0800280 unsigned int timebase_l;
Simon Glass345c9742023-07-15 21:38:53 -0600281 /**
282 * @malloc_start: start of malloc() region
283 */
284#if CONFIG_IS_ENABLED(CMD_BDINFO_EXTRA)
285 unsigned long malloc_start;
286#endif
Simon Glassadad2d02023-09-26 08:14:27 -0600287#if CONFIG_IS_ENABLED(SYS_MALLOC_F)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200288 /**
289 * @malloc_base: base address of early malloc()
290 */
291 unsigned long malloc_base;
292 /**
293 * @malloc_limit: limit address of early malloc()
294 */
295 unsigned long malloc_limit;
296 /**
297 * @malloc_ptr: current address of early malloc()
298 */
299 unsigned long malloc_ptr;
Simon Glass863e4042014-07-10 22:23:28 -0600300#endif
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200301 /**
302 * @cur_serial_dev: current serial device
303 */
304 struct udevice *cur_serial_dev;
305 /**
306 * @arch: architecture-specific data
307 */
308 struct arch_global_data arch;
Simon Glass1bb49232015-11-08 23:47:48 -0700309#ifdef CONFIG_CONSOLE_RECORD
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200310 /**
311 * @console_out: output buffer for console recording
312 *
313 * This buffer is used to collect output during console recording.
314 */
315 struct membuff console_out;
316 /**
317 * @console_in: input buffer for console recording
318 *
319 * If console recording is activated, this buffer can be used to
320 * emulate input.
321 */
322 struct membuff console_in;
Simon Glass1bb49232015-11-08 23:47:48 -0700323#endif
Nikhil M Jain7f561e12023-04-20 17:41:10 +0530324#if CONFIG_IS_ENABLED(VIDEO)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200325 /**
326 * @video_top: top of video frame buffer area
327 */
328 ulong video_top;
329 /**
330 * @video_bottom: bottom of video frame buffer area
331 */
332 ulong video_bottom;
Simon Glassfce58f52016-01-18 19:52:21 -0700333#endif
Simon Glass88200332017-05-22 05:05:25 -0600334#ifdef CONFIG_BOOTSTAGE
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200335 /**
336 * @bootstage: boot stage information
337 */
338 struct bootstage_data *bootstage;
339 /**
340 * @new_bootstage: relocated boot stage information
341 */
342 struct bootstage_data *new_bootstage;
Simon Glass88200332017-05-22 05:05:25 -0600343#endif
Simon Glassd95645d2017-12-04 13:48:24 -0700344#ifdef CONFIG_LOG
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200345 /**
346 * @log_drop_count: number of dropped log messages
347 *
348 * This counter is incremented for each log message which can not
349 * be processed because logging is not yet available as signaled by
350 * flag %GD_FLG_LOG_READY in @flags.
351 */
352 int log_drop_count;
353 /**
354 * @default_log_level: default logging level
355 *
356 * For logging devices without filters @default_log_level defines the
357 * logging level, cf. &enum log_level_t.
358 */
359 int default_log_level;
360 /**
361 * @log_head: list of logging devices
362 */
363 struct list_head log_head;
364 /**
365 * @log_fmt: bit mask for logging format
366 *
367 * The @log_fmt bit mask selects the fields to be shown in log messages.
368 * &enum log_fmt defines the bits of the bit mask.
369 */
370 int log_fmt;
Heinrich Schuchardtfdf55992020-10-17 14:31:57 +0200371
372 /**
373 * @processing_msg: a log message is being processed
374 *
375 * This flag is used to suppress the creation of additional messages
376 * while another message is being processed.
377 */
378 bool processing_msg;
Heinrich Schuchardt0fc9f4f2020-10-17 14:31:58 +0200379 /**
380 * @logc_prev: logging category of previous message
381 *
382 * This value is used as logging category for continuation messages.
383 */
384 int logc_prev;
385 /**
Heinrich Schuchardt14e77222020-10-30 18:50:31 +0100386 * @logl_prev: logging level of the previous message
Heinrich Schuchardt0fc9f4f2020-10-17 14:31:58 +0200387 *
388 * This value is used as logging level for continuation messages.
389 */
390 int logl_prev;
Simon Glass5fc47e32021-01-20 20:10:53 -0700391 /**
392 * @log_cont: Previous log line did not finished wtih \n
393 *
394 * This allows for chained log messages on the same line
395 */
396 bool log_cont;
Simon Glassd95645d2017-12-04 13:48:24 -0700397#endif
Simon Glassa815dab2018-11-15 18:43:52 -0700398#if CONFIG_IS_ENABLED(BLOBLIST)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200399 /**
400 * @bloblist: blob list information
401 */
402 struct bloblist_hdr *bloblist;
403 /**
404 * @new_bloblist: relocated blob list information
405 */
406 struct bloblist_hdr *new_bloblist;
Ovidiu Panaitc1b30d52020-11-28 10:43:20 +0200407#endif
408#if CONFIG_IS_ENABLED(HANDOFF)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200409 /**
410 * @spl_handoff: SPL hand-off information
411 */
Simon Glasse14f1a22018-11-15 18:44:09 -0700412 struct spl_handoff *spl_handoff;
Simon Glassa815dab2018-11-15 18:43:52 -0700413#endif
Stefan Roese85bddff2019-04-12 16:42:28 +0200414#if defined(CONFIG_TRANSLATION_OFFSET)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200415 /**
416 * @translation_offset: optional translation offset
417 *
418 * See CONFIG_TRANSLATION_OFFSET.
419 */
420 fdt_addr_t translation_offset;
Stefan Roese85bddff2019-04-12 16:42:28 +0200421#endif
Simon Glasscf1f4bb2023-05-04 16:54:59 -0600422#ifdef CONFIG_ACPI
Simon Glassde0115a2020-11-04 09:57:19 -0700423 /**
424 * @acpi_ctx: ACPI context pointer
425 */
426 struct acpi_ctx *acpi_ctx;
Simon Glassb33f2f92021-12-01 09:02:37 -0700427 /**
428 * @acpi_start: Start address of ACPI tables
429 */
430 ulong acpi_start;
Simon Glassde0115a2020-11-04 09:57:19 -0700431#endif
Simon Glassa05eb042021-02-04 21:17:20 -0700432#if CONFIG_IS_ENABLED(GENERATE_SMBIOS_TABLE)
433 /**
434 * @smbios_version: Points to SMBIOS type 0 version
435 */
436 char *smbios_version;
437#endif
Simon Glassaa4bce92022-03-04 08:43:00 -0700438#if CONFIG_IS_ENABLED(EVENT)
439 /**
440 * @event_state: Points to the current state of events
441 */
442 struct event_state event_state;
443#endif
Simon Glass0b385222024-07-31 08:44:08 -0600444#if CONFIG_IS_ENABLED(CYCLIC)
Stefan Roese036f89a2022-09-02 13:57:48 +0200445 /**
Rasmus Villemoesc794e492022-10-28 13:50:54 +0200446 * @cyclic_list: list of registered cyclic functions
Stefan Roese036f89a2022-09-02 13:57:48 +0200447 */
Rasmus Villemoesc794e492022-10-28 13:50:54 +0200448 struct hlist_head cyclic_list;
Stefan Roese036f89a2022-09-02 13:57:48 +0200449#endif
AKASHI Takahiroe04f4fb2022-03-08 20:36:46 +0900450 /**
451 * @dmtag_list: List of DM tags
452 */
453 struct list_head dmtag_list;
Simon Glass3a028c22024-08-07 16:47:30 -0600454#if CONFIG_IS_ENABLED(UPL)
455 /**
456 * @upl: Universal Payload-handoff information
457 */
458 struct upl *upl;
459#endif
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200460};
Rasmus Villemoesb8cfd9e2021-05-18 11:19:47 +0200461#ifndef DO_DEPS_ONLY
462static_assert(sizeof(struct global_data) == GD_SIZE);
463#endif
Simon Glass0e724032012-12-13 20:49:12 +0000464
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200465/**
466 * gd_board_type() - retrieve board type
467 *
468 * Return: global board type
469 */
Simon Glassb4de3f32017-03-31 08:40:24 -0600470#ifdef CONFIG_BOARD_TYPES
471#define gd_board_type() gd->board_type
472#else
473#define gd_board_type() 0
474#endif
475
Simon Glass40916e62020-10-03 09:25:22 -0600476/* These macros help avoid #ifdefs in the code */
477#if CONFIG_IS_ENABLED(OF_LIVE)
478#define gd_of_root() gd->of_root
479#define gd_of_root_ptr() &gd->of_root
480#define gd_set_of_root(_root) gd->of_root = (_root)
481#else
482#define gd_of_root() NULL
483#define gd_of_root_ptr() NULL
484#define gd_set_of_root(_root)
485#endif
486
Simon Glass8beeb282021-03-15 17:25:36 +1300487#if CONFIG_IS_ENABLED(OF_PLATDATA_DRIVER_RT)
Simon Glasscfd6a002020-10-03 11:31:33 -0600488#define gd_set_dm_driver_rt(dyn) gd->dm_driver_rt = dyn
489#define gd_dm_driver_rt() gd->dm_driver_rt
490#else
491#define gd_set_dm_driver_rt(dyn)
492#define gd_dm_driver_rt() NULL
493#endif
494
Simon Glass8beeb282021-03-15 17:25:36 +1300495#if CONFIG_IS_ENABLED(OF_PLATDATA_RT)
496#define gd_set_dm_udevice_rt(dyn) gd->dm_udevice_rt = dyn
497#define gd_dm_udevice_rt() gd->dm_udevice_rt
Simon Glass8dee67a2021-03-15 17:25:38 +1300498#define gd_set_dm_priv_base(dyn) gd->dm_priv_base = dyn
499#define gd_dm_priv_base() gd->dm_priv_base
Simon Glass8beeb282021-03-15 17:25:36 +1300500#else
501#define gd_set_dm_udevice_rt(dyn)
502#define gd_dm_udevice_rt() NULL
Simon Glass8dee67a2021-03-15 17:25:38 +1300503#define gd_set_dm_priv_base(dyn)
504#define gd_dm_priv_base() NULL
Simon Glass8beeb282021-03-15 17:25:36 +1300505#endif
506
Simon Glasscf1f4bb2023-05-04 16:54:59 -0600507#ifdef CONFIG_ACPI
Simon Glassde0115a2020-11-04 09:57:19 -0700508#define gd_acpi_ctx() gd->acpi_ctx
Simon Glassb33f2f92021-12-01 09:02:37 -0700509#define gd_acpi_start() gd->acpi_start
510#define gd_set_acpi_start(addr) gd->acpi_start = addr
Simon Glassde0115a2020-11-04 09:57:19 -0700511#else
512#define gd_acpi_ctx() NULL
Simon Glassb33f2f92021-12-01 09:02:37 -0700513#define gd_acpi_start() 0UL
514#define gd_set_acpi_start(addr)
Simon Glassde0115a2020-11-04 09:57:19 -0700515#endif
516
Simon Glass9b388102023-09-19 21:00:15 -0600517#ifdef CONFIG_SMBIOS
Simon Glass42b7da52023-12-31 08:25:48 -0700518#define gd_smbios_start() gd->arch.smbios_start
Simon Glass9b388102023-09-19 21:00:15 -0600519#define gd_set_smbios_start(addr) gd->arch.smbios_start = addr
520#else
521#define gd_smbios_start() 0UL
522#define gd_set_smbios_start(addr)
523#endif
524
Simon Glass69daf5a2021-12-16 20:59:25 -0700525#if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
526#define gd_multi_dtb_fit() gd->multi_dtb_fit
527#define gd_set_multi_dtb_fit(_dtb) gd->multi_dtb_fit = _dtb
528#else
529#define gd_multi_dtb_fit() NULL
530#define gd_set_multi_dtb_fit(_dtb)
531#endif
532
Simon Glassaa4bce92022-03-04 08:43:00 -0700533#if CONFIG_IS_ENABLED(EVENT_DYNAMIC)
534#define gd_event_state() ((struct event_state *)&gd->event_state)
535#else
536#define gd_event_state() NULL
537#endif
538
Simon Glass345c9742023-07-15 21:38:53 -0600539#if CONFIG_IS_ENABLED(CMD_BDINFO_EXTRA)
540#define gd_malloc_start() gd->malloc_start
541#define gd_set_malloc_start(_val) gd->malloc_start = (_val)
542#else
543#define gd_malloc_start() 0
544#define gd_set_malloc_start(val)
545#endif
Troy Kiskye143c272023-03-13 14:31:43 -0700546
Simon Glasse8804d72023-09-26 08:14:31 -0600547#if CONFIG_VAL(SYS_MALLOC_F_LEN)
548#define gd_malloc_ptr() gd->malloc_ptr
549#else
550#define gd_malloc_ptr() 0L
551#endif
552
Simon Glass3a028c22024-08-07 16:47:30 -0600553#if CONFIG_IS_ENABLED(UPL)
554#define gd_upl() gd->upl
555#define gd_set_upl(_val) gd->upl = (_val)
556#else
557#define gd_upl() NULL
558#define gd_set_upl(val)
559#endif
560
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200561/**
562 * enum gd_flags - global data flags
563 *
564 * See field flags of &struct global_data.
Simon Glass0e724032012-12-13 20:49:12 +0000565 */
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200566enum gd_flags {
567 /**
568 * @GD_FLG_RELOC: code was relocated to RAM
569 */
570 GD_FLG_RELOC = 0x00001,
571 /**
572 * @GD_FLG_DEVINIT: devices have been initialized
573 */
574 GD_FLG_DEVINIT = 0x00002,
575 /**
576 * @GD_FLG_SILENT: silent mode
577 */
578 GD_FLG_SILENT = 0x00004,
579 /**
580 * @GD_FLG_POSTFAIL: critical POST test failed
581 */
582 GD_FLG_POSTFAIL = 0x00008,
583 /**
584 * @GD_FLG_POSTSTOP: POST sequence aborted
585 */
586 GD_FLG_POSTSTOP = 0x00010,
587 /**
588 * @GD_FLG_LOGINIT: log Buffer has been initialized
589 */
590 GD_FLG_LOGINIT = 0x00020,
591 /**
592 * @GD_FLG_DISABLE_CONSOLE: disable console (in & out)
593 */
594 GD_FLG_DISABLE_CONSOLE = 0x00040,
595 /**
596 * @GD_FLG_ENV_READY: environment imported into hash table
597 */
598 GD_FLG_ENV_READY = 0x00080,
599 /**
600 * @GD_FLG_SERIAL_READY: pre-relocation serial console ready
601 */
602 GD_FLG_SERIAL_READY = 0x00100,
603 /**
604 * @GD_FLG_FULL_MALLOC_INIT: full malloc() is ready
605 */
606 GD_FLG_FULL_MALLOC_INIT = 0x00200,
607 /**
608 * @GD_FLG_SPL_INIT: spl_init() has been called
609 */
610 GD_FLG_SPL_INIT = 0x00400,
611 /**
612 * @GD_FLG_SKIP_RELOC: don't relocate
613 */
614 GD_FLG_SKIP_RELOC = 0x00800,
615 /**
616 * @GD_FLG_RECORD: record console
617 */
618 GD_FLG_RECORD = 0x01000,
619 /**
Simon Glassd6ed4af2021-05-08 06:59:56 -0600620 * @GD_FLG_RECORD_OVF: record console overflow
621 */
622 GD_FLG_RECORD_OVF = 0x02000,
623 /**
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200624 * @GD_FLG_ENV_DEFAULT: default variable flag
625 */
Simon Glassd6ed4af2021-05-08 06:59:56 -0600626 GD_FLG_ENV_DEFAULT = 0x04000,
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200627 /**
628 * @GD_FLG_SPL_EARLY_INIT: early SPL initialization is done
629 */
Simon Glassd6ed4af2021-05-08 06:59:56 -0600630 GD_FLG_SPL_EARLY_INIT = 0x08000,
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200631 /**
632 * @GD_FLG_LOG_READY: log system is ready for use
633 */
Simon Glassd6ed4af2021-05-08 06:59:56 -0600634 GD_FLG_LOG_READY = 0x10000,
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200635 /**
Stefan Roese5128a872022-11-17 09:20:34 +0100636 * @GD_FLG_CYCLIC_RUNNING: cyclic_run is in progress
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200637 */
Stefan Roese5128a872022-11-17 09:20:34 +0100638 GD_FLG_CYCLIC_RUNNING = 0x20000,
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200639 /**
640 * @GD_FLG_SKIP_LL_INIT: don't perform low-level initialization
641 */
Simon Glassd6ed4af2021-05-08 06:59:56 -0600642 GD_FLG_SKIP_LL_INIT = 0x40000,
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200643 /**
644 * @GD_FLG_SMP_READY: SMP initialization is complete
645 */
Simon Glassd6ed4af2021-05-08 06:59:56 -0600646 GD_FLG_SMP_READY = 0x80000,
Simon Glass60f08992022-09-06 20:27:06 -0600647 /**
648 * @GD_FLG_FDT_CHANGED: Device tree change has been detected by tests
649 */
650 GD_FLG_FDT_CHANGED = 0x100000,
Simon Glassc2727e52023-02-13 08:56:32 -0700651 /**
652 * @GD_FLG_OF_TAG_MIGRATE: Device tree has old u-boot,dm- tags
653 */
654 GD_FLG_OF_TAG_MIGRATE = 0x200000,
Simon Glass31ef8342023-09-07 09:58:13 -0600655 /**
656 * @GD_FLG_DM_DEAD: Driver model is not accessible. This can be set when
657 * the memory used to holds its tables has been mapped out.
658 */
659 GD_FLG_DM_DEAD = 0x400000,
Simon Glassa28f39c2023-09-26 08:14:51 -0600660 /**
661 * @GD_FLG_BLOBLIST_READY: bloblist is ready for use
662 */
663 GD_FLG_BLOBLIST_READY = 0x800000,
Francis Laniel1239d232023-12-22 22:02:30 +0100664 /**
665 * @GD_FLG_HUSH_OLD_PARSER: Use hush old parser.
666 */
667 GD_FLG_HUSH_OLD_PARSER = 0x1000000,
Francis Laniel3b66e572023-12-22 22:02:32 +0100668 /**
669 * @GD_FLG_HUSH_MODERN_PARSER: Use hush 2021 parser.
670 */
671 GD_FLG_HUSH_MODERN_PARSER = 0x2000000,
Simon Glass9b5bfba2024-08-07 16:47:33 -0600672 /**
673 * @GD_FLG_UPL: Read/write a Universal Payload (UPL) handoff
674 */
675 GD_FLG_UPL = 0x4000000,
Simon Glassd4b0fdb2024-08-21 10:19:04 -0600676 /**
677 * @GD_FLG_HAVE_CONSOLE: serial_init() was called and a console
678 * is available. When not set, indicates that console input and output
679 * drivers shall not be called.
680 */
681 GD_FLG_HAVE_CONSOLE = 0x8000000,
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200682};
683
684#endif /* __ASSEMBLY__ */
Simon Glass0e724032012-12-13 20:49:12 +0000685
686#endif /* __ASM_GENERIC_GBL_DATA_H */