]> git.proxmox.com Git - mirror_edk2.git/blame - UefiPayloadPkg/SecCore/SecMain.h
BaseTools: Library hashing fix and optimization for --hash feature
[mirror_edk2.git] / UefiPayloadPkg / SecCore / SecMain.h
CommitLineData
04af8bf2
DG
1/** @file\r
2 Master header file for SecCore.\r
3\r
4Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>\r
5SPDX-License-Identifier: BSD-2-Clause-Patent\r
6\r
7**/\r
8\r
9#ifndef _SEC_CORE_H_\r
10#define _SEC_CORE_H_\r
11\r
12\r
13#include <PiPei.h>\r
14\r
15#include <Ppi/SecPlatformInformation.h>\r
16#include <Ppi/TemporaryRamSupport.h>\r
17\r
18#include <Library/BaseLib.h>\r
19#include <Library/DebugLib.h>\r
20#include <Library/PcdLib.h>\r
21#include <Library/BaseMemoryLib.h>\r
22#include <Library/UefiCpuLib.h>\r
23#include <Library/PeCoffGetEntryPointLib.h>\r
24#include <Library/PeCoffExtraActionLib.h>\r
25#include <Library/DebugAgentLib.h>\r
26\r
27\r
28#define SEC_IDT_ENTRY_COUNT 34\r
29\r
30typedef struct _SEC_IDT_TABLE {\r
31 //\r
32 // Reserved 8 bytes preceding IDT to store EFI_PEI_SERVICES**, since IDT base\r
33 // address should be 8-byte alignment.\r
34 // Note: For IA32, only the 4 bytes immediately preceding IDT is used to store\r
35 // EFI_PEI_SERVICES**\r
36 //\r
37 UINT64 PeiService;\r
38 UINT64 IdtTable[SEC_IDT_ENTRY_COUNT];\r
39} SEC_IDT_TABLE;\r
40\r
41/**\r
42 Switch the stack in the temporary memory to the one in the permanent memory.\r
43\r
44 This function must be invoked after the memory migration immediately. The relative\r
45 position of the stack in the temporary and permanent memory is same.\r
46\r
47 @param TemporaryMemoryBase Base address of the temporary memory.\r
48 @param PermenentMemoryBase Base address of the permanent memory.\r
49**/\r
50VOID\r
51EFIAPI\r
52SecSwitchStack (\r
53 UINT32 TemporaryMemoryBase,\r
54 UINT32 PermenentMemoryBase\r
55 );\r
56\r
57/**\r
58 This service of the TEMPORARY_RAM_SUPPORT_PPI that migrates temporary RAM into\r
59 permanent memory.\r
60\r
61 @param PeiServices Pointer to the PEI Services Table.\r
62 @param TemporaryMemoryBase Source Address in temporary memory from which the SEC or PEIM will copy the\r
63 Temporary RAM contents.\r
64 @param PermanentMemoryBase Destination Address in permanent memory into which the SEC or PEIM will copy the\r
65 Temporary RAM contents.\r
66 @param CopySize Amount of memory to migrate from temporary to permanent memory.\r
67\r
68 @retval EFI_SUCCESS The data was successfully returned.\r
69 @retval EFI_INVALID_PARAMETER PermanentMemoryBase + CopySize > TemporaryMemoryBase when\r
70 TemporaryMemoryBase > PermanentMemoryBase.\r
71\r
72**/\r
73EFI_STATUS\r
74EFIAPI\r
75SecTemporaryRamSupport (\r
76 IN CONST EFI_PEI_SERVICES **PeiServices,\r
77 IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase,\r
78 IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase,\r
79 IN UINTN CopySize\r
80 );\r
81\r
82/**\r
83 Entry point to the C language phase of SEC. After the SEC assembly\r
84 code has initialized some temporary memory and set up the stack,\r
85 the control is transferred to this function.\r
86\r
87 @param SizeOfRam Size of the temporary memory available for use.\r
88 @param TempRamBase Base address of temporary ram\r
89 @param BootFirmwareVolume Base address of the Boot Firmware Volume.\r
90 @param BootloaderParameter A parameter from bootloader, e.g. HobList from SlimBootloader\r
91\r
92**/\r
93VOID\r
94EFIAPI\r
95SecStartup (\r
96 IN UINT32 SizeOfRam,\r
97 IN UINT32 TempRamBase,\r
98 IN VOID *BootFirmwareVolume,\r
99 IN UINT32 BootloaderParameter\r
100 );\r
101\r
102/**\r
103 Find and return Pei Core entry point.\r
104\r
105 It also find SEC and PEI Core file debug information. It will report them if\r
106 remote debug is enabled.\r
107\r
108 @param BootFirmwareVolumePtr Point to the boot firmware volume.\r
109 @param PeiCoreEntryPoint Point to the PEI core entry point.\r
110\r
111**/\r
112VOID\r
113EFIAPI\r
114FindAndReportEntryPoints (\r
115 IN EFI_FIRMWARE_VOLUME_HEADER *BootFirmwareVolumePtr,\r
116 OUT EFI_PEI_CORE_ENTRY_POINT *PeiCoreEntryPoint\r
117 );\r
118\r
119/**\r
120 Autogenerated function that calls the library constructors for all of the module's\r
121 dependent libraries. This function must be called by the SEC Core once a stack has\r
122 been established.\r
123\r
124**/\r
125VOID\r
126EFIAPI\r
127ProcessLibraryConstructorList (\r
128 VOID\r
129 );\r
130\r
131#endif\r