2 RISC-V SEC phase module for Qemu Virt.
4 Copyright (c) 2008 - 2015, Intel Corporation. All rights reserved.<BR>
5 Copyright (c) 2022, Ventana Micro Systems Inc. All rights reserved.<BR>
7 SPDX-License-Identifier: BSD-2-Clause-Patent
16 SecInitializePlatform (
22 MemoryPeimInitialization ();
24 CpuPeimInitialization ();
27 SetBootMode (BOOT_WITH_FULL_CONFIGURATION
);
29 Status
= PlatformPeimInitialization ();
30 ASSERT_EFI_ERROR (Status
);
37 Entry point to the C language phase of SEC. After the SEC assembly
38 code has initialized some temporary memory and set up the stack,
39 the control is transferred to this function.
42 @param[in] BootHartId Hardware thread ID of boot hart.
43 @param[in] DeviceTreeAddress Pointer to Device Tree (DTB)
50 IN VOID
*DeviceTreeAddress
53 EFI_HOB_HANDOFF_INFO_TABLE
*HobList
;
54 EFI_RISCV_FIRMWARE_CONTEXT FirmwareContext
;
56 UINT64 UefiMemoryBase
;
61 // Report Status Code to indicate entering SEC core
65 "%a() BootHartId: 0x%x, DeviceTreeAddress=0x%x\n",
71 FirmwareContext
.BootHartId
= BootHartId
;
72 FirmwareContext
.FlattenedDeviceTree
= (UINT64
)DeviceTreeAddress
;
73 SetFirmwareContextPointer (&FirmwareContext
);
75 StackBase
= (UINT64
)FixedPcdGet32 (PcdOvmfSecPeiTempRamBase
);
76 StackSize
= FixedPcdGet32 (PcdOvmfSecPeiTempRamSize
);
77 UefiMemoryBase
= StackBase
+ StackSize
- SIZE_32MB
;
79 // Declare the PI/UEFI memory region
80 HobList
= HobConstructor (
81 (VOID
*)UefiMemoryBase
,
83 (VOID
*)UefiMemoryBase
,
84 (VOID
*)StackBase
// The top of the UEFI Memory is reserved for the stacks
86 PrePeiSetHobList (HobList
);
88 SecInitializePlatform ();
90 BuildStackHob (StackBase
, StackSize
);
93 // Process all libraries constructor function linked to SecMain.
95 ProcessLibraryConstructorList ();
97 // Assume the FV that contains the SEC (our code) also contains a compressed FV.
98 Status
= DecompressFirstFv ();
99 ASSERT_EFI_ERROR (Status
);
101 // Load the DXE Core and transfer control to it
102 Status
= LoadDxeCoreFromFv (NULL
, 0);
103 ASSERT_EFI_ERROR (Status
);
105 // Should not come here.