From 2db1e7663db8f94986bea02ade171693abfbdee6 Mon Sep 17 00:00:00 2001 From: Hadi Asyrafi <muhammad.hadi.asyrafi.abdul.halim@intel.com> Date: Tue, 22 Oct 2019 12:59:32 +0800 Subject: [PATCH] intel: stratix10: Enable uboot entrypoint support This patch will provide an entrypoint for uboot's spl into BL31. BL31 will also handle secondary cpu state during uboot's cold boot Signed-off-by: Hadi Asyrafi <muhammad.hadi.asyrafi.abdul.halim@intel.com> Change-Id: I661bdb782c2d793d5fc3c7f78dd7ff746e33b7a3 --- plat/intel/soc/common/aarch64/plat_helpers.S | 14 +++++++++++++- plat/intel/soc/common/include/platform_def.h | 3 +++ plat/intel/soc/common/include/socfpga_private.h | 1 + plat/intel/soc/stratix10/bl31_plat_setup.c | 4 ++++ 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/plat/intel/soc/common/aarch64/plat_helpers.S b/plat/intel/soc/common/aarch64/plat_helpers.S index 00fe2d999..27b538a4f 100644 --- a/plat/intel/soc/common/aarch64/plat_helpers.S +++ b/plat/intel/soc/common/aarch64/plat_helpers.S @@ -8,6 +8,7 @@ #include <asm_macros.S> #include <cpu_macros.S> #include <platform_def.h> +#include <el3_common_macros.S> .globl plat_secondary_cold_boot_setup .globl platform_is_primary_cpu @@ -17,6 +18,7 @@ .globl plat_crash_console_putc .globl plat_crash_console_flush .globl platform_mem_init + .globl plat_secondary_cpus_bl31_entry .globl plat_get_my_entrypoint @@ -33,7 +35,6 @@ func plat_secondary_cold_boot_setup /* Wait until the it gets reset signal from rstmgr gets populated */ poll_mailbox: wfi - mov_imm x0, PLAT_SEC_ENTRY ldr x1, [x0] mov_imm x2, PLAT_CPUID_RELEASE @@ -114,3 +115,14 @@ func platform_mem_init mov x0, #0 ret endfunc platform_mem_init + +func plat_secondary_cpus_bl31_entry + el3_entrypoint_common \ + _init_sctlr=0 \ + _warm_boot_mailbox=!PROGRAMMABLE_RESET_ADDRESS \ + _secondary_cold_boot=!COLD_BOOT_SINGLE_CPU \ + _init_memory=1 \ + _init_c_runtime=1 \ + _exception_vectors=runtime_exceptions \ + _pie_fixup_size=BL31_LIMIT - BL31_BASE +endfunc plat_secondary_cpus_bl31_entry diff --git a/plat/intel/soc/common/include/platform_def.h b/plat/intel/soc/common/include/platform_def.h index e57aafb6a..12dd49911 100644 --- a/plat/intel/soc/common/include/platform_def.h +++ b/plat/intel/soc/common/include/platform_def.h @@ -19,6 +19,9 @@ #define PLAT_CPUID_RELEASE 0xffe1b000 #define PLAT_SEC_ENTRY 0xffe1b008 +/* sysmgr.boot_scratch_cold4 & 5 used for CPU release address for SPL */ +#define PLAT_CPU_RELEASE_ADDR 0xffd12210 + /* Define next boot image name and offset */ #define PLAT_NS_IMAGE_OFFSET 0x50000 #define PLAT_HANDOFF_OFFSET 0xFFE3F000 diff --git a/plat/intel/soc/common/include/socfpga_private.h b/plat/intel/soc/common/include/socfpga_private.h index 375484443..ca38f62d8 100644 --- a/plat/intel/soc/common/include/socfpga_private.h +++ b/plat/intel/soc/common/include/socfpga_private.h @@ -61,5 +61,6 @@ uint32_t socfpga_get_spsr_for_bl33_entry(void); unsigned long socfpga_get_ns_image_entrypoint(void); +void plat_secondary_cpus_bl31_entry(void); #endif /* SOCFPGA_PRIVATE_H */ diff --git a/plat/intel/soc/stratix10/bl31_plat_setup.c b/plat/intel/soc/stratix10/bl31_plat_setup.c index a133f82cb..98ab35e7f 100644 --- a/plat/intel/soc/stratix10/bl31_plat_setup.c +++ b/plat/intel/soc/stratix10/bl31_plat_setup.c @@ -100,6 +100,10 @@ void bl31_platform_setup(void) gicv2_distif_init(); gicv2_pcpu_distif_init(); gicv2_cpuif_enable(); + + /* Signal secondary CPUs to jump to BL31 (BL2 = U-boot SPL) */ + mmio_write_64(PLAT_CPU_RELEASE_ADDR, + (uint64_t)plat_secondary_cpus_bl31_entry); } const mmap_region_t plat_stratix10_mmap[] = { -- GitLab