]> git.proxmox.com Git - mirror_edk2.git/blame - CorebootModulePkg/SecCore/SecMain.h
CorebootModulePkg: Replace BSD License with BSD+Patent License
[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
f3342b7a 5SPDX-License-Identifier: BSD-2-Clause-Patent\r
fce4ecd9
MM
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
06516768 88 @param TempRamBase Base address of temporary ram\r
fce4ecd9
MM
89 @param BootFirmwareVolume Base address of the Boot Firmware Volume.\r
90**/\r
91VOID\r
92EFIAPI\r
93SecStartup (\r
94 IN UINT32 SizeOfRam,\r
95 IN UINT32 TempRamBase,\r
96 IN VOID *BootFirmwareVolume\r
97 );\r
98\r
99/**\r
100 Find and return Pei Core entry point.\r
101\r
06516768 102 It also find SEC and PEI Core file debug information. It will report them if\r
fce4ecd9
MM
103 remote debug is enabled.\r
104\r
105 @param BootFirmwareVolumePtr Point to the boot firmware volume.\r
106 @param PeiCoreEntryPoint Point to the PEI core entry point.\r
107\r
108**/\r
109VOID\r
110EFIAPI\r
111FindAndReportEntryPoints (\r
112 IN EFI_FIRMWARE_VOLUME_HEADER *BootFirmwareVolumePtr,\r
113 OUT EFI_PEI_CORE_ENTRY_POINT *PeiCoreEntryPoint\r
114 );\r
115\r
116/**\r
117 Autogenerated function that calls the library constructors for all of the module's\r
118 dependent libraries. This function must be called by the SEC Core once a stack has\r
119 been established.\r
120\r
121**/\r
122VOID\r
123EFIAPI\r
124ProcessLibraryConstructorList (\r
125 VOID\r
126 );\r
127 \r
128#endif\r