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