]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/PiPcd.h
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Include / Protocol / 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
9df063a0 15 Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
9344f092 16 SPDX-License-Identifier: BSD-2-Clause-Patent\r
be35570d 17\r
d6b58d32 18 @par Revision Reference:\r
be35570d 19 PI Version 1.2 Vol 3.\r
20**/\r
21\r
22#ifndef __PI_PCD_H__\r
23#define __PI_PCD_H__\r
24\r
25extern EFI_GUID gEfiPcdProtocolGuid;\r
26\r
27#define EFI_PCD_PROTOCOL_GUID \\r
28 { 0x13a3f0f6, 0x264a, 0x3ef0, { 0xf2, 0xe0, 0xde, 0xc5, 0x12, 0x34, 0x2f, 0x34 } }\r
29\r
30#define EFI_PCD_INVALID_TOKEN_NUMBER ((UINTN) 0)\r
31\r
32/**\r
33 SetSku() sets the SKU Id to be used for subsequent calls to set or get PCD values. SetSku() is\r
34 normally called only once by the system.\r
35 For each item (token), the database can hold a single value that applies to all SKUs, or multiple\r
36 values, where each value is associated with a specific SKU Id. Items with multiple, SKU-specific\r
37 values are called SKU enabled.\r
38 The SKU Id of zero is reserved as a default. The valid SkuId range is 1 to 255. For tokens that are\r
39 not SKU enabled, the system ignores any set SKU Id and works with the single value for that token.\r
40 For SKU-enabled tokens, the system will use the SKU Id set by the last call to SetSku(). If no SKU\r
fa3e7746 41 Id is set or the currently set SKU Id isn't valid for the specified token, the system uses the default\r
be35570d 42 SKU Id. If the system attempts to use the default SKU Id and no value has been set for that Id, the\r
43 results are unpredictable.\r
d6b58d32 44\r
be35570d 45 @param[in] SkuId The SKU value to set.\r
46**/\r
47typedef\r
48VOID\r
49(EFIAPI *EFI_PCD_PROTOCOL_SET_SKU)(\r
50 IN UINTN SkuId\r
51);\r
52\r
53/**\r
54 Retrieves an 8-bit value for a given PCD token.\r
55 If the TokenNumber is invalid, the results are unpredictable.\r
d6b58d32 56\r
be35570d 57 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
58 @param[in] TokenNumber The PCD token number.\r
d6b58d32 59\r
be35570d 60 @return 8-bit value for a given PCD token.\r
61**/\r
62typedef\r
63UINT8\r
9dbad162 64(EFIAPI *EFI_PCD_PROTOCOL_GET_8)(\r
be35570d 65 IN CONST EFI_GUID *Guid,\r
66 IN UINTN TokenNumber\r
67);\r
68\r
69/**\r
d6b58d32 70 Retrieves the current word-sized value for a PCD token number.\r
be35570d 71 If the TokenNumber is invalid, the results are unpredictable.\r
d6b58d32 72\r
be35570d 73 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
74 @param[in] TokenNumber The PCD token number.\r
d6b58d32 75\r
76 @return word-sized value for a given PCD token.\r
be35570d 77**/\r
78typedef\r
79UINT16\r
9dbad162 80(EFIAPI *EFI_PCD_PROTOCOL_GET_16)(\r
be35570d 81 IN CONST EFI_GUID *Guid,\r
82 IN UINTN TokenNumber\r
83);\r
84\r
85/**\r
d6b58d32 86 Retrieves the current 32-bit sized value for a PCD token number.\r
be35570d 87 If the TokenNumber is invalid, the results are unpredictable.\r
88\r
89 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
90 @param[in] TokenNumber The PCD token number.\r
91\r
92 @return 32-bit value for a given PCD token.\r
93**/\r
94typedef\r
95UINT32\r
9dbad162 96(EFIAPI *EFI_PCD_PROTOCOL_GET_32)(\r
be35570d 97 IN CONST EFI_GUID *Guid,\r
98 IN UINTN TokenNumber\r
99);\r
100\r
101/**\r
d6b58d32 102 Retrieves the 64-bit sized value for a PCD token number.\r
be35570d 103 If the TokenNumber is invalid, the results are unpredictable.\r
d6b58d32 104\r
be35570d 105 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
106 @param[in] TokenNumber The PCD token number.\r
107\r
108 @return 64-bit value for a given PCD token.\r
d6b58d32 109\r
be35570d 110**/\r
111typedef\r
112UINT64\r
9dbad162 113(EFIAPI *EFI_PCD_PROTOCOL_GET_64)(\r
be35570d 114 IN CONST EFI_GUID *Guid,\r
115 IN UINTN TokenNumber\r
116);\r
117\r
118/**\r
119 Retrieves the current pointer to the value for a PCD token number. Do not make any assumptions\r
120 about the alignment of the pointer that is returned by this function call. If the TokenNumber is\r
121 invalid, the results are unpredictable.\r
d6b58d32 122\r
be35570d 123 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
124 @param[in] TokenNumber The PCD token number.\r
125\r
126 @return pointer to a value for a given PCD token.\r
127**/\r
128typedef\r
129VOID *\r
9dbad162 130(EFIAPI *EFI_PCD_PROTOCOL_GET_POINTER)(\r
be35570d 131 IN CONST EFI_GUID *Guid,\r
132 IN UINTN TokenNumber\r
133);\r
134\r
135/**\r
136 Retrieves the current BOOLEAN-sized value for a PCD token number. If the TokenNumber is\r
137 invalid, the results are unpredictable.\r
d6b58d32 138\r
be35570d 139 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
140 @param[in] TokenNumber The PCD token number.\r
d6b58d32 141\r
be35570d 142 @return Boolean value for a given PCD token.\r
143**/\r
144typedef\r
145BOOLEAN\r
9dbad162 146(EFIAPI *EFI_PCD_PROTOCOL_GET_BOOLEAN)(\r
be35570d 147 IN CONST EFI_GUID *Guid,\r
148 IN UINTN TokenNumber\r
149);\r
150\r
151/**\r
152 Retrieves the current size of a particular PCD token. If the TokenNumber is invalid, the results are\r
153 unpredictable.\r
d6b58d32 154\r
be35570d 155 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
156 @param[in] TokenNumber The PCD token number.\r
d6b58d32 157\r
be35570d 158 @return the size of the value for a given PCD token.\r
159**/\r
160typedef\r
161UINTN\r
9dbad162 162(EFIAPI *EFI_PCD_PROTOCOL_GET_SIZE)(\r
be35570d 163 IN CONST EFI_GUID *Guid,\r
164 IN UINTN TokenNumber\r
165);\r
166\r
167/**\r
168 Sets an 8-bit value for a given PCD token.\r
d6b58d32 169\r
be35570d 170 When the PCD service sets a value, it will check to ensure that the size of the value being set is\r
171 compatible with the Token's existing definition. If it is not, an error will be returned.\r
d6b58d32 172\r
be35570d 173 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
174 @param[in] TokenNumber The PCD token number.\r
175 @param[in] Value The value to set for the PCD token.\r
d6b58d32 176\r
be35570d 177 @retval EFI_SUCCESS The PCD service has set the value requested\r
178 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was\r
179 incompatible with a call to this function. Use GetSizeEx() to\r
180 retrieve the size of the target data.\r
181 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
182**/\r
183typedef\r
184EFI_STATUS\r
9dbad162 185(EFIAPI *EFI_PCD_PROTOCOL_SET_8)(\r
be35570d 186 IN CONST EFI_GUID *Guid,\r
187 IN UINTN TokenNumber,\r
188 IN UINT8 Value\r
189);\r
190\r
191/**\r
192 Sets an 16-bit value for a given PCD token.\r
d6b58d32 193\r
be35570d 194 When the PCD service sets a value, it will check to ensure that the size of the value being set is\r
195 compatible with the Token's existing definition. If it is not, an error will be returned.\r
d6b58d32 196\r
be35570d 197 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
198 @param[in] TokenNumber The PCD token number.\r
199 @param[in] Value The value to set for the PCD token.\r
d6b58d32 200\r
be35570d 201 @retval EFI_SUCCESS The PCD service has set the value requested\r
202 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was\r
203 incompatible with a call to this function. Use GetSizeEx() to\r
204 retrieve the size of the target data.\r
205 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
206**/\r
207typedef\r
208EFI_STATUS\r
9dbad162 209(EFIAPI *EFI_PCD_PROTOCOL_SET_16)(\r
be35570d 210 IN CONST EFI_GUID *Guid,\r
211 IN UINTN TokenNumber,\r
212 IN UINT16 Value\r
213);\r
214\r
215/**\r
216 Sets an 32-bit value for a given PCD token.\r
d6b58d32 217\r
be35570d 218 When the PCD service sets a value, it will check to ensure that the size of the value being set is\r
219 compatible with the Token's existing definition. If it is not, an error will be returned.\r
d6b58d32 220\r
be35570d 221 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
222 @param[in] TokenNumber The PCD token number.\r
223 @param[in] Value The value to set for the PCD token.\r
d6b58d32 224\r
be35570d 225 @retval EFI_SUCCESS The PCD service has set the value requested\r
226 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was\r
227 incompatible with a call to this function. Use GetSizeEx() to\r
228 retrieve the size of the target data.\r
229 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
230**/\r
231typedef\r
232EFI_STATUS\r
9dbad162 233(EFIAPI *EFI_PCD_PROTOCOL_SET_32)(\r
be35570d 234 IN CONST EFI_GUID *Guid,\r
235 IN UINTN TokenNumber,\r
236 IN UINT32 Value\r
237);\r
238\r
239/**\r
240 Sets an 64-bit value for a given PCD token.\r
d6b58d32 241\r
be35570d 242 When the PCD service sets a value, it will check to ensure that the size of the value being set is\r
243 compatible with the Token's existing definition. If it is not, an error will be returned.\r
d6b58d32 244\r
be35570d 245 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
246 @param[in] TokenNumber The PCD token number.\r
247 @param[in] Value The value to set for the PCD token.\r
d6b58d32 248\r
be35570d 249 @retval EFI_SUCCESS The PCD service has set the value requested\r
250 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was\r
251 incompatible with a call to this function. Use GetSizeEx() to\r
252 retrieve the size of the target data.\r
253 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
254**/\r
255typedef\r
256EFI_STATUS\r
9dbad162 257(EFIAPI *EFI_PCD_PROTOCOL_SET_64)(\r
be35570d 258 IN CONST EFI_GUID *Guid,\r
259 IN UINTN TokenNumber,\r
260 IN UINT64 Value\r
261);\r
262\r
263/**\r
264 Sets a value of a specified size for a given PCD token.\r
d6b58d32 265\r
be35570d 266 When the PCD service sets a value, it will check to ensure that the size of the value being set is\r
267 compatible with the Token's existing definition. If it is not, an error will be returned.\r
d6b58d32 268\r
be35570d 269 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
270 @param[in] TokenNumber The PCD token number.\r
d6b58d32 271 @param[in] SizeOfValue The length of the value being set for the PCD token. If too large of a length is\r
272 specified, upon return from this function the value of SizeOfValue will\r
273 reflect the maximum size for the PCD token.\r
be35570d 274 @param[in] Buffer A pointer to the buffer containing the value to set for the PCD token.\r
d6b58d32 275\r
be35570d 276 @retval EFI_SUCCESS The PCD service has set the value requested\r
277 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was\r
278 incompatible with a call to this function. Use GetSizeEx() to\r
279 retrieve the size of the target data.\r
280 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
281**/\r
282typedef\r
283EFI_STATUS\r
9dbad162 284(EFIAPI *EFI_PCD_PROTOCOL_SET_POINTER)(\r
be35570d 285 IN CONST EFI_GUID *Guid,\r
286 IN UINTN TokenNumber,\r
d6b58d32 287 IN OUT UINTN *SizeOfValue,\r
be35570d 288 IN VOID *Buffer\r
289);\r
290\r
291/**\r
292 Sets a Boolean value for a given PCD token.\r
d6b58d32 293\r
be35570d 294 When the PCD service sets a value, it will check to ensure that the size of the value being set is\r
295 compatible with the Token's existing definition. If it is not, an error will be returned.\r
d6b58d32 296\r
be35570d 297 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
298 @param[in] TokenNumber The PCD token number.\r
299 @param[in] Value The value to set for the PCD token.\r
d6b58d32 300\r
be35570d 301 @retval EFI_SUCCESS The PCD service has set the value requested\r
302 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was\r
303 incompatible with a call to this function. Use GetSizeEx() to\r
304 retrieve the size of the target data.\r
305 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
306**/\r
307typedef\r
308EFI_STATUS\r
9dbad162 309(EFIAPI *EFI_PCD_PROTOCOL_SET_BOOLEAN)(\r
be35570d 310 IN CONST EFI_GUID *Guid,\r
311 IN UINTN TokenNumber,\r
312 IN BOOLEAN Value\r
313);\r
314\r
315typedef\r
316VOID\r
317(EFIAPI *EFI_PCD_PROTOCOL_CALLBACK)(\r
d6b58d32 318 IN EFI_GUID *Guid OPTIONAL,\r
319 IN UINTN CallBackToken,\r
320 IN OUT VOID *TokenData,\r
321 IN UINTN TokenDataSize\r
be35570d 322);\r
323\r
324/**\r
325 Specifies a function to be called anytime the value of a designated token is changed.\r
d6b58d32 326\r
be35570d 327 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
328 @param[in] CallBackToken The PCD token number to monitor.\r
329 @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.\r
d6b58d32 330\r
be35570d 331 @retval EFI_SUCCESS The PCD service has successfully established a call event for the CallBackToken requested.\r
332 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.\r
333**/\r
334typedef\r
335EFI_STATUS\r
336(EFIAPI *EFI_PCD_PROTOCOL_CALLBACK_ON_SET)(\r
337 IN CONST EFI_GUID *Guid OPTIONAL,\r
338 IN UINTN CallBackToken,\r
339 IN EFI_PCD_PROTOCOL_CALLBACK CallBackFunction\r
340);\r
341\r
342/**\r
343 Cancels a callback function that was set through a previous call to the CallBackOnSet function.\r
d6b58d32 344\r
be35570d 345 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
346 @param[in] CallBackToken The PCD token number to monitor.\r
347 @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.\r
d6b58d32 348\r
be35570d 349 @retval EFI_SUCCESS The PCD service has successfully established a call event for the CallBackToken requested.\r
350 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.\r
351**/\r
352typedef\r
353EFI_STATUS\r
354(EFIAPI *EFI_PCD_PROTOCOL_CANCEL_CALLBACK)(\r
355 IN CONST EFI_GUID *Guid OPTIONAL,\r
356 IN UINTN CallBackToken,\r
357 IN EFI_PCD_PROTOCOL_CALLBACK CallBackFunction\r
358);\r
359\r
360/**\r
361 Gets the next valid token number in a given namespace. This is useful since the PCD infrastructure\r
362 contains a sparse list of token numbers, and one cannot a priori know what token numbers are valid\r
363 in the database.\r
d6b58d32 364\r
be35570d 365 @param[in] Guid The 128-bit unique value that designates the namespace from which to retrieve the next token.\r
366 @param[in] TokenNumber A pointer to the PCD token number to use to find the subsequent token number. To\r
367 retrieve the "first" token, have the pointer reference a TokenNumber value of 0.\r
368 @retval EFI_SUCCESS The PCD service has retrieved the value requested\r
d6b58d32 369 @retval EFI_NOT_FOUND The PCD service could not find data from the requested token number.\r
be35570d 370**/\r
371typedef\r
372EFI_STATUS\r
373(EFIAPI *EFI_PCD_PROTOCOL_GET_NEXT_TOKEN)(\r
374 IN CONST EFI_GUID *Guid, OPTIONAL\r
375 IN UINTN *TokenNumber\r
376);\r
377\r
378/**\r
379 Gets the next valid token namespace for a given namespace. This is useful to traverse the valid\r
380 token namespaces on a platform.\r
d6b58d32 381\r
be35570d 382 @param[in, out] Guid An indirect pointer to EFI_GUID. On input it designates a known token namespace\r
383 from which the search will start. On output, it designates the next valid token\r
384 namespace on the platform. If *Guid is NULL, then the GUID of the first token\r
385 space of the current platform is returned. If the search cannot locate the next valid\r
386 token namespace, an error is returned and the value of *Guid is undefined.\r
d6b58d32 387\r
be35570d 388 @retval EFI_SUCCESS The PCD service retrieved the value requested.\r
389 @retval EFI_NOT_FOUND The PCD service could not find the next valid token namespace.\r
390**/\r
391typedef\r
392EFI_STATUS\r
393(EFIAPI *EFI_PCD_PROTOCOL_GET_NEXT_TOKEN_SPACE)(\r
394 IN OUT CONST EFI_GUID **Guid\r
395);\r
396\r
397typedef struct _EFI_PCD_PROTOCOL {\r
398 EFI_PCD_PROTOCOL_SET_SKU SetSku;\r
9dbad162 399 EFI_PCD_PROTOCOL_GET_8 Get8;\r
400 EFI_PCD_PROTOCOL_GET_16 Get16;\r
401 EFI_PCD_PROTOCOL_GET_32 Get32;\r
402 EFI_PCD_PROTOCOL_GET_64 Get64;\r
403 EFI_PCD_PROTOCOL_GET_POINTER GetPtr;\r
404 EFI_PCD_PROTOCOL_GET_BOOLEAN GetBool;\r
405 EFI_PCD_PROTOCOL_GET_SIZE GetSize;\r
406 EFI_PCD_PROTOCOL_SET_8 Set8;\r
407 EFI_PCD_PROTOCOL_SET_16 Set16;\r
408 EFI_PCD_PROTOCOL_SET_32 Set32;\r
409 EFI_PCD_PROTOCOL_SET_64 Set64;\r
410 EFI_PCD_PROTOCOL_SET_POINTER SetPtr;\r
411 EFI_PCD_PROTOCOL_SET_BOOLEAN SetBool;\r
be35570d 412 EFI_PCD_PROTOCOL_CALLBACK_ON_SET CallbackOnSet;\r
413 EFI_PCD_PROTOCOL_CANCEL_CALLBACK CancelCallback;\r
414 EFI_PCD_PROTOCOL_GET_NEXT_TOKEN GetNextToken;\r
415 EFI_PCD_PROTOCOL_GET_NEXT_TOKEN_SPACE GetNextTokenSpace;\r
416} EFI_PCD_PROTOCOL;\r
417\r
418#endif\r