1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Copyright (c) 2012 The Chromium OS Authors.
4 * (C) Copyright 2002-2010
5 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
8 #ifndef __ASM_GENERIC_GBL_DATA_H
9 #define __ASM_GENERIC_GBL_DATA_H
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).
17 * Keep it *SMALL* and remember to set GENERATED_GBL_DATA_SIZE > sizeof(gd_t)
19 * Each architecture has its own private fields. For now all are private
25 #include <linux/list.h>
27 typedef struct global_data gd_t;
30 * struct global_data - global data structure
34 * @bd: board information
38 * @flags: global data flags
44 * @baudrate: baud rate of the serial interface
46 unsigned int baudrate;
48 * @cpu_clk: CPU clock rate in Hz
50 unsigned long cpu_clk;
52 * @bus_clk: platform clock rate in Hz
54 unsigned long bus_clk;
56 * @pci_clk: PCI clock rate in Hz
58 /* We cannot bracket this with CONFIG_PCI due to mpc5xxx */
59 unsigned long pci_clk;
61 * @mem_clk: memory clock rate in Hz
63 unsigned long mem_clk;
64 #if defined(CONFIG_LCD) || defined(CONFIG_VIDEO) || defined(CONFIG_DM_VIDEO)
66 * @fb_base: base address of frame buffer memory
68 unsigned long fb_base;
70 #if defined(CONFIG_POST)
72 * @post_log_word: active POST tests
74 * @post_log_word is a bit mask defining which POST tests are recorded
75 * (see constants POST_*).
77 unsigned long post_log_word;
79 * @post_log_res: POST results
81 * @post_log_res is a bit mask with the POST results. A bit with value 1
82 * indicates successful execution.
84 unsigned long post_log_res;
86 * @post_init_f_time: time in ms when post_init_f() started
88 unsigned long post_init_f_time;
90 #ifdef CONFIG_BOARD_TYPES
92 * @board_type: board type
94 * If a U-Boot configuration supports multiple board types, the actual
95 * board type may be stored in this field.
97 unsigned long board_type;
100 * @have_console: console is available
102 * A value of 1 indicates that serial_init() was called and a console
104 * A value of 0 indicates that console input and output drivers shall
107 unsigned long have_console;
108 #if CONFIG_IS_ENABLED(PRE_CONSOLE_BUFFER)
110 * @precon_buf_idx: pre-console buffer index
112 * @precon_buf_idx indicates the current position of the buffer used to
113 * collect output before the console becomes available
115 unsigned long precon_buf_idx;
118 * @env_addr: address of environment structure
120 * @env_addr contains the address of the structure holding the
121 * environment variables.
123 unsigned long env_addr;
125 * @env_valid: environment is valid
127 * See &enum env_valid
129 unsigned long env_valid;
131 * @env_has_init: bit mask indicating environment locations
133 * &enum env_location defines which bit relates to which location
135 unsigned long env_has_init;
137 * @env_load_prio: priority of the loaded environment
141 * @ram_base: base address of RAM used by U-Boot
143 unsigned long ram_base;
145 * @ram_top: top address of RAM used by U-Boot
147 unsigned long ram_top;
149 * @relocaddr: start address of U-Boot in RAM
151 * After relocation this field indicates the address to which U-Boot
152 * has been relocated. It can be displayed using the bdinfo command.
153 * Its value is needed to display the source code when debugging with
154 * GDB using the 'add-symbol-file u-boot <relocaddr>' command.
156 unsigned long relocaddr;
158 * @ram_size: RAM size in bytes
160 phys_size_t ram_size;
162 * @mon_len: monitor length in bytes
164 unsigned long mon_len;
166 * @irq_sp: IRQ stack pointer
168 unsigned long irq_sp;
170 * @start_addr_sp: initial stack pointer address
172 unsigned long start_addr_sp;
174 * @reloc_off: relocation offset
176 unsigned long reloc_off;
178 * @new_gd: pointer to relocated global data
180 struct global_data *new_gd;
184 * @dm_root: root instance for Driver Model
186 struct udevice *dm_root;
188 * @dm_root_f: pre-relocation root instance
190 struct udevice *dm_root_f;
192 * @uclass_root: head of core tree
194 struct list_head uclass_root;
198 * @timer: timer instance for Driver Model
200 struct udevice *timer;
203 * @fdt_blob: U-Boot's own device tree, NULL if none
205 const void *fdt_blob;
207 * @new_fdt: relocated device tree
211 * @fdt_size: space reserved for relocated device space
213 unsigned long fdt_size;
214 #ifdef CONFIG_OF_LIVE
216 * @of_root: root node of the live tree
218 struct device_node *of_root;
221 #if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
223 * @multi_dtb_fit: pointer to uncompressed multi-dtb FIT image
225 const void *multi_dtb_fit;
230 * The jump table contains pointers to exported functions. A pointer to
231 * the jump table is passed to standalone applications.
235 * @env_buf: buffer for env_get() before reloc
240 * @trace_buff: trace buffer
242 * When tracing function in U-Boot this field points to the buffer
243 * recording the function calls.
247 #if defined(CONFIG_SYS_I2C)
249 * @cur_i2c_bus: currently used I2C bus
254 * @timebase_h: high 32 bits of timer
256 unsigned int timebase_h;
258 * @timebase_l: low 32 bits of timer
260 unsigned int timebase_l;
261 #if CONFIG_VAL(SYS_MALLOC_F_LEN)
263 * @malloc_base: base address of early malloc()
265 unsigned long malloc_base;
267 * @malloc_limit: limit address of early malloc()
269 unsigned long malloc_limit;
271 * @malloc_ptr: current address of early malloc()
273 unsigned long malloc_ptr;
277 * @hose: PCI hose for early use
279 struct pci_controller *hose;
281 * @pci_ram_top: top of region accessible to PCI
283 phys_addr_t pci_ram_top;
285 #ifdef CONFIG_PCI_BOOTDELAY
287 * @pcidelay_done: delay time before scanning of PIC hose expired
289 * If CONFIG_PCI_BOOTDELAY=y, pci_hose_scan() waits for the number of
290 * milliseconds defined by environment variable pcidelay before
291 * scanning. Once this delay has expired the flag @pcidelay_done
297 * @cur_serial_dev: current serial device
299 struct udevice *cur_serial_dev;
301 * @arch: architecture-specific data
303 struct arch_global_data arch;
304 #ifdef CONFIG_CONSOLE_RECORD
306 * @console_out: output buffer for console recording
308 * This buffer is used to collect output during console recording.
310 struct membuff console_out;
312 * @console_in: input buffer for console recording
314 * If console recording is activated, this buffer can be used to
317 struct membuff console_in;
319 #ifdef CONFIG_DM_VIDEO
321 * @video_top: top of video frame buffer area
325 * @video_bottom: bottom of video frame buffer area
329 #ifdef CONFIG_BOOTSTAGE
331 * @bootstage: boot stage information
333 struct bootstage_data *bootstage;
335 * @new_bootstage: relocated boot stage information
337 struct bootstage_data *new_bootstage;
341 * @log_drop_count: number of dropped log messages
343 * This counter is incremented for each log message which can not
344 * be processed because logging is not yet available as signaled by
345 * flag %GD_FLG_LOG_READY in @flags.
349 * @default_log_level: default logging level
351 * For logging devices without filters @default_log_level defines the
352 * logging level, cf. &enum log_level_t.
354 int default_log_level;
356 * @log_head: list of logging devices
358 struct list_head log_head;
360 * @log_fmt: bit mask for logging format
362 * The @log_fmt bit mask selects the fields to be shown in log messages.
363 * &enum log_fmt defines the bits of the bit mask.
367 #if CONFIG_IS_ENABLED(BLOBLIST)
369 * @bloblist: blob list information
371 struct bloblist_hdr *bloblist;
373 * @new_bloblist: relocated blob list information
375 struct bloblist_hdr *new_bloblist;
378 * @spl_handoff: SPL hand-off information
380 struct spl_handoff *spl_handoff;
383 #if defined(CONFIG_TRANSLATION_OFFSET)
385 * @translation_offset: optional translation offset
387 * See CONFIG_TRANSLATION_OFFSET.
389 fdt_addr_t translation_offset;
391 #if CONFIG_IS_ENABLED(WDT)
393 * @watchdog_dev: watchdog device
395 struct udevice *watchdog_dev;
400 * gd_board_type() - retrieve board type
402 * Return: global board type
404 #ifdef CONFIG_BOARD_TYPES
405 #define gd_board_type() gd->board_type
407 #define gd_board_type() 0
411 * enum gd_flags - global data flags
413 * See field flags of &struct global_data.
417 * @GD_FLG_RELOC: code was relocated to RAM
419 GD_FLG_RELOC = 0x00001,
421 * @GD_FLG_DEVINIT: devices have been initialized
423 GD_FLG_DEVINIT = 0x00002,
425 * @GD_FLG_SILENT: silent mode
427 GD_FLG_SILENT = 0x00004,
429 * @GD_FLG_POSTFAIL: critical POST test failed
431 GD_FLG_POSTFAIL = 0x00008,
433 * @GD_FLG_POSTSTOP: POST sequence aborted
435 GD_FLG_POSTSTOP = 0x00010,
437 * @GD_FLG_LOGINIT: log Buffer has been initialized
439 GD_FLG_LOGINIT = 0x00020,
441 * @GD_FLG_DISABLE_CONSOLE: disable console (in & out)
443 GD_FLG_DISABLE_CONSOLE = 0x00040,
445 * @GD_FLG_ENV_READY: environment imported into hash table
447 GD_FLG_ENV_READY = 0x00080,
449 * @GD_FLG_SERIAL_READY: pre-relocation serial console ready
451 GD_FLG_SERIAL_READY = 0x00100,
453 * @GD_FLG_FULL_MALLOC_INIT: full malloc() is ready
455 GD_FLG_FULL_MALLOC_INIT = 0x00200,
457 * @GD_FLG_SPL_INIT: spl_init() has been called
459 GD_FLG_SPL_INIT = 0x00400,
461 * @GD_FLG_SKIP_RELOC: don't relocate
463 GD_FLG_SKIP_RELOC = 0x00800,
465 * @GD_FLG_RECORD: record console
467 GD_FLG_RECORD = 0x01000,
469 * @GD_FLG_ENV_DEFAULT: default variable flag
471 GD_FLG_ENV_DEFAULT = 0x02000,
473 * @GD_FLG_SPL_EARLY_INIT: early SPL initialization is done
475 GD_FLG_SPL_EARLY_INIT = 0x04000,
477 * @GD_FLG_LOG_READY: log system is ready for use
479 GD_FLG_LOG_READY = 0x08000,
481 * @GD_FLG_WDT_READY: watchdog is ready for use
483 GD_FLG_WDT_READY = 0x10000,
485 * @GD_FLG_SKIP_LL_INIT: don't perform low-level initialization
487 GD_FLG_SKIP_LL_INIT = 0x20000,
489 * @GD_FLG_SMP_READY: SMP initialization is complete
491 GD_FLG_SMP_READY = 0x40000,
494 #endif /* __ASSEMBLY__ */
496 #endif /* __ASM_GENERIC_GBL_DATA_H */