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_FSP_H_
15 #define _SEC_FSPE_H_
16 
17 #include <PiPei.h>
18 #include <FspApi.h>
19 #include <Library/PcdLib.h>
20 #include <Library/BaseLib.h>
21 #include <Library/DebugLib.h>
22 #include <Library/SerialPortLib.h>
23 #include <Library/BaseMemoryLib.h>
24 #include <Library/FspCommonLib.h>
25 #include <Library/FspSecPlatformLib.h>
26 
27 #define FSP_MCUD_SIGNATURE  SIGNATURE_32 ('M', 'C', 'U', 'D')
28 #define FSP_PER0_SIGNATURE  SIGNATURE_32 ('P', 'E', 'R', '0')
29 
30 /**
31 
32   Calculate the FSP IDT gate descriptor.
33 
34   @param[in] IdtEntryTemplate     IDT gate descriptor template.
35 
36   @return                     FSP specific IDT gate descriptor.
37 
38 **/
39 UINT64
40 FspGetExceptionHandler(
41   IN  UINT64  IdtEntryTemplate
42   );
43 
44 /**
45 
46   Initialize the FSP global data region.
47   It needs to be done as soon as possible after the stack is setup.
48 
49   @param[in,out] PeiFspData             Pointer of the FSP global data.
50   @param[in]     BootLoaderStack        BootLoader stack.
51   @param[in]     ApiIdx                 The index of the FSP API.
52 
53 **/
54 VOID
55 FspGlobalDataInit (
56   IN OUT  FSP_GLOBAL_DATA    *PeiFspData,
57   IN UINT32                   BootLoaderStack,
58   IN UINT8                    ApiIdx
59   );
60 
61 
62 /**
63 
64   Adjust the FSP data pointers after the stack is migrated to memory.
65 
66   @param[in] OffsetGap             The offset gap between the old stack and the new stack.
67 
68 **/
69 VOID
70 FspDataPointerFixUp (
71   IN UINT32   OffsetGap
72   );
73 
74 
75 /**
76   This interface returns the base address of FSP binary.
77 
78   @return   FSP binary base address.
79 
80 **/
81 UINT32
82 EFIAPI
83 AsmGetFspBaseAddress (
84   VOID
85   );
86 
87 /**
88   This interface gets FspInfoHeader pointer
89 
90   @return   FSP binary base address.
91 
92 **/
93 UINT32
94 EFIAPI
95 AsmGetFspInfoHeader (
96   VOID
97   );
98 
99 /**
100   This function gets the FSP UPD region offset in flash.
101 
102   @return the offset of the UPD region.
103 
104 **/
105 UINT32
106 EFIAPI
107 GetFspUpdRegionOffset (
108   VOID
109   );
110 
111 #endif
112