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