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