summaryrefslogtreecommitdiff
path: root/IntelFrameworkPkg/Include/Framework/PeiCis.h
blob: d823339eee9db16d4b9235a0706360fbebb7adc3 (plain)
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
/** @file
  The Include file for definitions in the Intel Platform Innovation Framework for EFI
  Pre-EFI Initialization Core Interface Specification (PEI CIS) Version 0.91.

Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available under 
the terms and conditions of the BSD License that accompanies this distribution.  
The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php.                                          
    
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

**/

#ifndef __PEICIS_H__
#define __PEICIS_H__

#include <Ppi/PciCfg.h>
//
// Framework PEI Specification Revision information
//
#define FRAMEWORK_PEI_SPECIFICATION_MAJOR_REVISION    0
#define FRAMEWORK_PEI_SPECIFICATION_MINOR_REVISION    91


//
// PEI services signature and Revision defined in Framework PEI spec
//
#define FRAMEWORK_PEI_SERVICES_SIGNATURE               0x5652455320494550ULL
#define FRAMEWORK_PEI_SERVICES_REVISION               ((FRAMEWORK_PEI_SPECIFICATION_MAJOR_REVISION<<16) | (FRAMEWORK_PEI_SPECIFICATION_MINOR_REVISION))



typedef struct _FRAMEWORK_EFI_PEI_SERVICES FRAMEWORK_EFI_PEI_SERVICES;

/**
  The PEI Dispatcher will invoke each PEIM one time.  During this pass, the PEI 
  Dispatcher will pass control to the PEIM at the AddressOfEntryPoint in the PE Header. 

  @param  FfsHeader        The pointer to the FFS file header.
  @param  PeiServices      Describes the list of possible PEI Services.

  @return Status code

**/
typedef
EFI_STATUS
(EFIAPI *EFI_PEIM_ENTRY_POINT)(
  IN EFI_FFS_FILE_HEADER            *FfsHeader,
  IN EFI_PEI_SERVICES               **PeiServices
  );
  
/**
  This service abstracts the capability of the PEI 
  Foundation to discover instances of firmware volumes in the system. 
  Given the input file pointer, this service searches for the next 
  matching file in the Firmware File System (FFS) volume.

  @param  PeiServices      An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
  @param  Instance         This instance of the firmware volume to find. The value 0 is the Boot Firmware Volume (BFV).
  @param  FwVolHeader      The pointer to the firmware volume header of the volume to return.

  @retval EFI_SUCCESS           The volume was found.
  @retval EFI_NOT_FOUND         The volume was not found.
  @retval EFI_INVALID_PARAMETER FwVolHeader is NULL

**/
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_FFS_FIND_NEXT_VOLUME)(
  IN FRAMEWORK_EFI_PEI_SERVICES     **PeiServices,
  IN UINTN                          Instance,
  IN OUT EFI_FIRMWARE_VOLUME_HEADER **FwVolHeader
  );
    
/**
  This service abstracts the capability of the PEI 
  Foundation to discover instances of firmware files in the system. 
  Given the input file pointer, this service searches for the next matching 
  file in the Firmware File System (FFS) volume.

  @param  PeiServices      An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
  @param  SearchType       A filter to find files only of this type.
  @param  FwVolHeader      The pointer to the firmware volume header of the volume to search. This parameter 
                           must point to a valid FFS volume.
  @param  FileHeader       The pointer to the current file from which to begin searching. Upon return this pointer will be 
                           updated to reflect the file found.

  @retval EFI_SUCCESS      The file was found.
  @retval EFI_NOT_FOUND    The file was not found.
  @retval EFI_NOT_FOUND    The header checksum was not zero.

**/
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_FFS_FIND_NEXT_FILE)(
  IN FRAMEWORK_EFI_PEI_SERVICES     **PeiServices,
  IN EFI_FV_FILETYPE                SearchType,
  IN EFI_FIRMWARE_VOLUME_HEADER     *FwVolHeader,
  IN OUT EFI_FFS_FILE_HEADER        **FileHeader
  );

/**
  Given the input file pointer, this service searches for the next 
  matching file in the Firmware File System (FFS) volume. 

  @param  PeiServices      An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.
  @param  SectionType      The value of the section type to find.
  @param  FfsFileHeader    A pointer to the file header that contains the set of sections to be searched.
  @param  SectionData      A pointer to the discovered section, if successful.

  @retval EFI_SUCCESS      The section was found.
  @retval EFI_NOT_FOUND    The section was not found.

**/
typedef
EFI_STATUS
(EFIAPI *EFI_PEI_FFS_FIND_SECTION_DATA)(
  IN FRAMEWORK_EFI_PEI_SERVICES     **PeiServices,
  IN EFI_SECTION_TYPE               SectionType,
  IN EFI_FFS_FILE_HEADER            *FfsFileHeader,
  IN OUT VOID                       **SectionData
  );

///
///  FRAMEWORK_EFI_PEI_SERVICES is a collection of functions whose implementation is provided by the PEI
///  Foundation. The table may be located in the temporary or permanent memory, depending upon the capabilities 
///  and phase of execution of PEI.
///  
///  These services fall into various classes, including the following:
///  - Managing the boot mode.
///  - Allocating both early and permanent memory.
///  - Supporting the Firmware File System (FFS).
///  - Abstracting the PPI database abstraction.
///  - Creating Hand-Off Blocks (HOBs).
///        
struct _FRAMEWORK_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
  //
  EFI_PEI_FFS_FIND_NEXT_VOLUME      FfsFindNextVolume;
  EFI_PEI_FFS_FIND_NEXT_FILE        FfsFindNextFile;
  EFI_PEI_FFS_FIND_SECTION_DATA     FfsFindSectionData;
  //
  // 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;
  //
  // (the following interfaces are installed by publishing PEIM)
  // Status Code
  //
  EFI_PEI_REPORT_STATUS_CODE        ReportStatusCode;
  //
  // Reset
  //
  EFI_PEI_RESET_SYSTEM              ResetSystem;
  ///
  /// Inconsistent with specification here: 
  /// In Framework Spec, PeiCis0.91, CpuIo and PciCfg are NOT pointers. 
  ///
  
  //
  // I/O Abstractions
  //
  EFI_PEI_CPU_IO_PPI                *CpuIo;
  EFI_PEI_PCI_CFG_PPI               *PciCfg;
};
///
/// Enumeration of reset types defined in the Framework Specification PeiCis.
///
typedef enum {
  ///
  /// Used to induce a system-wide reset. This sets all circuitry within the 
  /// system to its initial state.  This type of reset is asynchronous to system
  /// operation and operates withgout regard to cycle boundaries.  EfiColdReset 
  /// is tantamount to a system power cycle.
  ///
  EfiPeiResetCold,
  ///
  /// Used to induce a system-wide initialization. The processors are set to their
  /// initial state, and pending cycles are not corrupted.  If the system does 
  /// not support this reset type, then an EfiResetCold must be performed.
  ///
  EfiPeiResetWarm,
} EFI_PEI_RESET_TYPE;

#endif