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