blob: 9006c76927969240e1f9f43cbeed05e1a9d194ca [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;
33
Heinrich Schuchardt50d92862020-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 Yamadad788bba2020-02-25 02:22:27 +090043 struct bd_info *bd;
Heinrich Schuchardt50d92862020-10-05 08:30:09 +020044 /**
45 * @flags: global data flags
46 *
47 * See &enum gd_flags
48 */
Simon Glass0e724032012-12-13 20:49:12 +000049 unsigned long flags;
Heinrich Schuchardt50d92862020-10-05 08:30:09 +020050 /**
51 * @baudrate: baud rate of the serial interface
52 */
Simon Glass059c54f2013-03-05 14:40:05 +000053 unsigned int baudrate;
Heinrich Schuchardt50d92862020-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 Glass0e724032012-12-13 20:49:12 +000061 unsigned long bus_clk;
Heinrich Schuchardt50d92862020-10-05 08:30:09 +020062 /**
63 * @pci_clk: PCI clock rate in Hz
64 */
Simon Glass0e724032012-12-13 20:49:12 +000065 /* We cannot bracket this with CONFIG_PCI due to mpc5xxx */
66 unsigned long pci_clk;
Heinrich Schuchardt50d92862020-10-05 08:30:09 +020067 /**
68 * @mem_clk: memory clock rate in Hz
69 */
Simon Glass0e724032012-12-13 20:49:12 +000070 unsigned long mem_clk;
Simon Glass03fbd252022-01-23 07:04:08 -070071#if defined(CONFIG_LCD) || defined(CONFIG_DM_VIDEO)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +020072 /**
73 * @fb_base: base address of frame buffer memory
74 */
75 unsigned long fb_base;
Simon Glass0e724032012-12-13 20:49:12 +000076#endif
Simon Glass49badb92017-12-04 13:48:23 -070077#if defined(CONFIG_POST)
Heinrich Schuchardt50d92862020-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 Glass0e724032012-12-13 20:49:12 +000096#endif
97#ifdef CONFIG_BOARD_TYPES
Heinrich Schuchardt50d92862020-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 Glass0e724032012-12-13 20:49:12 +0000104 unsigned long board_type;
105#endif
Heinrich Schuchardt50d92862020-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 Glasse304a5e2016-10-17 20:12:36 -0600115#if CONFIG_IS_ENABLED(PRE_CONSOLE_BUFFER)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200116 /**
117 * @precon_buf_idx: pre-console buffer index
118 *
119 * @precon_buf_idx indicates the current position of the buffer used to
120 * collect output before the console becomes available
121 */
122 unsigned long precon_buf_idx;
Simon Glass0e724032012-12-13 20:49:12 +0000123#endif
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200124 /**
125 * @env_addr: address of environment structure
126 *
127 * @env_addr contains the address of the structure holding the
128 * environment variables.
129 */
130 unsigned long env_addr;
131 /**
132 * @env_valid: environment is valid
133 *
134 * See &enum env_valid
135 */
136 unsigned long env_valid;
137 /**
138 * @env_has_init: bit mask indicating environment locations
139 *
140 * &enum env_location defines which bit relates to which location
141 */
142 unsigned long env_has_init;
143 /**
144 * @env_load_prio: priority of the loaded environment
145 */
146 int env_load_prio;
147 /**
148 * @ram_base: base address of RAM used by U-Boot
149 */
150 unsigned long ram_base;
151 /**
152 * @ram_top: top address of RAM used by U-Boot
153 */
Bin Mengf936cf62021-01-31 20:35:59 +0800154 phys_addr_t ram_top;
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200155 /**
156 * @relocaddr: start address of U-Boot in RAM
157 *
158 * After relocation this field indicates the address to which U-Boot
159 * has been relocated. It can be displayed using the bdinfo command.
160 * Its value is needed to display the source code when debugging with
161 * GDB using the 'add-symbol-file u-boot <relocaddr>' command.
162 */
163 unsigned long relocaddr;
164 /**
165 * @ram_size: RAM size in bytes
166 */
167 phys_size_t ram_size;
168 /**
169 * @mon_len: monitor length in bytes
170 */
171 unsigned long mon_len;
172 /**
173 * @irq_sp: IRQ stack pointer
174 */
175 unsigned long irq_sp;
176 /**
177 * @start_addr_sp: initial stack pointer address
178 */
179 unsigned long start_addr_sp;
180 /**
181 * @reloc_off: relocation offset
182 */
Simon Glass0e724032012-12-13 20:49:12 +0000183 unsigned long reloc_off;
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200184 /**
185 * @new_gd: pointer to relocated global data
186 */
187 struct global_data *new_gd;
Simon Glassdd6ab882014-02-26 15:59:18 -0700188
189#ifdef CONFIG_DM
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200190 /**
191 * @dm_root: root instance for Driver Model
192 */
193 struct udevice *dm_root;
194 /**
195 * @dm_root_f: pre-relocation root instance
196 */
197 struct udevice *dm_root_f;
198 /**
Heinrich Schuchardt18000fe2021-01-24 21:48:00 +0100199 * @uclass_root_s:
200 * head of core tree when uclasses are not in read-only memory.
201 *
202 * When uclasses are in read-only memory, @uclass_root_s is not used and
203 * @uclass_root points to the root node generated by dtoc.
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200204 */
Simon Glass784cd9e2020-12-19 10:40:17 -0700205 struct list_head uclass_root_s;
206 /**
Heinrich Schuchardt18000fe2021-01-24 21:48:00 +0100207 * @uclass_root:
208 * pointer to head of core tree, if uclasses are in read-only memory and
209 * cannot be adjusted to use @uclass_root as a list head.
210 *
211 * When not in read-only memory, @uclass_root_s is used to hold the
212 * uclass root, and @uclass_root points to the address of
213 * @uclass_root_s.
Simon Glass784cd9e2020-12-19 10:40:17 -0700214 */
215 struct list_head *uclass_root;
Simon Glass8beeb282021-03-15 17:25:36 +1300216# if CONFIG_IS_ENABLED(OF_PLATDATA_DRIVER_RT)
Simon Glass9286eb92020-11-29 17:07:05 -0700217 /** @dm_driver_rt: Dynamic info about the driver */
Simon Glasscfd6a002020-10-03 11:31:33 -0600218 struct driver_rt *dm_driver_rt;
219# endif
Simon Glass8beeb282021-03-15 17:25:36 +1300220#if CONFIG_IS_ENABLED(OF_PLATDATA_RT)
221 /** @dm_udevice_rt: Dynamic info about the udevice */
222 struct udevice_rt *dm_udevice_rt;
Simon Glass8dee67a2021-03-15 17:25:38 +1300223 /**
224 * @dm_priv_base: Base address of the priv/plat region used when
225 * udevices and uclasses are in read-only memory. This is NULL if not
226 * used
227 */
228 void *dm_priv_base;
Simon Glass8beeb282021-03-15 17:25:36 +1300229# endif
Simon Glassdd6ab882014-02-26 15:59:18 -0700230#endif
Thomas Choufb798b12015-10-09 13:46:34 +0800231#ifdef CONFIG_TIMER
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200232 /**
233 * @timer: timer instance for Driver Model
234 */
235 struct udevice *timer;
Thomas Choufb798b12015-10-09 13:46:34 +0800236#endif
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200237 /**
238 * @fdt_blob: U-Boot's own device tree, NULL if none
239 */
240 const void *fdt_blob;
241 /**
242 * @new_fdt: relocated device tree
243 */
244 void *new_fdt;
245 /**
246 * @fdt_size: space reserved for relocated device space
247 */
248 unsigned long fdt_size;
Simon Glassbed6bc72021-12-16 20:59:33 -0700249 /**
250 * @fdt_src: Source of FDT
251 */
252 enum fdt_source_t fdt_src;
Simon Glass40916e62020-10-03 09:25:22 -0600253#if CONFIG_IS_ENABLED(OF_LIVE)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200254 /**
255 * @of_root: root node of the live tree
256 */
Simon Glassa6eedb82017-05-18 20:08:53 -0600257 struct device_node *of_root;
258#endif
Jean-Jacques Hiblot7c530e32018-12-07 14:50:52 +0100259
260#if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200261 /**
262 * @multi_dtb_fit: pointer to uncompressed multi-dtb FIT image
263 */
264 const void *multi_dtb_fit;
Jean-Jacques Hiblot7c530e32018-12-07 14:50:52 +0100265#endif
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200266 /**
267 * @jt: jump table
268 *
269 * The jump table contains pointers to exported functions. A pointer to
270 * the jump table is passed to standalone applications.
271 */
272 struct jt_funcs *jt;
273 /**
274 * @env_buf: buffer for env_get() before reloc
275 */
276 char env_buf[32];
Simon Glass209a1a62013-06-11 11:14:42 -0700277#ifdef CONFIG_TRACE
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200278 /**
279 * @trace_buff: trace buffer
280 *
281 * When tracing function in U-Boot this field points to the buffer
282 * recording the function calls.
283 */
284 void *trace_buff;
Simon Glass209a1a62013-06-11 11:14:42 -0700285#endif
Tom Rini52b2e262021-08-18 23:12:24 -0400286#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200287 /**
288 * @cur_i2c_bus: currently used I2C bus
289 */
290 int cur_i2c_bus;
Heiko Schochere7d9c4f2012-01-16 21:12:23 +0000291#endif
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200292 /**
293 * @timebase_h: high 32 bits of timer
294 */
Peng Fan9a60a9e2017-05-09 10:32:03 +0800295 unsigned int timebase_h;
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200296 /**
297 * @timebase_l: low 32 bits of timer
298 */
Peng Fan9a60a9e2017-05-09 10:32:03 +0800299 unsigned int timebase_l;
Andy Yan1fa20e4d2017-07-24 17:43:34 +0800300#if CONFIG_VAL(SYS_MALLOC_F_LEN)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200301 /**
302 * @malloc_base: base address of early malloc()
303 */
304 unsigned long malloc_base;
305 /**
306 * @malloc_limit: limit address of early malloc()
307 */
308 unsigned long malloc_limit;
309 /**
310 * @malloc_ptr: current address of early malloc()
311 */
312 unsigned long malloc_ptr;
Simon Glass863e4042014-07-10 22:23:28 -0600313#endif
Bin Mengf1b81fc2014-12-30 22:53:21 +0800314#ifdef CONFIG_PCI
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200315 /**
316 * @hose: PCI hose for early use
317 */
318 struct pci_controller *hose;
319 /**
320 * @pci_ram_top: top of region accessible to PCI
321 */
322 phys_addr_t pci_ram_top;
Bin Mengf1b81fc2014-12-30 22:53:21 +0800323#endif
324#ifdef CONFIG_PCI_BOOTDELAY
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200325 /**
326 * @pcidelay_done: delay time before scanning of PIC hose expired
327 *
328 * If CONFIG_PCI_BOOTDELAY=y, pci_hose_scan() waits for the number of
329 * milliseconds defined by environment variable pcidelay before
330 * scanning. Once this delay has expired the flag @pcidelay_done
331 * is set to 1.
332 */
Bin Mengf1b81fc2014-12-30 22:53:21 +0800333 int pcidelay_done;
334#endif
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200335 /**
336 * @cur_serial_dev: current serial device
337 */
338 struct udevice *cur_serial_dev;
339 /**
340 * @arch: architecture-specific data
341 */
342 struct arch_global_data arch;
Simon Glass1bb49232015-11-08 23:47:48 -0700343#ifdef CONFIG_CONSOLE_RECORD
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200344 /**
345 * @console_out: output buffer for console recording
346 *
347 * This buffer is used to collect output during console recording.
348 */
349 struct membuff console_out;
350 /**
351 * @console_in: input buffer for console recording
352 *
353 * If console recording is activated, this buffer can be used to
354 * emulate input.
355 */
356 struct membuff console_in;
Simon Glass1bb49232015-11-08 23:47:48 -0700357#endif
Simon Glassfce58f52016-01-18 19:52:21 -0700358#ifdef CONFIG_DM_VIDEO
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200359 /**
360 * @video_top: top of video frame buffer area
361 */
362 ulong video_top;
363 /**
364 * @video_bottom: bottom of video frame buffer area
365 */
366 ulong video_bottom;
Simon Glassfce58f52016-01-18 19:52:21 -0700367#endif
Simon Glass88200332017-05-22 05:05:25 -0600368#ifdef CONFIG_BOOTSTAGE
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200369 /**
370 * @bootstage: boot stage information
371 */
372 struct bootstage_data *bootstage;
373 /**
374 * @new_bootstage: relocated boot stage information
375 */
376 struct bootstage_data *new_bootstage;
Simon Glass88200332017-05-22 05:05:25 -0600377#endif
Simon Glassd95645d2017-12-04 13:48:24 -0700378#ifdef CONFIG_LOG
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200379 /**
380 * @log_drop_count: number of dropped log messages
381 *
382 * This counter is incremented for each log message which can not
383 * be processed because logging is not yet available as signaled by
384 * flag %GD_FLG_LOG_READY in @flags.
385 */
386 int log_drop_count;
387 /**
388 * @default_log_level: default logging level
389 *
390 * For logging devices without filters @default_log_level defines the
391 * logging level, cf. &enum log_level_t.
392 */
393 int default_log_level;
394 /**
395 * @log_head: list of logging devices
396 */
397 struct list_head log_head;
398 /**
399 * @log_fmt: bit mask for logging format
400 *
401 * The @log_fmt bit mask selects the fields to be shown in log messages.
402 * &enum log_fmt defines the bits of the bit mask.
403 */
404 int log_fmt;
Heinrich Schuchardtfdf55992020-10-17 14:31:57 +0200405
406 /**
407 * @processing_msg: a log message is being processed
408 *
409 * This flag is used to suppress the creation of additional messages
410 * while another message is being processed.
411 */
412 bool processing_msg;
Heinrich Schuchardt0fc9f4f2020-10-17 14:31:58 +0200413 /**
414 * @logc_prev: logging category of previous message
415 *
416 * This value is used as logging category for continuation messages.
417 */
418 int logc_prev;
419 /**
Heinrich Schuchardt14e77222020-10-30 18:50:31 +0100420 * @logl_prev: logging level of the previous message
Heinrich Schuchardt0fc9f4f2020-10-17 14:31:58 +0200421 *
422 * This value is used as logging level for continuation messages.
423 */
424 int logl_prev;
Simon Glass5fc47e32021-01-20 20:10:53 -0700425 /**
426 * @log_cont: Previous log line did not finished wtih \n
427 *
428 * This allows for chained log messages on the same line
429 */
430 bool log_cont;
Simon Glassd95645d2017-12-04 13:48:24 -0700431#endif
Simon Glassa815dab2018-11-15 18:43:52 -0700432#if CONFIG_IS_ENABLED(BLOBLIST)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200433 /**
434 * @bloblist: blob list information
435 */
436 struct bloblist_hdr *bloblist;
437 /**
438 * @new_bloblist: relocated blob list information
439 */
440 struct bloblist_hdr *new_bloblist;
Ovidiu Panaitc1b30d52020-11-28 10:43:20 +0200441#endif
442#if CONFIG_IS_ENABLED(HANDOFF)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200443 /**
444 * @spl_handoff: SPL hand-off information
445 */
Simon Glasse14f1a22018-11-15 18:44:09 -0700446 struct spl_handoff *spl_handoff;
Simon Glassa815dab2018-11-15 18:43:52 -0700447#endif
Stefan Roese85bddff2019-04-12 16:42:28 +0200448#if defined(CONFIG_TRANSLATION_OFFSET)
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200449 /**
450 * @translation_offset: optional translation offset
451 *
452 * See CONFIG_TRANSLATION_OFFSET.
453 */
454 fdt_addr_t translation_offset;
Stefan Roese85bddff2019-04-12 16:42:28 +0200455#endif
Simon Glassde0115a2020-11-04 09:57:19 -0700456#ifdef CONFIG_GENERATE_ACPI_TABLE
457 /**
458 * @acpi_ctx: ACPI context pointer
459 */
460 struct acpi_ctx *acpi_ctx;
Simon Glassb33f2f92021-12-01 09:02:37 -0700461 /**
462 * @acpi_start: Start address of ACPI tables
463 */
464 ulong acpi_start;
Simon Glassde0115a2020-11-04 09:57:19 -0700465#endif
Simon Glassa05eb042021-02-04 21:17:20 -0700466#if CONFIG_IS_ENABLED(GENERATE_SMBIOS_TABLE)
467 /**
468 * @smbios_version: Points to SMBIOS type 0 version
469 */
470 char *smbios_version;
471#endif
Simon Glassaa4bce92022-03-04 08:43:00 -0700472#if CONFIG_IS_ENABLED(EVENT)
473 /**
474 * @event_state: Points to the current state of events
475 */
476 struct event_state event_state;
477#endif
Stefan Roese036f89a2022-09-02 13:57:48 +0200478#ifdef CONFIG_CYCLIC
479 /**
480 * @cyclic: cyclic driver data
481 */
482 struct cyclic_drv *cyclic;
483#endif
AKASHI Takahiroe04f4fb2022-03-08 20:36:46 +0900484 /**
485 * @dmtag_list: List of DM tags
486 */
487 struct list_head dmtag_list;
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200488};
Rasmus Villemoesb8cfd9e2021-05-18 11:19:47 +0200489#ifndef DO_DEPS_ONLY
490static_assert(sizeof(struct global_data) == GD_SIZE);
491#endif
Simon Glass0e724032012-12-13 20:49:12 +0000492
Heinrich Schuchardt50d92862020-10-05 08:30:09 +0200493/**
494 * gd_board_type() - retrieve board type
495 *
496 * Return: global board type
497 */
Simon Glassb4de3f32017-03-31 08:40:24 -0600498#ifdef CONFIG_BOARD_TYPES
499#define gd_board_type() gd->board_type
500#else
501#define gd_board_type() 0
502#endif
503
Simon Glass40916e62020-10-03 09:25:22 -0600504/* These macros help avoid #ifdefs in the code */
505#if CONFIG_IS_ENABLED(OF_LIVE)
506#define gd_of_root() gd->of_root
507#define gd_of_root_ptr() &gd->of_root
508#define gd_set_of_root(_root) gd->of_root = (_root)
509#else
510#define gd_of_root() NULL
511#define gd_of_root_ptr() NULL
512#define gd_set_of_root(_root)
513#endif
514
Simon Glass8beeb282021-03-15 17:25:36 +1300515#if CONFIG_IS_ENABLED(OF_PLATDATA_DRIVER_RT)
Simon Glasscfd6a002020-10-03 11:31:33 -0600516#define gd_set_dm_driver_rt(dyn) gd->dm_driver_rt = dyn
517#define gd_dm_driver_rt() gd->dm_driver_rt
518#else
519#define gd_set_dm_driver_rt(dyn)
520#define gd_dm_driver_rt() NULL
521#endif
522
Simon Glass8beeb282021-03-15 17:25:36 +1300523#if CONFIG_IS_ENABLED(OF_PLATDATA_RT)
524#define gd_set_dm_udevice_rt(dyn) gd->dm_udevice_rt = dyn
525#define gd_dm_udevice_rt() gd->dm_udevice_rt
Simon Glass8dee67a2021-03-15 17:25:38 +1300526#define gd_set_dm_priv_base(dyn) gd->dm_priv_base = dyn
527#define gd_dm_priv_base() gd->dm_priv_base
Simon Glass8beeb282021-03-15 17:25:36 +1300528#else
529#define gd_set_dm_udevice_rt(dyn)
530#define gd_dm_udevice_rt() NULL
Simon Glass8dee67a2021-03-15 17:25:38 +1300531#define gd_set_dm_priv_base(dyn)
532#define gd_dm_priv_base() NULL
Simon Glass8beeb282021-03-15 17:25:36 +1300533#endif
534
Simon Glassde0115a2020-11-04 09:57:19 -0700535#ifdef CONFIG_GENERATE_ACPI_TABLE
536#define gd_acpi_ctx() gd->acpi_ctx
Simon Glassb33f2f92021-12-01 09:02:37 -0700537#define gd_acpi_start() gd->acpi_start
538#define gd_set_acpi_start(addr) gd->acpi_start = addr
Simon Glassde0115a2020-11-04 09:57:19 -0700539#else
540#define gd_acpi_ctx() NULL
Simon Glassb33f2f92021-12-01 09:02:37 -0700541#define gd_acpi_start() 0UL
542#define gd_set_acpi_start(addr)
Simon Glassde0115a2020-11-04 09:57:19 -0700543#endif
544
Simon Glass69daf5a2021-12-16 20:59:25 -0700545#if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
546#define gd_multi_dtb_fit() gd->multi_dtb_fit
547#define gd_set_multi_dtb_fit(_dtb) gd->multi_dtb_fit = _dtb
548#else
549#define gd_multi_dtb_fit() NULL
550#define gd_set_multi_dtb_fit(_dtb)
551#endif
552
Simon Glassaa4bce92022-03-04 08:43:00 -0700553#if CONFIG_IS_ENABLED(EVENT_DYNAMIC)
554#define gd_event_state() ((struct event_state *)&gd->event_state)
555#else
556#define gd_event_state() NULL
557#endif
558
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200559/**
560 * enum gd_flags - global data flags
561 *
562 * See field flags of &struct global_data.
Simon Glass0e724032012-12-13 20:49:12 +0000563 */
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200564enum gd_flags {
565 /**
566 * @GD_FLG_RELOC: code was relocated to RAM
567 */
568 GD_FLG_RELOC = 0x00001,
569 /**
570 * @GD_FLG_DEVINIT: devices have been initialized
571 */
572 GD_FLG_DEVINIT = 0x00002,
573 /**
574 * @GD_FLG_SILENT: silent mode
575 */
576 GD_FLG_SILENT = 0x00004,
577 /**
578 * @GD_FLG_POSTFAIL: critical POST test failed
579 */
580 GD_FLG_POSTFAIL = 0x00008,
581 /**
582 * @GD_FLG_POSTSTOP: POST sequence aborted
583 */
584 GD_FLG_POSTSTOP = 0x00010,
585 /**
586 * @GD_FLG_LOGINIT: log Buffer has been initialized
587 */
588 GD_FLG_LOGINIT = 0x00020,
589 /**
590 * @GD_FLG_DISABLE_CONSOLE: disable console (in & out)
591 */
592 GD_FLG_DISABLE_CONSOLE = 0x00040,
593 /**
594 * @GD_FLG_ENV_READY: environment imported into hash table
595 */
596 GD_FLG_ENV_READY = 0x00080,
597 /**
598 * @GD_FLG_SERIAL_READY: pre-relocation serial console ready
599 */
600 GD_FLG_SERIAL_READY = 0x00100,
601 /**
602 * @GD_FLG_FULL_MALLOC_INIT: full malloc() is ready
603 */
604 GD_FLG_FULL_MALLOC_INIT = 0x00200,
605 /**
606 * @GD_FLG_SPL_INIT: spl_init() has been called
607 */
608 GD_FLG_SPL_INIT = 0x00400,
609 /**
610 * @GD_FLG_SKIP_RELOC: don't relocate
611 */
612 GD_FLG_SKIP_RELOC = 0x00800,
613 /**
614 * @GD_FLG_RECORD: record console
615 */
616 GD_FLG_RECORD = 0x01000,
617 /**
Simon Glassd6ed4af2021-05-08 06:59:56 -0600618 * @GD_FLG_RECORD_OVF: record console overflow
619 */
620 GD_FLG_RECORD_OVF = 0x02000,
621 /**
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200622 * @GD_FLG_ENV_DEFAULT: default variable flag
623 */
Simon Glassd6ed4af2021-05-08 06:59:56 -0600624 GD_FLG_ENV_DEFAULT = 0x04000,
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200625 /**
626 * @GD_FLG_SPL_EARLY_INIT: early SPL initialization is done
627 */
Simon Glassd6ed4af2021-05-08 06:59:56 -0600628 GD_FLG_SPL_EARLY_INIT = 0x08000,
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200629 /**
630 * @GD_FLG_LOG_READY: log system is ready for use
631 */
Simon Glassd6ed4af2021-05-08 06:59:56 -0600632 GD_FLG_LOG_READY = 0x10000,
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200633 /**
634 * @GD_FLG_WDT_READY: watchdog is ready for use
635 */
Simon Glassd6ed4af2021-05-08 06:59:56 -0600636 GD_FLG_WDT_READY = 0x20000,
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200637 /**
638 * @GD_FLG_SKIP_LL_INIT: don't perform low-level initialization
639 */
Simon Glassd6ed4af2021-05-08 06:59:56 -0600640 GD_FLG_SKIP_LL_INIT = 0x40000,
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200641 /**
642 * @GD_FLG_SMP_READY: SMP initialization is complete
643 */
Simon Glassd6ed4af2021-05-08 06:59:56 -0600644 GD_FLG_SMP_READY = 0x80000,
Heinrich Schuchardt1e5c4fe2020-10-05 08:30:08 +0200645};
646
647#endif /* __ASSEMBLY__ */
Simon Glass0e724032012-12-13 20:49:12 +0000648
649#endif /* __ASM_GENERIC_GBL_DATA_H */