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