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