summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2023-01-19 17:46:57 +0300
committerTom Rini <trini@konsulko.com>2023-01-19 17:46:57 +0300
commit53c47c59e638cc118c272235db516bb541dad0ac (patch)
treecd40236202c66c25e6f311f2654ebcfa087ed2b1 /arch
parent7aec35be4b5fa7aabc0ece03dc8825495d86a1be (diff)
parent4c5907889553696160fabaa7e9f0c96ed1fa6597 (diff)
downloadu-boot-53c47c59e638cc118c272235db516bb541dad0ac.tar.xz
Merge tag 'dm-pull-18jan23' of https://source.denx.de/u-boot/custodians/u-boot-dm
convert rockchip to use binman patman fix for checkpatch binman optional entries, improved support for ELF symbols trace improvements minor fdt refactoring
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/cpu/armv7/s5p-common/timer.c2
-rw-r--r--arch/arm/cpu/armv8/generic_timer.c6
-rw-r--r--arch/arm/dts/px30-ringneck-haikou-u-boot.dtsi2
-rw-r--r--arch/arm/dts/rk3399-puma-haikou-u-boot.dtsi4
-rw-r--r--arch/arm/dts/rk3399-u-boot.dtsi3
-rw-r--r--arch/arm/dts/rockchip-u-boot.dtsi78
-rw-r--r--arch/arm/mach-exynos/include/mach/cpu.h6
-rwxr-xr-xarch/arm/mach-rockchip/make_fit_atf.py267
-rw-r--r--arch/arm/mach-rockchip/tpl.c16
-rw-r--r--arch/x86/include/asm/global_data.h2
-rw-r--r--arch/x86/include/asm/msr.h2
-rw-r--r--arch/x86/include/asm/u-boot-x86.h2
12 files changed, 100 insertions, 290 deletions
diff --git a/arch/arm/cpu/armv7/s5p-common/timer.c b/arch/arm/cpu/armv7/s5p-common/timer.c
index f4a045e2f0..9d981cce14 100644
--- a/arch/arm/cpu/armv7/s5p-common/timer.c
+++ b/arch/arm/cpu/armv7/s5p-common/timer.c
@@ -82,7 +82,7 @@ unsigned long get_timer(unsigned long base)
return time_ms - base;
}
-unsigned long __attribute__((no_instrument_function)) timer_get_us(void)
+unsigned long notrace timer_get_us(void)
{
static unsigned long base_time_us;
diff --git a/arch/arm/cpu/armv8/generic_timer.c b/arch/arm/cpu/armv8/generic_timer.c
index f27a74b9d0..8f83372cbc 100644
--- a/arch/arm/cpu/armv8/generic_timer.c
+++ b/arch/arm/cpu/armv8/generic_timer.c
@@ -17,7 +17,7 @@ DECLARE_GLOBAL_DATA_PTR;
/*
* Generic timer implementation of get_tbclk()
*/
-unsigned long get_tbclk(void)
+unsigned long notrace get_tbclk(void)
{
unsigned long cntfrq;
asm volatile("mrs %0, cntfrq_el0" : "=r" (cntfrq));
@@ -78,7 +78,7 @@ unsigned long timer_read_counter(void)
/*
* timer_read_counter() using the Arm Generic Timer (aka arch timer).
*/
-unsigned long timer_read_counter(void)
+unsigned long notrace timer_read_counter(void)
{
unsigned long cntpct;
@@ -89,7 +89,7 @@ unsigned long timer_read_counter(void)
}
#endif
-uint64_t get_ticks(void)
+uint64_t notrace get_ticks(void)
{
unsigned long ticks = timer_read_counter();
diff --git a/arch/arm/dts/px30-ringneck-haikou-u-boot.dtsi b/arch/arm/dts/px30-ringneck-haikou-u-boot.dtsi
index e8a34c7c1e..1325e0cb05 100644
--- a/arch/arm/dts/px30-ringneck-haikou-u-boot.dtsi
+++ b/arch/arm/dts/px30-ringneck-haikou-u-boot.dtsi
@@ -17,7 +17,7 @@
&binman {
simple-bin {
- blob {
+ fit {
offset = <((CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR - 64) * 512)>;
};
};
diff --git a/arch/arm/dts/rk3399-puma-haikou-u-boot.dtsi b/arch/arm/dts/rk3399-puma-haikou-u-boot.dtsi
index d2349ae90e..088861dbf6 100644
--- a/arch/arm/dts/rk3399-puma-haikou-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-puma-haikou-u-boot.dtsi
@@ -46,14 +46,14 @@
&binman {
simple-bin {
- blob {
+ fit {
offset = <((CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR - 64) * 512)>;
};
};
#ifdef CONFIG_ROCKCHIP_SPI_IMAGE
simple-bin-spi {
- blob {
+ fit {
/* same as u-boot,spl-payload-offset */
offset = <0x80000>;
};
diff --git a/arch/arm/dts/rk3399-u-boot.dtsi b/arch/arm/dts/rk3399-u-boot.dtsi
index 3c1a15fe51..8a0b1803f3 100644
--- a/arch/arm/dts/rk3399-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-u-boot.dtsi
@@ -62,6 +62,7 @@
#if defined(CONFIG_ROCKCHIP_SPI_IMAGE) && defined(CONFIG_HAS_ROM)
&binman {
+ multiple-images;
rom {
filename = "u-boot.rom";
size = <0x400000>;
@@ -82,7 +83,7 @@
};
};
};
-#endif
+#endif /* CONFIG_ROCKCHIP_SPI_IMAGE && CONFIG_HAS_ROM */
&cru {
u-boot,dm-pre-reloc;
diff --git a/arch/arm/dts/rockchip-u-boot.dtsi b/arch/arm/dts/rockchip-u-boot.dtsi
index fa094b0039..234fc5df43 100644
--- a/arch/arm/dts/rockchip-u-boot.dtsi
+++ b/arch/arm/dts/rockchip-u-boot.dtsi
@@ -30,14 +30,79 @@
};
};
-#ifdef CONFIG_ARM64
- blob {
+#if defined(CONFIG_SPL_FIT) && defined(CONFIG_ARM64)
+ fit: fit {
+ description = "FIT image for U-Boot with bl31 (TF-A)";
+ #address-cells = <1>;
+ fit,fdt-list = "of-list";
filename = "u-boot.itb";
+ fit,external-offset = <CONFIG_FIT_EXTERNAL_OFFSET>;
+ offset = <CONFIG_SPL_PAD_TO>;
+ images {
+ u-boot {
+ description = "U-Boot (64-bit)";
+ type = "standalone";
+ os = "U-Boot";
+ arch = "arm64";
+ compression = "none";
+ load = <CONFIG_TEXT_BASE>;
+ entry = <CONFIG_TEXT_BASE>;
+ u-boot-nodtb {
+ };
+ };
+
+ @atf-SEQ {
+ fit,operation = "split-elf";
+ description = "ARM Trusted Firmware";
+ type = "firmware";
+ arch = "arm64";
+ os = "arm-trusted-firmware";
+ compression = "none";
+ fit,load;
+ fit,entry;
+ fit,data;
+
+ atf-bl31 {
+ };
+ };
+ @tee-SEQ {
+ fit,operation = "split-elf";
+ description = "TEE";
+ type = "tee";
+ arch = "arm64";
+ os = "tee";
+ compression = "none";
+ fit,load;
+ fit,entry;
+ fit,data;
+
+ tee-os {
+ optional;
+ };
+ };
+
+ @fdt-SEQ {
+ description = "fdt-NAME";
+ compression = "none";
+ type = "flat_dt";
+ };
+ };
+
+ configurations {
+ default = "@config-DEFAULT-SEQ";
+ @config-SEQ {
+ description = "NAME.dtb";
+ fdt = "fdt-SEQ";
+ firmware = "u-boot";
+ fit,loadables;
+ };
+ };
+ };
#else
u-boot-img {
-#endif
offset = <CONFIG_SPL_PAD_TO>;
};
+#endif
};
#ifdef CONFIG_ROCKCHIP_SPI_IMAGE
@@ -59,7 +124,8 @@
};
#ifdef CONFIG_ARM64
- blob {
+ fit {
+ type = "blob";
filename = "u-boot.itb";
#else
u-boot-img {
@@ -68,6 +134,6 @@
offset = <CONFIG_SYS_SPI_U_BOOT_OFFS>;
};
};
-#endif
+#endif /* CONFIG_ROCKCHIP_SPI_IMAGE */
};
-#endif
+#endif /* CONFIG_SPL */
diff --git a/arch/arm/mach-exynos/include/mach/cpu.h b/arch/arm/mach-exynos/include/mach/cpu.h
index fb5fdaf3ba..dab148e332 100644
--- a/arch/arm/mach-exynos/include/mach/cpu.h
+++ b/arch/arm/mach-exynos/include/mach/cpu.h
@@ -248,7 +248,7 @@ static inline char *s5p_get_cpu_name(void)
}
#define IS_SAMSUNG_TYPE(type, id) \
-static inline int __attribute__((no_instrument_function)) cpu_is_##type(void) \
+static inline int notrace cpu_is_##type(void) \
{ \
return (s5p_cpu_id >> 12) == id; \
}
@@ -257,7 +257,7 @@ IS_SAMSUNG_TYPE(exynos4, 0x4)
IS_SAMSUNG_TYPE(exynos5, 0x5)
#define IS_EXYNOS_TYPE(type, id) \
-static inline int __attribute__((no_instrument_function)) \
+static inline int notrace \
proid_is_##type(void) \
{ \
return s5p_cpu_id == id; \
@@ -272,7 +272,7 @@ IS_EXYNOS_TYPE(exynos5422, 0x5422)
#define proid_is_exynos542x() (proid_is_exynos5420() || proid_is_exynos5422())
#define SAMSUNG_BASE(device, base) \
-static inline unsigned long __attribute__((no_instrument_function)) \
+static inline unsigned long notrace \
samsung_get_base_##device(void) \
{ \
if (cpu_is_exynos4()) { \
diff --git a/arch/arm/mach-rockchip/make_fit_atf.py b/arch/arm/mach-rockchip/make_fit_atf.py
deleted file mode 100755
index 08cfe9f51e..0000000000
--- a/arch/arm/mach-rockchip/make_fit_atf.py
+++ /dev/null
@@ -1,267 +0,0 @@
-#!/usr/bin/env python3
-"""
-# SPDX-License-Identifier: GPL-2.0+
-#
-# A script to generate FIT image source for rockchip boards
-# with ARM Trusted Firmware
-# and multiple device trees (given on the command line)
-#
-# usage: $0 <dt_name> [<dt_name> [<dt_name] ...]
-"""
-
-import os
-import sys
-import getopt
-import logging
-import struct
-
-DT_HEADER = """
-/*
- * This is a generated file.
- */
-/dts-v1/;
-
-/ {
- description = "FIT image for U-Boot with bl31 (TF-A)";
- #address-cells = <1>;
-
- images {
-"""
-
-DT_UBOOT = """
- uboot {
- description = "U-Boot (64-bit)";
- data = /incbin/("u-boot-nodtb.bin");
- type = "standalone";
- os = "U-Boot";
- arch = "arm64";
- compression = "none";
- load = <0x%08x>;
- };
-
-"""
-
-DT_IMAGES_NODE_END = """ };
-
-"""
-
-DT_END = "};"
-
-def append_bl31_node(file, atf_index, phy_addr, elf_entry):
- # Append BL31 DT node to input FIT dts file.
- data = 'bl31_0x%08x.bin' % phy_addr
- file.write('\t\tatf_%d {\n' % atf_index)
- file.write('\t\t\tdescription = \"ARM Trusted Firmware\";\n')
- file.write('\t\t\tdata = /incbin/("%s");\n' % data)
- file.write('\t\t\ttype = "firmware";\n')
- file.write('\t\t\tarch = "arm64";\n')
- file.write('\t\t\tos = "arm-trusted-firmware";\n')
- file.write('\t\t\tcompression = "none";\n')
- file.write('\t\t\tload = <0x%08x>;\n' % phy_addr)
- if atf_index == 1:
- file.write('\t\t\tentry = <0x%08x>;\n' % elf_entry)
- file.write('\t\t};\n')
- file.write('\n')
-
-def append_tee_node(file, atf_index, phy_addr, elf_entry):
- # Append TEE DT node to input FIT dts file.
- data = 'tee_0x%08x.bin' % phy_addr
- file.write('\t\tatf_%d {\n' % atf_index)
- file.write('\t\t\tdescription = \"TEE\";\n')
- file.write('\t\t\tdata = /incbin/("%s");\n' % data)
- file.write('\t\t\ttype = "tee";\n')
- file.write('\t\t\tarch = "arm64";\n')
- file.write('\t\t\tos = "tee";\n')
- file.write('\t\t\tcompression = "none";\n')
- file.write('\t\t\tload = <0x%08x>;\n' % phy_addr)
- file.write('\t\t\tentry = <0x%08x>;\n' % elf_entry)
- file.write('\t\t};\n')
- file.write('\n')
-
-def append_fdt_node(file, dtbs):
- # Append FDT nodes.
- cnt = 1
- for dtb in dtbs:
- dtname = os.path.basename(dtb)
- file.write('\t\tfdt_%d {\n' % cnt)
- file.write('\t\t\tdescription = "%s";\n' % dtname)
- file.write('\t\t\tdata = /incbin/("%s");\n' % dtb)
- file.write('\t\t\ttype = "flat_dt";\n')
- file.write('\t\t\tcompression = "none";\n')
- file.write('\t\t};\n')
- file.write('\n')
- cnt = cnt + 1
-
-def append_conf_section(file, cnt, dtname, segments):
- file.write('\t\tconfig_%d {\n' % cnt)
- file.write('\t\t\tdescription = "%s";\n' % dtname)
- file.write('\t\t\tfirmware = "atf_1";\n')
- file.write('\t\t\tloadables = "uboot"')
- if segments > 1:
- file.write(',')
- for i in range(1, segments):
- file.write('"atf_%d"' % (i + 1))
- if i != (segments - 1):
- file.write(',')
- else:
- file.write(';\n')
- if segments <= 1:
- file.write(';\n')
- file.write('\t\t\tfdt = "fdt_%d";\n' % cnt)
- file.write('\t\t};\n')
- file.write('\n')
-
-def append_conf_node(file, dtbs, segments):
- # Append configeration nodes.
- cnt = 1
- file.write('\tconfigurations {\n')
- file.write('\t\tdefault = "config_1";\n')
- for dtb in dtbs:
- dtname = os.path.basename(dtb)
- append_conf_section(file, cnt, dtname, segments)
- cnt = cnt + 1
- file.write('\t};\n')
- file.write('\n')
-
-def generate_atf_fit_dts_uboot(fit_file, uboot_file_name):
- segments = unpack_elf(uboot_file_name)
- if len(segments) != 1:
- raise ValueError("Invalid u-boot ELF image '%s'" % uboot_file_name)
- index, entry, p_paddr, data = segments[0]
- fit_file.write(DT_UBOOT % p_paddr)
-
-def generate_atf_fit_dts_bl31(fit_file, bl31_file_name, tee_file_name, dtbs_file_name):
- segments = unpack_elf(bl31_file_name)
- for index, entry, paddr, data in segments:
- append_bl31_node(fit_file, index + 1, paddr, entry)
- num_segments = len(segments)
-
- if tee_file_name:
- tee_segments = unpack_tee_file(tee_file_name)
- for index, entry, paddr, data in tee_segments:
- append_tee_node(fit_file, num_segments + index + 1, paddr, entry)
- num_segments = num_segments + len(tee_segments)
-
- append_fdt_node(fit_file, dtbs_file_name)
- fit_file.write(DT_IMAGES_NODE_END)
- append_conf_node(fit_file, dtbs_file_name, num_segments)
-
-def generate_atf_fit_dts(fit_file_name, bl31_file_name, tee_file_name, uboot_file_name, dtbs_file_name):
- # Generate FIT script for ATF image.
- if fit_file_name != sys.stdout:
- fit_file = open(fit_file_name, "wb")
- else:
- fit_file = sys.stdout
-
- fit_file.write(DT_HEADER)
- generate_atf_fit_dts_uboot(fit_file, uboot_file_name)
- generate_atf_fit_dts_bl31(fit_file, bl31_file_name, tee_file_name, dtbs_file_name)
- fit_file.write(DT_END)
-
- if fit_file_name != sys.stdout:
- fit_file.close()
-
-def generate_atf_binary(bl31_file_name):
- for index, entry, paddr, data in unpack_elf(bl31_file_name):
- file_name = 'bl31_0x%08x.bin' % paddr
- with open(file_name, "wb") as atf:
- atf.write(data)
-
-def generate_tee_binary(tee_file_name):
- if tee_file_name:
- for index, entry, paddr, data in unpack_tee_file(tee_file_name):
- file_name = 'tee_0x%08x.bin' % paddr
- with open(file_name, "wb") as atf:
- atf.write(data)
-
-def unpack_elf(filename):
- with open(filename, 'rb') as file:
- elf = file.read()
- if elf[0:7] != b'\x7fELF\x02\x01\x01' or elf[18:20] != b'\xb7\x00':
- raise ValueError("Invalid arm64 ELF file '%s'" % filename)
-
- e_entry, e_phoff = struct.unpack_from('<2Q', elf, 0x18)
- e_phentsize, e_phnum = struct.unpack_from('<2H', elf, 0x36)
- segments = []
-
- for index in range(e_phnum):
- offset = e_phoff + e_phentsize * index
- p_type, p_flags, p_offset = struct.unpack_from('<LLQ', elf, offset)
- if p_type == 1: # PT_LOAD
- p_paddr, p_filesz = struct.unpack_from('<2Q', elf, offset + 0x18)
- if p_filesz > 0:
- p_data = elf[p_offset:p_offset + p_filesz]
- segments.append((index, e_entry, p_paddr, p_data))
- return segments
-
-def unpack_tee_file(filename):
- if filename.endswith('.elf'):
- return unpack_elf(filename)
- with open(filename, 'rb') as file:
- bin = file.read()
- segments = []
- if bin[0:5] == b'OPTE\x01':
- # OP-TEE v1 format (tee.bin)
- init_sz, start_hi, start_lo, _, paged_sz = struct.unpack_from('<5I',
- bin,
- 0x8)
- if paged_sz != 0:
- raise ValueError("OP-TEE paged mode not supported")
- e_entry = (start_hi << 32) + start_lo
- p_addr = e_entry
- p_data = bin[0x1c:]
- if len(p_data) != init_sz:
- raise ValueError("Invalid file '%s': size mismatch "
- "(expected %d, have %d)" % (filename, init_sz,
- len(p_data)))
- segments.append((0, e_entry, p_addr, p_data))
- else:
- raise ValueError("Unknown format for TEE file '%s'" % filename)
- return segments
-
-def main():
- uboot_elf = "./u-boot"
- fit_its = sys.stdout
- if "BL31" in os.environ:
- bl31_elf=os.getenv("BL31");
- elif os.path.isfile("./bl31.elf"):
- bl31_elf = "./bl31.elf"
- else:
- os.system("echo 'int main(){}' > bl31.c")
- os.system("${CROSS_COMPILE}gcc -c bl31.c -o bl31.elf")
- bl31_elf = "./bl31.elf"
- logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.DEBUG)
- logging.warning(' BL31 file bl31.elf NOT found, resulting binary is non-functional')
- logging.warning(' Please read Building section in doc/README.rockchip')
-
- if "TEE" in os.environ:
- tee_file = os.getenv("TEE")
- elif os.path.isfile("./tee.bin"):
- tee_file = "./tee.bin"
- elif os.path.isfile("./tee.elf"):
- tee_file = "./tee.elf"
- else:
- tee_file = ""
-
- opts, args = getopt.getopt(sys.argv[1:], "o:u:b:t:h")
- for opt, val in opts:
- if opt == "-o":
- fit_its = val
- elif opt == "-u":
- uboot_elf = val
- elif opt == "-b":
- bl31_elf = val
- elif opt == "-t":
- tee_file = val
- elif opt == "-h":
- print(__doc__)
- sys.exit(2)
-
- dtbs = args
-
- generate_atf_fit_dts(fit_its, bl31_elf, tee_file, uboot_elf, dtbs)
- generate_atf_binary(bl31_elf)
- generate_tee_binary(tee_file)
-
-if __name__ == "__main__":
- main()
diff --git a/arch/arm/mach-rockchip/tpl.c b/arch/arm/mach-rockchip/tpl.c
index ed46a9ad28..fdd0c592b3 100644
--- a/arch/arm/mach-rockchip/tpl.c
+++ b/arch/arm/mach-rockchip/tpl.c
@@ -4,6 +4,7 @@
*/
#include <common.h>
+#include <bootstage.h>
#include <debug_uart.h>
#include <dm.h>
#include <hang.h>
@@ -70,15 +71,15 @@ void board_init_f(ulong dummy)
U_BOOT_TIME ")\n");
#endif
#endif
+ /* Init secure timer */
+ rockchip_stimer_init();
+
ret = spl_early_init();
if (ret) {
debug("spl_early_init() failed: %d\n", ret);
hang();
}
- /* Init secure timer */
- rockchip_stimer_init();
-
/* Init ARM arch timer */
if (IS_ENABLED(CONFIG_SYS_ARCH_TIMER))
timer_init();
@@ -93,6 +94,15 @@ void board_init_f(ulong dummy)
int board_return_to_bootrom(struct spl_image_info *spl_image,
struct spl_boot_device *bootdev)
{
+#ifdef CONFIG_BOOTSTAGE_STASH
+ int ret;
+
+ bootstage_mark_name(BOOTSTAGE_ID_END_TPL, "end tpl");
+ ret = bootstage_stash((void *)CONFIG_BOOTSTAGE_STASH_ADDR,
+ CONFIG_BOOTSTAGE_STASH_SIZE);
+ if (ret)
+ debug("Failed to stash bootstage: err=%d\n", ret);
+#endif
back_to_bootrom(BROM_BOOT_NEXTSTAGE);
return 0;
diff --git a/arch/x86/include/asm/global_data.h b/arch/x86/include/asm/global_data.h
index 23693f85a7..22d103df4e 100644
--- a/arch/x86/include/asm/global_data.h
+++ b/arch/x86/include/asm/global_data.h
@@ -137,7 +137,7 @@ struct arch_global_data {
#define DECLARE_GLOBAL_DATA_PTR extern struct global_data *global_data_ptr
# else
-static inline __attribute__((no_instrument_function)) gd_t *get_fs_gd_ptr(void)
+static inline notrace gd_t *get_fs_gd_ptr(void)
{
gd_t *gd_ptr;
diff --git a/arch/x86/include/asm/msr.h b/arch/x86/include/asm/msr.h
index 3e613de6ce..27764fc56c 100644
--- a/arch/x86/include/asm/msr.h
+++ b/arch/x86/include/asm/msr.h
@@ -71,7 +71,7 @@ static inline unsigned long long native_read_tscp(unsigned int *aux)
#define EAX_EDX_RET(val, low, high) "=A" (val)
#endif
-static inline __attribute__((no_instrument_function))
+static inline notrace
unsigned long long native_read_msr(unsigned int msr)
{
DECLARE_ARGS(val, low, high);
diff --git a/arch/x86/include/asm/u-boot-x86.h b/arch/x86/include/asm/u-boot-x86.h
index 4cf41e9354..8f38c2d1c6 100644
--- a/arch/x86/include/asm/u-boot-x86.h
+++ b/arch/x86/include/asm/u-boot-x86.h
@@ -108,7 +108,7 @@ void board_init_f_r(void) __attribute__ ((noreturn));
int arch_misc_init(void);
/* Read the time stamp counter */
-static inline __attribute__((no_instrument_function)) uint64_t rdtsc(void)
+static inline notrace uint64_t rdtsc(void)
{
uint32_t high, low;
__asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high));