2018-05-06 21:58:06 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0+ */
|
2012-12-13 20:49:12 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2012 The Chromium OS Authors.
|
|
|
|
* (C) Copyright 2002-2010
|
|
|
|
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __ASM_GENERIC_GBL_DATA_H
|
|
|
|
#define __ASM_GENERIC_GBL_DATA_H
|
|
|
|
/*
|
|
|
|
* The following data structure is placed in some memory which is
|
|
|
|
* available very early after boot (like DPRAM on MPC8xx/MPC82xx, or
|
|
|
|
* some locked parts of the data cache) to allow for a minimum set of
|
|
|
|
* global variables during system initialization (until we have set
|
|
|
|
* up the memory controller so that we can use RAM).
|
|
|
|
*
|
|
|
|
* Keep it *SMALL* and remember to set GENERATED_GBL_DATA_SIZE > sizeof(gd_t)
|
|
|
|
*
|
|
|
|
* Each architecture has its own private fields. For now all are private
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __ASSEMBLY__
|
2022-09-02 11:57:48 +00:00
|
|
|
#include <cyclic.h>
|
2022-03-04 15:43:00 +00:00
|
|
|
#include <event_internal.h>
|
2019-04-12 14:42:28 +00:00
|
|
|
#include <fdtdec.h>
|
2015-11-09 06:47:48 +00:00
|
|
|
#include <membuff.h>
|
2014-02-26 22:59:18 +00:00
|
|
|
#include <linux/list.h>
|
global-data.h: add build-time sanity check of sizeof(struct global_data)
The layout and contents of struct global_data depends on a lot of
CONFIG_* preprocessor macros, not all of which are entirely converted
to Kconfig - not to mention weird games played here and there. This
can result in one translation unit using one definition of struct
global_data while the actual layout is another.
That can be very hard to debug. But we already have a mechanism that
can help catch such bugs at build time, namely the asm-offsets
machinery which is necessary anyway to provide assembly code with the
necessary constants. So make sure that every C translation unit that
include global_data.h actually sees the same size of struct
global_data as that which was seen by the asm-offsets.c TU.
It is likely that this patch will break the build of some boards. For
example, without the patch from Matt Merhar
(https://lists.denx.de/pipermail/u-boot/2021-May/450135.html) or some
other fix, this breaks P2041RDB_defconfig:
CC arch/powerpc/lib/traps.o
AS arch/powerpc/cpu/mpc85xx/start.o
In file included from include/asm-generic/global_data.h:26,
from ./arch/powerpc/include/asm/global_data.h:109,
from include/init.h:21,
from arch/powerpc/lib/traps.c:7:
include/linux/build_bug.h:99:41: error: static assertion failed: "sizeof(struct global_data) == GD_SIZE"
99 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
| ^~~~~~~~~~~~~~
include/linux/build_bug.h:98:34: note: in expansion of macro ‘__static_assert’
98 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
| ^~~~~~~~~~~~~~~
include/asm-generic/global_data.h:470:1: note: in expansion of macro ‘static_assert’
470 | static_assert(sizeof(struct global_data) == GD_SIZE);
| ^~~~~~~~~~~~~
make[1]: *** [scripts/Makefile.build:266: arch/powerpc/lib/traps.o] Error 1
make: *** [Makefile:1753: arch/powerpc/lib] Error 2
make: *** Waiting for unfinished jobs....
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Simon Glass <sjg@chromium.org>
2021-05-18 09:19:47 +00:00
|
|
|
#include <linux/build_bug.h>
|
|
|
|
#include <asm-offsets.h>
|
2014-02-26 22:59:18 +00:00
|
|
|
|
2020-11-04 16:57:19 +00:00
|
|
|
struct acpi_ctx;
|
2020-10-03 17:31:33 +00:00
|
|
|
struct driver_rt;
|
|
|
|
|
2020-10-05 06:30:09 +00:00
|
|
|
typedef struct global_data gd_t;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct global_data - global data structure
|
|
|
|
*/
|
|
|
|
struct global_data {
|
|
|
|
/**
|
|
|
|
* @bd: board information
|
|
|
|
*/
|
2020-02-24 17:22:27 +00:00
|
|
|
struct bd_info *bd;
|
2020-10-05 06:30:09 +00:00
|
|
|
/**
|
|
|
|
* @flags: global data flags
|
|
|
|
*
|
|
|
|
* See &enum gd_flags
|
|
|
|
*/
|
2012-12-13 20:49:12 +00:00
|
|
|
unsigned long flags;
|
2020-10-05 06:30:09 +00:00
|
|
|
/**
|
|
|
|
* @baudrate: baud rate of the serial interface
|
|
|
|
*/
|
2013-03-05 14:40:05 +00:00
|
|
|
unsigned int baudrate;
|
2020-10-05 06:30:09 +00:00
|
|
|
/**
|
|
|
|
* @cpu_clk: CPU clock rate in Hz
|
|
|
|
*/
|
|
|
|
unsigned long cpu_clk;
|
|
|
|
/**
|
|
|
|
* @bus_clk: platform clock rate in Hz
|
|
|
|
*/
|
2012-12-13 20:49:12 +00:00
|
|
|
unsigned long bus_clk;
|
2020-10-05 06:30:09 +00:00
|
|
|
/**
|
|
|
|
* @pci_clk: PCI clock rate in Hz
|
|
|
|
*/
|
2012-12-13 20:49:12 +00:00
|
|
|
/* We cannot bracket this with CONFIG_PCI due to mpc5xxx */
|
|
|
|
unsigned long pci_clk;
|
2020-10-05 06:30:09 +00:00
|
|
|
/**
|
|
|
|
* @mem_clk: memory clock rate in Hz
|
|
|
|
*/
|
2012-12-13 20:49:12 +00:00
|
|
|
unsigned long mem_clk;
|
2022-10-18 13:46:31 +00:00
|
|
|
#if defined(CONFIG_VIDEO)
|
2020-10-05 06:30:09 +00:00
|
|
|
/**
|
|
|
|
* @fb_base: base address of frame buffer memory
|
|
|
|
*/
|
|
|
|
unsigned long fb_base;
|
2012-12-13 20:49:12 +00:00
|
|
|
#endif
|
2017-12-04 20:48:23 +00:00
|
|
|
#if defined(CONFIG_POST)
|
2020-10-05 06:30:09 +00:00
|
|
|
/**
|
|
|
|
* @post_log_word: active POST tests
|
|
|
|
*
|
|
|
|
* @post_log_word is a bit mask defining which POST tests are recorded
|
|
|
|
* (see constants POST_*).
|
|
|
|
*/
|
|
|
|
unsigned long post_log_word;
|
|
|
|
/**
|
|
|
|
* @post_log_res: POST results
|
|
|
|
*
|
|
|
|
* @post_log_res is a bit mask with the POST results. A bit with value 1
|
|
|
|
* indicates successful execution.
|
|
|
|
*/
|
|
|
|
unsigned long post_log_res;
|
|
|
|
/**
|
|
|
|
* @post_init_f_time: time in ms when post_init_f() started
|
|
|
|
*/
|
|
|
|
unsigned long post_init_f_time;
|
2012-12-13 20:49:12 +00:00
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_BOARD_TYPES
|
2020-10-05 06:30:09 +00:00
|
|
|
/**
|
|
|
|
* @board_type: board type
|
|
|
|
*
|
|
|
|
* If a U-Boot configuration supports multiple board types, the actual
|
|
|
|
* board type may be stored in this field.
|
|
|
|
*/
|
2012-12-13 20:49:12 +00:00
|
|
|
unsigned long board_type;
|
|
|
|
#endif
|
2020-10-05 06:30:09 +00:00
|
|
|
/**
|
|
|
|
* @have_console: console is available
|
|
|
|
*
|
|
|
|
* A value of 1 indicates that serial_init() was called and a console
|
|
|
|
* is available.
|
|
|
|
* A value of 0 indicates that console input and output drivers shall
|
|
|
|
* not be called.
|
|
|
|
*/
|
|
|
|
unsigned long have_console;
|
2016-10-18 02:12:36 +00:00
|
|
|
#if CONFIG_IS_ENABLED(PRE_CONSOLE_BUFFER)
|
2020-10-05 06:30:09 +00:00
|
|
|
/**
|
|
|
|
* @precon_buf_idx: pre-console buffer index
|
|
|
|
*
|
2022-05-03 13:13:27 +00:00
|
|
|
* @precon_buf_idx indicates the current position of the
|
|
|
|
* buffer used to collect output before the console becomes
|
|
|
|
* available. When negative, the pre-console buffer is
|
|
|
|
* temporarily disabled (used when the pre-console buffer is
|
|
|
|
* being written out, to prevent adding its contents to
|
|
|
|
* itself).
|
2020-10-05 06:30:09 +00:00
|
|
|
*/
|
2022-05-03 13:13:27 +00:00
|
|
|
long precon_buf_idx;
|
2012-12-13 20:49:12 +00:00
|
|
|
#endif
|
2020-10-05 06:30:09 +00:00
|
|
|
/**
|
|
|
|
* @env_addr: address of environment structure
|
|
|
|
*
|
|
|
|
* @env_addr contains the address of the structure holding the
|
|
|
|
* environment variables.
|
|
|
|
*/
|
|
|
|
unsigned long env_addr;
|
|
|
|
/**
|
|
|
|
* @env_valid: environment is valid
|
|
|
|
*
|
|
|
|
* See &enum env_valid
|
|
|
|
*/
|
|
|
|
unsigned long env_valid;
|
|
|
|
/**
|
|
|
|
* @env_has_init: bit mask indicating environment locations
|
|
|
|
*
|
|
|
|
* &enum env_location defines which bit relates to which location
|
|
|
|
*/
|
|
|
|
unsigned long env_has_init;
|
|
|
|
/**
|
|
|
|
* @env_load_prio: priority of the loaded environment
|
|
|
|
*/
|
|
|
|
int env_load_prio;
|
|
|
|
/**
|
|
|
|
* @ram_base: base address of RAM used by U-Boot
|
|
|
|
*/
|
|
|
|
unsigned long ram_base;
|
|
|
|
/**
|
|
|
|
* @ram_top: top address of RAM used by U-Boot
|
|
|
|
*/
|
2021-01-31 12:35:59 +00:00
|
|
|
phys_addr_t ram_top;
|
2020-10-05 06:30:09 +00:00
|
|
|
/**
|
|
|
|
* @relocaddr: start address of U-Boot in RAM
|
|
|
|
*
|
|
|
|
* After relocation this field indicates the address to which U-Boot
|
|
|
|
* has been relocated. It can be displayed using the bdinfo command.
|
|
|
|
* Its value is needed to display the source code when debugging with
|
|
|
|
* GDB using the 'add-symbol-file u-boot <relocaddr>' command.
|
|
|
|
*/
|
|
|
|
unsigned long relocaddr;
|
|
|
|
/**
|
|
|
|
* @ram_size: RAM size in bytes
|
|
|
|
*/
|
|
|
|
phys_size_t ram_size;
|
|
|
|
/**
|
|
|
|
* @mon_len: monitor length in bytes
|
|
|
|
*/
|
|
|
|
unsigned long mon_len;
|
|
|
|
/**
|
|
|
|
* @irq_sp: IRQ stack pointer
|
|
|
|
*/
|
|
|
|
unsigned long irq_sp;
|
|
|
|
/**
|
|
|
|
* @start_addr_sp: initial stack pointer address
|
|
|
|
*/
|
|
|
|
unsigned long start_addr_sp;
|
|
|
|
/**
|
|
|
|
* @reloc_off: relocation offset
|
|
|
|
*/
|
2012-12-13 20:49:12 +00:00
|
|
|
unsigned long reloc_off;
|
2020-10-05 06:30:09 +00:00
|
|
|
/**
|
|
|
|
* @new_gd: pointer to relocated global data
|
|
|
|
*/
|
|
|
|
struct global_data *new_gd;
|
2014-02-26 22:59:18 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_DM
|
2020-10-05 06:30:09 +00:00
|
|
|
/**
|
|
|
|
* @dm_root: root instance for Driver Model
|
|
|
|
*/
|
|
|
|
struct udevice *dm_root;
|
|
|
|
/**
|
|
|
|
* @dm_root_f: pre-relocation root instance
|
|
|
|
*/
|
|
|
|
struct udevice *dm_root_f;
|
|
|
|
/**
|
2021-01-24 20:48:00 +00:00
|
|
|
* @uclass_root_s:
|
|
|
|
* head of core tree when uclasses are not in read-only memory.
|
|
|
|
*
|
|
|
|
* When uclasses are in read-only memory, @uclass_root_s is not used and
|
|
|
|
* @uclass_root points to the root node generated by dtoc.
|
2020-10-05 06:30:09 +00:00
|
|
|
*/
|
2020-12-19 17:40:17 +00:00
|
|
|
struct list_head uclass_root_s;
|
|
|
|
/**
|
2021-01-24 20:48:00 +00:00
|
|
|
* @uclass_root:
|
|
|
|
* pointer to head of core tree, if uclasses are in read-only memory and
|
|
|
|
* cannot be adjusted to use @uclass_root as a list head.
|
|
|
|
*
|
|
|
|
* When not in read-only memory, @uclass_root_s is used to hold the
|
|
|
|
* uclass root, and @uclass_root points to the address of
|
|
|
|
* @uclass_root_s.
|
2020-12-19 17:40:17 +00:00
|
|
|
*/
|
|
|
|
struct list_head *uclass_root;
|
2021-03-15 04:25:36 +00:00
|
|
|
# if CONFIG_IS_ENABLED(OF_PLATDATA_DRIVER_RT)
|
2020-11-30 00:07:05 +00:00
|
|
|
/** @dm_driver_rt: Dynamic info about the driver */
|
2020-10-03 17:31:33 +00:00
|
|
|
struct driver_rt *dm_driver_rt;
|
|
|
|
# endif
|
2021-03-15 04:25:36 +00:00
|
|
|
#if CONFIG_IS_ENABLED(OF_PLATDATA_RT)
|
|
|
|
/** @dm_udevice_rt: Dynamic info about the udevice */
|
|
|
|
struct udevice_rt *dm_udevice_rt;
|
2021-03-15 04:25:38 +00:00
|
|
|
/**
|
|
|
|
* @dm_priv_base: Base address of the priv/plat region used when
|
|
|
|
* udevices and uclasses are in read-only memory. This is NULL if not
|
|
|
|
* used
|
|
|
|
*/
|
|
|
|
void *dm_priv_base;
|
2021-03-15 04:25:36 +00:00
|
|
|
# endif
|
2014-02-26 22:59:18 +00:00
|
|
|
#endif
|
2015-10-09 05:46:34 +00:00
|
|
|
#ifdef CONFIG_TIMER
|
2020-10-05 06:30:09 +00:00
|
|
|
/**
|
|
|
|
* @timer: timer instance for Driver Model
|
|
|
|
*/
|
|
|
|
struct udevice *timer;
|
2015-10-09 05:46:34 +00:00
|
|
|
#endif
|
2020-10-05 06:30:09 +00:00
|
|
|
/**
|
|
|
|
* @fdt_blob: U-Boot's own device tree, NULL if none
|
|
|
|
*/
|
|
|
|
const void *fdt_blob;
|
|
|
|
/**
|
|
|
|
* @new_fdt: relocated device tree
|
|
|
|
*/
|
|
|
|
void *new_fdt;
|
|
|
|
/**
|
|
|
|
* @fdt_size: space reserved for relocated device space
|
|
|
|
*/
|
|
|
|
unsigned long fdt_size;
|
2021-12-17 03:59:33 +00:00
|
|
|
/**
|
|
|
|
* @fdt_src: Source of FDT
|
|
|
|
*/
|
|
|
|
enum fdt_source_t fdt_src;
|
2020-10-03 15:25:22 +00:00
|
|
|
#if CONFIG_IS_ENABLED(OF_LIVE)
|
2020-10-05 06:30:09 +00:00
|
|
|
/**
|
|
|
|
* @of_root: root node of the live tree
|
|
|
|
*/
|
2017-05-19 02:08:53 +00:00
|
|
|
struct device_node *of_root;
|
|
|
|
#endif
|
2018-12-07 13:50:52 +00:00
|
|
|
|
|
|
|
#if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
|
2020-10-05 06:30:09 +00:00
|
|
|
/**
|
|
|
|
* @multi_dtb_fit: pointer to uncompressed multi-dtb FIT image
|
|
|
|
*/
|
|
|
|
const void *multi_dtb_fit;
|
2018-12-07 13:50:52 +00:00
|
|
|
#endif
|
2020-10-05 06:30:09 +00:00
|
|
|
/**
|
|
|
|
* @jt: jump table
|
|
|
|
*
|
|
|
|
* The jump table contains pointers to exported functions. A pointer to
|
|
|
|
* the jump table is passed to standalone applications.
|
|
|
|
*/
|
|
|
|
struct jt_funcs *jt;
|
|
|
|
/**
|
|
|
|
* @env_buf: buffer for env_get() before reloc
|
|
|
|
*/
|
|
|
|
char env_buf[32];
|
2013-06-11 18:14:42 +00:00
|
|
|
#ifdef CONFIG_TRACE
|
2020-10-05 06:30:09 +00:00
|
|
|
/**
|
|
|
|
* @trace_buff: trace buffer
|
|
|
|
*
|
|
|
|
* When tracing function in U-Boot this field points to the buffer
|
|
|
|
* recording the function calls.
|
|
|
|
*/
|
|
|
|
void *trace_buff;
|
2012-01-16 21:12:23 +00:00
|
|
|
#endif
|
2021-08-19 03:12:24 +00:00
|
|
|
#if CONFIG_IS_ENABLED(SYS_I2C_LEGACY)
|
2020-10-05 06:30:09 +00:00
|
|
|
/**
|
|
|
|
* @cur_i2c_bus: currently used I2C bus
|
|
|
|
*/
|
|
|
|
int cur_i2c_bus;
|
2013-06-11 18:14:42 +00:00
|
|
|
#endif
|
2020-10-05 06:30:09 +00:00
|
|
|
/**
|
|
|
|
* @timebase_h: high 32 bits of timer
|
|
|
|
*/
|
2017-05-09 02:32:03 +00:00
|
|
|
unsigned int timebase_h;
|
2020-10-05 06:30:09 +00:00
|
|
|
/**
|
|
|
|
* @timebase_l: low 32 bits of timer
|
|
|
|
*/
|
2017-05-09 02:32:03 +00:00
|
|
|
unsigned int timebase_l;
|
2017-07-24 09:43:34 +00:00
|
|
|
#if CONFIG_VAL(SYS_MALLOC_F_LEN)
|
2020-10-05 06:30:09 +00:00
|
|
|
/**
|
|
|
|
* @malloc_base: base address of early malloc()
|
|
|
|
*/
|
|
|
|
unsigned long malloc_base;
|
|
|
|
/**
|
|
|
|
* @malloc_limit: limit address of early malloc()
|
|
|
|
*/
|
|
|
|
unsigned long malloc_limit;
|
|
|
|
/**
|
|
|
|
* @malloc_ptr: current address of early malloc()
|
|
|
|
*/
|
|
|
|
unsigned long malloc_ptr;
|
2014-12-30 14:53:21 +00:00
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_PCI
|
2020-10-05 06:30:09 +00:00
|
|
|
/**
|
|
|
|
* @hose: PCI hose for early use
|
|
|
|
*/
|
|
|
|
struct pci_controller *hose;
|
|
|
|
/**
|
|
|
|
* @pci_ram_top: top of region accessible to PCI
|
|
|
|
*/
|
|
|
|
phys_addr_t pci_ram_top;
|
2014-12-30 14:53:21 +00:00
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_PCI_BOOTDELAY
|
2020-10-05 06:30:09 +00:00
|
|
|
/**
|
|
|
|
* @pcidelay_done: delay time before scanning of PIC hose expired
|
|
|
|
*
|
|
|
|
* If CONFIG_PCI_BOOTDELAY=y, pci_hose_scan() waits for the number of
|
|
|
|
* milliseconds defined by environment variable pcidelay before
|
|
|
|
* scanning. Once this delay has expired the flag @pcidelay_done
|
|
|
|
* is set to 1.
|
|
|
|
*/
|
2014-12-30 14:53:21 +00:00
|
|
|
int pcidelay_done;
|
2014-07-11 04:23:28 +00:00
|
|
|
#endif
|
2020-10-05 06:30:09 +00:00
|
|
|
/**
|
|
|
|
* @cur_serial_dev: current serial device
|
|
|
|
*/
|
|
|
|
struct udevice *cur_serial_dev;
|
|
|
|
/**
|
|
|
|
* @arch: architecture-specific data
|
|
|
|
*/
|
|
|
|
struct arch_global_data arch;
|
2015-11-09 06:47:48 +00:00
|
|
|
#ifdef CONFIG_CONSOLE_RECORD
|
2020-10-05 06:30:09 +00:00
|
|
|
/**
|
|
|
|
* @console_out: output buffer for console recording
|
|
|
|
*
|
|
|
|
* This buffer is used to collect output during console recording.
|
|
|
|
*/
|
|
|
|
struct membuff console_out;
|
|
|
|
/**
|
|
|
|
* @console_in: input buffer for console recording
|
|
|
|
*
|
|
|
|
* If console recording is activated, this buffer can be used to
|
|
|
|
* emulate input.
|
|
|
|
*/
|
|
|
|
struct membuff console_in;
|
2015-11-09 06:47:48 +00:00
|
|
|
#endif
|
2022-10-18 13:46:31 +00:00
|
|
|
#ifdef CONFIG_VIDEO
|
2020-10-05 06:30:09 +00:00
|
|
|
/**
|
|
|
|
* @video_top: top of video frame buffer area
|
|
|
|
*/
|
|
|
|
ulong video_top;
|
|
|
|
/**
|
|
|
|
* @video_bottom: bottom of video frame buffer area
|
|
|
|
*/
|
|
|
|
ulong video_bottom;
|
2016-01-19 02:52:21 +00:00
|
|
|
#endif
|
2017-05-22 11:05:25 +00:00
|
|
|
#ifdef CONFIG_BOOTSTAGE
|
2020-10-05 06:30:09 +00:00
|
|
|
/**
|
|
|
|
* @bootstage: boot stage information
|
|
|
|
*/
|
|
|
|
struct bootstage_data *bootstage;
|
|
|
|
/**
|
|
|
|
* @new_bootstage: relocated boot stage information
|
|
|
|
*/
|
|
|
|
struct bootstage_data *new_bootstage;
|
2017-05-22 11:05:25 +00:00
|
|
|
#endif
|
2017-12-04 20:48:24 +00:00
|
|
|
#ifdef CONFIG_LOG
|
2020-10-05 06:30:09 +00:00
|
|
|
/**
|
|
|
|
* @log_drop_count: number of dropped log messages
|
|
|
|
*
|
|
|
|
* This counter is incremented for each log message which can not
|
|
|
|
* be processed because logging is not yet available as signaled by
|
|
|
|
* flag %GD_FLG_LOG_READY in @flags.
|
|
|
|
*/
|
|
|
|
int log_drop_count;
|
|
|
|
/**
|
|
|
|
* @default_log_level: default logging level
|
|
|
|
*
|
|
|
|
* For logging devices without filters @default_log_level defines the
|
|
|
|
* logging level, cf. &enum log_level_t.
|
|
|
|
*/
|
|
|
|
int default_log_level;
|
|
|
|
/**
|
|
|
|
* @log_head: list of logging devices
|
|
|
|
*/
|
|
|
|
struct list_head log_head;
|
|
|
|
/**
|
|
|
|
* @log_fmt: bit mask for logging format
|
|
|
|
*
|
|
|
|
* The @log_fmt bit mask selects the fields to be shown in log messages.
|
|
|
|
* &enum log_fmt defines the bits of the bit mask.
|
|
|
|
*/
|
|
|
|
int log_fmt;
|
2020-10-17 12:31:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @processing_msg: a log message is being processed
|
|
|
|
*
|
|
|
|
* This flag is used to suppress the creation of additional messages
|
|
|
|
* while another message is being processed.
|
|
|
|
*/
|
|
|
|
bool processing_msg;
|
2020-10-17 12:31:58 +00:00
|
|
|
/**
|
|
|
|
* @logc_prev: logging category of previous message
|
|
|
|
*
|
|
|
|
* This value is used as logging category for continuation messages.
|
|
|
|
*/
|
|
|
|
int logc_prev;
|
|
|
|
/**
|
2020-10-30 17:50:31 +00:00
|
|
|
* @logl_prev: logging level of the previous message
|
2020-10-17 12:31:58 +00:00
|
|
|
*
|
|
|
|
* This value is used as logging level for continuation messages.
|
|
|
|
*/
|
|
|
|
int logl_prev;
|
2021-01-21 03:10:53 +00:00
|
|
|
/**
|
|
|
|
* @log_cont: Previous log line did not finished wtih \n
|
|
|
|
*
|
|
|
|
* This allows for chained log messages on the same line
|
|
|
|
*/
|
|
|
|
bool log_cont;
|
2017-12-04 20:48:24 +00:00
|
|
|
#endif
|
2018-11-16 01:43:52 +00:00
|
|
|
#if CONFIG_IS_ENABLED(BLOBLIST)
|
2020-10-05 06:30:09 +00:00
|
|
|
/**
|
|
|
|
* @bloblist: blob list information
|
|
|
|
*/
|
|
|
|
struct bloblist_hdr *bloblist;
|
|
|
|
/**
|
|
|
|
* @new_bloblist: relocated blob list information
|
|
|
|
*/
|
|
|
|
struct bloblist_hdr *new_bloblist;
|
2020-11-28 08:43:20 +00:00
|
|
|
#endif
|
|
|
|
#if CONFIG_IS_ENABLED(HANDOFF)
|
2020-10-05 06:30:09 +00:00
|
|
|
/**
|
|
|
|
* @spl_handoff: SPL hand-off information
|
|
|
|
*/
|
2018-11-16 01:44:09 +00:00
|
|
|
struct spl_handoff *spl_handoff;
|
2018-11-16 01:43:52 +00:00
|
|
|
#endif
|
2019-04-12 14:42:28 +00:00
|
|
|
#if defined(CONFIG_TRANSLATION_OFFSET)
|
2020-10-05 06:30:09 +00:00
|
|
|
/**
|
|
|
|
* @translation_offset: optional translation offset
|
|
|
|
*
|
|
|
|
* See CONFIG_TRANSLATION_OFFSET.
|
|
|
|
*/
|
|
|
|
fdt_addr_t translation_offset;
|
2019-04-12 14:42:28 +00:00
|
|
|
#endif
|
2020-11-04 16:57:19 +00:00
|
|
|
#ifdef CONFIG_GENERATE_ACPI_TABLE
|
|
|
|
/**
|
|
|
|
* @acpi_ctx: ACPI context pointer
|
|
|
|
*/
|
|
|
|
struct acpi_ctx *acpi_ctx;
|
2021-12-01 16:02:37 +00:00
|
|
|
/**
|
|
|
|
* @acpi_start: Start address of ACPI tables
|
|
|
|
*/
|
|
|
|
ulong acpi_start;
|
2020-11-04 16:57:19 +00:00
|
|
|
#endif
|
2021-02-05 04:17:20 +00:00
|
|
|
#if CONFIG_IS_ENABLED(GENERATE_SMBIOS_TABLE)
|
|
|
|
/**
|
|
|
|
* @smbios_version: Points to SMBIOS type 0 version
|
|
|
|
*/
|
|
|
|
char *smbios_version;
|
|
|
|
#endif
|
2022-03-04 15:43:00 +00:00
|
|
|
#if CONFIG_IS_ENABLED(EVENT)
|
|
|
|
/**
|
|
|
|
* @event_state: Points to the current state of events
|
|
|
|
*/
|
|
|
|
struct event_state event_state;
|
2022-09-02 11:57:48 +00:00
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_CYCLIC
|
|
|
|
/**
|
cyclic: get rid of cyclic_init()
Currently, we must call cyclic_init() at some point before
cyclic_register() becomes possible. That turns out to be somewhat
awkward, especially with SPL, and has resulted in a watchdog callback
not being registered, thus causing the board to prematurely reset.
We already rely on gd->cyclic reliably being set to NULL by the asm
code that clears all of gd. Now that the cyclic list is a hlist, and
thus an empty list is represented by a NULL head pointer, and struct
cyclic_drv has no other members, we can just as well drop a level of
indirection and put the hlist_head directly in struct
global_data. This doesn't increase the size of struct global_data,
gets rid of an early malloc(), and generates slightly smaller code.
But primarily, this avoids having to call cyclic_init() early; the cyclic
infrastructure is simply ready to register callbacks as soon as we
enter C code.
We can still end up with schedule() being called from asm very early,
so we still need to check that gd itself has been properly initialized
[*], but once it has, gd->cyclic_list is perfectly fine to access, and
will just be an empty list.
As for cyclic_uninit(), it was never really the opposite of
cyclic_init() since it didn't free the struct cyclic_drv nor set
gd->cyclic to NULL. Rename it to cyclic_unregister_all() and use that
in test/, and also insert a call at the end of the board_init_f
sequence so that gd->cyclic_list is a fresh empty list before we enter
board_init_r().
A small piece of ugliness is that I had to add a cast in
cyclic_get_list() to silence a "discards 'volatile' qualifier"
warning, but that is completely equivalent to the existing handling of
the uclass_root_s list_head member.
[*] I'm not really sure where we guarantee that the register used for
gd contains 0 until it gets explicitly initialized, but that must be
the case, otherwise testing gd for being NULL would not make much sense.
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
Tested-by: Tim Harvey <tharvey@gateworks.com> # imx8mm-venice-*
2022-10-28 11:50:54 +00:00
|
|
|
* @cyclic_list: list of registered cyclic functions
|
2022-09-02 11:57:48 +00:00
|
|
|
*/
|
cyclic: get rid of cyclic_init()
Currently, we must call cyclic_init() at some point before
cyclic_register() becomes possible. That turns out to be somewhat
awkward, especially with SPL, and has resulted in a watchdog callback
not being registered, thus causing the board to prematurely reset.
We already rely on gd->cyclic reliably being set to NULL by the asm
code that clears all of gd. Now that the cyclic list is a hlist, and
thus an empty list is represented by a NULL head pointer, and struct
cyclic_drv has no other members, we can just as well drop a level of
indirection and put the hlist_head directly in struct
global_data. This doesn't increase the size of struct global_data,
gets rid of an early malloc(), and generates slightly smaller code.
But primarily, this avoids having to call cyclic_init() early; the cyclic
infrastructure is simply ready to register callbacks as soon as we
enter C code.
We can still end up with schedule() being called from asm very early,
so we still need to check that gd itself has been properly initialized
[*], but once it has, gd->cyclic_list is perfectly fine to access, and
will just be an empty list.
As for cyclic_uninit(), it was never really the opposite of
cyclic_init() since it didn't free the struct cyclic_drv nor set
gd->cyclic to NULL. Rename it to cyclic_unregister_all() and use that
in test/, and also insert a call at the end of the board_init_f
sequence so that gd->cyclic_list is a fresh empty list before we enter
board_init_r().
A small piece of ugliness is that I had to add a cast in
cyclic_get_list() to silence a "discards 'volatile' qualifier"
warning, but that is completely equivalent to the existing handling of
the uclass_root_s list_head member.
[*] I'm not really sure where we guarantee that the register used for
gd contains 0 until it gets explicitly initialized, but that must be
the case, otherwise testing gd for being NULL would not make much sense.
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Stefan Roese <sr@denx.de>
Tested-by: Tim Harvey <tharvey@gateworks.com> # imx8mm-venice-*
2022-10-28 11:50:54 +00:00
|
|
|
struct hlist_head cyclic_list;
|
2022-03-04 15:43:00 +00:00
|
|
|
#endif
|
2022-03-08 11:36:46 +00:00
|
|
|
/**
|
|
|
|
* @dmtag_list: List of DM tags
|
|
|
|
*/
|
|
|
|
struct list_head dmtag_list;
|
2020-10-05 06:30:09 +00:00
|
|
|
};
|
global-data.h: add build-time sanity check of sizeof(struct global_data)
The layout and contents of struct global_data depends on a lot of
CONFIG_* preprocessor macros, not all of which are entirely converted
to Kconfig - not to mention weird games played here and there. This
can result in one translation unit using one definition of struct
global_data while the actual layout is another.
That can be very hard to debug. But we already have a mechanism that
can help catch such bugs at build time, namely the asm-offsets
machinery which is necessary anyway to provide assembly code with the
necessary constants. So make sure that every C translation unit that
include global_data.h actually sees the same size of struct
global_data as that which was seen by the asm-offsets.c TU.
It is likely that this patch will break the build of some boards. For
example, without the patch from Matt Merhar
(https://lists.denx.de/pipermail/u-boot/2021-May/450135.html) or some
other fix, this breaks P2041RDB_defconfig:
CC arch/powerpc/lib/traps.o
AS arch/powerpc/cpu/mpc85xx/start.o
In file included from include/asm-generic/global_data.h:26,
from ./arch/powerpc/include/asm/global_data.h:109,
from include/init.h:21,
from arch/powerpc/lib/traps.c:7:
include/linux/build_bug.h:99:41: error: static assertion failed: "sizeof(struct global_data) == GD_SIZE"
99 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
| ^~~~~~~~~~~~~~
include/linux/build_bug.h:98:34: note: in expansion of macro ‘__static_assert’
98 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
| ^~~~~~~~~~~~~~~
include/asm-generic/global_data.h:470:1: note: in expansion of macro ‘static_assert’
470 | static_assert(sizeof(struct global_data) == GD_SIZE);
| ^~~~~~~~~~~~~
make[1]: *** [scripts/Makefile.build:266: arch/powerpc/lib/traps.o] Error 1
make: *** [Makefile:1753: arch/powerpc/lib] Error 2
make: *** Waiting for unfinished jobs....
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Simon Glass <sjg@chromium.org>
2021-05-18 09:19:47 +00:00
|
|
|
#ifndef DO_DEPS_ONLY
|
|
|
|
static_assert(sizeof(struct global_data) == GD_SIZE);
|
|
|
|
#endif
|
2012-12-13 20:49:12 +00:00
|
|
|
|
2020-10-05 06:30:09 +00:00
|
|
|
/**
|
|
|
|
* gd_board_type() - retrieve board type
|
|
|
|
*
|
|
|
|
* Return: global board type
|
|
|
|
*/
|
2017-03-31 14:40:24 +00:00
|
|
|
#ifdef CONFIG_BOARD_TYPES
|
|
|
|
#define gd_board_type() gd->board_type
|
|
|
|
#else
|
|
|
|
#define gd_board_type() 0
|
|
|
|
#endif
|
|
|
|
|
2020-10-03 15:25:22 +00:00
|
|
|
/* These macros help avoid #ifdefs in the code */
|
|
|
|
#if CONFIG_IS_ENABLED(OF_LIVE)
|
|
|
|
#define gd_of_root() gd->of_root
|
|
|
|
#define gd_of_root_ptr() &gd->of_root
|
|
|
|
#define gd_set_of_root(_root) gd->of_root = (_root)
|
|
|
|
#else
|
|
|
|
#define gd_of_root() NULL
|
|
|
|
#define gd_of_root_ptr() NULL
|
|
|
|
#define gd_set_of_root(_root)
|
|
|
|
#endif
|
|
|
|
|
2021-03-15 04:25:36 +00:00
|
|
|
#if CONFIG_IS_ENABLED(OF_PLATDATA_DRIVER_RT)
|
2020-10-03 17:31:33 +00:00
|
|
|
#define gd_set_dm_driver_rt(dyn) gd->dm_driver_rt = dyn
|
|
|
|
#define gd_dm_driver_rt() gd->dm_driver_rt
|
|
|
|
#else
|
|
|
|
#define gd_set_dm_driver_rt(dyn)
|
|
|
|
#define gd_dm_driver_rt() NULL
|
|
|
|
#endif
|
|
|
|
|
2021-03-15 04:25:36 +00:00
|
|
|
#if CONFIG_IS_ENABLED(OF_PLATDATA_RT)
|
|
|
|
#define gd_set_dm_udevice_rt(dyn) gd->dm_udevice_rt = dyn
|
|
|
|
#define gd_dm_udevice_rt() gd->dm_udevice_rt
|
2021-03-15 04:25:38 +00:00
|
|
|
#define gd_set_dm_priv_base(dyn) gd->dm_priv_base = dyn
|
|
|
|
#define gd_dm_priv_base() gd->dm_priv_base
|
2021-03-15 04:25:36 +00:00
|
|
|
#else
|
|
|
|
#define gd_set_dm_udevice_rt(dyn)
|
|
|
|
#define gd_dm_udevice_rt() NULL
|
2021-03-15 04:25:38 +00:00
|
|
|
#define gd_set_dm_priv_base(dyn)
|
|
|
|
#define gd_dm_priv_base() NULL
|
2021-03-15 04:25:36 +00:00
|
|
|
#endif
|
|
|
|
|
2020-11-04 16:57:19 +00:00
|
|
|
#ifdef CONFIG_GENERATE_ACPI_TABLE
|
|
|
|
#define gd_acpi_ctx() gd->acpi_ctx
|
2021-12-01 16:02:37 +00:00
|
|
|
#define gd_acpi_start() gd->acpi_start
|
|
|
|
#define gd_set_acpi_start(addr) gd->acpi_start = addr
|
2020-11-04 16:57:19 +00:00
|
|
|
#else
|
|
|
|
#define gd_acpi_ctx() NULL
|
2021-12-01 16:02:37 +00:00
|
|
|
#define gd_acpi_start() 0UL
|
|
|
|
#define gd_set_acpi_start(addr)
|
2020-11-04 16:57:19 +00:00
|
|
|
#endif
|
|
|
|
|
2021-12-17 03:59:25 +00:00
|
|
|
#if CONFIG_IS_ENABLED(MULTI_DTB_FIT)
|
|
|
|
#define gd_multi_dtb_fit() gd->multi_dtb_fit
|
|
|
|
#define gd_set_multi_dtb_fit(_dtb) gd->multi_dtb_fit = _dtb
|
|
|
|
#else
|
|
|
|
#define gd_multi_dtb_fit() NULL
|
|
|
|
#define gd_set_multi_dtb_fit(_dtb)
|
|
|
|
#endif
|
|
|
|
|
2022-03-04 15:43:00 +00:00
|
|
|
#if CONFIG_IS_ENABLED(EVENT_DYNAMIC)
|
|
|
|
#define gd_event_state() ((struct event_state *)&gd->event_state)
|
|
|
|
#else
|
|
|
|
#define gd_event_state() NULL
|
|
|
|
#endif
|
|
|
|
|
2020-10-05 06:30:08 +00:00
|
|
|
/**
|
|
|
|
* enum gd_flags - global data flags
|
|
|
|
*
|
|
|
|
* See field flags of &struct global_data.
|
2012-12-13 20:49:12 +00:00
|
|
|
*/
|
2020-10-05 06:30:08 +00:00
|
|
|
enum gd_flags {
|
|
|
|
/**
|
|
|
|
* @GD_FLG_RELOC: code was relocated to RAM
|
|
|
|
*/
|
|
|
|
GD_FLG_RELOC = 0x00001,
|
|
|
|
/**
|
|
|
|
* @GD_FLG_DEVINIT: devices have been initialized
|
|
|
|
*/
|
|
|
|
GD_FLG_DEVINIT = 0x00002,
|
|
|
|
/**
|
|
|
|
* @GD_FLG_SILENT: silent mode
|
|
|
|
*/
|
|
|
|
GD_FLG_SILENT = 0x00004,
|
|
|
|
/**
|
|
|
|
* @GD_FLG_POSTFAIL: critical POST test failed
|
|
|
|
*/
|
|
|
|
GD_FLG_POSTFAIL = 0x00008,
|
|
|
|
/**
|
|
|
|
* @GD_FLG_POSTSTOP: POST sequence aborted
|
|
|
|
*/
|
|
|
|
GD_FLG_POSTSTOP = 0x00010,
|
|
|
|
/**
|
|
|
|
* @GD_FLG_LOGINIT: log Buffer has been initialized
|
|
|
|
*/
|
|
|
|
GD_FLG_LOGINIT = 0x00020,
|
|
|
|
/**
|
|
|
|
* @GD_FLG_DISABLE_CONSOLE: disable console (in & out)
|
|
|
|
*/
|
|
|
|
GD_FLG_DISABLE_CONSOLE = 0x00040,
|
|
|
|
/**
|
|
|
|
* @GD_FLG_ENV_READY: environment imported into hash table
|
|
|
|
*/
|
|
|
|
GD_FLG_ENV_READY = 0x00080,
|
|
|
|
/**
|
|
|
|
* @GD_FLG_SERIAL_READY: pre-relocation serial console ready
|
|
|
|
*/
|
|
|
|
GD_FLG_SERIAL_READY = 0x00100,
|
|
|
|
/**
|
|
|
|
* @GD_FLG_FULL_MALLOC_INIT: full malloc() is ready
|
|
|
|
*/
|
|
|
|
GD_FLG_FULL_MALLOC_INIT = 0x00200,
|
|
|
|
/**
|
|
|
|
* @GD_FLG_SPL_INIT: spl_init() has been called
|
|
|
|
*/
|
|
|
|
GD_FLG_SPL_INIT = 0x00400,
|
|
|
|
/**
|
|
|
|
* @GD_FLG_SKIP_RELOC: don't relocate
|
|
|
|
*/
|
|
|
|
GD_FLG_SKIP_RELOC = 0x00800,
|
|
|
|
/**
|
|
|
|
* @GD_FLG_RECORD: record console
|
|
|
|
*/
|
|
|
|
GD_FLG_RECORD = 0x01000,
|
2021-05-08 12:59:56 +00:00
|
|
|
/**
|
|
|
|
* @GD_FLG_RECORD_OVF: record console overflow
|
|
|
|
*/
|
|
|
|
GD_FLG_RECORD_OVF = 0x02000,
|
2020-10-05 06:30:08 +00:00
|
|
|
/**
|
|
|
|
* @GD_FLG_ENV_DEFAULT: default variable flag
|
|
|
|
*/
|
2021-05-08 12:59:56 +00:00
|
|
|
GD_FLG_ENV_DEFAULT = 0x04000,
|
2020-10-05 06:30:08 +00:00
|
|
|
/**
|
|
|
|
* @GD_FLG_SPL_EARLY_INIT: early SPL initialization is done
|
|
|
|
*/
|
2021-05-08 12:59:56 +00:00
|
|
|
GD_FLG_SPL_EARLY_INIT = 0x08000,
|
2020-10-05 06:30:08 +00:00
|
|
|
/**
|
|
|
|
* @GD_FLG_LOG_READY: log system is ready for use
|
|
|
|
*/
|
2021-05-08 12:59:56 +00:00
|
|
|
GD_FLG_LOG_READY = 0x10000,
|
2020-10-05 06:30:08 +00:00
|
|
|
/**
|
2022-11-17 08:20:34 +00:00
|
|
|
* @GD_FLG_CYCLIC_RUNNING: cyclic_run is in progress
|
2020-10-05 06:30:08 +00:00
|
|
|
*/
|
2022-11-17 08:20:34 +00:00
|
|
|
GD_FLG_CYCLIC_RUNNING = 0x20000,
|
2020-10-05 06:30:08 +00:00
|
|
|
/**
|
|
|
|
* @GD_FLG_SKIP_LL_INIT: don't perform low-level initialization
|
|
|
|
*/
|
2021-05-08 12:59:56 +00:00
|
|
|
GD_FLG_SKIP_LL_INIT = 0x40000,
|
2020-10-05 06:30:08 +00:00
|
|
|
/**
|
|
|
|
* @GD_FLG_SMP_READY: SMP initialization is complete
|
|
|
|
*/
|
2021-05-08 12:59:56 +00:00
|
|
|
GD_FLG_SMP_READY = 0x80000,
|
2022-09-07 02:27:06 +00:00
|
|
|
/**
|
|
|
|
* @GD_FLG_FDT_CHANGED: Device tree change has been detected by tests
|
|
|
|
*/
|
|
|
|
GD_FLG_FDT_CHANGED = 0x100000,
|
2023-02-13 15:56:32 +00:00
|
|
|
/**
|
|
|
|
* @GD_FLG_OF_TAG_MIGRATE: Device tree has old u-boot,dm- tags
|
|
|
|
*/
|
|
|
|
GD_FLG_OF_TAG_MIGRATE = 0x200000,
|
2020-10-05 06:30:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __ASSEMBLY__ */
|
2012-12-13 20:49:12 +00:00
|
|
|
|
|
|
|
#endif /* __ASM_GENERIC_GBL_DATA_H */
|