xref: /freebsd/sys/contrib/edk2/Include/Pi/PiMultiPhase.h (revision f439973d6726c3be929c8fb3b1545b8b1744abc3)
1 /** @file
2   Include file matches things in PI for multiple module types.
3 
4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6 
7   @par Revision Reference:
8   These elements are defined in UEFI Platform Initialization Specification 1.8.A
9 
10 **/
11 
12 #ifndef __PI_MULTIPHASE_H__
13 #define __PI_MULTIPHASE_H__
14 
15 #include <Pi/PiFirmwareVolume.h>
16 #include <Pi/PiFirmwareFile.h>
17 #include <Pi/PiBootMode.h>
18 #include <Pi/PiHob.h>
19 #include <Pi/PiDependency.h>
20 #include <Pi/PiStatusCode.h>
21 #include <Pi/PiS3BootScript.h>
22 
23 //
24 // PI Specification Version Information
25 //
26 #define PI_SPECIFICATION_MAJOR_REVISION  1
27 #define PI_SPECIFICATION_MINOR_REVISION  80
28 #define PI_SPECIFICATION_VERSION         ((PI_SPECIFICATION_MAJOR_REVISION << 16) | (PI_SPECIFICATION_MINOR_REVISION))
29 
30 /**
31   Produces an error code in the range reserved for use by the Platform Initialization
32   Architecture Specification.
33 
34   The supported 32-bit range is 0xA0000000-0xBFFFFFFF
35   The supported 64-bit range is 0xA000000000000000-0xBFFFFFFFFFFFFFFF
36 
37   @param  StatusCode    The status code value to convert into a warning code.
38                         StatusCode must be in the range 0x00000000..0x1FFFFFFF.
39 
40   @return The value specified by StatusCode in the PI reserved range.
41 
42 **/
43 #define DXE_ERROR(StatusCode)  (MAX_BIT | (MAX_BIT >> 2) | StatusCode)
44 
45 ///
46 /// If this value is returned by an EFI image, then the image should be unloaded.
47 ///
48 #define EFI_REQUEST_UNLOAD_IMAGE  DXE_ERROR (1)
49 
50 ///
51 /// If this value is returned by an API, it means the capability is not yet
52 /// installed/available/ready to use.
53 ///
54 #define EFI_NOT_AVAILABLE_YET  DXE_ERROR (2)
55 
56 ///
57 /// Success and warning codes reserved for use by PI.
58 /// Supported 32-bit range is 0x20000000-0x3fffffff.
59 /// Supported 64-bit range is 0x2000000000000000-0x3fffffffffffffff.
60 ///
61 #define PI_ENCODE_WARNING(a)  ((MAX_BIT >> 2) | (a))
62 
63 ///
64 /// Error codes reserved for use by PI.
65 /// Supported 32-bit range is 0xa0000000-0xbfffffff.
66 /// Supported 64-bit range is 0xa000000000000000-0xbfffffffffffffff.
67 ///
68 #define PI_ENCODE_ERROR(a)  (MAX_BIT | (MAX_BIT >> 2) | (a))
69 
70 ///
71 /// Return status codes defined in SMM CIS.
72 ///
73 #define EFI_INTERRUPT_PENDING  PI_ENCODE_ERROR (0)
74 
75 #define EFI_WARN_INTERRUPT_SOURCE_PENDING   PI_ENCODE_WARNING (0)
76 #define EFI_WARN_INTERRUPT_SOURCE_QUIESCED  PI_ENCODE_WARNING (1)
77 
78 ///
79 /// Bitmask of values for Authentication Status.
80 /// Authentication Status is returned from EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL
81 /// and the EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI
82 ///
83 /// xx00 Image was not signed.
84 /// xxx1 Platform security policy override. Assumes the same meaning as 0010 (the image was signed, the
85 ///      signature was tested, and the signature passed authentication test).
86 /// 0010 Image was signed, the signature was tested, and the signature passed authentication test.
87 /// 0110 Image was signed and the signature was not tested.
88 /// 1010 Image was signed, the signature was tested, and the signature failed the authentication test.
89 ///
90 ///@{
91 #define EFI_AUTH_STATUS_PLATFORM_OVERRIDE  0x01
92 #define EFI_AUTH_STATUS_IMAGE_SIGNED       0x02
93 #define EFI_AUTH_STATUS_NOT_TESTED         0x04
94 #define EFI_AUTH_STATUS_TEST_FAILED        0x08
95 #define EFI_AUTH_STATUS_ALL                0x0f
96 ///@}
97 
98 ///
99 /// MMRAM states and capabilities
100 ///
101 #define EFI_MMRAM_OPEN                0x00000001
102 #define EFI_MMRAM_CLOSED              0x00000002
103 #define EFI_MMRAM_LOCKED              0x00000004
104 #define EFI_CACHEABLE                 0x00000008
105 #define EFI_ALLOCATED                 0x00000010
106 #define EFI_NEEDS_TESTING             0x00000020
107 #define EFI_NEEDS_ECC_INITIALIZATION  0x00000040
108 
109 #define EFI_SMRAM_OPEN    EFI_MMRAM_OPEN
110 #define EFI_SMRAM_CLOSED  EFI_MMRAM_CLOSED
111 #define EFI_SMRAM_LOCKED  EFI_MMRAM_LOCKED
112 
113 ///
114 /// Structure describing a MMRAM region and its accessibility attributes.
115 ///
116 typedef struct {
117   ///
118   /// Designates the physical address of the MMRAM in memory. This view of memory is
119   /// the same as seen by I/O-based agents, for example, but it may not be the address seen
120   /// by the processors.
121   ///
122   EFI_PHYSICAL_ADDRESS    PhysicalStart;
123   ///
124   /// Designates the address of the MMRAM, as seen by software executing on the
125   /// processors. This address may or may not match PhysicalStart.
126   ///
127   EFI_PHYSICAL_ADDRESS    CpuStart;
128   ///
129   /// Describes the number of bytes in the MMRAM region.
130   ///
131   UINT64                  PhysicalSize;
132   ///
133   /// Describes the accessibility attributes of the MMRAM.  These attributes include the
134   /// hardware state (e.g., Open/Closed/Locked), capability (e.g., cacheable), logical
135   /// allocation (e.g., allocated), and pre-use initialization (e.g., needs testing/ECC
136   /// initialization).
137   ///
138   UINT64                  RegionState;
139 } EFI_MMRAM_DESCRIPTOR;
140 
141 typedef EFI_MMRAM_DESCRIPTOR EFI_SMRAM_DESCRIPTOR;
142 
143 ///
144 /// Structure describing a MMRAM region which cannot be used for the MMRAM heap.
145 ///
146 typedef struct _EFI_MM_RESERVED_MMRAM_REGION {
147   ///
148   /// Starting address of the reserved MMRAM area, as it appears while MMRAM is open.
149   /// Ignored if MmramReservedSize is 0.
150   ///
151   EFI_PHYSICAL_ADDRESS    MmramReservedStart;
152   ///
153   /// Number of bytes occupied by the reserved MMRAM area. A size of zero indicates the
154   /// last MMRAM area.
155   ///
156   UINT64                  MmramReservedSize;
157 } EFI_MM_RESERVED_MMRAM_REGION;
158 
159 typedef enum {
160   EFI_PCD_TYPE_8,
161   EFI_PCD_TYPE_16,
162   EFI_PCD_TYPE_32,
163   EFI_PCD_TYPE_64,
164   EFI_PCD_TYPE_BOOL,
165   EFI_PCD_TYPE_PTR
166 } EFI_PCD_TYPE;
167 
168 typedef struct {
169   ///
170   /// The returned information associated with the requested TokenNumber. If
171   /// TokenNumber is 0, then PcdType is set to EFI_PCD_TYPE_8.
172   ///
173   EFI_PCD_TYPE    PcdType;
174   ///
175   /// The size of the data in bytes associated with the TokenNumber specified. If
176   /// TokenNumber is 0, then PcdSize is set 0.
177   ///
178   UINTN           PcdSize;
179   ///
180   /// The null-terminated ASCII string associated with a given token. If the
181   /// TokenNumber specified was 0, then this field corresponds to the null-terminated
182   /// ASCII string associated with the token's namespace Guid. If NULL, there is no
183   /// name associated with this request.
184   ///
185   CHAR8           *PcdName;
186 } EFI_PCD_INFO;
187 
188 /**
189   The function prototype for invoking a function on an Application Processor.
190 
191   This definition is used by the UEFI MP Serices Protocol, and the
192   PI SMM System Table.
193 
194   @param[in,out] Buffer  The pointer to private data buffer.
195 **/
196 typedef
197 VOID
198 (EFIAPI *EFI_AP_PROCEDURE)(
199   IN OUT VOID  *Buffer
200   );
201 
202 /**
203   The function prototype for invoking a function on an Application Processor.
204 
205   This definition is used by the UEFI MM MP Serices Protocol.
206 
207   @param[in] ProcedureArgument    The pointer to private data buffer.
208 
209   @retval EFI_SUCCESS             Excutive the procedure successfully
210 
211 **/
212 typedef
213 EFI_STATUS
214 (EFIAPI *EFI_AP_PROCEDURE2)(
215   IN VOID  *ProcedureArgument
216   );
217 
218 #endif
219