]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Ppi/PiPcd.h
Enable "Load Module At fixed Address" feature in SMM Core
[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
d6b58d32 4 A platform database that contains a variety of current platform settings or\r
be35570d 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
d6b58d32 7\r
be35570d 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
d6b58d32 15 Copyright (c) 2009 - 2010, 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
be35570d 20\r
d6b58d32 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
be35570d 23\r
d6b58d32 24 @par Revision Reference:\r
be35570d 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
d6b58d32 50\r
be35570d 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
d6b58d32 62\r
be35570d 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
d6b58d32 65\r
be35570d 66 @return 8-bit value for a given PCD token.\r
67**/\r
68typedef\r
69UINT8\r
8f79ed81 70(EFIAPI *EFI_PEI_PCD_PPI_GET_EX_8)(\r
be35570d 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
d6b58d32 78\r
be35570d 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
d6b58d32 81\r
be35570d 82 @return 16-bit value for a given PCD token.\r
83**/\r
84typedef\r
85UINT16\r
8f79ed81 86(EFIAPI *EFI_PEI_PCD_PPI_GET_EX_16)(\r
be35570d 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
d6b58d32 94\r
be35570d 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
d6b58d32 97\r
98 @return 32-bit value for a given PCD token.\r
be35570d 99**/\r
100typedef\r
101UINT32\r
8f79ed81 102(EFIAPI *EFI_PEI_PCD_PPI_GET_EX_32)(\r
be35570d 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
d6b58d32 110\r
39ef213c 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
d6b58d32 113\r
114 @return 64-bit value for a given PCD token.\r
39ef213c 115**/\r
116typedef\r
9136fc3c 117UINT64\r
8f79ed81 118(EFIAPI *EFI_PEI_PCD_PPI_GET_EX_64)(\r
39ef213c 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
d6b58d32 127\r
be35570d 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
8f79ed81 133(EFIAPI *EFI_PEI_PCD_PPI_GET_EX_POINTER)(\r
be35570d 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
d6b58d32 144\r
be35570d 145 @return Boolean value for a given PCD token.\r
146**/\r
147typedef\r
148BOOLEAN\r
8f79ed81 149(EFIAPI *EFI_PEI_PCD_PPI_GET_EX_BOOLEAN)(\r
be35570d 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
d6b58d32 157\r
be35570d 158 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.\r
d6b58d32 159 @param[in] TokenNumber The PCD token number.\r
160\r
be35570d 161 @return the size of the value for a given PCD token.\r
162**/\r
163typedef\r
164UINTN\r
8f79ed81 165(EFIAPI *EFI_PEI_PCD_PPI_GET_EX_SIZE)(\r
be35570d 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
d6b58d32 172\r
be35570d 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
d6b58d32 175\r
be35570d 176 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.\r
d6b58d32 177 @param[in] TokenNumber The PCD token number.\r
be35570d 178 @param[in] Value The value to set for the PCD token.\r
d6b58d32 179\r
be35570d 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
d6b58d32 184 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
be35570d 185**/\r
186typedef\r
187EFI_STATUS\r
8f79ed81 188(EFIAPI *EFI_PEI_PCD_PPI_SET_EX_8)(\r
be35570d 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
d6b58d32 196\r
be35570d 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
d6b58d32 199\r
be35570d 200 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.\r
d6b58d32 201 @param[in] TokenNumber The PCD token number.\r
be35570d 202 @param[in] Value The value to set for the PCD token.\r
d6b58d32 203\r
be35570d 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
d6b58d32 208 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
be35570d 209**/\r
210typedef\r
211EFI_STATUS\r
8f79ed81 212(EFIAPI *EFI_PEI_PCD_PPI_SET_EX_16)(\r
be35570d 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
d6b58d32 220\r
be35570d 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
d6b58d32 223\r
be35570d 224 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.\r
d6b58d32 225 @param[in] TokenNumber The PCD token number.\r
be35570d 226 @param[in] Value The value to set for the PCD token.\r
d6b58d32 227\r
be35570d 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
d6b58d32 232 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
be35570d 233**/\r
234typedef\r
235EFI_STATUS\r
8f79ed81 236(EFIAPI *EFI_PEI_PCD_PPI_SET_EX_32)(\r
be35570d 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
d6b58d32 244\r
be35570d 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
d6b58d32 247\r
be35570d 248 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.\r
d6b58d32 249 @param[in] TokenNumber The PCD token number.\r
be35570d 250 @param[in] Value The value to set for the PCD token.\r
d6b58d32 251\r
be35570d 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
d6b58d32 256 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
be35570d 257**/\r
258typedef\r
259EFI_STATUS\r
8f79ed81 260(EFIAPI *EFI_PEI_PCD_PPI_SET_EX_64)(\r
be35570d 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
d6b58d32 268\r
be35570d 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
d6b58d32 271\r
be35570d 272 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.\r
d6b58d32 273 @param[in] TokenNumber The PCD token number.\r
274 @param[in] SizeOfValue The length of the value being set for the PCD token. If too large of a length is\r
275 specified, upon return from this function the value of SizeOfValue will reflect the\r
276 maximum size for the PCD token.\r
be35570d 277 @param[in] Buffer A pointer to the buffer containing the value to set for the PCD token.\r
d6b58d32 278\r
be35570d 279 @retval EFI_SUCCESS The PCD service has set the value requested\r
280 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was\r
281 incompatible with a call to this function. Use GetSizeEx() to\r
282 retrieve the size of the target data.\r
d6b58d32 283 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
be35570d 284**/\r
285typedef\r
286EFI_STATUS\r
8f79ed81 287(EFIAPI *EFI_PEI_PCD_PPI_SET_EX_POINTER)(\r
be35570d 288 IN CONST EFI_GUID *Guid,\r
289 IN UINTN TokenNumber,\r
9136fc3c 290 IN OUT UINTN *SizeOfValue,\r
be35570d 291 IN VOID *Buffer\r
292);\r
293\r
294/**\r
295 Sets a Boolean value for a given PCD token.\r
d6b58d32 296\r
be35570d 297 When the PCD service sets a value, it will check to ensure that the size of the value being set is\r
fa3e7746 298 compatible with the Token's existing definition. If it is not, an error will be returned.\r
d6b58d32 299\r
be35570d 300 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.\r
d6b58d32 301 @param[in] TokenNumber The PCD token number.\r
be35570d 302 @param[in] Value The value to set for the PCD token.\r
d6b58d32 303\r
be35570d 304 @retval EFI_SUCCESS The PCD service has set the value requested\r
305 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was\r
306 incompatible with a call to this function. Use GetSizeEx() to\r
307 retrieve the size of the target data.\r
d6b58d32 308 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
be35570d 309**/\r
310typedef\r
311EFI_STATUS\r
8f79ed81 312(EFIAPI *EFI_PEI_PCD_PPI_SET_EX_BOOLEAN)(\r
be35570d 313 IN CONST EFI_GUID *Guid,\r
314 IN UINTN TokenNumber,\r
315 IN BOOLEAN Value\r
316);\r
317\r
318typedef\r
319VOID\r
d6b58d32 320(EFIAPI *EFI_PEI_PCD_PPI_CALLBACK)(\r
321 IN EFI_GUID *Guid OPTIONAL,\r
322 IN UINTN CallBackToken,\r
323 IN OUT VOID *TokenData,\r
324 IN UINTN TokenDatSize\r
be35570d 325);\r
326\r
327/**\r
328 Specifies a function to be called anytime the value of a designated token is changed.\r
d6b58d32 329\r
be35570d 330 @param[in] Guid The 128-bit unique value that designates which namespace to monitor. If NULL, use\r
331 the standard platform namespace.\r
332 @param[in] CallBackToken The PCD token number to monitor.\r
333 @param[in] CallBackFunction The function prototype that will be called when the value associated with the\r
334 CallBackToken is set.\r
335\r
336 @retval EFI_SUCCESS The PCD service has successfully established a call event for the\r
337 CallBackToken requested.\r
d6b58d32 338 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.\r
be35570d 339**/\r
340typedef\r
341EFI_STATUS\r
39ef213c 342(EFIAPI *EFI_PEI_PCD_PPI_CALLBACK_ON_SET)(\r
d6b58d32 343 IN CONST EFI_GUID *Guid OPTIONAL,\r
344 IN UINTN CallBackToken,\r
345 IN EFI_PEI_PCD_PPI_CALLBACK CallBackFunction\r
be35570d 346);\r
347\r
348/**\r
349 Cancels a previously set callback function for a particular PCD token number.\r
d6b58d32 350\r
be35570d 351 @param[in] Guid The 128-bit unique value that designates which namespace to monitor. If NULL, use\r
352 the standard platform namespace.\r
353 @param[in] CallBackToken The PCD token number to cancel monitoring.\r
354 @param[in] CallBackFunction The function prototype that was originally passed to the CallBackOnSet function.\r
d6b58d32 355\r
be35570d 356 @retval EFI_SUCCESS The PCD service has cancelled the call event associated with the\r
357 CallBackToken.\r
358 @retval EFI_INVALID_PARAMETER The PCD service did not match the CallBackFunction to one\r
359 that is currently being monitored.\r
d6b58d32 360 @retval EFI_NOT_FOUND The PCD service could not find data the requested token number.\r
be35570d 361**/\r
362typedef\r
363EFI_STATUS\r
39ef213c 364(EFIAPI *EFI_PEI_PCD_PPI_CANCEL_CALLBACK)(\r
d6b58d32 365 IN CONST EFI_GUID *Guid OPTIONAL,\r
366 IN UINTN CallBackToken,\r
367 IN EFI_PEI_PCD_PPI_CALLBACK CallBackFunction\r
be35570d 368);\r
369\r
370/**\r
371 Retrieves the next valid PCD token for a given namespace.\r
d6b58d32 372\r
be35570d 373 This provides a means by which to get the next valid token number in a given namespace. This is\r
374 useful since the PCD infrastructure has a sparse list of token numbers in it, and one cannot a priori\r
375 know what token numbers are valid in the database.\r
d6b58d32 376\r
be35570d 377 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.\r
d6b58d32 378 @param[in] TokenNumber The PCD token number.\r
379\r
be35570d 380 @retval EFI_SUCCESS The PCD service has retrieved the value requested.\r
381 @retval EFI_NOT_FOUND The PCD service could not find data from the requested token number.\r
382**/\r
383typedef\r
384EFI_STATUS\r
385(EFIAPI *EFI_PEI_PCD_PPI_GET_NEXT_TOKEN)(\r
386 IN CONST EFI_GUID *Guid OPTIONAL,\r
387 IN UINTN *TokenNumber\r
388);\r
389\r
390/**\r
391 Retrieves the next valid PCD token namespace for a given namespace.\r
d6b58d32 392\r
be35570d 393 Gets the next valid token namespace for a given namespace. This is useful to traverse the valid\r
394 token namespaces on a platform.\r
d6b58d32 395\r
be35570d 396 @param[in, out] Guid An indirect pointer to EFI_GUID. On input it designates a known token\r
397 namespace from which the search will start. On output, it designates the next valid\r
398 token namespace on the platform. If *Guid is NULL, then the GUID of the first token\r
399 space of the current platform is returned. If the search cannot locate the next valid\r
400 token namespace, an error is returned and the value of *Guid is undefined.\r
d6b58d32 401\r
be35570d 402 @retval EFI_SUCCESS The PCD service retrieved the value requested.\r
d6b58d32 403 @retval EFI_NOT_FOUND The PCD service could not find the next valid token namespace.\r
be35570d 404**/\r
405typedef\r
406EFI_STATUS\r
407(EFIAPI *EFI_PEI_PCD_PPI_GET_NEXT_TOKEN_SPACE)(\r
408 IN OUT CONST EFI_GUID **Guid\r
409);\r
410\r
411typedef struct {\r
412 EFI_PEI_PCD_PPI_SET_SKU SetSku;\r
8f79ed81 413 EFI_PEI_PCD_PPI_GET_EX_8 GetEx8;\r
414 EFI_PEI_PCD_PPI_GET_EX_16 GetEx16;\r
415 EFI_PEI_PCD_PPI_GET_EX_32 GetEx32;\r
416 EFI_PEI_PCD_PPI_GET_EX_64 GetEx64;\r
417 EFI_PEI_PCD_PPI_GET_EX_POINTER GetExPtr;\r
418 EFI_PEI_PCD_PPI_GET_EX_BOOLEAN GetExBool;\r
419 EFI_PEI_PCD_PPI_GET_EX_SIZE GetExSize;\r
420 EFI_PEI_PCD_PPI_SET_EX_8 SetEx8;\r
421 EFI_PEI_PCD_PPI_SET_EX_16 SetEx16;\r
422 EFI_PEI_PCD_PPI_SET_EX_32 SetEx32;\r
423 EFI_PEI_PCD_PPI_SET_EX_64 SetEx64;\r
424 EFI_PEI_PCD_PPI_SET_EX_POINTER SetExPtr;\r
425 EFI_PEI_PCD_PPI_SET_EX_BOOLEAN SetExBool;\r
be35570d 426 EFI_PEI_PCD_PPI_CALLBACK_ON_SET CallbackOnSet;\r
427 EFI_PEI_PCD_PPI_CANCEL_CALLBACK CancelCallback;\r
428 EFI_PEI_PCD_PPI_GET_NEXT_TOKEN GetNextToken;\r
429 EFI_PEI_PCD_PPI_GET_NEXT_TOKEN_SPACE GetNextTokenSpace;\r
430} EFI_PEI_PCD_PPI;\r
431\r
432#endif\r