]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFspPkg/FspSecCore/SecMain.h
Clean up code.
[mirror_edk2.git] / IntelFspPkg / FspSecCore / SecMain.h
CommitLineData
c8ec22a2
JY
1/** @file\r
2\r
3 Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>\r
4 This program and the accompanying materials\r
5 are licensed and made available under the terms and conditions of the BSD License\r
6 which accompanies this distribution. The full text of the license may be found at\r
7 http://opensource.org/licenses/bsd-license.php.\r
8\r
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
11\r
12**/\r
13\r
14#ifndef _SEC_CORE_H_\r
15#define _SEC_CORE_H_\r
16\r
17\r
18#include <PiPei.h>\r
19#include <Ppi/TemporaryRamSupport.h>\r
20\r
21#include <Library/BaseLib.h>\r
22#include <Library/IoLib.h>\r
23#include <Library/DebugLib.h>\r
24#include <Library/PcdLib.h>\r
25#include <Library/BaseMemoryLib.h>\r
26#include <Library/PciCf8Lib.h>\r
27#include <Library/SerialPortLib.h>\r
28#include <Library/FspSwitchStackLib.h>\r
29#include <Library/FspCommonLib.h>\r
30#include <FspApi.h>\r
31\r
32#define SEC_IDT_ENTRY_COUNT 34\r
33\r
34typedef VOID (*PEI_CORE_ENTRY) ( \\r
35 IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData, \\r
36 IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList \\r
37);\r
38\r
39typedef struct _SEC_IDT_TABLE {\r
40 EFI_PEI_SERVICES *PeiService;\r
41 UINT64 IdtTable[SEC_IDT_ENTRY_COUNT];\r
42} SEC_IDT_TABLE;\r
43\r
44/**\r
45 Switch the stack in the temporary memory to the one in the permanent memory.\r
46\r
47 This function must be invoked after the memory migration immediately. The relative\r
48 position of the stack in the temporary and permanent memory is same.\r
49\r
50 @param[in] TemporaryMemoryBase Base address of the temporary memory.\r
51 @param[in] PermenentMemoryBase Base address of the permanent memory.\r
52**/\r
53VOID\r
54EFIAPI\r
55SecSwitchStack (\r
56 IN UINT32 TemporaryMemoryBase,\r
57 IN UINT32 PermenentMemoryBase\r
58 );\r
59\r
60/**\r
61 This service of the TEMPORARY_RAM_SUPPORT_PPI that migrates temporary RAM into\r
62 permanent memory.\r
63\r
64 @param[in] PeiServices Pointer to the PEI Services Table.\r
65 @param[in] TemporaryMemoryBase Source Address in temporary memory from which the SEC or PEIM will copy the\r
66 Temporary RAM contents.\r
67 @param[in] PermanentMemoryBase Destination Address in permanent memory into which the SEC or PEIM will copy the\r
68 Temporary RAM contents.\r
69 @param[in] CopySize Amount of memory to migrate from temporary to permanent memory.\r
70\r
71 @retval EFI_SUCCESS The data was successfully returned.\r
72 @retval EFI_INVALID_PARAMETER PermanentMemoryBase + CopySize > TemporaryMemoryBase when\r
73 TemporaryMemoryBase > PermanentMemoryBase.\r
74\r
75**/\r
76EFI_STATUS\r
77EFIAPI\r
78SecTemporaryRamSupport (\r
79 IN CONST EFI_PEI_SERVICES **PeiServices,\r
80 IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase,\r
81 IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase,\r
82 IN UINTN CopySize\r
83 );\r
84\r
85/**\r
86 Initializes floating point units for requirement of UEFI specification.\r
87\r
88 This function initializes floating-point control word to 0x027F (all exceptions\r
89 masked,double-precision, round-to-nearest) and multimedia-extensions control word\r
90 (if supported) to 0x1F80 (all exceptions masked, round-to-nearest, flush to zero\r
91 for masked underflow).\r
92\r
93**/\r
94VOID\r
95EFIAPI\r
96InitializeFloatingPointUnits (\r
97 VOID\r
98 );\r
99\r
100/**\r
101\r
102 Entry point to the C language phase of SEC. After the SEC assembly\r
103 code has initialized some temporary memory and set up the stack,\r
104 the control is transferred to this function.\r
105\r
106\r
107 @param[in] SizeOfRam Size of the temporary memory available for use.\r
108 @param[in] TempRamBase Base address of tempory ram\r
109 @param[in] BootFirmwareVolume Base address of the Boot Firmware Volume.\r
a0e0fb6d 110 @param[in] PeiCoreEntry Pei Core entrypoint.\r
c8ec22a2
JY
111\r
112 @return This function never returns.\r
113\r
114**/\r
115VOID\r
116EFIAPI\r
117SecStartup (\r
118 IN UINT32 SizeOfRam,\r
119 IN UINT32 TempRamBase,\r
a0e0fb6d
JY
120 IN VOID *BootFirmwareVolume,\r
121 IN UINTN PeiCoreEntry\r
c8ec22a2
JY
122 );\r
123\r
124/**\r
125 Autogenerated function that calls the library constructors for all of the module's\r
126 dependent libraries. This function must be called by the SEC Core once a stack has\r
127 been established.\r
128\r
129**/\r
130VOID\r
131EFIAPI\r
132ProcessLibraryConstructorList (\r
133 VOID\r
134 );\r
135\r
136#endif\r