3 Copyright (c) 2014 - 2022, Intel Corporation. All rights reserved.<BR>
4 SPDX-License-Identifier: BSD-2-Clause-Patent
12 #include <Ppi/TemporaryRamSupport.h>
14 #include <Library/BaseLib.h>
15 #include <Library/IoLib.h>
16 #include <Library/DebugLib.h>
17 #include <Library/PcdLib.h>
18 #include <Library/BaseMemoryLib.h>
19 #include <Library/PciCf8Lib.h>
20 #include <Library/SerialPortLib.h>
21 #include <Library/FspSwitchStackLib.h>
22 #include <Library/FspCommonLib.h>
23 #include <Library/CpuLib.h>
24 #include <Library/UefiCpuLib.h>
29 (EFIAPI
*PEI_CORE_ENTRY
)(
30 IN CONST EFI_SEC_PEI_HAND_OFF
*SecCoreData
,
31 IN CONST EFI_PEI_PPI_DESCRIPTOR
*PpiList
34 typedef struct _SEC_IDT_TABLE
{
36 // Reserved 8 bytes preceding IDT to store EFI_PEI_SERVICES**, since IDT base
37 // address should be 8-byte alignment.
38 // Note: For IA32, only the 4 bytes immediately preceding IDT is used to store
42 IA32_IDT_GATE_DESCRIPTOR IdtTable
[FixedPcdGet8 (PcdFspMaxInterruptSupported
)];
46 Switch the stack in the temporary memory to the one in the permanent memory.
48 This function must be invoked after the memory migration immediately. The relative
49 position of the stack in the temporary and permanent memory is same.
51 @param[in] TemporaryMemoryBase Base address of the temporary memory.
52 @param[in] PermenentMemoryBase Base address of the permanent memory.
57 IN UINTN TemporaryMemoryBase
,
58 IN UINTN PermenentMemoryBase
62 This service of the TEMPORARY_RAM_SUPPORT_PPI that migrates temporary RAM into
65 @param[in] PeiServices Pointer to the PEI Services Table.
66 @param[in] TemporaryMemoryBase Source Address in temporary memory from which the SEC or PEIM will copy the
67 Temporary RAM contents.
68 @param[in] PermanentMemoryBase Destination Address in permanent memory into which the SEC or PEIM will copy the
69 Temporary RAM contents.
70 @param[in] CopySize Amount of memory to migrate from temporary to permanent memory.
72 @retval EFI_SUCCESS The data was successfully returned.
73 @retval EFI_INVALID_PARAMETER PermanentMemoryBase + CopySize > TemporaryMemoryBase when
74 TemporaryMemoryBase > PermanentMemoryBase.
79 SecTemporaryRamSupport (
80 IN CONST EFI_PEI_SERVICES
**PeiServices
,
81 IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase
,
82 IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase
,
88 Entry point to the C language phase of SEC. After the SEC assembly
89 code has initialized some temporary memory and set up the stack,
90 the control is transferred to this function.
93 @param[in] SizeOfRam Size of the temporary memory available for use.
94 @param[in] TempRamBase Base address of temporary ram
95 @param[in] BootFirmwareVolume Base address of the Boot Firmware Volume.
96 @param[in] PeiCore PeiCore entry point.
97 @param[in] BootLoaderStack BootLoader stack.
98 @param[in] ApiIdx the index of API.
100 @return This function never returns.
107 IN UINT32 TempRamBase
,
108 IN VOID
*BootFirmwareVolume
,
109 IN PEI_CORE_ENTRY PeiCore
,
110 IN UINTN BootLoaderStack
,
115 Autogenerated function that calls the library constructors for all of the module's
116 dependent libraries. This function must be called by the SEC Core once a stack has
122 ProcessLibraryConstructorList (
130 @return value of esp.
135 AsmReadStackPointer (