From 454dc1a83ded7c6b0220b9f46bcc893598041a09 Mon Sep 17 00:00:00 2001 From: David Garske Date: Thu, 7 Nov 2024 16:50:14 -0800 Subject: [PATCH] Aarch64 support for FDT fixups. --- IDE/XilinxSDK/README.md | 4 ++-- hal/zynq.c | 7 +++++++ src/boot_aarch64.c | 14 ++++++++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/IDE/XilinxSDK/README.md b/IDE/XilinxSDK/README.md index 6d0723f8c..61674e1c2 100644 --- a/IDE/XilinxSDK/README.md +++ b/IDE/XilinxSDK/README.md @@ -237,8 +237,8 @@ Successfully ran Hello World application 6. Build “boot.bin” image: * `bootgen -image boot.bif -arch zynqmp -o i BOOT.BIN -w` -Note: To generate a report of a boot.bin use the `bootgen_utility`: -`bootgen_utility -arch zynqmp -bin boot.bin -out boot.bin.txt` +Note: To generate a report of a boot.bin use the `bootgen_utility` or after 2022.1 use `bootgen -read`: +`bootgen -read -arch zynqmp -bin boot.bin -out boot.bin.txt` ## Post Quantum diff --git a/hal/zynq.c b/hal/zynq.c index 62d0fcd63..0f526ad29 100644 --- a/hal/zynq.c +++ b/hal/zynq.c @@ -1109,6 +1109,13 @@ void* hal_get_dts_address(void) { return (void*)WOLFBOOT_DTS_BOOT_ADDRESS; } + +int hal_dts_fixup(void* dts_addr) +{ + /* place FDT fixup specific to ZynqMP here */ + //fdt_set_boot_cpuid_phys(buf, fdt_boot_cpuid_phys(fdt)); + return 0; +} #endif diff --git a/src/boot_aarch64.c b/src/boot_aarch64.c index 97abff8c7..e4e59d4f7 100644 --- a/src/boot_aarch64.c +++ b/src/boot_aarch64.c @@ -67,6 +67,16 @@ void boot_entry_C(void) main(); } + +#ifdef MMU +int __attribute((weak)) hal_dts_fixup(void* dts_addr) +{ + (void)dts_addr; + return 0; +} +#endif + + /* This is the main loop for the bootloader. * * It performs the following actions: @@ -80,6 +90,10 @@ void RAMFUNCTION do_boot(const uint32_t *app_offset, const uint32_t* dts_offset) void RAMFUNCTION do_boot(const uint32_t *app_offset) #endif { +#ifdef MMU + hal_dts_fixup((uint32_t*)dts_offset); +#endif + /* Set application address via x4 */ asm volatile("mov x4, %0" : : "r"(app_offset));