1 /** @file
2   Master header file for SecCore.
3 
4   Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
5   This program and the accompanying materials
6   are licensed and made available under the terms and conditions of the BSD License
7   which accompanies this distribution.  The full text of the license may be found at
8   http://opensource.org/licenses/bsd-license.php.
9 
10   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 
13 **/
14 
15 #ifndef _SEC_CORE_H_
16 #define _SEC_CORE_H_
17 
18 
19 #include <PiPei.h>
20 
21 #include <Ppi/TopOfTemporaryRam.h>
22 #include <Ppi/FspInitDone.h>
23 
24 #include <Library/BaseLib.h>
25 #include <Library/DebugLib.h>
26 #include <Library/PcdLib.h>
27 #include <Library/BaseMemoryLib.h>
28 #include <Library/FspPlatformSecLib.h>
29 #include <Library/FspPlatformInfoLib.h>
30 #include <Library/UefiCpuLib.h>
31 #include <Library/PeCoffGetEntryPointLib.h>
32 #include <Library/PeCoffExtraActionLib.h>
33 #include <Library/DebugAgentLib.h>
34 
35 #include <FspApi.h>
36 #include <FspInfoHeader.h>
37 
38 #define SEC_IDT_ENTRY_COUNT  34
39 
40 typedef struct _SEC_IDT_TABLE {
41   //
42   // Reserved 8 bytes preceding IDT to store EFI_PEI_SERVICES**, since IDT base
43   // address should be 8-byte alignment.
44   // Note: For IA32, only the 4 bytes immediately preceding IDT is used to store
45   // EFI_PEI_SERVICES**
46   //
47   UINT64            PeiService;
48   UINT64            IdtTable[SEC_IDT_ENTRY_COUNT];
49 } SEC_IDT_TABLE;
50 
51 /**
52   Entry point to the C language phase of SEC. After the SEC assembly
53   code has initialized some temporary memory and set up the stack,
54   the control is transferred to this function.
55 
56   @param[in] SizeOfRam           Size of the temporary memory available for use.
57   @param[in] TempRamBase         Base address of tempory ram
58   @param[in] BootFirmwareVolume  Base address of the Boot Firmware Volume.
59 **/
60 VOID
61 EFIAPI
62 SecStartup (
63   IN UINT32                   SizeOfRam,
64   IN UINT32                   TempRamBase,
65   IN VOID                     *BootFirmwareVolume
66   );
67 
68 /**
69   Find and return Pei Core entry point.
70 
71   It also find SEC and PEI Core file debug inforamtion. It will report them if
72   remote debug is enabled.
73 
74   @param[in]  BootFirmwareVolumePtr  Point to the boot firmware volume.
75   @param[out] PeiCoreEntryPoint      Point to the PEI core entry point.
76 
77 **/
78 VOID
79 EFIAPI
80 FindAndReportEntryPoints (
81   IN  EFI_FIRMWARE_VOLUME_HEADER       *BootFirmwareVolumePtr,
82   OUT EFI_PEI_CORE_ENTRY_POINT         *PeiCoreEntryPoint
83   );
84 
85 /**
86   Autogenerated function that calls the library constructors for all of the module's
87   dependent libraries.  This function must be called by the SEC Core once a stack has
88   been established.
89 
90 **/
91 VOID
92 EFIAPI
93 ProcessLibraryConstructorList (
94   VOID
95   );
96 
97 /**
98   Return Hob list produced by FSP.
99 
100   @param[in]  PeiServices  The pointer to the PEI Services Table.
101   @param[in]  This         The pointer to this instance of this PPI.
102   @param[out] FspHobList   The pointer to Hob list produced by FSP.
103 
104   @return EFI_SUCCESS FReturn Hob list produced by FSP successfully.
105 **/
106 EFI_STATUS
107 EFIAPI
108 FspInitDoneGetFspHobList (
109   IN  CONST EFI_PEI_SERVICES         **PeiServices,
110   IN  FSP_INIT_DONE_PPI              *This,
111   OUT VOID                           **FspHobList
112   );
113 
114 extern FSP_INIT_DONE_PPI gFspInitDonePpi;
115 
116 #endif
117