1/** @file
2
3  Copyright (c) 2014 - 2016, 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 _FSP_COMMON_LIB_H_
15#define _FSP_COMMON_LIB_H_
16
17#include <FspGlobalData.h>
18#include <FspMeasurePointId.h>
19
20/**
21  This function sets the FSP global data pointer.
22
23  @param[in] FspData       Fsp global data pointer.
24
25**/
26VOID
27EFIAPI
28SetFspGlobalDataPointer (
29  IN FSP_GLOBAL_DATA   *FspData
30  );
31
32/**
33  This function gets the FSP global data pointer.
34
35**/
36FSP_GLOBAL_DATA *
37EFIAPI
38GetFspGlobalDataPointer (
39  VOID
40  );
41
42/**
43  This function gets back the FSP API first parameter passed by the bootlaoder.
44
45  @retval ApiParameter FSP API first parameter passed by the bootlaoder.
46**/
47UINT32
48EFIAPI
49GetFspApiParameter (
50  VOID
51  );
52
53/**
54  This function gets back the FSP API second parameter passed by the bootlaoder.
55
56  @retval ApiParameter FSP API second parameter passed by the bootlaoder.
57**/
58UINT32
59EFIAPI
60GetFspApiParameter2 (
61  VOID
62  );
63
64/**
65  This function sets the FSP API parameter in the stack.
66
67   @param[in] Value       New parameter value.
68
69**/
70VOID
71EFIAPI
72SetFspApiParameter (
73  IN UINT32      Value
74  );
75
76/**
77  This function set the API status code returned to the BootLoader.
78
79  @param[in] ReturnStatus       Status code to return.
80
81**/
82VOID
83EFIAPI
84SetFspApiReturnStatus (
85  IN UINT32  ReturnStatus
86  );
87
88/**
89  This function sets the context switching stack to a new stack frame.
90
91  @param[in] NewStackTop       New core stack to be set.
92
93**/
94VOID
95EFIAPI
96SetFspCoreStackPointer (
97  IN VOID   *NewStackTop
98  );
99
100/**
101  This function sets the platform specific data pointer.
102
103  @param[in] PlatformData       Fsp platform specific data pointer.
104
105**/
106VOID
107EFIAPI
108SetFspPlatformDataPointer (
109  IN VOID   *PlatformData
110  );
111
112/**
113  This function gets the platform specific data pointer.
114
115   @param[in] PlatformData       Fsp platform specific data pointer.
116
117**/
118VOID *
119EFIAPI
120GetFspPlatformDataPointer (
121  VOID
122  );
123
124/**
125  This function sets the UPD data pointer.
126
127  @param[in] UpdDataPtr   UPD data pointer.
128**/
129VOID
130EFIAPI
131SetFspUpdDataPointer (
132  IN VOID    *UpdDataPtr
133  );
134
135/**
136  This function gets the UPD data pointer.
137
138  @return UpdDataPtr   UPD data pointer.
139**/
140VOID *
141EFIAPI
142GetFspUpdDataPointer (
143  VOID
144  );
145
146/**
147  This function sets the memory init UPD data pointer.
148
149  @param[in] MemoryInitUpdPtr   memory init UPD data pointer.
150**/
151VOID
152EFIAPI
153SetFspMemoryInitUpdDataPointer (
154  IN VOID    *MemoryInitUpdPtr
155  );
156
157/**
158  This function gets the memory init UPD data pointer.
159
160  @return memory init UPD data pointer.
161**/
162VOID *
163EFIAPI
164GetFspMemoryInitUpdDataPointer (
165  VOID
166  );
167
168/**
169  This function sets the silicon init UPD data pointer.
170
171  @param[in] SiliconInitUpdPtr   silicon init UPD data pointer.
172**/
173VOID
174EFIAPI
175SetFspSiliconInitUpdDataPointer (
176  IN VOID    *SiliconInitUpdPtr
177  );
178
179/**
180  This function gets the silicon init UPD data pointer.
181
182  @return silicon init UPD data pointer.
183**/
184VOID *
185EFIAPI
186GetFspSiliconInitUpdDataPointer (
187  VOID
188  );
189
190/**
191  Set FSP measurement point timestamp.
192
193  @param[in] Id       Measurement point ID.
194
195  @return performance timestamp.
196**/
197UINT64
198EFIAPI
199SetFspMeasurePoint (
200  IN UINT8  Id
201  );
202
203/**
204  This function gets the FSP info header pointer.
205
206  @retval FspInfoHeader   FSP info header pointer
207**/
208FSP_INFO_HEADER *
209EFIAPI
210GetFspInfoHeader (
211  VOID
212  );
213
214/**
215  This function sets the FSP info header pointer.
216
217  @param[in] FspInfoHeader   FSP info header pointer
218**/
219VOID
220EFIAPI
221SetFspInfoHeader (
222  FSP_INFO_HEADER *FspInfoHeader
223  );
224
225/**
226  This function gets the FSP info header pointer from the API context.
227
228  @retval FspInfoHeader   FSP info header pointer
229**/
230FSP_INFO_HEADER *
231EFIAPI
232GetFspInfoHeaderFromApiContext (
233  VOID
234  );
235
236/**
237  This function gets the CfgRegion data pointer.
238
239  @return CfgRegion data pointer.
240**/
241VOID *
242EFIAPI
243GetFspCfgRegionDataPointer (
244  VOID
245  );
246
247/**
248  This function gets FSP API calling mode.
249
250  @retval API calling mode
251**/
252UINT8
253EFIAPI
254GetFspApiCallingIndex (
255  VOID
256  );
257
258/**
259  This function sets FSP API calling mode.
260
261  @param[in] Index     API calling index
262**/
263VOID
264EFIAPI
265SetFspApiCallingIndex (
266  UINT8  Index
267  );
268
269/**
270  This function gets FSP Phase StatusCode.
271
272  @retval StatusCode
273**/
274UINT32
275EFIAPI
276GetPhaseStatusCode (
277  VOID
278  );
279
280
281/**
282  This function sets FSP Phase StatusCode.
283
284  @param[in] Mode     Phase StatusCode
285**/
286VOID
287EFIAPI
288SetPhaseStatusCode (
289  UINT32  StatusCode
290  );
291
292/**
293  This function updates the return status of the FSP API with requested reset type and returns to Boot Loader.
294
295  @param[in] FspResetType     Reset type that needs to returned as API return status
296
297**/
298VOID
299EFIAPI
300FspApiReturnStatusReset (
301  IN UINT32   FspResetType
302  );
303#endif
304