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