blob: 45401d5e3c8a42714cd246f22b1d6154a4230031 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
wdenk0157ced2002-10-21 17:04:47 +00002/*
Wolfgang Denkf710efd2010-07-24 20:22:02 +02003 * (C) Copyright 2002-2010
wdenk0157ced2002-10-21 17:04:47 +00004 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
wdenk0157ced2002-10-21 17:04:47 +00005 */
6
7#ifndef __ASM_GBL_DATA_H
8#define __ASM_GBL_DATA_H
Simon Glass3ac47d72012-12-13 20:48:30 +00009
Siew Chin Lim3dbd3492021-02-23 14:34:37 +080010#ifndef __ASSEMBLY__
11
Tom Rini5dc7f612021-06-03 09:39:02 -040012#include <config.h>
13
Simon Glass3ba929a2020-10-30 21:38:53 -060014#include <linux/types.h>
Tom Rinidec7ea02024-05-20 13:35:03 -060015#include <asm/u-boot.h>
Simon Glass3ba929a2020-10-30 21:38:53 -060016
Simon Glass3ac47d72012-12-13 20:48:30 +000017/* Architecture-specific global data */
18struct arch_global_data {
Yangbo Lu73340382019-06-21 11:42:28 +080019#if defined(CONFIG_FSL_ESDHC) || defined(CONFIG_FSL_ESDHC_IMX)
Simon Glass9e247d12012-12-13 20:49:05 +000020 u32 sdhc_clk;
21#endif
Heinrich Schuchardtb10571a2023-12-19 16:04:02 +010022#if CONFIG_IS_ENABLED(ACPI)
23 ulong table_start; /* Start address of ACPI tables */
24 ulong table_end; /* End address of ACPI tables */
25 ulong table_start_high; /* Start address of high ACPI tables */
26 ulong table_end_high; /* End address of high ACPI tables */
27#endif
Yangbo Lu0fa68762019-12-19 18:59:28 +080028#if defined(CONFIG_FSL_ESDHC)
29 u32 sdhc_per_clk;
30#endif
31
Zhao Qiang5ad93952014-09-25 13:52:25 +080032#if defined(CONFIG_U_QE)
33 u32 qe_clk;
34 u32 brg_clk;
35 uint mp_alloc_base;
36 uint mp_alloc_top;
37#endif /* CONFIG_U_QE */
38
Simon Glasse61accc2012-12-13 20:48:31 +000039#ifdef CONFIG_AT91FAMILY
40 /* "static data" needed by at91's clock.c */
41 unsigned long cpu_clk_rate_hz;
42 unsigned long main_clk_rate_hz;
43 unsigned long mck_rate_hz;
44 unsigned long plla_rate_hz;
45 unsigned long pllb_rate_hz;
46 unsigned long at91_pllb_usb_init;
47#endif
Simon Glass6ed6e032012-12-13 20:48:32 +000048 /* "static data" needed by most of timer.c on ARM platforms */
49 unsigned long timer_rate_hz;
Peng Fanf2d397b2017-05-09 10:32:02 +080050 unsigned int tbu;
51 unsigned int tbl;
Simon Glassa848da52012-12-13 20:48:35 +000052 unsigned long lastinc;
Simon Glass9cbe003a2012-12-13 20:48:36 +000053 unsigned long long timer_reset_value;
Trevor Woerner43ec7e02019-05-03 09:41:00 -040054#if !(CONFIG_IS_ENABLED(SYS_ICACHE_OFF) && CONFIG_IS_ENABLED(SYS_DCACHE_OFF))
Simon Glass6b4ee152012-12-13 20:48:39 +000055 unsigned long tlb_addr;
Alexander Grafe317fe82016-03-04 01:09:47 +010056 unsigned long tlb_size;
Alexander Grafce0a64e2016-03-04 01:09:54 +010057#if defined(CONFIG_ARM64)
Alexander Grafe317fe82016-03-04 01:09:47 +010058 unsigned long tlb_fillptr;
59 unsigned long tlb_emerg;
Sergey Temerkhanov78eaa492015-10-14 09:55:45 -070060#endif
Simon Glass6b4ee152012-12-13 20:48:39 +000061#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -050062#ifdef CFG_SYS_MEM_RESERVE_SECURE
York Sun1ef95cc2016-06-24 16:46:18 -070063#define MEM_RESERVE_SECURE_SECURED 0x1
64#define MEM_RESERVE_SECURE_MAINTAINED 0x2
65#define MEM_RESERVE_SECURE_ADDR_MASK (~0x3)
66 /*
67 * Secure memory addr
68 * This variable needs maintenance if the RAM base is not zero,
69 * or if RAM splits into non-consecutive banks. It also has a
70 * flag indicating the secure memory is marked as secure by MMU.
71 * Flags used: 0x1 secured
72 * 0x2 maintained
73 */
74 phys_addr_t secure_ram;
York Sunf84f81e2016-06-24 16:46:19 -070075 unsigned long tlb_allocated;
York Sun1ef95cc2016-06-24 16:46:18 -070076#endif
York Sund6964b32017-03-06 09:02:24 -080077#ifdef CONFIG_RESV_RAM
78 /*
79 * Reserved RAM for memory resident, eg. Management Complex (MC)
80 * driver which continues to run after U-Boot exits.
81 */
82 phys_addr_t resv_ram;
83#endif
SRICHARAN R4af19882013-04-24 00:41:23 +000084
Masahiro Yamada6e1288c2017-04-25 13:10:11 +090085#ifdef CONFIG_ARCH_OMAP2PLUS
Paul Kocialkowskid5b76242015-07-15 16:02:19 +020086 u32 omap_boot_device;
87 u32 omap_boot_mode;
88 u8 omap_ch_flags;
SRICHARAN R4af19882013-04-24 00:41:23 +000089#endif
Prabhakar Kushwaha122bcfd2015-11-09 16:42:07 +053090#if defined(CONFIG_FSL_LSCH3) && defined(CONFIG_SYS_FSL_HAS_DP_DDR)
York Sun1ecab782015-01-06 13:18:49 -080091 unsigned long mem2_clk;
92#endif
Peng Fanf17a0ce2018-10-18 14:28:10 +020093
94#ifdef CONFIG_ARCH_IMX8
95 struct udevice *scu_dev;
96#endif
Ye Li0db17f42021-08-07 16:00:41 +080097
Peng Fand5c31832023-06-15 18:09:05 +080098#ifdef CONFIG_IMX_ELE
99 struct udevice *ele_dev;
Peng Fan3700c472022-07-26 16:40:56 +0800100 u32 soc_rev;
101 u32 lifecycle;
102 u32 uid[4];
Ye Li0db17f42021-08-07 16:00:41 +0800103#endif
104
Ye Li80b33152023-01-31 16:42:17 +0800105#ifdef CONFIG_ARCH_IMX8ULP
106 bool m33_handshake_done;
107#endif
Simon Glass9b388102023-09-19 21:00:15 -0600108#ifdef CONFIG_SMBIOS
109 ulong smbios_start; /* Start address of SMBIOS table */
110#endif
Simon Glass3ac47d72012-12-13 20:48:30 +0000111};
112
Simon Glass6878cd12012-12-13 20:49:14 +0000113#include <asm-generic/global_data.h>
wdenk0157ced2002-10-21 17:04:47 +0000114
Simon Glass6c8ec912022-08-03 12:13:08 -0600115#if defined(__clang__) || defined(LTO_ENABLE)
Jeroen Hofstee43614d12014-07-30 21:54:52 +0200116
117#define DECLARE_GLOBAL_DATA_PTR
118#define gd get_gd()
119
120static inline gd_t *get_gd(void)
121{
122 gd_t *gd_ptr;
123
124#ifdef CONFIG_ARM64
Jeroen Hofstee43614d12014-07-30 21:54:52 +0200125 __asm__ volatile("mov %0, x18\n" : "=r" (gd_ptr));
126#else
127 __asm__ volatile("mov %0, r9\n" : "=r" (gd_ptr));
128#endif
129
130 return gd_ptr;
131}
132
133#else
134
David Feng85fd5f12013-12-14 11:47:35 +0800135#ifdef CONFIG_ARM64
136#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("x18")
137#else
138#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r9")
139#endif
Jeroen Hofstee43614d12014-07-30 21:54:52 +0200140#endif
wdenk0157ced2002-10-21 17:04:47 +0000141
Heinrich Schuchardt1a3732c2020-05-27 01:58:30 +0200142static inline void set_gd(volatile gd_t *gd_ptr)
143{
144#ifdef CONFIG_ARM64
145 __asm__ volatile("ldr x18, %0\n" : : "m"(gd_ptr));
Marek BehĂșnc2854e02021-05-20 13:24:09 +0200146#elif __ARM_ARCH >= 7
Heinrich Schuchardt1a3732c2020-05-27 01:58:30 +0200147 __asm__ volatile("ldr r9, %0\n" : : "m"(gd_ptr));
Marek BehĂșnc2854e02021-05-20 13:24:09 +0200148#else
149 __asm__ volatile("mov r9, %0\n" : : "r"(gd_ptr));
Heinrich Schuchardt1a3732c2020-05-27 01:58:30 +0200150#endif
151}
152
Siew Chin Lim3dbd3492021-02-23 14:34:37 +0800153#endif /* __ASSEMBLY__ */
154
wdenk0157ced2002-10-21 17:04:47 +0000155#endif /* __ASM_GBL_DATA_H */