blob: 9d97517e124c916d1c8bb4fe208a6d411e99dbf6 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Rick Chen76c0a242017-12-26 13:55:51 +08002/*
3 * (C) Copyright 2002
4 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 *
6 * Copyright (c) 2017 Microsemi Corporation.
7 * Padmarao Begari, Microsemi Corporation <padmarao.begari@microsemi.com>
Rick Chen76c0a242017-12-26 13:55:51 +08008 */
9
10#ifndef __ASM_GBL_DATA_H
11#define __ASM_GBL_DATA_H
12
Lukas Auer83d573d2019-03-17 19:28:32 +010013#include <asm/smp.h>
Sean Anderson5aa00742020-06-24 06:41:16 -040014#include <asm/u-boot.h>
15#include <compiler.h>
Lukas Auer83d573d2019-03-17 19:28:32 +010016
Rick Chen76c0a242017-12-26 13:55:51 +080017/* Architecture-specific global data */
18struct arch_global_data {
Bin Meng89681a72018-12-12 06:12:45 -080019 long boot_hart; /* boot hart id */
Atish Patra111b8042020-04-21 11:15:01 -070020 phys_addr_t firmware_fdt_addr;
Bin Mengb5f03722023-06-21 23:11:46 +080021#if CONFIG_IS_ENABLED(RISCV_ACLINT)
22 void __iomem *aclint; /* aclint base address */
Bin Mengb6ee5e12018-12-12 06:12:30 -080023#endif
Yu Chien Peter Lin739cd6f2022-10-25 23:03:50 +080024#ifdef CONFIG_ANDES_PLICSW
Yu Chien Peter Lin52d54e12023-02-06 10:06:29 +080025 void __iomem *plicsw; /* andes plicsw base address */
Rick Chen6df4ed02019-04-02 15:56:39 +080026#endif
Bin Mengb161f902020-04-16 08:09:30 -070027#if CONFIG_IS_ENABLED(SMP)
Lukas Auer83d573d2019-03-17 19:28:32 +010028 struct ipi_data ipi[CONFIG_NR_CPUS];
29#endif
Nikita Shubin7e5e0292022-09-02 11:47:39 +030030#if !CONFIG_IS_ENABLED(XIP)
Rick Chen9c4d5c12022-09-21 14:34:54 +080031#ifdef CONFIG_AVAILABLE_HARTS
Lukas Auer83d573d2019-03-17 19:28:32 +010032 ulong available_harts;
Rick Chene5e6c362019-04-30 13:49:33 +080033#endif
Rick Chen9c4d5c12022-09-21 14:34:54 +080034#endif
Rick Chen76c0a242017-12-26 13:55:51 +080035};
36
37#include <asm-generic/global_data.h>
38
Rick Chenb34b4b92018-02-12 11:10:04 +080039#define DECLARE_GLOBAL_DATA_PTR register gd_t *gd asm ("gp")
Rick Chen76c0a242017-12-26 13:55:51 +080040
Heinrich Schuchardt6e7eb462020-09-10 07:47:39 +020041static inline void set_gd(volatile gd_t *gd_ptr)
42{
43#ifdef CONFIG_64BIT
44 asm volatile("ld gp, %0\n" : : "m"(gd_ptr));
45#else
46 asm volatile("lw gp, %0\n" : : "m"(gd_ptr));
47#endif
48}
49
Rick Chen76c0a242017-12-26 13:55:51 +080050#endif /* __ASM_GBL_DATA_H */