1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
|
//**********************************************************************
//**********************************************************************
//** **
//** (C)Copyright 1985-2005, American Megatrends, Inc. **
//** **
//** All Rights Reserved. **
//** **
//** 6145-F Northbelt Pkwy, Norcross, GA 30071 **
//** **
//** Phone: (770)-246-8600 **
//** **
//**********************************************************************
//**********************************************************************
//**********************************************************************
// $Header: /Alaska/BIN/Core/Include/PEI.h 13 6/16/11 2:52p Felixp $
//
// $Revision: 13 $
//
// $Date: 6/16/11 2:52p $
//**********************************************************************
// Revision History
// ----------------
// $Log: /Alaska/BIN/Core/Include/PEI.h $
//
// 13 6/16/11 2:52p Felixp
// Surround backward compatibility definitions with #if
// BACKWARD_COMPATIBLE_MODE
//
// 12 5/27/11 5:49p Felixp
// The definitions that will be removed in the future versions are marked
// with the comments.
//
// 11 3/16/11 11:31p Felixp
// Several identifiers have been updated to match with the latest revision
// of the PI spec.
//
// 10 3/09/11 5:36p Artems
// PI 1.0 clean-up - added EFI_FV_INFO and EFI_FV_FILE_INFO definitions
//
// 9 2/05/11 1:48p Artems
// Added PI 1.0-1.1 support
//
// 8 11/02/06 10:25p Felixp
// EFI_PEI_END_OF_PEI_PHASE_PPI_GUID added
//
// 7 3/13/06 1:15a Felixp
//
// 6 6/06/05 7:49p Felixp
//
// 5 6/06/05 1:24p Felixp
// Type parameter removed from AllocatePages to match PEI CIS 0.91
//
// 4 6/03/05 3:44p Felixp
// Updated to support changes introduced in PEI CIS 0.91
//
// 3 3/22/05 5:31p Felixp
//
// 2 3/04/05 10:20a Mandal
//
// 1 1/28/05 12:44p Felixp
//
// 3 1/18/05 3:21p Felixp
// PrintDebugMessage renamed to Trace
//
// 1 12/23/04 9:41a Felixp
//
// 11 3/29/04 2:32a Felixp
//
// 10 2/24/04 10:20a Felixp
//
// 9 2/04/04 12:34a Felixp
// definition of EFI_PEI_REPORT_STATUS_CODE is fixed
// to match the spec (PEICIS)
//
// 8 1/28/04 3:24a Felixp
//
// 7 1/19/04 4:25p Felixp
// EFI_PEIM_ENTRY_POINT added
//
// 6 1/06/04 4:02p Felixp
//
// 5 12/29/03 6:58p Felixp
//
// 4 12/29/03 5:25p Felixp
// preffix 'EFI_' added to the names of the PEIM descriptor structures and
// flags
//
// 3 12/17/03 11:08a Markw
// Uncommented Hob and FFS defintions. Added Boot Mode include.
//
// 2 12/15/03 5:33p Robert
//
// 1 12/15/03 3:40p Felixp
//
//**********************************************************************
//<AMI_FHDR_START>
//
// Name: pei.h
//
// Description: PEI definitions
//
//<AMI_FHDR_END>
//**********************************************************************
#ifndef __PEI__H__
#define __PEI__H__
#include "efi.h"
#include "ffs.h"
#ifdef __cplusplus
extern "C" {
#endif
// EFI PEI Services Table
#define PEI_SERVICES_SIGNATURE 0x5652455320494550
// PEI Specification Revision information
#ifndef PI_SPECIFICATION_VERSION
#define PI_SPECIFICATION_VERSION 91
#endif
#define PEI_SERVICES_REVISION PI_SPECIFICATION_VERSION
#define PEI_SPECIFICATION_MAJOR_REVISION ((PEI_SERVICES_REVISION)>>16)
#define PEI_SPECIFICATION_MINOR_REVISION ((UINT16)(PEI_SERVICES_REVISION))
//=========================================================================
// PEI Ppi Services List Descriptors
#define EFI_PEI_PPI_DESCRIPTOR_PIC 0x00000001
#define EFI_PEI_PPI_DESCRIPTOR_PPI 0x00000010
#define EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK 0x00000020
#define EFI_PEI_PPI_DESCRIPTOR_NOTIFY_DISPATCH 0x00000040
#define EFI_PEI_PPI_DESCRIPTOR_NOTIFY_TYPES 0x00000060
#define EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST 0x80000000
typedef VOID *EFI_PEI_FILE_HANDLE;
typedef VOID *EFI_PEI_FV_HANDLE;
typedef struct _EFI_SEC_PEI_HAND_OFF {
UINT16 DataSize;
VOID *BootFirmwareVolumeBase;
UINTN BootFirmwareVolumeSize;
VOID *TemporaryRamBase;
UINTN TemporaryRamSize;
VOID *PeiTemporaryRamBase;
UINTN PeiTemporaryRamSize;
VOID *StackBase;
UINTN StackSize;
} EFI_SEC_PEI_HAND_OFF;
typedef
EFI_STATUS
(EFIAPI *EFI_PEIM_NOTIFY_ENTRY_POINT) (
IN struct _EFI_PEI_SERVICES **PeiServices,
IN struct _EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
IN VOID *Ppi
);
typedef struct _EFI_PEI_PPI_DESCRIPTOR {
UINTN Flags;
EFI_GUID *Guid;
VOID *Ppi;
} EFI_PEI_PPI_DESCRIPTOR;
typedef struct _EFI_PEI_NOTIFY_DESCRIPTOR {
UINTN Flags;
EFI_GUID *Guid;
EFI_PEIM_NOTIFY_ENTRY_POINT Notify;
} EFI_PEI_NOTIFY_DESCRIPTOR;
typedef union {
EFI_PEI_NOTIFY_DESCRIPTOR Notify;
EFI_PEI_PPI_DESCRIPTOR Ppi;
} EFI_PEI_DESCRIPTOR;
struct _EFI_PEI_SERVICES;
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_INSTALL_PPI) (
IN struct _EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_PPI_DESCRIPTOR *PpiList
);
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_REINSTALL_PPI) (
IN struct _EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_PPI_DESCRIPTOR *OldPpi,
IN EFI_PEI_PPI_DESCRIPTOR *NewPpi
);
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_LOCATE_PPI) (
IN struct _EFI_PEI_SERVICES **PeiServices,
IN EFI_GUID *Guid,
IN UINTN Instance,
IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor,
IN OUT VOID **Ppi
);
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_NOTIFY_PPI) (
IN struct _EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList
);
// EFI PEI Boot Mode Services
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_GET_BOOT_MODE) (
IN struct _EFI_PEI_SERVICES **PeiServices,
IN OUT EFI_BOOT_MODE *BootMode
);
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_SET_BOOT_MODE) (
IN struct _EFI_PEI_SERVICES **PeiServices,
IN EFI_BOOT_MODE BootMode
);
// PEI HOB Services
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_GET_HOB_LIST) (
IN struct _EFI_PEI_SERVICES **PeiServices,
IN OUT VOID **HobList
);
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_CREATE_HOB) (
IN struct _EFI_PEI_SERVICES **PeiServices,
IN UINT16 Type,
IN UINT16 Length,
IN OUT VOID **Hob
);
// FFS Fw Volume support functions
#if PI_SPECIFICATION_VERSION>=0x00010000
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_FFS_FIND_NEXT_VOLUME2) (
IN struct _EFI_PEI_SERVICES **PeiServices,
IN UINTN Instance,
IN OUT EFI_PEI_FV_HANDLE *FwVolHeader
);
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_FFS_FIND_NEXT_FILE2) (
IN struct _EFI_PEI_SERVICES **PeiServices,
IN UINT8 SearchType,
IN EFI_PEI_FV_HANDLE FwVolHeader,
IN OUT EFI_PEI_FILE_HANDLE *FileHeader
);
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_FFS_FIND_SECTION_DATA2) (
IN struct _EFI_PEI_SERVICES **PeiServices,
IN EFI_SECTION_TYPE SectionType,
IN EFI_PEI_FILE_HANDLE FfsFileHeader,
IN OUT VOID **SectionData
);
#else
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_FFS_FIND_NEXT_VOLUME) (
IN struct _EFI_PEI_SERVICES **PeiServices,
IN UINTN Instance,
IN OUT EFI_FIRMWARE_VOLUME_HEADER **FwVolHeader
);
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_FFS_FIND_NEXT_FILE) (
IN struct _EFI_PEI_SERVICES **PeiServices,
IN UINT8 SearchType,
IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader,
IN OUT EFI_FFS_FILE_HEADER **FileHeader
);
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_FFS_FIND_SECTION_DATA) (
IN struct _EFI_PEI_SERVICES **PeiServices,
IN EFI_SECTION_TYPE SectionType,
IN EFI_FFS_FILE_HEADER *FfsFileHeader,
IN OUT VOID **SectionData
);
#endif
// Memory Services
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_INSTALL_PEI_MEMORY) (
IN struct _EFI_PEI_SERVICES **PeiServices,
IN EFI_PHYSICAL_ADDRESS MemoryBegin,
IN UINT64 MemoryLength
);
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_ALLOCATE_PAGES) (
IN struct _EFI_PEI_SERVICES **PeiServices,
IN EFI_MEMORY_TYPE MemoryType,
IN UINTN Pages,
IN OUT EFI_PHYSICAL_ADDRESS *Memory
);
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_ALLOCATE_POOL) (
IN struct _EFI_PEI_SERVICES **PeiServices,
IN UINTN Size,
OUT VOID **Buffer
);
typedef
VOID
(EFIAPI *EFI_PEI_COPY_MEM) (
IN VOID *Destination,
IN VOID *Source,
IN UINTN Length
);
typedef
VOID
(EFIAPI *EFI_PEI_SET_MEM) (
IN VOID *Buffer,
IN UINTN Size,
IN UINT8 Value
);
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_REPORT_STATUS_CODE) (
IN struct _EFI_PEI_SERVICES **PeiServices,
IN EFI_STATUS_CODE_TYPE Type,
IN EFI_STATUS_CODE_VALUE Value,
IN UINT32 Instance,
IN EFI_GUID *CallerId OPTIONAL,
IN EFI_STATUS_CODE_DATA *Data OPTIONAL
);
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_RESET_SYSTEM) (
IN struct _EFI_PEI_SERVICES **PeiServices
);
//forward declaration
typedef struct _EFI_PEI_SERVICES EFI_PEI_SERVICES;
//CPU I/O
typedef struct _EFI_PEI_CPU_IO_PPI EFI_PEI_CPU_IO_PPI;
typedef enum{
EfiPeiCpuIoWidthUint8,
EfiPeiCpuIoWidthUint16,
EfiPeiCpuIoWidthUint32,
EfiPeiCpuIoWidthUint64,
EfiPeiCpuIoWidthFifoUint8,
EfiPeiCpuIoWidthFifoUint16,
EfiPeiCpuIoWidthFifoUint32,
EfiPeiCpuIoWidthFifoUint64,
EfiPeiCpuIoWidthFillUint8,
EfiPeiCpuIoWidthFillUint16,
EfiPeiCpuIoWidthFillUint32,
EfiPeiCpuIoWidthFillUint64,
EfiPeiCpuIoWidthMaximum
} EFI_PEI_CPU_IO_PPI_WIDTH;
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_CPU_IO_PPI_IO_MEM) (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_CPU_IO_PPI *This,
IN EFI_PEI_CPU_IO_PPI_WIDTH Width,
IN UINT64 Address,
IN UINTN Count,
IN OUT VOID *Buffer
);
typedef
UINT8
(EFIAPI *EFI_PEI_CPU_IO_PPI_IO_READ8) (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_CPU_IO_PPI *This,
IN UINT64 Address
);
typedef
UINT16
(EFIAPI *EFI_PEI_CPU_IO_PPI_IO_READ16) (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_CPU_IO_PPI *This,
IN UINT64 Address
);
typedef
UINT32
(EFIAPI *EFI_PEI_CPU_IO_PPI_IO_READ32) (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_CPU_IO_PPI *This,
IN UINT64 Address
);
typedef
UINT64
(EFIAPI *EFI_PEI_CPU_IO_PPI_IO_READ64) (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_CPU_IO_PPI *This,
IN UINT64 Address
);
typedef
VOID
(EFIAPI *EFI_PEI_CPU_IO_PPI_IO_WRITE8) (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_CPU_IO_PPI *This,
IN UINT64 Address,
IN UINT8 Data
);
typedef
VOID
(EFIAPI *EFI_PEI_CPU_IO_PPI_IO_WRITE16) (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_CPU_IO_PPI *This,
IN UINT64 Address,
IN UINT16 Data
);
typedef
VOID
(EFIAPI *EFI_PEI_CPU_IO_PPI_IO_WRITE32) (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_CPU_IO_PPI *This,
IN UINT64 Address,
IN UINT32 Data
);
typedef
VOID
(EFIAPI *EFI_PEI_CPU_IO_PPI_IO_WRITE64) (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_CPU_IO_PPI *This,
IN UINT64 Address,
IN UINT64 Data
);
typedef
UINT8
(EFIAPI *EFI_PEI_CPU_IO_PPI_MEM_READ8) (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_CPU_IO_PPI *This,
IN UINT64 Address
);
typedef
UINT16
(EFIAPI *EFI_PEI_CPU_IO_PPI_MEM_READ16) (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_CPU_IO_PPI *This,
IN UINT64 Address
);
typedef
UINT32
(EFIAPI *EFI_PEI_CPU_IO_PPI_MEM_READ32) (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_CPU_IO_PPI *This,
IN UINT64 Address
);
typedef
UINT64
(EFIAPI *EFI_PEI_CPU_IO_PPI_MEM_READ64) (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_CPU_IO_PPI *This,
IN UINT64 Address
);
typedef
VOID
(EFIAPI *EFI_PEI_CPU_IO_PPI_MEM_WRITE8) (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_CPU_IO_PPI *This,
IN UINT64 Address,
IN UINT8 Data
);
typedef
VOID
(EFIAPI *EFI_PEI_CPU_IO_PPI_MEM_WRITE16) (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_CPU_IO_PPI *This,
IN UINT64 Address,
IN UINT16 Data
);
typedef
VOID
(EFIAPI *EFI_PEI_CPU_IO_PPI_MEM_WRITE32) (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_CPU_IO_PPI *This,
IN UINT64 Address,
IN UINT32 Data
);
typedef
VOID
(EFIAPI *EFI_PEI_CPU_IO_PPI_MEM_WRITE64) (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_CPU_IO_PPI *This,
IN UINT64 Address,
IN UINT64 Data
);
typedef struct _EFI_PEI_CPU_IO_PPI_ACCESS{
EFI_PEI_CPU_IO_PPI_IO_MEM Read;
EFI_PEI_CPU_IO_PPI_IO_MEM Write;
} EFI_PEI_CPU_IO_PPI_ACCESS;
// Interface definition
typedef struct _EFI_PEI_CPU_IO_PPI{
EFI_PEI_CPU_IO_PPI_ACCESS Mem;
EFI_PEI_CPU_IO_PPI_ACCESS Io;
EFI_PEI_CPU_IO_PPI_IO_READ8 IoRead8;
EFI_PEI_CPU_IO_PPI_IO_READ16 IoRead16;
EFI_PEI_CPU_IO_PPI_IO_READ32 IoRead32;
EFI_PEI_CPU_IO_PPI_IO_READ64 IoRead64;
EFI_PEI_CPU_IO_PPI_IO_WRITE8 IoWrite8;
EFI_PEI_CPU_IO_PPI_IO_WRITE16 IoWrite16;
EFI_PEI_CPU_IO_PPI_IO_WRITE32 IoWrite32;
EFI_PEI_CPU_IO_PPI_IO_WRITE64 IoWrite64;
EFI_PEI_CPU_IO_PPI_MEM_READ8 MemRead8;
EFI_PEI_CPU_IO_PPI_MEM_READ16 MemRead16;
EFI_PEI_CPU_IO_PPI_MEM_READ32 MemRead32;
EFI_PEI_CPU_IO_PPI_MEM_READ64 MemRead64;
EFI_PEI_CPU_IO_PPI_MEM_WRITE8 MemWrite8;
EFI_PEI_CPU_IO_PPI_MEM_WRITE16 MemWrite16;
EFI_PEI_CPU_IO_PPI_MEM_WRITE32 MemWrite32;
EFI_PEI_CPU_IO_PPI_MEM_WRITE64 MemWrite64;
} EFI_PEI_CPU_IO_PPI;
// PCI Cfg
// EFI_PEI_PCI_CFG_PPI_WIDTH
typedef enum{
EfiPeiPciCfgWidthUint8,
EfiPeiPciCfgWidthUint16,
EfiPeiPciCfgWidthUint32,
EfiPeiPciCfgWidthUint64,
EfiPeiPciCfgWidthMaximum
} EFI_PEI_PCI_CFG_PPI_WIDTH;
#define PEI_PCI_CFG_ADDRESS(bus,dev,func,reg) \
((UINT64) ( (((UINTN)bus) << 24) + (((UINTN)dev) << 16) + (((UINTN)func) << 8) + ((UINTN)reg) ))& 0x00000000ffffffff
#ifndef EFI_PEI_PCI_CFG_ADDRESS
#define EFI_PEI_PCI_CFG_ADDRESS(bus,dev,func,reg) \
((UINT64) ( (((UINTN)bus) << 24) + (((UINTN)dev) << 16) + (((UINTN)func) << 8) + ((UINTN)reg) ))& 0x00000000ffffffff
#endif
typedef struct{
UINT8 Register;
UINT8 Function;
UINT8 Device;
UINT8 Bus;
#if PI_SPECIFICATION_VERSION>=0x00010000
UINT32 ExtendedRegister;
#else
UINT8 Reserved[4];
#endif
} PEI_PCI_CFG_PPI_PCI_ADDRESS;
#if PI_SPECIFICATION_VERSION<0x00010000
typedef struct _EFI_PEI_PCI_CFG_PPI EFI_PEI_PCI_CFG_PPI;
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_PCI_CFG_PPI_IO) (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_PCI_CFG_PPI *This,
IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
IN UINT64 Address,
IN OUT VOID *Buffer
);
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_PCI_CFG_PPI_RW) (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_PCI_CFG_PPI *This,
IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
IN UINT64 Address,
IN UINTN SetBits,
IN UINTN ClearBits
);
typedef struct _EFI_PEI_PCI_CFG_PPI{
EFI_PEI_PCI_CFG_PPI_IO Read;
EFI_PEI_PCI_CFG_PPI_IO Write;
EFI_PEI_PCI_CFG_PPI_RW Modify;
} EFI_PEI_PCI_CFG_PPI;
//compatibility definition
//for PI 1.x Modules that do not use Modify funciton
typedef EFI_PEI_PCI_CFG_PPI EFI_PEI_PCI_CFG2_PPI;
#else //#if PI_SPECIFICATION_VERSION<0x00010000
typedef struct _EFI_PEI_PCI_CFG2_PPI EFI_PEI_PCI_CFG2_PPI;
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_PCI_CFG2_PPI_IO) (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_PCI_CFG2_PPI *This,
IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
IN UINT64 Address,
IN OUT VOID *Buffer
);
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_PCI_CFG2_PPI_RW) (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_PCI_CFG2_PPI *This,
IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
IN UINT64 Address,
IN VOID *SetBits,
IN VOID *ClearBits
);
typedef struct _EFI_PEI_PCI_CFG2_PPI{
EFI_PEI_PCI_CFG2_PPI_IO Read;
EFI_PEI_PCI_CFG2_PPI_IO Write;
EFI_PEI_PCI_CFG2_PPI_RW Modify;
UINT16 Segment;
} EFI_PEI_PCI_CFG2_PPI;
#if BACKWARD_COMPATIBLE_MODE
//compatibility definition
//for PI 0.91 Modules that do not use Modify funciton
typedef EFI_PEI_PCI_CFG2_PPI EFI_PEI_PCI_CFG_PPI;
#endif
typedef struct {
EFI_GUID FileName;
EFI_FV_FILETYPE FileType;
EFI_FV_FILE_ATTRIBUTES FileAttributes;
VOID *Buffer;
UINT32 BufferSize;
} EFI_FV_FILE_INFO;
typedef struct {
EFI_FVB_ATTRIBUTES_2 FvAttributes;
EFI_GUID FvFormat;
EFI_GUID FvName;
VOID *FvStart;
UINT64 FvSize;
} EFI_FV_INFO;
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_FFS_FIND_BY_NAME) (
IN CONST EFI_GUID *FileName,
IN EFI_PEI_FV_HANDLE VolumeHandle,
OUT EFI_PEI_FILE_HANDLE *FileHandle
);
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_FFS_GET_FILE_INFO) (
IN EFI_PEI_FILE_HANDLE FileHandle,
OUT EFI_FV_FILE_INFO *FileInfo
);
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_FFS_GET_VOLUME_INFO) (
IN EFI_PEI_FV_HANDLE VolumeHandle,
OUT EFI_FV_INFO *VolumeInfo
);
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_REGISTER_FOR_SHADOW) (
IN EFI_PEI_FILE_HANDLE FileHandle
);
#endif
//PEI Services
typedef struct _EFI_PEI_SERVICES {
EFI_TABLE_HEADER Hdr;
// PPI Functions
EFI_PEI_INSTALL_PPI InstallPpi;
EFI_PEI_REINSTALL_PPI ReInstallPpi;
EFI_PEI_LOCATE_PPI LocatePpi;
EFI_PEI_NOTIFY_PPI NotifyPpi;
// Boot Mode Functions
EFI_PEI_GET_BOOT_MODE GetBootMode;
EFI_PEI_SET_BOOT_MODE SetBootMode;
// HOB Functions
EFI_PEI_GET_HOB_LIST GetHobList;
EFI_PEI_CREATE_HOB CreateHob;
// Firmware Volume Functions
#if PI_SPECIFICATION_VERSION>=0x00010000
EFI_PEI_FFS_FIND_NEXT_VOLUME2 FfsFindNextVolume;
EFI_PEI_FFS_FIND_NEXT_FILE2 FfsFindNextFile;
EFI_PEI_FFS_FIND_SECTION_DATA2 FfsFindSectionData;
#else
EFI_PEI_FFS_FIND_NEXT_VOLUME FfsFindNextVolume;
EFI_PEI_FFS_FIND_NEXT_FILE FfsFindNextFile;
EFI_PEI_FFS_FIND_SECTION_DATA FfsFindSectionData;
#endif
// PEI Memory Functions
EFI_PEI_INSTALL_PEI_MEMORY InstallPeiMemory;
EFI_PEI_ALLOCATE_PAGES AllocatePages;
EFI_PEI_ALLOCATE_POOL AllocatePool;
EFI_PEI_COPY_MEM CopyMem;
EFI_PEI_SET_MEM SetMem;
// Status Code
EFI_PEI_REPORT_STATUS_CODE ReportStatusCode;
// Reset
EFI_PEI_RESET_SYSTEM ResetSystem;
// I/O Abstractions
EFI_PEI_CPU_IO_PPI *CpuIo;
EFI_PEI_PCI_CFG2_PPI *PciCfg;
#if PI_SPECIFICATION_VERSION>=0x00010000
EFI_PEI_FFS_FIND_BY_NAME FfsFindFileByName;
EFI_PEI_FFS_GET_FILE_INFO FfsGetFileInfo;
EFI_PEI_FFS_GET_VOLUME_INFO FfsGetVolumeInfo;
EFI_PEI_REGISTER_FOR_SHADOW RegisterForShadow;
#endif
} EFI_PEI_SERVICES;
typedef EFI_STATUS (EFIAPI *EFI_PEIM_ENTRY_POINT) (
IN EFI_PEI_FILE_HANDLE FfsHeader,
IN EFI_PEI_SERVICES **PeiServices
);
#define EFI_PEI_PERMANENT_MEMORY_INSTALLED_PPI \
{0xf894643d, 0xc449, 0x42d1, 0x8e, 0xa8, 0x85, 0xbd, 0xd8, 0xc6, 0x5b, 0xde}
#define EFI_PEI_MASTER_BOOT_MODE_PEIM_PPI \
{0x7408d748, 0xfc8c, 0x4ee6, 0x92, 0x88, 0xc4, 0xbe, 0xc0, 0x92, 0xa4, 0x10}
#define EFI_PEI_BOOT_IN_RECOVERY_MODE_PEIM_PPI \
{0x17ee496a, 0xd8e4, 0x4b9a, 0x94, 0xd1, 0xce, 0x82, 0x72, 0x30, 0x8, 0x50}
#define EFI_DXE_IPL_PPI_GUID \
{ 0xae8ce5d, 0xe448, 0x4437, 0xa8, 0xd7, 0xeb, 0xf5, 0xf1, 0x94, 0xf7, 0x31 }
#define EFI_PEI_END_OF_PEI_PHASE_PPI_GUID \
{ 0x605EA650, 0xC65C, 0x42e1, 0xBA, 0x80, 0x91, 0xA5, 0x2A, 0xB6,0x18, 0xC6 }
typedef struct _EFI_DXE_IPL_PPI EFI_DXE_IPL_PPI;
//TODO: Last parameter differs from PEICIS
typedef EFI_STATUS (EFIAPI *EFI_DXE_IPL_ENTRY) (
IN EFI_DXE_IPL_PPI *This,
IN EFI_PEI_SERVICES **PeiServices,
IN VOID* HobList
);
//PPI Interface Structure
struct _EFI_DXE_IPL_PPI {
EFI_DXE_IPL_ENTRY Entry;
};
/****** DO NOT WRITE BELOW THIS LINE *******/
#ifdef __cplusplus
}
#endif
#endif
//**********************************************************************
//** **
//** (C)Copyright 1985-2005, American Megatrends, Inc. **
//** **
//** All Rights Reserved. **
//** **
//** 6145-F Northbelt Pkwy, Norcross, GA 30071 **
//** **
//** Phone: (770)-246-8600 **
//** **
//**********************************************************************
//**********************************************************************
|