]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Ppi/PiPcd.h
Remove assumption that the transition code for transitioning from 64-bit to 32-bit...
[mirror_edk2.git] / MdePkg / Include / Ppi / PiPcd.h
CommitLineData
be35570d 1/** @file\r
2 Platform Configuration Database (PCD) Protocol defined in PI 1.2 Vol3\r
3\r
4 A platform database that contains a variety of current platform settings or \r
5 directives that can be accessed by a driver or application.\r
6 PI PCD protocol only provide the accessing interfaces for Dynamic-Ex type PCD.\r
7 \r
8 Callers to this protocol must be at a TPL_APPLICATION task priority level.\r
9 This is the base PCD service API that provides an abstraction for accessing configuration content in\r
10 the platform. It a seamless mechanism for extracting information regardless of where the\r
11 information is stored (such as in Read-only data, or an EFI Variable).\r
12 This protocol allows access to data through size-granular APIs and provides a mechanism for a\r
13 firmware component to monitor specific settings and be alerted when a setting is changed.\r
14\r
15 Copyright (c) 2009, Intel Corporation \r
16 All rights reserved. This program and the accompanying materials \r
17 are licensed and made available under the terms and conditions of the BSD License \r
18 which accompanies this distribution. The full text of the license may be found at \r
19 http://opensource.org/licenses/bsd-license.php \r
20\r
21 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
22 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
23\r
24 @par Revision Reference: \r
25 PI Version 1.2 Vol 3.\r
26**/\r
27\r
28#ifndef __PI_PCD_PPI_H__\r
29#define __PI_PCD_PPI_H__\r
30\r
31extern EFI_GUID gEfiPeiPcdPpiGuid;\r
32\r
33#define EFI_PEI_PCD_PPI_GUID \\r
34 { 0x1f34d25, 0x4de2, 0x23ad, { 0x3f, 0xf3, 0x36, 0x35, 0x3f, 0xf3, 0x23, 0xf1 } }\r
35\r
36#define EFI_PCD_INVALID_TOKEN_NUMBER ((UINTN) 0)\r
37\r
38/**\r
39 SetSku() sets the SKU Id to be used for subsequent calls to set or get PCD values. SetSku() is\r
40 normally called only once by the system.\r
41 For each item (token), the database can hold a single value that applies to all SKUs, or multiple\r
42 values, where each value is associated with a specific SKU Id. Items with multiple, SKU-specific\r
43 values are called SKU enabled.\r
44 The SKU Id of zero is reserved as a default. The valid SkuId range is 1 to 255. For tokens that are\r
45 not SKU enabled, the system ignores any set SKU Id and works with the single value for that token.\r
46 For SKU-enabled tokens, the system will use the SKU Id set by the last call to SetSku(). If no\r
fa3e7746 47 SKU Id is set or the currently set SKU Id isn't valid for the specified token, the system uses the\r
be35570d 48 default SKU Id. If the system attempts to use the default SKU Id and no value has been set for that\r
49 Id, the results are unpredictable.\r
50 \r
51 @param[in] SkuId The SKU value to set.\r
52**/\r
53typedef\r
54VOID\r
55(EFIAPI *EFI_PEI_PCD_PPI_SET_SKU)(\r
56 IN UINTN SkuId\r
57);\r
58\r
59/**\r
60 Retrieves the current byte-sized value for a PCD token number. If the TokenNumber is invalid,\r
61 the results are unpredictable.\r
62 \r
63 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.\r
64 @param[in] TokenNumber The PCD token number.\r
65 \r
66 @return 8-bit value for a given PCD token.\r
67**/\r
68typedef\r
69UINT8\r
70(EFIAPI *EFI_PEI_PCD_PPI_GET_EX_8)(\r
71 IN CONST EFI_GUID *Guid,\r
72 IN UINTN TokenNumber\r
73);\r
74\r
75/**\r
76 Retrieves the current byte-sized value for a PCD token number. If the TokenNumber is invalid,\r
77 the results are unpredictable.\r
78 \r
79 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.\r
80 @param[in] TokenNumber The PCD token number.\r
81 \r
82 @return 16-bit value for a given PCD token.\r
83**/\r
84typedef\r
85UINT16\r
86(EFIAPI *EFI_PEI_PCD_PPI_GET_EX_16)(\r
87 IN CONST EFI_GUID *Guid,\r
88 IN UINTN TokenNumber\r
89);\r
90\r
91/**\r
92 Retrieves the current 32-bit value for a PCD token number. If the TokenNumber is invalid, the\r
93 results are unpredictable.\r
94 \r
95 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.\r
96 @param[in] TokenNumber The PCD token number.\r
97 \r
98 @return 32-bit value for a given PCD token. \r
99**/\r
100typedef\r
101UINT32\r
102(EFIAPI *EFI_PEI_PCD_PPI_GET_EX_32)(\r
103 IN CONST EFI_GUID *Guid,\r
104 IN UINTN TokenNumber\r
105);\r
106\r
39ef213c 107/**\r
108 Retrieves the current 64-bit value for a PCD token number. If the TokenNumber is invalid, the\r
109 results are unpredictable.\r
110 \r
111 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.\r
112 @param[in] TokenNumber The PCD token number.\r
113 \r
114 @return 64-bit value for a given PCD token. \r
115**/\r
116typedef\r
9136fc3c 117UINT64\r
39ef213c 118(EFIAPI *EFI_PEI_PCD_PPI_GET_EX_64)(\r
119 IN CONST EFI_GUID *Guid,\r
120 IN UINTN TokenNumber\r
121);\r
122\r
be35570d 123/**\r
124 Retrieves the current pointer to the value for a PCD token number. There should not be any\r
125 alignment assumptions about the pointer that is returned by this function call. If the TokenNumber\r
126 is invalid, the results are unpredictable.\r
127 \r
128 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.\r
129 @param[in] TokenNumber The PCD token number.\r
130**/\r
131typedef\r
132VOID *\r
133(EFIAPI *EFI_PEI_PCD_PPI_GET_EX_POINTER)(\r
134 IN CONST EFI_GUID *Guid,\r
135 IN UINTN TokenNumber\r
136);\r
137\r
138/**\r
139 Retrieves the current Boolean-sized value for a PCD token number. If the TokenNumber is\r
140 invalid, the results are unpredictable.\r
141\r
142 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.\r
143 @param[in] TokenNumber The PCD token number.\r
144 \r
145 @return Boolean value for a given PCD token.\r
146**/\r
147typedef\r
148BOOLEAN\r
149(EFIAPI *EFI_PEI_PCD_PPI_GET_EX_BOOLEAN)(\r
150 IN CONST EFI_GUID *Guid,\r
151 IN UINTN TokenNumber\r
152);\r
153\r
154/**\r
155 Retrieves the current size of a particular PCD token. If the TokenNumber is invalid, the results are\r
156 unpredictable.\r
157 \r
158 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.\r
159 @param[in] TokenNumber The PCD token number. \r
160 \r
161 @return the size of the value for a given PCD token.\r
162**/\r
163typedef\r
164UINTN\r
165(EFIAPI *EFI_PEI_PCD_PPI_GET_EX_SIZE)(\r
166 IN CONST EFI_GUID *Guid,\r
167 IN UINTN TokenNumber\r
168);\r
169\r
170/**\r
171 Sets an 8-bit value for a given PCD token.\r
172 \r
173 When the PCD service sets a value, it will check to ensure that the size of the value being set is\r
fa3e7746 174 compatible with the Token's existing definition. If it is not, an error will be returned.\r
be35570d 175 \r
176 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.\r
177 @param[in] TokenNumber The PCD token number. \r
178 @param[in] Value The value to set for the PCD token.\r
179 \r
180 @retval EFI_SUCCESS The PCD service has set the value requested\r
181 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was\r
182 incompatible with a call to this function. Use GetSizeEx() to\r
183 retrieve the size of the target data.\r
184 @retval EFI_NOT_FOUND The PCD service could not find the requested token number. \r
185**/\r
186typedef\r
187EFI_STATUS\r
188(EFIAPI *EFI_PEI_PCD_PPI_SET_EX_8)(\r
189 IN CONST EFI_GUID *Guid,\r
190 IN UINTN TokenNumber,\r
191 IN UINT8 Value\r
192);\r
193\r
194/**\r
195 Sets an 16-bit value for a given PCD token.\r
196 \r
197 When the PCD service sets a value, it will check to ensure that the size of the value being set is\r
fa3e7746 198 compatible with the Token's existing definition. If it is not, an error will be returned.\r
be35570d 199 \r
200 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.\r
201 @param[in] TokenNumber The PCD token number. \r
202 @param[in] Value The value to set for the PCD token.\r
203 \r
204 @retval EFI_SUCCESS The PCD service has set the value requested\r
205 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was\r
206 incompatible with a call to this function. Use GetSizeEx() to\r
207 retrieve the size of the target data.\r
208 @retval EFI_NOT_FOUND The PCD service could not find the requested token number. \r
209**/\r
210typedef\r
211EFI_STATUS\r
212(EFIAPI *EFI_PEI_PCD_PPI_SET_EX_16)(\r
213 IN CONST EFI_GUID *Guid,\r
214 IN UINTN TokenNumber,\r
215 IN UINT16 Value\r
216);\r
217\r
218/**\r
219 Sets an 32-bit value for a given PCD token.\r
220 \r
221 When the PCD service sets a value, it will check to ensure that the size of the value being set is\r
fa3e7746 222 compatible with the Token's existing definition. If it is not, an error will be returned.\r
be35570d 223 \r
224 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.\r
225 @param[in] TokenNumber The PCD token number. \r
226 @param[in] Value The value to set for the PCD token.\r
227 \r
228 @retval EFI_SUCCESS The PCD service has set the value requested\r
229 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was\r
230 incompatible with a call to this function. Use GetSizeEx() to\r
231 retrieve the size of the target data.\r
232 @retval EFI_NOT_FOUND The PCD service could not find the requested token number. \r
233**/\r
234typedef\r
235EFI_STATUS\r
236(EFIAPI *EFI_PEI_PCD_PPI_SET_EX_32)(\r
237 IN CONST EFI_GUID *Guid,\r
238 IN UINTN TokenNumber,\r
239 IN UINT32 Value\r
240);\r
241\r
242/**\r
243 Sets an 64-bit value for a given PCD token.\r
244 \r
245 When the PCD service sets a value, it will check to ensure that the size of the value being set is\r
fa3e7746 246 compatible with the Token's existing definition. If it is not, an error will be returned.\r
be35570d 247 \r
248 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.\r
249 @param[in] TokenNumber The PCD token number. \r
250 @param[in] Value The value to set for the PCD token.\r
251 \r
252 @retval EFI_SUCCESS The PCD service has set the value requested\r
253 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was\r
254 incompatible with a call to this function. Use GetSizeEx() to\r
255 retrieve the size of the target data.\r
256 @retval EFI_NOT_FOUND The PCD service could not find the requested token number. \r
257**/\r
258typedef\r
259EFI_STATUS\r
260(EFIAPI *EFI_PEI_PCD_PPI_SET_EX_64)(\r
261 IN CONST EFI_GUID *Guid,\r
262 IN UINTN TokenNumber,\r
263 IN UINT64 Value\r
264);\r
265\r
266/**\r
267 Sets a value of the specified size for a given PCD token.\r
268 \r
269 When the PCD service sets a value, it will check to ensure that the size of the value being set is\r
fa3e7746 270 compatible with the Token's existing definition. If it is not, an error will be returned.\r
be35570d 271 \r
272 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.\r
273 @param[in] TokenNumber The PCD token number. \r
274 @param[in] SizeOfValue The length of the Value being set for the PCD token.\r
275 @param[in] Buffer A pointer to the buffer containing the value to set for the PCD token.\r
276 \r
277 @retval EFI_SUCCESS The PCD service has set the value requested\r
278 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was\r
279 incompatible with a call to this function. Use GetSizeEx() to\r
280 retrieve the size of the target data.\r
281 @retval EFI_NOT_FOUND The PCD service could not find the requested token number. \r
282**/\r
283typedef\r
284EFI_STATUS\r
285(EFIAPI *EFI_PEI_PCD_PPI_SET_EX_POINTER)(\r
286 IN CONST EFI_GUID *Guid,\r
287 IN UINTN TokenNumber,\r
9136fc3c 288 IN OUT UINTN *SizeOfValue,\r
be35570d 289 IN VOID *Buffer\r
290);\r
291\r
292/**\r
293 Sets a Boolean value for a given PCD token.\r
294 \r
295 When the PCD service sets a value, it will check to ensure that the size of the value being set is\r
fa3e7746 296 compatible with the Token's existing definition. If it is not, an error will be returned.\r
be35570d 297 \r
298 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.\r
299 @param[in] TokenNumber The PCD token number. \r
300 @param[in] Value The value to set for the PCD token.\r
301 \r
302 @retval EFI_SUCCESS The PCD service has set the value requested\r
303 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was\r
304 incompatible with a call to this function. Use GetSizeEx() to\r
305 retrieve the size of the target data.\r
306 @retval EFI_NOT_FOUND The PCD service could not find the requested token number. \r
307**/\r
308typedef\r
309EFI_STATUS\r
310(EFIAPI *EFI_PEI_PCD_PPI_SET_EX_BOOLEAN)(\r
311 IN CONST EFI_GUID *Guid,\r
312 IN UINTN TokenNumber,\r
313 IN BOOLEAN Value\r
314);\r
315\r
316typedef\r
317VOID\r
39ef213c 318(EFIAPI *EFI_PCD_PPI_CALLBACK)(\r
be35570d 319 IN EFI_GUID *Guid OPTIONAL,\r
320 IN UINTN CallBackToken,\r
321 IN VOID *TokenData,\r
322 IN UINTN TokenDatSize\r
323);\r
324\r
325/**\r
326 Specifies a function to be called anytime the value of a designated token is changed.\r
327 \r
328 @param[in] Guid The 128-bit unique value that designates which namespace to monitor. If NULL, use\r
329 the standard platform namespace.\r
330 @param[in] CallBackToken The PCD token number to monitor.\r
331 @param[in] CallBackFunction The function prototype that will be called when the value associated with the\r
332 CallBackToken is set.\r
333\r
334 @retval EFI_SUCCESS The PCD service has successfully established a call event for the\r
335 CallBackToken requested.\r
336 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number. \r
337**/\r
338typedef\r
339EFI_STATUS\r
39ef213c 340(EFIAPI *EFI_PEI_PCD_PPI_CALLBACK_ON_SET)(\r
be35570d 341 IN CONST EFI_GUID *Guid OPTIONAL,\r
342 IN UINTN CallBackToken,\r
39ef213c 343 IN EFI_PCD_PPI_CALLBACK CallBackFunction\r
be35570d 344);\r
345\r
346/**\r
347 Cancels a previously set callback function for a particular PCD token number.\r
348 \r
349 @param[in] Guid The 128-bit unique value that designates which namespace to monitor. If NULL, use\r
350 the standard platform namespace.\r
351 @param[in] CallBackToken The PCD token number to cancel monitoring.\r
352 @param[in] CallBackFunction The function prototype that was originally passed to the CallBackOnSet function.\r
353 \r
354 @retval EFI_SUCCESS The PCD service has cancelled the call event associated with the\r
355 CallBackToken.\r
356 @retval EFI_INVALID_PARAMETER The PCD service did not match the CallBackFunction to one\r
357 that is currently being monitored.\r
358 @retval EFI_NOT_FOUND The PCD service could not find data the requested token number. \r
359**/\r
360typedef\r
361EFI_STATUS\r
39ef213c 362(EFIAPI *EFI_PEI_PCD_PPI_CANCEL_CALLBACK)(\r
be35570d 363 IN CONST EFI_GUID *Guid OPTIONAL,\r
364 IN UINTN CallBackToken,\r
39ef213c 365 IN EFI_PCD_PPI_CALLBACK CallBackFunction\r
be35570d 366);\r
367\r
368/**\r
369 Retrieves the next valid PCD token for a given namespace.\r
370 \r
371 This provides a means by which to get the next valid token number in a given namespace. This is\r
372 useful since the PCD infrastructure has a sparse list of token numbers in it, and one cannot a priori\r
373 know what token numbers are valid in the database.\r
374 \r
375 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.\r
376 @param[in] TokenNumber The PCD token number. \r
377 \r
378 @retval EFI_SUCCESS The PCD service has retrieved the value requested.\r
379 @retval EFI_NOT_FOUND The PCD service could not find data from the requested token number.\r
380**/\r
381typedef\r
382EFI_STATUS\r
383(EFIAPI *EFI_PEI_PCD_PPI_GET_NEXT_TOKEN)(\r
384 IN CONST EFI_GUID *Guid OPTIONAL,\r
385 IN UINTN *TokenNumber\r
386);\r
387\r
388/**\r
389 Retrieves the next valid PCD token namespace for a given namespace.\r
390 \r
391 Gets the next valid token namespace for a given namespace. This is useful to traverse the valid\r
392 token namespaces on a platform.\r
393 \r
394 @param[in, out] Guid An indirect pointer to EFI_GUID. On input it designates a known token\r
395 namespace from which the search will start. On output, it designates the next valid\r
396 token namespace on the platform. If *Guid is NULL, then the GUID of the first token\r
397 space of the current platform is returned. If the search cannot locate the next valid\r
398 token namespace, an error is returned and the value of *Guid is undefined.\r
399 \r
400 @retval EFI_SUCCESS The PCD service retrieved the value requested.\r
401 @retval EFI_NOT_FOUND The PCD service could not find the next valid token namespace. \r
402**/\r
403typedef\r
404EFI_STATUS\r
405(EFIAPI *EFI_PEI_PCD_PPI_GET_NEXT_TOKEN_SPACE)(\r
406 IN OUT CONST EFI_GUID **Guid\r
407);\r
408\r
409typedef struct {\r
410 EFI_PEI_PCD_PPI_SET_SKU SetSku;\r
411 EFI_PEI_PCD_PPI_GET_EX_8 GetEx8;\r
412 EFI_PEI_PCD_PPI_GET_EX_16 GetEx16;\r
413 EFI_PEI_PCD_PPI_GET_EX_32 GetEx32;\r
414 EFI_PEI_PCD_PPI_GET_EX_64 GetEx64;\r
415 EFI_PEI_PCD_PPI_GET_EX_POINTER GetExPtr;\r
416 EFI_PEI_PCD_PPI_GET_EX_BOOLEAN GetExBool;\r
417 EFI_PEI_PCD_PPI_GET_EX_SIZE GetExSize;\r
418 EFI_PEI_PCD_PPI_SET_EX_8 SetEx8;\r
419 EFI_PEI_PCD_PPI_SET_EX_16 SetEx16;\r
420 EFI_PEI_PCD_PPI_SET_EX_32 SetEx32;\r
421 EFI_PEI_PCD_PPI_SET_EX_64 SetEx64;\r
422 EFI_PEI_PCD_PPI_SET_EX_POINTER SetExPtr;\r
423 EFI_PEI_PCD_PPI_SET_EX_BOOLEAN SetExBool;\r
424 EFI_PEI_PCD_PPI_CALLBACK_ON_SET CallbackOnSet;\r
425 EFI_PEI_PCD_PPI_CANCEL_CALLBACK CancelCallback;\r
426 EFI_PEI_PCD_PPI_GET_NEXT_TOKEN GetNextToken;\r
427 EFI_PEI_PCD_PPI_GET_NEXT_TOKEN_SPACE GetNextTokenSpace;\r
428} EFI_PEI_PCD_PPI;\r
429\r
430#endif\r