blob: 06523cab5225bb76c4bc6e7ee5f13206687e7b29 [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 Glassf782d542024-08-21 10:19:15 -060069 unsigned int 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 Glassf782d542024-08-21 10:19:15 -060073 unsigned int mem_clk;
Heinrich Schuchardt50d92862020-10-05 08:30:09 +020074 /**
Simon Glass0b6675d2024-08-21 10:19:16 -060075 * @mon_len: monitor length in bytes
76 */
77 unsigned int mon_len;
78 /**
Heinrich Schuchardt50d92862020-10-05 08:30:09 +020079 * @env_addr: address of environment structure
80 *
81 * @env_addr contains the address of the structure holding the
82 * environment variables.
83 */
84 unsigned long env_addr;
85 /**
Simon Glassc726f282024-08-21 10:19:08 -060086 * @env_has_init: bit mask indicating environment locations
Heinrich Schuchardt50d92862020-10-05 08:30:09 +020087 *
Simon Glassc726f282024-08-21 10:19:08 -060088 * &enum env_location defines which bit relates to which location
Heinrich Schuchardt50d92862020-10-05 08:30:09 +020089 */
Simon Glassc726f282024-08-21 10:19:08 -060090 unsigned short env_has_init;
Heinrich Schuchardt50d92862020-10-05 08:30:09 +020091 /**
Simon Glassc726f282024-08-21 10:19:08 -060092 * @env_valid: environment is valid
Heinrich Schuchardt50d92862020-10-05 08:30:09 +020093 *
Simon Glassc726f282024-08-21 10:19:08 -060094 * See &enum env_valid
Heinrich Schuchardt50d92862020-10-05 08:30:09 +020095 */
Simon Glassc726f282024-08-21 10:19:08 -060096 unsigned char env_valid;
Heinrich Schuchardt50d92862020-10-05 08:30:09 +020097 /**
98 * @env_load_prio: priority of the loaded environment
99 */
Simon Glassc726f282024-08-21 10:19:08 -0600100 char env_load_prio;
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200101 /**
102 * @ram_base: base address of RAM used by U-Boot
103 */
104 unsigned long ram_base;
105 /**
106 * @ram_top: top address of RAM used by U-Boot
107 */
Bin Mengf936cf62021-01-31 20:35:59 +0800108 phys_addr_t ram_top;
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200109 /**
110 * @relocaddr: start address of U-Boot in RAM
111 *
112 * After relocation this field indicates the address to which U-Boot
113 * has been relocated. It can be displayed using the bdinfo command.
114 * Its value is needed to display the source code when debugging with
115 * GDB using the 'add-symbol-file u-boot <relocaddr>' command.
116 */
117 unsigned long relocaddr;
118 /**
119 * @ram_size: RAM size in bytes
120 */
121 phys_size_t ram_size;
122 /**
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200123 * @irq_sp: IRQ stack pointer
124 */
125 unsigned long irq_sp;
126 /**
127 * @start_addr_sp: initial stack pointer address
128 */
129 unsigned long start_addr_sp;
130 /**
131 * @reloc_off: relocation offset
132 */
Simon Glass0e724032012-12-13 20:49:12 +0000133 unsigned long reloc_off;
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200134 /**
135 * @new_gd: pointer to relocated global data
136 */
137 struct global_data *new_gd;
Simon Glassa9ffc542024-08-21 10:19:14 -0600138 /**
139 * @fdt_blob: U-Boot's own device tree, NULL if none
140 */
141 const void *fdt_blob;
142 /**
143 * @fdt_src: Source of FDT
144 */
145 enum fdt_source_t fdt_src;
146 /**
147 * @jt: jump table
148 *
149 * The jump table contains pointers to exported functions. A pointer to
150 * the jump table is passed to standalone applications.
151 */
152 struct jt_funcs *jt;
153 /**
154 * @env_buf: buffer for env_get() before reloc
155 */
156 char env_buf[32];
157 /**
158 * @cur_serial_dev: current serial device
159 */
160 struct udevice *cur_serial_dev;
161 /**
162 * @arch: architecture-specific data
163 */
164 struct arch_global_data arch;
165 /**
166 * @dmtag_list: List of DM tags
167 */
168 struct list_head dmtag_list;
169 /**
170 * @timebase_h: high 32 bits of timer
171 */
172 unsigned int timebase_h;
173 /**
174 * @timebase_l: low 32 bits of timer
175 */
176 unsigned int timebase_l;
177#if defined(CONFIG_POST)
178 /**
179 * @post_log_word: active POST tests
180 *
181 * @post_log_word is a bit mask defining which POST tests are recorded
182 * (see constants POST_*).
183 */
184 unsigned long post_log_word;
185 /**
186 * @post_log_res: POST results
187 *
188 * @post_log_res is a bit mask with the POST results. A bit with value 1
189 * indicates successful execution.
190 */
191 unsigned long post_log_res;
192 /**
193 * @post_init_f_time: time in ms when post_init_f() started
194 */
195 unsigned long post_init_f_time;
196#endif
197#ifdef CONFIG_BOARD_TYPES
198 /**
199 * @board_type: board type
200 *
201 * If a U-Boot configuration supports multiple board types, the actual
202 * board type may be stored in this field.
203 */
204 unsigned long board_type;
205#endif
206#if CONFIG_IS_ENABLED(PRE_CONSOLE_BUFFER)
207 /**
208 * @precon_buf_idx: pre-console buffer index
209 *
210 * @precon_buf_idx indicates the current position of the
211 * buffer used to collect output before the console becomes
212 * available. When negative, the pre-console buffer is
213 * temporarily disabled (used when the pre-console buffer is
214 * being written out, to prevent adding its contents to
215 * itself).
216 */
217 long precon_buf_idx;
218#endif
Simon Glassdd6ab882014-02-26 15:59:18 -0700219#ifdef CONFIG_DM
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200220 /**
221 * @dm_root: root instance for Driver Model
222 */
223 struct udevice *dm_root;
224 /**
Heinrich Schuchardt18000fe2021-01-24 21:48:00 +0100225 * @uclass_root_s:
226 * head of core tree when uclasses are not in read-only memory.
227 *
228 * When uclasses are in read-only memory, @uclass_root_s is not used and
229 * @uclass_root points to the root node generated by dtoc.
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200230 */
Simon Glass784cd9e2020-12-19 10:40:17 -0700231 struct list_head uclass_root_s;
232 /**
Heinrich Schuchardt18000fe2021-01-24 21:48:00 +0100233 * @uclass_root:
234 * pointer to head of core tree, if uclasses are in read-only memory and
235 * cannot be adjusted to use @uclass_root as a list head.
236 *
237 * When not in read-only memory, @uclass_root_s is used to hold the
238 * uclass root, and @uclass_root points to the address of
239 * @uclass_root_s.
Simon Glass784cd9e2020-12-19 10:40:17 -0700240 */
241 struct list_head *uclass_root;
Simon Glass8beeb282021-03-15 17:25:36 +1300242# if CONFIG_IS_ENABLED(OF_PLATDATA_DRIVER_RT)
Simon Glass9286eb92020-11-29 17:07:05 -0700243 /** @dm_driver_rt: Dynamic info about the driver */
Simon Glasscfd6a002020-10-03 11:31:33 -0600244 struct driver_rt *dm_driver_rt;
245# endif
Simon Glass8beeb282021-03-15 17:25:36 +1300246#if CONFIG_IS_ENABLED(OF_PLATDATA_RT)
247 /** @dm_udevice_rt: Dynamic info about the udevice */
248 struct udevice_rt *dm_udevice_rt;
Simon Glass8dee67a2021-03-15 17:25:38 +1300249 /**
250 * @dm_priv_base: Base address of the priv/plat region used when
251 * udevices and uclasses are in read-only memory. This is NULL if not
252 * used
253 */
254 void *dm_priv_base;
Simon Glass8beeb282021-03-15 17:25:36 +1300255# endif
Simon Glassdd6ab882014-02-26 15:59:18 -0700256#endif
Thomas Choufb798b12015-10-09 13:46:34 +0800257#ifdef CONFIG_TIMER
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200258 /**
259 * @timer: timer instance for Driver Model
260 */
261 struct udevice *timer;
Thomas Choufb798b12015-10-09 13:46:34 +0800262#endif
Simon Glass40916e62020-10-03 09:25:22 -0600263#if CONFIG_IS_ENABLED(OF_LIVE)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200264 /**
265 * @of_root: root node of the live tree
266 */
Simon Glassa6eedb82017-05-18 20:08:53 -0600267 struct device_node *of_root;
268#endif
Jean-Jacques Hiblot7c530e32018-12-07 14:50:52 +0100269#if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200270 /**
271 * @multi_dtb_fit: pointer to uncompressed multi-dtb FIT image
272 */
273 const void *multi_dtb_fit;
Jean-Jacques Hiblot7c530e32018-12-07 14:50:52 +0100274#endif
Simon Glass209a1a62013-06-11 11:14:42 -0700275#ifdef CONFIG_TRACE
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200276 /**
277 * @trace_buff: trace buffer
278 *
279 * When tracing function in U-Boot this field points to the buffer
280 * recording the function calls.
281 */
282 void *trace_buff;
Simon Glass209a1a62013-06-11 11:14:42 -0700283#endif
Tom Rini52b2e262021-08-18 23:12:24 -0400284#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200285 /**
286 * @cur_i2c_bus: currently used I2C bus
287 */
288 int cur_i2c_bus;
Heiko Schochere7d9c4f2012-01-16 21:12:23 +0000289#endif
Simon Glassa9ffc542024-08-21 10:19:14 -0600290#if CONFIG_IS_ENABLED(CMD_BDINFO_EXTRA)
Simon Glass345c9742023-07-15 21:38:53 -0600291 /**
292 * @malloc_start: start of malloc() region
293 */
Simon Glass345c9742023-07-15 21:38:53 -0600294 unsigned long malloc_start;
295#endif
Simon Glassadad2d02023-09-26 08:14:27 -0600296#if CONFIG_IS_ENABLED(SYS_MALLOC_F)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200297 /**
298 * @malloc_base: base address of early malloc()
299 */
300 unsigned long malloc_base;
301 /**
302 * @malloc_limit: limit address of early malloc()
303 */
304 unsigned long malloc_limit;
305 /**
306 * @malloc_ptr: current address of early malloc()
307 */
308 unsigned long malloc_ptr;
Simon Glass863e4042014-07-10 22:23:28 -0600309#endif
Simon Glass1bb49232015-11-08 23:47:48 -0700310#ifdef CONFIG_CONSOLE_RECORD
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200311 /**
312 * @console_out: output buffer for console recording
313 *
314 * This buffer is used to collect output during console recording.
315 */
316 struct membuff console_out;
317 /**
318 * @console_in: input buffer for console recording
319 *
320 * If console recording is activated, this buffer can be used to
321 * emulate input.
322 */
323 struct membuff console_in;
Simon Glass1bb49232015-11-08 23:47:48 -0700324#endif
Nikhil M Jain7f561e12023-04-20 17:41:10 +0530325#if CONFIG_IS_ENABLED(VIDEO)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200326 /**
327 * @video_top: top of video frame buffer area
328 */
329 ulong video_top;
330 /**
331 * @video_bottom: bottom of video frame buffer area
332 */
333 ulong video_bottom;
Simon Glassfce58f52016-01-18 19:52:21 -0700334#endif
Simon Glass88200332017-05-22 05:05:25 -0600335#ifdef CONFIG_BOOTSTAGE
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200336 /**
337 * @bootstage: boot stage information
338 */
339 struct bootstage_data *bootstage;
Simon Glass88200332017-05-22 05:05:25 -0600340#endif
Simon Glassd95645d2017-12-04 13:48:24 -0700341#ifdef CONFIG_LOG
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200342 /**
343 * @log_drop_count: number of dropped log messages
344 *
345 * This counter is incremented for each log message which can not
346 * be processed because logging is not yet available as signaled by
347 * flag %GD_FLG_LOG_READY in @flags.
348 */
349 int log_drop_count;
350 /**
351 * @default_log_level: default logging level
352 *
353 * For logging devices without filters @default_log_level defines the
354 * logging level, cf. &enum log_level_t.
355 */
356 int default_log_level;
357 /**
358 * @log_head: list of logging devices
359 */
360 struct list_head log_head;
361 /**
362 * @log_fmt: bit mask for logging format
363 *
364 * The @log_fmt bit mask selects the fields to be shown in log messages.
365 * &enum log_fmt defines the bits of the bit mask.
366 */
367 int log_fmt;
Heinrich Schuchardtfdf55992020-10-17 14:31:57 +0200368
369 /**
370 * @processing_msg: a log message is being processed
371 *
372 * This flag is used to suppress the creation of additional messages
373 * while another message is being processed.
374 */
375 bool processing_msg;
Heinrich Schuchardt0fc9f4f2020-10-17 14:31:58 +0200376 /**
377 * @logc_prev: logging category of previous message
378 *
379 * This value is used as logging category for continuation messages.
380 */
381 int logc_prev;
382 /**
Heinrich Schuchardt14e77222020-10-30 18:50:31 +0100383 * @logl_prev: logging level of the previous message
Heinrich Schuchardt0fc9f4f2020-10-17 14:31:58 +0200384 *
385 * This value is used as logging level for continuation messages.
386 */
387 int logl_prev;
Simon Glass5fc47e32021-01-20 20:10:53 -0700388 /**
389 * @log_cont: Previous log line did not finished wtih \n
390 *
391 * This allows for chained log messages on the same line
392 */
393 bool log_cont;
Simon Glassd95645d2017-12-04 13:48:24 -0700394#endif
Simon Glassa815dab2018-11-15 18:43:52 -0700395#if CONFIG_IS_ENABLED(BLOBLIST)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200396 /**
397 * @bloblist: blob list information
398 */
399 struct bloblist_hdr *bloblist;
Ovidiu Panaitc1b30d52020-11-28 10:43:20 +0200400#endif
Stefan Roese85bddff2019-04-12 16:42:28 +0200401#if defined(CONFIG_TRANSLATION_OFFSET)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200402 /**
403 * @translation_offset: optional translation offset
404 *
405 * See CONFIG_TRANSLATION_OFFSET.
406 */
407 fdt_addr_t translation_offset;
Stefan Roese85bddff2019-04-12 16:42:28 +0200408#endif
Simon Glasscf1f4bb2023-05-04 16:54:59 -0600409#ifdef CONFIG_ACPI
Simon Glassde0115a2020-11-04 09:57:19 -0700410 /**
411 * @acpi_ctx: ACPI context pointer
412 */
413 struct acpi_ctx *acpi_ctx;
Simon Glassb33f2f92021-12-01 09:02:37 -0700414 /**
415 * @acpi_start: Start address of ACPI tables
416 */
417 ulong acpi_start;
Simon Glassde0115a2020-11-04 09:57:19 -0700418#endif
Simon Glassa05eb042021-02-04 21:17:20 -0700419#if CONFIG_IS_ENABLED(GENERATE_SMBIOS_TABLE)
420 /**
421 * @smbios_version: Points to SMBIOS type 0 version
422 */
423 char *smbios_version;
424#endif
Simon Glassaa4bce92022-03-04 08:43:00 -0700425#if CONFIG_IS_ENABLED(EVENT)
426 /**
427 * @event_state: Points to the current state of events
428 */
429 struct event_state event_state;
430#endif
Simon Glass0b385222024-07-31 08:44:08 -0600431#if CONFIG_IS_ENABLED(CYCLIC)
Stefan Roese036f89a2022-09-02 13:57:48 +0200432 /**
Rasmus Villemoesc794e492022-10-28 13:50:54 +0200433 * @cyclic_list: list of registered cyclic functions
Stefan Roese036f89a2022-09-02 13:57:48 +0200434 */
Rasmus Villemoesc794e492022-10-28 13:50:54 +0200435 struct hlist_head cyclic_list;
Stefan Roese036f89a2022-09-02 13:57:48 +0200436#endif
Simon Glass3a028c22024-08-07 16:47:30 -0600437#if CONFIG_IS_ENABLED(UPL)
438 /**
439 * @upl: Universal Payload-handoff information
440 */
441 struct upl *upl;
442#endif
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200443};
Rasmus Villemoesb8cfd9e2021-05-18 11:19:47 +0200444#ifndef DO_DEPS_ONLY
445static_assert(sizeof(struct global_data) == GD_SIZE);
446#endif
Simon Glass0e724032012-12-13 20:49:12 +0000447
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200448/**
449 * gd_board_type() - retrieve board type
450 *
451 * Return: global board type
452 */
Simon Glassb4de3f32017-03-31 08:40:24 -0600453#ifdef CONFIG_BOARD_TYPES
454#define gd_board_type() gd->board_type
455#else
456#define gd_board_type() 0
457#endif
458
Simon Glass40916e62020-10-03 09:25:22 -0600459/* These macros help avoid #ifdefs in the code */
460#if CONFIG_IS_ENABLED(OF_LIVE)
461#define gd_of_root() gd->of_root
462#define gd_of_root_ptr() &gd->of_root
463#define gd_set_of_root(_root) gd->of_root = (_root)
464#else
465#define gd_of_root() NULL
466#define gd_of_root_ptr() NULL
467#define gd_set_of_root(_root)
468#endif
469
Simon Glass8beeb282021-03-15 17:25:36 +1300470#if CONFIG_IS_ENABLED(OF_PLATDATA_DRIVER_RT)
Simon Glasscfd6a002020-10-03 11:31:33 -0600471#define gd_set_dm_driver_rt(dyn) gd->dm_driver_rt = dyn
472#define gd_dm_driver_rt() gd->dm_driver_rt
473#else
474#define gd_set_dm_driver_rt(dyn)
475#define gd_dm_driver_rt() NULL
476#endif
477
Simon Glass8beeb282021-03-15 17:25:36 +1300478#if CONFIG_IS_ENABLED(OF_PLATDATA_RT)
479#define gd_set_dm_udevice_rt(dyn) gd->dm_udevice_rt = dyn
480#define gd_dm_udevice_rt() gd->dm_udevice_rt
Simon Glass8dee67a2021-03-15 17:25:38 +1300481#define gd_set_dm_priv_base(dyn) gd->dm_priv_base = dyn
482#define gd_dm_priv_base() gd->dm_priv_base
Simon Glass8beeb282021-03-15 17:25:36 +1300483#else
484#define gd_set_dm_udevice_rt(dyn)
485#define gd_dm_udevice_rt() NULL
Simon Glass8dee67a2021-03-15 17:25:38 +1300486#define gd_set_dm_priv_base(dyn)
487#define gd_dm_priv_base() NULL
Simon Glass8beeb282021-03-15 17:25:36 +1300488#endif
489
Simon Glasscf1f4bb2023-05-04 16:54:59 -0600490#ifdef CONFIG_ACPI
Simon Glassde0115a2020-11-04 09:57:19 -0700491#define gd_acpi_ctx() gd->acpi_ctx
Simon Glassb33f2f92021-12-01 09:02:37 -0700492#define gd_acpi_start() gd->acpi_start
493#define gd_set_acpi_start(addr) gd->acpi_start = addr
Simon Glassde0115a2020-11-04 09:57:19 -0700494#else
495#define gd_acpi_ctx() NULL
Simon Glassb33f2f92021-12-01 09:02:37 -0700496#define gd_acpi_start() 0UL
497#define gd_set_acpi_start(addr)
Simon Glassde0115a2020-11-04 09:57:19 -0700498#endif
499
Simon Glass9b388102023-09-19 21:00:15 -0600500#ifdef CONFIG_SMBIOS
Simon Glass42b7da52023-12-31 08:25:48 -0700501#define gd_smbios_start() gd->arch.smbios_start
Simon Glass9b388102023-09-19 21:00:15 -0600502#define gd_set_smbios_start(addr) gd->arch.smbios_start = addr
503#else
504#define gd_smbios_start() 0UL
505#define gd_set_smbios_start(addr)
506#endif
507
Simon Glass69daf5a2021-12-16 20:59:25 -0700508#if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
509#define gd_multi_dtb_fit() gd->multi_dtb_fit
510#define gd_set_multi_dtb_fit(_dtb) gd->multi_dtb_fit = _dtb
511#else
512#define gd_multi_dtb_fit() NULL
513#define gd_set_multi_dtb_fit(_dtb)
514#endif
515
Simon Glassaa4bce92022-03-04 08:43:00 -0700516#if CONFIG_IS_ENABLED(EVENT_DYNAMIC)
517#define gd_event_state() ((struct event_state *)&gd->event_state)
518#else
519#define gd_event_state() NULL
520#endif
521
Simon Glass345c9742023-07-15 21:38:53 -0600522#if CONFIG_IS_ENABLED(CMD_BDINFO_EXTRA)
523#define gd_malloc_start() gd->malloc_start
524#define gd_set_malloc_start(_val) gd->malloc_start = (_val)
525#else
526#define gd_malloc_start() 0
527#define gd_set_malloc_start(val)
528#endif
Troy Kiskye143c272023-03-13 14:31:43 -0700529
Simon Glasse8804d72023-09-26 08:14:31 -0600530#if CONFIG_VAL(SYS_MALLOC_F_LEN)
531#define gd_malloc_ptr() gd->malloc_ptr
532#else
533#define gd_malloc_ptr() 0L
534#endif
535
Simon Glass3a028c22024-08-07 16:47:30 -0600536#if CONFIG_IS_ENABLED(UPL)
537#define gd_upl() gd->upl
538#define gd_set_upl(_val) gd->upl = (_val)
539#else
540#define gd_upl() NULL
541#define gd_set_upl(val)
542#endif
543
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200544/**
545 * enum gd_flags - global data flags
546 *
547 * See field flags of &struct global_data.
Simon Glass0e724032012-12-13 20:49:12 +0000548 */
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200549enum gd_flags {
550 /**
551 * @GD_FLG_RELOC: code was relocated to RAM
552 */
553 GD_FLG_RELOC = 0x00001,
554 /**
555 * @GD_FLG_DEVINIT: devices have been initialized
556 */
557 GD_FLG_DEVINIT = 0x00002,
558 /**
559 * @GD_FLG_SILENT: silent mode
560 */
561 GD_FLG_SILENT = 0x00004,
562 /**
563 * @GD_FLG_POSTFAIL: critical POST test failed
564 */
565 GD_FLG_POSTFAIL = 0x00008,
566 /**
567 * @GD_FLG_POSTSTOP: POST sequence aborted
568 */
569 GD_FLG_POSTSTOP = 0x00010,
570 /**
571 * @GD_FLG_LOGINIT: log Buffer has been initialized
572 */
573 GD_FLG_LOGINIT = 0x00020,
574 /**
575 * @GD_FLG_DISABLE_CONSOLE: disable console (in & out)
576 */
577 GD_FLG_DISABLE_CONSOLE = 0x00040,
578 /**
579 * @GD_FLG_ENV_READY: environment imported into hash table
580 */
581 GD_FLG_ENV_READY = 0x00080,
582 /**
583 * @GD_FLG_SERIAL_READY: pre-relocation serial console ready
584 */
585 GD_FLG_SERIAL_READY = 0x00100,
586 /**
587 * @GD_FLG_FULL_MALLOC_INIT: full malloc() is ready
588 */
589 GD_FLG_FULL_MALLOC_INIT = 0x00200,
590 /**
591 * @GD_FLG_SPL_INIT: spl_init() has been called
592 */
593 GD_FLG_SPL_INIT = 0x00400,
594 /**
595 * @GD_FLG_SKIP_RELOC: don't relocate
596 */
597 GD_FLG_SKIP_RELOC = 0x00800,
598 /**
599 * @GD_FLG_RECORD: record console
600 */
601 GD_FLG_RECORD = 0x01000,
602 /**
Simon Glassd6ed4af2021-05-08 06:59:56 -0600603 * @GD_FLG_RECORD_OVF: record console overflow
604 */
605 GD_FLG_RECORD_OVF = 0x02000,
606 /**
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200607 * @GD_FLG_ENV_DEFAULT: default variable flag
608 */
Simon Glassd6ed4af2021-05-08 06:59:56 -0600609 GD_FLG_ENV_DEFAULT = 0x04000,
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200610 /**
611 * @GD_FLG_SPL_EARLY_INIT: early SPL initialization is done
612 */
Simon Glassd6ed4af2021-05-08 06:59:56 -0600613 GD_FLG_SPL_EARLY_INIT = 0x08000,
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200614 /**
615 * @GD_FLG_LOG_READY: log system is ready for use
616 */
Simon Glassd6ed4af2021-05-08 06:59:56 -0600617 GD_FLG_LOG_READY = 0x10000,
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200618 /**
Stefan Roese5128a872022-11-17 09:20:34 +0100619 * @GD_FLG_CYCLIC_RUNNING: cyclic_run is in progress
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200620 */
Stefan Roese5128a872022-11-17 09:20:34 +0100621 GD_FLG_CYCLIC_RUNNING = 0x20000,
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200622 /**
623 * @GD_FLG_SKIP_LL_INIT: don't perform low-level initialization
624 */
Simon Glassd6ed4af2021-05-08 06:59:56 -0600625 GD_FLG_SKIP_LL_INIT = 0x40000,
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200626 /**
627 * @GD_FLG_SMP_READY: SMP initialization is complete
628 */
Simon Glassd6ed4af2021-05-08 06:59:56 -0600629 GD_FLG_SMP_READY = 0x80000,
Simon Glass60f08992022-09-06 20:27:06 -0600630 /**
631 * @GD_FLG_FDT_CHANGED: Device tree change has been detected by tests
632 */
633 GD_FLG_FDT_CHANGED = 0x100000,
Simon Glassc2727e52023-02-13 08:56:32 -0700634 /**
635 * @GD_FLG_OF_TAG_MIGRATE: Device tree has old u-boot,dm- tags
636 */
637 GD_FLG_OF_TAG_MIGRATE = 0x200000,
Simon Glass31ef8342023-09-07 09:58:13 -0600638 /**
639 * @GD_FLG_DM_DEAD: Driver model is not accessible. This can be set when
640 * the memory used to holds its tables has been mapped out.
641 */
642 GD_FLG_DM_DEAD = 0x400000,
Simon Glassa28f39c2023-09-26 08:14:51 -0600643 /**
644 * @GD_FLG_BLOBLIST_READY: bloblist is ready for use
645 */
646 GD_FLG_BLOBLIST_READY = 0x800000,
Francis Laniel1239d232023-12-22 22:02:30 +0100647 /**
648 * @GD_FLG_HUSH_OLD_PARSER: Use hush old parser.
649 */
650 GD_FLG_HUSH_OLD_PARSER = 0x1000000,
Francis Laniel3b66e572023-12-22 22:02:32 +0100651 /**
652 * @GD_FLG_HUSH_MODERN_PARSER: Use hush 2021 parser.
653 */
654 GD_FLG_HUSH_MODERN_PARSER = 0x2000000,
Simon Glass9b5bfba2024-08-07 16:47:33 -0600655 /**
656 * @GD_FLG_UPL: Read/write a Universal Payload (UPL) handoff
657 */
658 GD_FLG_UPL = 0x4000000,
Simon Glassd4b0fdb2024-08-21 10:19:04 -0600659 /**
660 * @GD_FLG_HAVE_CONSOLE: serial_init() was called and a console
661 * is available. When not set, indicates that console input and output
662 * drivers shall not be called.
663 */
664 GD_FLG_HAVE_CONSOLE = 0x8000000,
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200665};
666
667#endif /* __ASSEMBLY__ */
Simon Glass0e724032012-12-13 20:49:12 +0000668
669#endif /* __ASM_GENERIC_GBL_DATA_H */