(This is migrated from edk2-platforms) Cc: Daniel Schaefer <daniel.schae...@hpe.com> Cc: Abner Chang <abner.ch...@hpe.com> Cc: Sunil V L <suni...@ventanamicro.com> Reviewed-by: Abner Chang <abner.ch...@hpe.com>
Signed-off-by: Daniel Schaefer <daniel.schae...@hpe.com> --- .../RiscVOpensbiLib/RiscVOpensbiLib.inf | 13 ++++++--- .../Include/Library/RiscVEdk2SbiLib.h | 1 + .../ProcessorPkg/Include/OpensbiTypes.h | 1 + .../Library/OpensbiPlatformLibNull/Platform.c | 27 ++++++++++++------- .../PlatformPkg/Universal/Sec/SecMain.c | 5 ++-- .../Universal/Sec/Riscv64/SecEntry.S | 2 ++ 6 files changed, 34 insertions(+), 15 deletions(-) diff --git a/Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/RiscVOpensbiLib.inf b/Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/RiscVOpensbiLib.inf index 71cc76444e..e40a797896 100644 --- a/Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/RiscVOpensbiLib.inf +++ b/Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbiLib/RiscVOpensbiLib.inf @@ -23,6 +23,7 @@ opensbi/lib/sbi/sbi_bitmap.c opensbi/lib/sbi/sbi_bitops.c opensbi/lib/sbi/sbi_console.c + opensbi/lib/sbi/sbi_domain.c opensbi/lib/sbi/sbi_ecall.c opensbi/lib/sbi/sbi_ecall_base.c opensbi/lib/sbi/sbi_ecall_hsm.c @@ -51,27 +52,33 @@ opensbi/lib/utils/fdt/fdt_helper.c opensbi/lib/utils/fdt/fdt_fixup.c + opensbi/lib/utils/fdt/fdt_domain.c opensbi/lib/utils/ipi/fdt_ipi.c - opensbi/lib/utils/ipi/fdt_ipi_clint.c + opensbi/lib/utils/ipi/aclint_mswi.c + opensbi/lib/utils/ipi/fdt_ipi_mswi.c opensbi/lib/utils/irqchip/fdt_irqchip.c opensbi/lib/utils/irqchip/fdt_irqchip_plic.c opensbi/lib/utils/irqchip/plic.c opensbi/lib/utils/reset/fdt_reset.c opensbi/lib/utils/reset/fdt_reset_htif.c opensbi/lib/utils/reset/fdt_reset_sifive.c + opensbi/lib/utils/reset/fdt_reset_thead.c + opensbi/lib/utils/reset/fdt_reset_thead_asm.S opensbi/lib/utils/serial/fdt_serial.c opensbi/lib/utils/serial/fdt_serial_htif.c opensbi/lib/utils/serial/fdt_serial_shakti.c opensbi/lib/utils/serial/fdt_serial_sifive.c opensbi/lib/utils/serial/fdt_serial_uart8250.c + opensbi/lib/utils/serial/fdt_serial_gaisler.c + opensbi/lib/utils/serial/gaisler-uart.c opensbi/lib/utils/serial/shakti-uart.c opensbi/lib/utils/serial/sifive-uart.c opensbi/lib/utils/serial/uart8250.c - opensbi/lib/utils/sys/clint.c opensbi/lib/utils/sys/htif.c opensbi/lib/utils/sys/sifive_test.c opensbi/lib/utils/timer/fdt_timer.c - opensbi/lib/utils/timer/fdt_timer_clint.c + opensbi/lib/utils/timer/aclint_mtimer.c + opensbi/lib/utils/timer/fdt_timer_mtimer.c [Packages] EmbeddedPkg/EmbeddedPkg.dec # For libfdt. diff --git a/Silicon/RISC-V/ProcessorPkg/Include/Library/RiscVEdk2SbiLib.h b/Silicon/RISC-V/ProcessorPkg/Include/Library/RiscVEdk2SbiLib.h index f81ea06b05..66a87cb8c3 100644 --- a/Silicon/RISC-V/ProcessorPkg/Include/Library/RiscVEdk2SbiLib.h +++ b/Silicon/RISC-V/ProcessorPkg/Include/Library/RiscVEdk2SbiLib.h @@ -16,6 +16,7 @@ #include <IndustryStandard/RiscVOpensbi.h> #include <sbi/sbi_scratch.h> #include <sbi/sbi_platform.h> +#include <sbi/sbi_ecall.h> // // EDK2 OpenSBI Firmware extension. diff --git a/Silicon/RISC-V/ProcessorPkg/Include/OpensbiTypes.h b/Silicon/RISC-V/ProcessorPkg/Include/OpensbiTypes.h index 37e407908a..8a6ea97708 100644 --- a/Silicon/RISC-V/ProcessorPkg/Include/OpensbiTypes.h +++ b/Silicon/RISC-V/ProcessorPkg/Include/OpensbiTypes.h @@ -49,6 +49,7 @@ typedef UINT64 physical_size_t; #define __packed __attribute__((packed)) #define __noreturn __attribute__((noreturn)) +#define __aligned(x) __attribute__((aligned(x))) #if defined(__GNUC__) || defined(__clang__) #define likely(x) __builtin_expect((x), 1) diff --git a/Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLibNull/Platform.c b/Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLibNull/Platform.c index e78d811f4c..b7e39d19c1 100644 --- a/Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLibNull/Platform.c +++ b/Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLibNull/Platform.c @@ -14,31 +14,38 @@ #include <sbi/sbi_platform.h> const struct sbi_platform_operations platform_ops = { - .pmp_region_count = NULL, - .pmp_region_info = NULL, + .early_init = NULL, .final_init = NULL, + .early_exit = NULL, + .final_exit = NULL, + .domains_root_regions = NULL, + .domains_init = NULL, .console_putc = NULL, .console_getc = NULL, .console_init = NULL, .irqchip_init = NULL, + .irqchip_exit = NULL, .ipi_send = NULL, .ipi_clear = NULL, .ipi_init = NULL, + .ipi_exit = NULL, + .get_tlbr_flush_limit = NULL, .timer_value = NULL, .timer_event_stop = NULL, .timer_event_start = NULL, .timer_init = NULL, - .system_reboot = NULL, - .system_shutdown = NULL + .timer_exit = NULL, + .system_reset_check = NULL, + .system_reset = NULL, }; -const struct sbi_platform platform = { - .opensbi_version = OPENSBI_VERSION, // The OpenSBI version this platform table is built bassed on. - .platform_version = SBI_PLATFORM_VERSION(0x0000, 0x0000), // SBI Platform version 1.0 - .name = "NULL platform", +struct sbi_platform platform = { + .opensbi_version = OPENSBI_VERSION, + .platform_version = SBI_PLATFORM_VERSION(0x0, 0x01), + .name = "NULL Platform", .features = 0, .hart_count = 0, + .hart_index2id = 0, .hart_stack_size = 0, - .disabled_hart_mask = 0, - .platform_ops_addr = 0 + .platform_ops_addr = 0, }; diff --git a/Platform/RISC-V/PlatformPkg/Universal/Sec/SecMain.c b/Platform/RISC-V/PlatformPkg/Universal/Sec/SecMain.c index 0af0b4bac8..e9f030f352 100644 --- a/Platform/RISC-V/PlatformPkg/Universal/Sec/SecMain.c +++ b/Platform/RISC-V/PlatformPkg/Universal/Sec/SecMain.c @@ -21,6 +21,7 @@ #include <sbi/sbi_platform.h> // Reference to header file in opensbi #include <sbi/sbi_init.h> // Reference to header file in opensbi #include <sbi/sbi_ecall.h> // Reference to header file in opensbi +#include <sbi/sbi_trap.h> // Reference to header file in opensbi // // Indicates the boot hart (PcdBootHartId) OpenSBI initialization is done. @@ -434,7 +435,7 @@ EFI_STATUS EFIAPI TemporaryRamDone ( STATIC int SbiEcallFirmwareHandler ( IN unsigned long ExtId, IN unsigned long FuncId, - IN unsigned long *Args, + IN CONST struct sbi_trap_regs *TrapRegs, OUT unsigned long *OutVal, OUT struct sbi_trap_info *OutTrap ) @@ -446,7 +447,7 @@ STATIC int SbiEcallFirmwareHandler ( *OutVal = (unsigned long) sbi_scratch_thishart_ptr(); break; case SBI_EXT_FW_MSCRATCH_HARTID_FUNC: - *OutVal = (unsigned long) sbi_hartid_to_scratch (Args[0]); + *OutVal = (unsigned long) sbi_hartid_to_scratch (TrapRegs->a0); break; default: Ret = SBI_ENOTSUPP; diff --git a/Platform/RISC-V/PlatformPkg/Universal/Sec/Riscv64/SecEntry.S b/Platform/RISC-V/PlatformPkg/Universal/Sec/Riscv64/SecEntry.S index d3d589aefc..692985cefb 100644 --- a/Platform/RISC-V/PlatformPkg/Universal/Sec/Riscv64/SecEntry.S +++ b/Platform/RISC-V/PlatformPkg/Universal/Sec/Riscv64/SecEntry.S @@ -21,6 +21,8 @@ .text .align 3 + .globl _start_warm + ASM_FUNC (_ModuleEntryPoint) /* * Jump to warm-boot if this is not the selected core booting, -- 2.31.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#85377): https://edk2.groups.io/g/devel/message/85377 Mute This Topic: https://groups.io/mt/88278552/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-