]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | \r | |
3 | Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.<BR>\r | |
4 | SPDX-License-Identifier: BSD-2-Clause-Patent\r | |
5 | \r | |
6 | **/\r | |
7 | \r | |
8 | #ifndef _SEC_CORE_H_\r | |
9 | #define _SEC_CORE_H_\r | |
10 | \r | |
11 | #include <PiPei.h>\r | |
12 | #include <Ppi/TemporaryRamSupport.h>\r | |
13 | \r | |
14 | #include <Library/BaseLib.h>\r | |
15 | #include <Library/IoLib.h>\r | |
16 | #include <Library/DebugLib.h>\r | |
17 | #include <Library/PcdLib.h>\r | |
18 | #include <Library/BaseMemoryLib.h>\r | |
19 | #include <Library/PciCf8Lib.h>\r | |
20 | #include <Library/SerialPortLib.h>\r | |
21 | #include <Library/FspSwitchStackLib.h>\r | |
22 | #include <Library/FspCommonLib.h>\r | |
23 | #include <Library/UefiCpuLib.h>\r | |
24 | #include <FspEas.h>\r | |
25 | \r | |
26 | typedef VOID (*PEI_CORE_ENTRY) ( \\r | |
27 | IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData, \\r | |
28 | IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList \\r | |
29 | );\r | |
30 | \r | |
31 | typedef struct _SEC_IDT_TABLE {\r | |
32 | //\r | |
33 | // Reserved 8 bytes preceding IDT to store EFI_PEI_SERVICES**, since IDT base\r | |
34 | // address should be 8-byte alignment.\r | |
35 | // Note: For IA32, only the 4 bytes immediately preceding IDT is used to store\r | |
36 | // EFI_PEI_SERVICES**\r | |
37 | //\r | |
38 | UINT64 PeiService;\r | |
39 | UINT64 IdtTable[FixedPcdGet8 (PcdFspMaxInterruptSupported)];\r | |
40 | } SEC_IDT_TABLE;\r | |
41 | \r | |
42 | /**\r | |
43 | Switch the stack in the temporary memory to the one in the permanent memory.\r | |
44 | \r | |
45 | This function must be invoked after the memory migration immediately. The relative\r | |
46 | position of the stack in the temporary and permanent memory is same.\r | |
47 | \r | |
48 | @param[in] TemporaryMemoryBase Base address of the temporary memory.\r | |
49 | @param[in] PermenentMemoryBase Base address of the permanent memory.\r | |
50 | **/\r | |
51 | VOID\r | |
52 | EFIAPI\r | |
53 | SecSwitchStack (\r | |
54 | IN UINT32 TemporaryMemoryBase,\r | |
55 | IN UINT32 PermenentMemoryBase\r | |
56 | );\r | |
57 | \r | |
58 | /**\r | |
59 | This service of the TEMPORARY_RAM_SUPPORT_PPI that migrates temporary RAM into\r | |
60 | permanent memory.\r | |
61 | \r | |
62 | @param[in] PeiServices Pointer to the PEI Services Table.\r | |
63 | @param[in] TemporaryMemoryBase Source Address in temporary memory from which the SEC or PEIM will copy the\r | |
64 | Temporary RAM contents.\r | |
65 | @param[in] PermanentMemoryBase Destination Address in permanent memory into which the SEC or PEIM will copy the\r | |
66 | Temporary RAM contents.\r | |
67 | @param[in] CopySize Amount of memory to migrate from temporary to permanent memory.\r | |
68 | \r | |
69 | @retval EFI_SUCCESS The data was successfully returned.\r | |
70 | @retval EFI_INVALID_PARAMETER PermanentMemoryBase + CopySize > TemporaryMemoryBase when\r | |
71 | TemporaryMemoryBase > PermanentMemoryBase.\r | |
72 | \r | |
73 | **/\r | |
74 | EFI_STATUS\r | |
75 | EFIAPI\r | |
76 | SecTemporaryRamSupport (\r | |
77 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
78 | IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase,\r | |
79 | IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase,\r | |
80 | IN UINTN CopySize\r | |
81 | );\r | |
82 | \r | |
83 | /**\r | |
84 | \r | |
85 | Entry point to the C language phase of SEC. After the SEC assembly\r | |
86 | code has initialized some temporary memory and set up the stack,\r | |
87 | the control is transferred to this function.\r | |
88 | \r | |
89 | \r | |
90 | @param[in] SizeOfRam Size of the temporary memory available for use.\r | |
91 | @param[in] TempRamBase Base address of temporary ram\r | |
92 | @param[in] BootFirmwareVolume Base address of the Boot Firmware Volume.\r | |
93 | @param[in] PeiCore PeiCore entry point.\r | |
94 | @param[in] BootLoaderStack BootLoader stack.\r | |
95 | @param[in] ApiIdx the index of API.\r | |
96 | \r | |
97 | @return This function never returns.\r | |
98 | \r | |
99 | **/\r | |
100 | VOID\r | |
101 | EFIAPI\r | |
102 | SecStartup (\r | |
103 | IN UINT32 SizeOfRam,\r | |
104 | IN UINT32 TempRamBase,\r | |
105 | IN VOID *BootFirmwareVolume,\r | |
106 | IN PEI_CORE_ENTRY PeiCore,\r | |
107 | IN UINT32 BootLoaderStack,\r | |
108 | IN UINT32 ApiIdx\r | |
109 | );\r | |
110 | \r | |
111 | /**\r | |
112 | Autogenerated function that calls the library constructors for all of the module's\r | |
113 | dependent libraries. This function must be called by the SEC Core once a stack has\r | |
114 | been established.\r | |
115 | \r | |
116 | **/\r | |
117 | VOID\r | |
118 | EFIAPI\r | |
119 | ProcessLibraryConstructorList (\r | |
120 | VOID\r | |
121 | );\r | |
122 | \r | |
123 | /**\r | |
124 | \r | |
125 | Return value of esp.\r | |
126 | \r | |
127 | @return value of esp.\r | |
128 | \r | |
129 | **/\r | |
130 | UINT32\r | |
131 | EFIAPI\r | |
132 | AsmReadEsp (\r | |
133 | VOID\r | |
134 | );\r | |
135 | \r | |
136 | #endif\r |