Coverage Report

Created: 2024-10-17 06:29

/src/hbfa-fl/HBFA/UefiHostTestPkg/Library/PeiServicesTablePointerLibHost/PeiServicesTablePointerLibHost.c
Line
Count
Source (jump to first uncovered line)
1
/** @file
2
  PEI Services Table Pointer Library.
3
4
  This library is used for PEIM which does executed from flash device directly but
5
  executed in memory.
6
7
  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
8
  SPDX-License-Identifier: BSD-2-Clause-Patent
9
10
**/
11
12
#include <PiPei.h>
13
#include <Library/PeiServicesTablePointerLib.h>
14
#include <Library/DebugLib.h>
15
#include <Library/BaseMemoryLib.h>
16
17
#include "PeiMain.h"
18
19
extern EFI_PEI_CPU_IO_PPI mPeiDefaultCpuIoPpi;
20
extern EFI_PEI_PCI_CFG2_PPI mPeiDefaultPciCfg2Ppi;
21
extern EFI_PEI_SERVICES mPeiServices;
22
23
PEI_CORE_INSTANCE mPrivateData = {
24
    PEI_CORE_HANDLE_SIGNATURE,
25
    &mPeiServices,
26
};
27
28
CONST EFI_PEI_SERVICES  **gPeiServices = &mPrivateData.Ps;
29
30
/**
31
  Caches a pointer PEI Services Table.
32
33
  Caches the pointer to the PEI Services Table specified by PeiServicesTablePointer
34
  in a CPU specific manner as specified in the CPU binding section of the Platform Initialization
35
  Pre-EFI Initialization Core Interface Specification.
36
37
  If PeiServicesTablePointer is NULL, then ASSERT().
38
39
  @param    PeiServicesTablePointer   The address of PeiServices pointer.
40
**/
41
VOID
42
EFIAPI
43
SetPeiServicesTablePointer (
44
  IN CONST EFI_PEI_SERVICES ** PeiServicesTablePointer
45
  )
46
0
{
47
0
  ASSERT (FALSE);
48
0
  ASSERT (PeiServicesTablePointer != NULL);
49
0
  gPeiServices = PeiServicesTablePointer;
50
0
}
51
52
/**
53
  Retrieves the cached value of the PEI Services Table pointer.
54
55
  Returns the cached value of the PEI Services Table pointer in a CPU specific manner
56
  as specified in the CPU binding section of the Platform Initialization Pre-EFI
57
  Initialization Core Interface Specification.
58
59
  If the cached PEI Services Table pointer is NULL, then ASSERT().
60
61
  @return  The pointer to PeiServices.
62
63
**/
64
CONST EFI_PEI_SERVICES **
65
EFIAPI
66
GetPeiServicesTablePointer (
67
  VOID
68
  )
69
0
{
70
0
  return gPeiServices;
71
0
}
72
73
/**
74
  Perform CPU specific actions required to migrate the PEI Services Table
75
  pointer from temporary RAM to permanent RAM.
76
77
  For IA32 CPUs, the PEI Services Table pointer is stored in the 4 bytes
78
  immediately preceding the Interrupt Descriptor Table (IDT) in memory.
79
  For X64 CPUs, the PEI Services Table pointer is stored in the 8 bytes
80
  immediately preceding the Interrupt Descriptor Table (IDT) in memory.
81
  For Itanium and ARM CPUs, a the PEI Services Table Pointer is stored in
82
  a dedicated CPU register.  This means that there is no memory storage
83
  associated with storing the PEI Services Table pointer, so no additional
84
  migration actions are required for Itanium or ARM CPUs.
85
86
**/
87
VOID
88
EFIAPI
89
MigratePeiServicesTablePointer (
90
  VOID
91
  )
92
0
{
93
  //
94
  //  PEI Services Table pointer is cached in the global variable. No additional
95
  //  migration actions are required.
96
  //
97
0
  ASSERT (FALSE);
98
0
  return;
99
0
}
100
101
EFI_STATUS
102
EFIAPI
103
PeiInstallPpi (
104
  IN CONST EFI_PEI_SERVICES        **PeiServices,
105
  IN CONST EFI_PEI_PPI_DESCRIPTOR  *PpiList
106
  );
107
108
EFI_STATUS
109
EFIAPI
110
PeiReInstallPpi (
111
  IN CONST EFI_PEI_SERVICES        **PeiServices,
112
  IN CONST EFI_PEI_PPI_DESCRIPTOR  *OldPpi,
113
  IN CONST EFI_PEI_PPI_DESCRIPTOR  *NewPpi
114
  );
115
116
EFI_STATUS
117
EFIAPI
118
PeiLocatePpi (
119
  IN CONST EFI_PEI_SERVICES      **PeiServices,
120
  IN CONST EFI_GUID              *Guid,
121
  IN UINTN                       Instance,
122
  IN OUT EFI_PEI_PPI_DESCRIPTOR  **PpiDescriptor,
123
  IN OUT VOID                    **Ppi
124
  );
125
126
EFI_STATUS
127
EFIAPI
128
PeiNotifyPpi (
129
  IN CONST EFI_PEI_SERVICES           **PeiServices,
130
  IN CONST EFI_PEI_NOTIFY_DESCRIPTOR  *NotifyList
131
  );
132
133
EFI_STATUS
134
EFIAPI
135
PeiGetBootMode (
136
  IN CONST EFI_PEI_SERVICES  **PeiServices,
137
  IN OUT   EFI_BOOT_MODE     *BootMode
138
  )
139
0
{
140
0
  ASSERT (FALSE);
141
0
  return  EFI_NOT_AVAILABLE_YET;
142
0
}
143
144
EFI_STATUS
145
EFIAPI
146
PeiSetBootMode (
147
  IN CONST EFI_PEI_SERVICES  **PeiServices,
148
  IN EFI_BOOT_MODE     BootMode
149
  )
150
0
{
151
0
  ASSERT (FALSE);
152
0
  return  EFI_NOT_AVAILABLE_YET;
153
0
}
154
155
EFI_STATUS
156
EFIAPI
157
PeiGetHobList (
158
  IN CONST EFI_PEI_SERVICES  **PeiServices,
159
  IN OUT VOID          **HobList
160
  )
161
0
{
162
0
  ASSERT (FALSE);
163
0
  return  EFI_NOT_AVAILABLE_YET;
164
0
}
165
166
EFI_STATUS
167
EFIAPI
168
PeiCreateHob (
169
  IN CONST EFI_PEI_SERVICES  **PeiServices,
170
  IN UINT16            Type,
171
  IN UINT16            Length,
172
  IN OUT VOID          **Hob
173
  )
174
0
{
175
0
  ASSERT (FALSE);
176
0
  return  EFI_NOT_AVAILABLE_YET;
177
0
}
178
179
EFI_STATUS
180
EFIAPI
181
PeiFfsFindNextVolume (
182
  IN CONST EFI_PEI_SERVICES          **PeiServices,
183
  IN UINTN                           Instance,
184
  IN OUT EFI_PEI_FV_HANDLE           *VolumeHandle
185
  )
186
0
{
187
0
  ASSERT (FALSE);
188
0
  return  EFI_NOT_AVAILABLE_YET;
189
0
}
190
191
EFI_STATUS
192
EFIAPI
193
PeiFfsFindNextFile (
194
  IN CONST EFI_PEI_SERVICES      **PeiServices,
195
  IN UINT8                       SearchType,
196
  IN EFI_PEI_FV_HANDLE           FvHandle,
197
  IN OUT EFI_PEI_FILE_HANDLE     *FileHandle
198
  )
199
0
{
200
0
  ASSERT (FALSE);
201
0
  return  EFI_NOT_AVAILABLE_YET;
202
0
}
203
204
EFI_STATUS
205
EFIAPI
206
PeiFfsFindSectionData (
207
  IN CONST EFI_PEI_SERVICES    **PeiServices,
208
  IN     EFI_SECTION_TYPE      SectionType,
209
  IN     EFI_PEI_FILE_HANDLE   FileHandle,
210
  OUT VOID                     **SectionData
211
  )
212
0
{
213
0
  ASSERT (FALSE);
214
0
  return  EFI_NOT_AVAILABLE_YET;
215
0
}
216
217
EFI_STATUS
218
EFIAPI
219
PeiInstallPeiMemory (
220
  IN CONST EFI_PEI_SERVICES      **PeiServices,
221
  IN EFI_PHYSICAL_ADDRESS  MemoryBegin,
222
  IN UINT64                MemoryLength
223
  )
224
0
{
225
0
  ASSERT (FALSE);
226
0
  return  EFI_NOT_AVAILABLE_YET;
227
0
}
228
229
EFI_STATUS
230
EFIAPI
231
PeiAllocatePages (
232
  IN CONST EFI_PEI_SERVICES     **PeiServices,
233
  IN       EFI_MEMORY_TYPE      MemoryType,
234
  IN       UINTN                Pages,
235
  OUT      EFI_PHYSICAL_ADDRESS *Memory
236
  )
237
0
{
238
0
  ASSERT (FALSE);
239
0
  return  EFI_NOT_AVAILABLE_YET;
240
0
}
241
242
EFI_STATUS
243
EFIAPI
244
PeiAllocatePool (
245
  IN CONST EFI_PEI_SERVICES           **PeiServices,
246
  IN UINTN                      Size,
247
  OUT VOID                      **Buffer
248
  )
249
0
{
250
0
  ASSERT (FALSE);
251
0
  return  EFI_NOT_AVAILABLE_YET;
252
0
}
253
254
EFI_STATUS
255
EFIAPI
256
PeiReportStatusCode (
257
  IN CONST EFI_PEI_SERVICES         **PeiServices,
258
  IN EFI_STATUS_CODE_TYPE     CodeType,
259
  IN EFI_STATUS_CODE_VALUE    Value,
260
  IN UINT32                   Instance,
261
  IN CONST EFI_GUID                 *CallerId,
262
  IN CONST EFI_STATUS_CODE_DATA     *Data OPTIONAL
263
  )
264
0
{
265
0
  ASSERT (FALSE);
266
0
  return  EFI_NOT_AVAILABLE_YET;
267
0
}
268
269
EFI_STATUS
270
EFIAPI
271
PeiResetSystem (
272
  IN CONST EFI_PEI_SERVICES   **PeiServices
273
  )
274
0
{
275
0
  ASSERT (FALSE);
276
0
  return  EFI_NOT_AVAILABLE_YET;
277
0
}
278
279
EFI_STATUS
280
EFIAPI
281
PeiFfsFindFileByName (
282
  IN  CONST EFI_GUID        *FileName,
283
  IN  EFI_PEI_FV_HANDLE     VolumeHandle,
284
  OUT EFI_PEI_FILE_HANDLE   *FileHandle
285
  )
286
0
{
287
0
  ASSERT (FALSE);
288
0
  return  EFI_NOT_AVAILABLE_YET;
289
0
}
290
291
EFI_STATUS
292
EFIAPI
293
PeiFfsGetFileInfo (
294
  IN EFI_PEI_FILE_HANDLE  FileHandle,
295
  OUT EFI_FV_FILE_INFO    *FileInfo
296
  )
297
0
{
298
0
  ASSERT (FALSE);
299
0
  return  EFI_NOT_AVAILABLE_YET;
300
0
}
301
302
EFI_STATUS
303
EFIAPI
304
PeiFfsGetVolumeInfo (
305
  IN EFI_PEI_FV_HANDLE  VolumeHandle,
306
  OUT EFI_FV_INFO       *VolumeInfo
307
  )
308
0
{
309
0
  ASSERT (FALSE);
310
0
  return  EFI_NOT_AVAILABLE_YET;
311
0
}
312
313
EFI_STATUS
314
EFIAPI
315
PeiRegisterForShadow (
316
  IN EFI_PEI_FILE_HANDLE       FileHandle
317
  )
318
0
{
319
0
  ASSERT (FALSE);
320
0
  return  EFI_NOT_AVAILABLE_YET;
321
0
}
322
323
EFI_STATUS
324
EFIAPI
325
PeiFfsFindSectionData3 (
326
  IN CONST EFI_PEI_SERVICES    **PeiServices,
327
  IN     EFI_SECTION_TYPE      SectionType,
328
  IN     UINTN                 SectionInstance,
329
  IN     EFI_PEI_FILE_HANDLE   FileHandle,
330
  OUT VOID                     **SectionData,
331
  OUT UINT32                   *AuthenticationStatus
332
  )
333
0
{
334
0
  ASSERT (FALSE);
335
0
  return  EFI_NOT_AVAILABLE_YET;
336
0
}
337
338
EFI_STATUS
339
EFIAPI
340
PeiFfsGetFileInfo2 (
341
  IN EFI_PEI_FILE_HANDLE  FileHandle,
342
  OUT EFI_FV_FILE_INFO2   *FileInfo
343
  )
344
0
{
345
0
  ASSERT (FALSE);
346
0
  return  EFI_NOT_AVAILABLE_YET;
347
0
}
348
349
VOID
350
EFIAPI
351
PeiResetSystem2 (
352
  IN EFI_RESET_TYPE     ResetType,
353
  IN EFI_STATUS         ResetStatus,
354
  IN UINTN              DataSize,
355
  IN VOID               *ResetData OPTIONAL
356
  )
357
0
{
358
0
  ASSERT (FALSE);
359
0
}
360
361
EFI_STATUS
362
EFIAPI
363
PeiFreePages (
364
  IN CONST EFI_PEI_SERVICES     **PeiServices,
365
  IN EFI_PHYSICAL_ADDRESS       Memory,
366
  IN UINTN                      Pages
367
  )
368
0
{
369
0
  ASSERT (FALSE);
370
0
  return  EFI_NOT_AVAILABLE_YET;
371
0
}
372
373
EFI_PEI_SERVICES mPeiServices = {
374
  {
375
    PEI_SERVICES_SIGNATURE,
376
    PEI_SERVICES_REVISION,
377
    sizeof (EFI_PEI_SERVICES),
378
    0,
379
    0
380
  },
381
  PeiInstallPpi,
382
  PeiReInstallPpi,
383
  PeiLocatePpi,
384
  PeiNotifyPpi,
385
386
  PeiGetBootMode,
387
  PeiSetBootMode,
388
389
  PeiGetHobList,
390
  PeiCreateHob,
391
392
  PeiFfsFindNextVolume,
393
  PeiFfsFindNextFile,
394
  PeiFfsFindSectionData,
395
396
  PeiInstallPeiMemory,
397
  PeiAllocatePages,
398
  PeiAllocatePool,
399
  (EFI_PEI_COPY_MEM)CopyMem,
400
  (EFI_PEI_SET_MEM)SetMem,
401
402
  PeiReportStatusCode,
403
  PeiResetSystem,
404
405
  &mPeiDefaultCpuIoPpi,
406
  &mPeiDefaultPciCfg2Ppi,
407
408
  PeiFfsFindFileByName,
409
  PeiFfsGetFileInfo,
410
  PeiFfsGetVolumeInfo,
411
  PeiRegisterForShadow,
412
  PeiFfsFindSectionData3,
413
  PeiFfsGetFileInfo2,
414
  PeiResetSystem2,
415
  PeiFreePages,
416
};