]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFspPkg/FspSecCore/SecMain.h
MdeModulePkg/Partition: Fix media probe
[mirror_edk2.git] / IntelFspPkg / FspSecCore / SecMain.h
1 /** @file
2
3 Copyright (c) 2014 - 2015, 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 <FspApi.h>
31
32 #define SEC_IDT_ENTRY_COUNT 34
33
34 typedef VOID (*PEI_CORE_ENTRY) ( \
35 IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData, \
36 IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList \
37 );
38
39 typedef struct _SEC_IDT_TABLE {
40 EFI_PEI_SERVICES *PeiService;
41 UINT64 IdtTable[SEC_IDT_ENTRY_COUNT];
42 } SEC_IDT_TABLE;
43
44 /**
45 Switch the stack in the temporary memory to the one in the permanent memory.
46
47 This function must be invoked after the memory migration immediately. The relative
48 position of the stack in the temporary and permanent memory is same.
49
50 @param[in] TemporaryMemoryBase Base address of the temporary memory.
51 @param[in] PermenentMemoryBase Base address of the permanent memory.
52 **/
53 VOID
54 EFIAPI
55 SecSwitchStack (
56 IN UINT32 TemporaryMemoryBase,
57 IN UINT32 PermenentMemoryBase
58 );
59
60 /**
61 This service of the TEMPORARY_RAM_SUPPORT_PPI that migrates temporary RAM into
62 permanent memory.
63
64 @param[in] PeiServices Pointer to the PEI Services Table.
65 @param[in] TemporaryMemoryBase Source Address in temporary memory from which the SEC or PEIM will copy the
66 Temporary RAM contents.
67 @param[in] PermanentMemoryBase Destination Address in permanent memory into which the SEC or PEIM will copy the
68 Temporary RAM contents.
69 @param[in] CopySize Amount of memory to migrate from temporary to permanent memory.
70
71 @retval EFI_SUCCESS The data was successfully returned.
72 @retval EFI_INVALID_PARAMETER PermanentMemoryBase + CopySize > TemporaryMemoryBase when
73 TemporaryMemoryBase > PermanentMemoryBase.
74
75 **/
76 EFI_STATUS
77 EFIAPI
78 SecTemporaryRamSupport (
79 IN CONST EFI_PEI_SERVICES **PeiServices,
80 IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase,
81 IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase,
82 IN UINTN CopySize
83 );
84
85 /**
86 Initializes floating point units for requirement of UEFI specification.
87
88 This function initializes floating-point control word to 0x027F (all exceptions
89 masked,double-precision, round-to-nearest) and multimedia-extensions control word
90 (if supported) to 0x1F80 (all exceptions masked, round-to-nearest, flush to zero
91 for masked underflow).
92
93 **/
94 VOID
95 EFIAPI
96 InitializeFloatingPointUnits (
97 VOID
98 );
99
100 /**
101
102 Entry point to the C language phase of SEC. After the SEC assembly
103 code has initialized some temporary memory and set up the stack,
104 the control is transferred to this function.
105
106
107 @param[in] SizeOfRam Size of the temporary memory available for use.
108 @param[in] TempRamBase Base address of temporary ram
109 @param[in] BootFirmwareVolume Base address of the Boot Firmware Volume.
110 @param[in] PeiCore PeiCore entry point.
111 @param[in] BootLoaderStack BootLoader stack.
112 @param[in] ApiIdx the index of API.
113
114 @return This function never returns.
115
116 **/
117 VOID
118 EFIAPI
119 SecStartup (
120 IN UINT32 SizeOfRam,
121 IN UINT32 TempRamBase,
122 IN VOID *BootFirmwareVolume,
123 IN PEI_CORE_ENTRY PeiCore,
124 IN UINT32 BootLoaderStack,
125 IN UINT32 ApiIdx
126 );
127
128 /**
129 Autogenerated function that calls the library constructors for all of the module's
130 dependent libraries. This function must be called by the SEC Core once a stack has
131 been established.
132
133 **/
134 VOID
135 EFIAPI
136 ProcessLibraryConstructorList (
137 VOID
138 );
139
140 #endif