Coverage Report

Created: 2024-10-17 06:29

/src/hbfa-fl/HBFA/UefiHostTestPkg/Library/PeiServicesTablePointerLibHost/CpuIo.c
Line
Count
Source (jump to first uncovered line)
1
/** @file
2
  The default version of EFI_PEI_CPU_IO_PPI support published by PeiServices in
3
  PeiCore initialization phase.
4
5
  EFI_PEI_CPU_IO_PPI is installed by some platform or chipset-specific PEIM that
6
  abstracts the processor-visible I/O operations. When PeiCore is started, the
7
  default version of EFI_PEI_CPU_IO_PPI will be assigned to PeiServices table.
8
9
Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
10
SPDX-License-Identifier: BSD-2-Clause-Patent
11
12
**/
13
14
#include <PiPei.h>
15
16
/**
17
  Memory-based read services.
18
19
  This function is to perform the Memory Access Read service based on installed
20
  instance of the EFI_PEI_CPU_IO_PPI.
21
  If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
22
  return EFI_NOT_YET_AVAILABLE.
23
24
  @param  PeiServices           An indirect pointer to the PEI Services Table
25
                                published by the PEI Foundation.
26
  @param  This                  Pointer to local data for the interface.
27
  @param  Width                 The width of the access. Enumerated in bytes.
28
  @param  Address               The physical address of the access.
29
  @param  Count                 The number of accesses to perform.
30
  @param  Buffer                A pointer to the buffer of data.
31
32
  @retval EFI_SUCCESS           The function completed successfully.
33
  @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
34
**/
35
EFI_STATUS
36
EFIAPI
37
PeiDefaultMemRead (
38
  IN  CONST EFI_PEI_SERVICES            **PeiServices,
39
  IN  CONST EFI_PEI_CPU_IO_PPI          *This,
40
  IN  EFI_PEI_CPU_IO_PPI_WIDTH          Width,
41
  IN  UINT64                            Address,
42
  IN  UINTN                             Count,
43
  IN  OUT VOID                          *Buffer
44
  )
45
0
{
46
0
  return EFI_NOT_AVAILABLE_YET;
47
0
}
48
49
/**
50
  Memory-based write services.
51
52
  This function is to perform the Memory Access Write service based on installed
53
  instance of the EFI_PEI_CPU_IO_PPI.
54
  If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
55
  return EFI_NOT_YET_AVAILABLE.
56
57
  @param  PeiServices           An indirect pointer to the PEI Services Table
58
                                published by the PEI Foundation.
59
  @param  This                  Pointer to local data for the interface.
60
  @param  Width                 The width of the access. Enumerated in bytes.
61
  @param  Address               The physical address of the access.
62
  @param  Count                 The number of accesses to perform.
63
  @param  Buffer                A pointer to the buffer of data.
64
65
  @retval EFI_SUCCESS           The function completed successfully.
66
  @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
67
**/
68
EFI_STATUS
69
EFIAPI
70
PeiDefaultMemWrite (
71
  IN  CONST EFI_PEI_SERVICES            **PeiServices,
72
  IN  CONST EFI_PEI_CPU_IO_PPI          *This,
73
  IN  EFI_PEI_CPU_IO_PPI_WIDTH          Width,
74
  IN  UINT64                            Address,
75
  IN  UINTN                             Count,
76
  IN  OUT VOID                          *Buffer
77
  )
78
0
{
79
0
  return EFI_NOT_AVAILABLE_YET;
80
0
}
81
82
/**
83
  IO-based read services.
84
85
  This function is to perform the IO-base read service for the EFI_PEI_CPU_IO_PPI.
86
  If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
87
  return EFI_NOT_YET_AVAILABLE.
88
89
  @param  PeiServices           An indirect pointer to the PEI Services Table
90
                                published by the PEI Foundation.
91
  @param  This                  Pointer to local data for the interface.
92
  @param  Width                 The width of the access. Enumerated in bytes.
93
  @param  Address               The physical address of the access.
94
  @param  Count                 The number of accesses to perform.
95
  @param  Buffer                A pointer to the buffer of data.
96
97
  @retval EFI_SUCCESS           The function completed successfully.
98
  @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
99
**/
100
EFI_STATUS
101
EFIAPI
102
PeiDefaultIoRead (
103
  IN      CONST EFI_PEI_SERVICES          **PeiServices,
104
  IN      CONST EFI_PEI_CPU_IO_PPI        *This,
105
  IN      EFI_PEI_CPU_IO_PPI_WIDTH        Width,
106
  IN      UINT64                          Address,
107
  IN      UINTN                           Count,
108
  IN OUT  VOID                            *Buffer
109
  )
110
0
{
111
0
  return EFI_NOT_AVAILABLE_YET;
112
0
}
113
114
/**
115
  IO-based write services.
116
117
  This function is to perform the IO-base write service for the EFI_PEI_CPU_IO_PPI.
118
  If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
119
  return EFI_NOT_YET_AVAILABLE.
120
121
  @param  PeiServices           An indirect pointer to the PEI Services Table
122
                                published by the PEI Foundation.
123
  @param  This                  Pointer to local data for the interface.
124
  @param  Width                 The width of the access. Enumerated in bytes.
125
  @param  Address               The physical address of the access.
126
  @param  Count                 The number of accesses to perform.
127
  @param  Buffer                A pointer to the buffer of data.
128
129
  @retval EFI_SUCCESS           The function completed successfully.
130
  @retval EFI_NOT_YET_AVAILABLE The service has not been installed.
131
**/
132
EFI_STATUS
133
EFIAPI
134
PeiDefaultIoWrite (
135
  IN      CONST EFI_PEI_SERVICES          **PeiServices,
136
  IN      CONST EFI_PEI_CPU_IO_PPI        *This,
137
  IN      EFI_PEI_CPU_IO_PPI_WIDTH        Width,
138
  IN      UINT64                          Address,
139
  IN      UINTN                           Count,
140
  IN OUT  VOID                            *Buffer
141
  )
142
0
{
143
0
  return EFI_NOT_AVAILABLE_YET;
144
0
}
145
146
/**
147
  8-bit I/O read operations.
148
149
  If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
150
  return 0.
151
152
  @param  PeiServices    An indirect pointer to the PEI Services Table published by the PEI Foundation.
153
  @param  This           Pointer to local data for the interface.
154
  @param  Address        The physical address of the access.
155
156
  @return An 8-bit value returned from the I/O space.
157
**/
158
UINT8
159
EFIAPI
160
PeiDefaultIoRead8 (
161
  IN  CONST EFI_PEI_SERVICES      **PeiServices,
162
  IN  CONST EFI_PEI_CPU_IO_PPI    *This,
163
  IN  UINT64                      Address
164
  )
165
0
{
166
0
  return 0;
167
0
}
168
169
/**
170
  Reads an 16-bit I/O port.
171
172
  If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
173
  return 0.
174
175
  @param  PeiServices    An indirect pointer to the PEI Services Table published by the PEI Foundation.
176
  @param  This           Pointer to local data for the interface.
177
  @param  Address        The physical address of the access.
178
179
  @return A 16-bit value returned from the I/O space.
180
**/
181
UINT16
182
EFIAPI
183
PeiDefaultIoRead16 (
184
  IN  CONST EFI_PEI_SERVICES      **PeiServices,
185
  IN  CONST EFI_PEI_CPU_IO_PPI    *This,
186
  IN  UINT64                      Address
187
  )
188
0
{
189
0
  return 0;
190
0
}
191
192
/**
193
  Reads an 32-bit I/O port.
194
195
  If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
196
  return 0.
197
198
  @param  PeiServices    An indirect pointer to the PEI Services Table published by the PEI Foundation.
199
  @param  This           Pointer to local data for the interface.
200
  @param  Address        The physical address of the access.
201
202
  @return A 32-bit value returned from the I/O space.
203
**/
204
UINT32
205
EFIAPI
206
PeiDefaultIoRead32 (
207
  IN  CONST EFI_PEI_SERVICES      **PeiServices,
208
  IN  CONST EFI_PEI_CPU_IO_PPI    *This,
209
  IN  UINT64                      Address
210
  )
211
0
{
212
0
  return 0;
213
0
}
214
215
/**
216
  Reads an 64-bit I/O port.
217
218
  If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
219
  return 0.
220
221
  @param  PeiServices    An indirect pointer to the PEI Services Table published by the PEI Foundation.
222
  @param  This           Pointer to local data for the interface.
223
  @param  Address        The physical address of the access.
224
225
  @return A 64-bit value returned from the I/O space.
226
**/
227
UINT64
228
EFIAPI
229
PeiDefaultIoRead64 (
230
  IN  CONST EFI_PEI_SERVICES      **PeiServices,
231
  IN  CONST EFI_PEI_CPU_IO_PPI    *This,
232
  IN  UINT64                      Address
233
  )
234
0
{
235
0
  return 0;
236
0
}
237
238
/**
239
  8-bit I/O write operations.
240
  If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then do
241
  nothing.
242
243
  @param  PeiServices    An indirect pointer to the PEI Services Table published by the PEI Foundation.
244
  @param  This           Pointer to local data for the interface.
245
  @param  Address        The physical address of the access.
246
  @param  Data           The data to write.
247
**/
248
VOID
249
EFIAPI
250
PeiDefaultIoWrite8 (
251
  IN  CONST EFI_PEI_SERVICES      **PeiServices,
252
  IN  CONST EFI_PEI_CPU_IO_PPI    *This,
253
  IN  UINT64                      Address,
254
  IN  UINT8                       Data
255
  )
256
0
{
257
0
}
258
259
/**
260
  16-bit I/O write operations.
261
  If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then do
262
  nothing.
263
264
  @param  PeiServices    An indirect pointer to the PEI Services Table published by the PEI Foundation.
265
  @param  This           Pointer to local data for the interface.
266
  @param  Address        The physical address of the access.
267
  @param  Data           The data to write.
268
**/
269
VOID
270
EFIAPI
271
PeiDefaultIoWrite16 (
272
  IN  CONST EFI_PEI_SERVICES      **PeiServices,
273
  IN  CONST EFI_PEI_CPU_IO_PPI    *This,
274
  IN  UINT64                      Address,
275
  IN  UINT16                      Data
276
  )
277
0
{
278
0
}
279
280
/**
281
  32-bit I/O write operations.
282
  If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then do
283
  nothing.
284
285
  @param  PeiServices    An indirect pointer to the PEI Services Table published by the PEI Foundation.
286
  @param  This           Pointer to local data for the interface.
287
  @param  Address        The physical address of the access.
288
  @param  Data           The data to write.
289
**/
290
VOID
291
EFIAPI
292
PeiDefaultIoWrite32 (
293
  IN  CONST EFI_PEI_SERVICES      **PeiServices,
294
  IN  CONST EFI_PEI_CPU_IO_PPI    *This,
295
  IN  UINT64                      Address,
296
  IN  UINT32                      Data
297
  )
298
0
{
299
0
}
300
301
/**
302
  64-bit I/O write operations.
303
  If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then do
304
  nothing.
305
306
  @param  PeiServices    An indirect pointer to the PEI Services Table published by the PEI Foundation.
307
  @param  This           Pointer to local data for the interface.
308
  @param  Address        The physical address of the access.
309
  @param  Data           The data to write.
310
**/
311
VOID
312
EFIAPI
313
PeiDefaultIoWrite64 (
314
  IN  CONST EFI_PEI_SERVICES      **PeiServices,
315
  IN  CONST EFI_PEI_CPU_IO_PPI    *This,
316
  IN  UINT64                      Address,
317
  IN  UINT64                      Data
318
  )
319
0
{
320
0
}
321
322
/**
323
  8-bit memory read operations.
324
325
  If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
326
  return 0.
327
328
  @param  PeiServices    An indirect pointer to the PEI Services Table published by the PEI Foundation.
329
  @param  This           Pointer to local data for the interface.
330
  @param  Address        The physical address of the access.
331
332
  @return An 8-bit value returned from the memory space.
333
334
**/
335
UINT8
336
EFIAPI
337
PeiDefaultMemRead8 (
338
  IN  CONST EFI_PEI_SERVICES      **PeiServices,
339
  IN  CONST EFI_PEI_CPU_IO_PPI    *This,
340
  IN  UINT64                      Address
341
  )
342
0
{
343
0
  return 0;
344
0
}
345
346
/**
347
  16-bit memory read operations.
348
349
  If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
350
  return 0.
351
352
  @param  PeiServices    An indirect pointer to the PEI Services Table published by the PEI Foundation.
353
  @param  This           Pointer to local data for the interface.
354
  @param  Address        The physical address of the access.
355
356
  @return An 16-bit value returned from the memory space.
357
358
**/
359
UINT16
360
EFIAPI
361
PeiDefaultMemRead16 (
362
  IN  CONST EFI_PEI_SERVICES      **PeiServices,
363
  IN  CONST EFI_PEI_CPU_IO_PPI    *This,
364
  IN  UINT64                      Address
365
  )
366
0
{
367
0
  return 0;
368
0
}
369
370
/**
371
  32-bit memory read operations.
372
373
  If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
374
  return 0.
375
376
  @param  PeiServices    An indirect pointer to the PEI Services Table published by the PEI Foundation.
377
  @param  This           Pointer to local data for the interface.
378
  @param  Address        The physical address of the access.
379
380
  @return An 32-bit value returned from the memory space.
381
382
**/
383
UINT32
384
EFIAPI
385
PeiDefaultMemRead32 (
386
  IN  CONST EFI_PEI_SERVICES      **PeiServices,
387
  IN  CONST EFI_PEI_CPU_IO_PPI    *This,
388
  IN  UINT64                      Address
389
  )
390
0
{
391
0
  return 0;
392
0
}
393
394
/**
395
  64-bit memory read operations.
396
397
  If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then
398
  return 0.
399
400
  @param  PeiServices    An indirect pointer to the PEI Services Table published by the PEI Foundation.
401
  @param  This           Pointer to local data for the interface.
402
  @param  Address        The physical address of the access.
403
404
  @return An 64-bit value returned from the memory space.
405
406
**/
407
UINT64
408
EFIAPI
409
PeiDefaultMemRead64 (
410
  IN  CONST EFI_PEI_SERVICES      **PeiServices,
411
  IN  CONST EFI_PEI_CPU_IO_PPI    *This,
412
  IN  UINT64                      Address
413
  )
414
0
{
415
0
  return 0;
416
0
}
417
418
/**
419
  8-bit memory write operations.
420
  If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then do
421
  nothing.
422
423
  @param  PeiServices    An indirect pointer to the PEI Services Table published by the PEI Foundation.
424
  @param  This           Pointer to local data for the interface.
425
  @param  Address        The physical address of the access.
426
  @param  Data           The data to write.
427
428
**/
429
VOID
430
EFIAPI
431
PeiDefaultMemWrite8 (
432
  IN  CONST EFI_PEI_SERVICES        **PeiServices,
433
  IN  CONST EFI_PEI_CPU_IO_PPI      *This,
434
  IN  UINT64                        Address,
435
  IN  UINT8                         Data
436
  )
437
0
{
438
0
}
439
440
/**
441
  16-bit memory write operations.
442
  If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then do
443
  nothing.
444
445
  @param  PeiServices    An indirect pointer to the PEI Services Table published by the PEI Foundation.
446
  @param  This           Pointer to local data for the interface.
447
  @param  Address        The physical address of the access.
448
  @param  Data           The data to write.
449
450
**/
451
VOID
452
EFIAPI
453
PeiDefaultMemWrite16 (
454
  IN  CONST EFI_PEI_SERVICES        **PeiServices,
455
  IN  CONST EFI_PEI_CPU_IO_PPI      *This,
456
  IN  UINT64                        Address,
457
  IN  UINT16                        Data
458
  )
459
0
{
460
0
}
461
462
/**
463
  32-bit memory write operations.
464
  If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then do
465
  nothing.
466
467
  @param  PeiServices    An indirect pointer to the PEI Services Table published by the PEI Foundation.
468
  @param  This           Pointer to local data for the interface.
469
  @param  Address        The physical address of the access.
470
  @param  Data           The data to write.
471
472
**/
473
VOID
474
EFIAPI
475
PeiDefaultMemWrite32 (
476
  IN  CONST EFI_PEI_SERVICES        **PeiServices,
477
  IN  CONST EFI_PEI_CPU_IO_PPI      *This,
478
  IN  UINT64                        Address,
479
  IN  UINT32                        Data
480
  )
481
0
{
482
0
}
483
484
/**
485
  64-bit memory write operations.
486
  If the EFI_PEI_CPU_IO_PPI is not installed by platform/chipset PEIM, then do
487
  nothing.
488
489
  @param  PeiServices    An indirect pointer to the PEI Services Table published by the PEI Foundation.
490
  @param  This           Pointer to local data for the interface.
491
  @param  Address        The physical address of the access.
492
  @param  Data           The data to write.
493
494
**/
495
VOID
496
EFIAPI
497
PeiDefaultMemWrite64 (
498
  IN  CONST EFI_PEI_SERVICES        **PeiServices,
499
  IN  CONST EFI_PEI_CPU_IO_PPI      *This,
500
  IN  UINT64                        Address,
501
  IN  UINT64                        Data
502
  )
503
0
{
504
0
}
505
506
///
507
/// This default instance of EFI_PEI_CPU_IO_PPI install assigned to EFI_PEI_SERVICE.CpuIo
508
/// when PeiCore's initialization.
509
///
510
EFI_PEI_CPU_IO_PPI mPeiDefaultCpuIoPpi = {
511
  {
512
    PeiDefaultMemRead,
513
    PeiDefaultMemWrite
514
  },
515
  {
516
    PeiDefaultIoRead,
517
    PeiDefaultIoWrite
518
  },
519
  PeiDefaultIoRead8,
520
  PeiDefaultIoRead16,
521
  PeiDefaultIoRead32,
522
  PeiDefaultIoRead64,
523
  PeiDefaultIoWrite8,
524
  PeiDefaultIoWrite16,
525
  PeiDefaultIoWrite32,
526
  PeiDefaultIoWrite64,
527
  PeiDefaultMemRead8,
528
  PeiDefaultMemRead16,
529
  PeiDefaultMemRead32,
530
  PeiDefaultMemRead64,
531
  PeiDefaultMemWrite8,
532
  PeiDefaultMemWrite16,
533
  PeiDefaultMemWrite32,
534
  PeiDefaultMemWrite64
535
};