]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/PCD/Pei/Service.h
MdeModulePkg PCD: Update PCD database structure definition to match BaseTools
[mirror_edk2.git] / MdeModulePkg / Universal / PCD / Pei / Service.h
CommitLineData
80408db0 1/** @file\r
5944a83b 2 The internal header file declares the private functions used by PeiPcd driver.\r
80408db0 3\r
b6e89910 4Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
e5eed7d3 5This program and the accompanying materials\r
c52fa98c 6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
80408db0 12\r
80408db0 13**/\r
14\r
fc547e08 15#ifndef _PEI_PCD_SERVICE_H_\r
16#define _PEI_PCD_SERVICE_H_\r
80408db0 17\r
97a079ed
A
18#include <PiPei.h>\r
19#include <Ppi/ReadOnlyVariable2.h>\r
20#include <Ppi/Pcd.h>\r
c896d682 21#include <Ppi/PiPcd.h>\r
96d6d004
SZ
22#include <Ppi/PcdInfo.h>\r
23#include <Ppi/PiPcdInfo.h>\r
98b15cf1 24#include <Guid/PcdDataBaseHobGuid.h>\r
419db80b 25#include <Guid/PcdDataBaseSignatureGuid.h>\r
97a079ed
A
26#include <Library/DebugLib.h>\r
27#include <Library/PeimEntryPoint.h>\r
28#include <Library/BaseLib.h>\r
29#include <Library/HobLib.h>\r
30#include <Library/PeiServicesLib.h>\r
31#include <Library/PcdLib.h>\r
97a079ed 32#include <Library/BaseMemoryLib.h>\r
96d6d004 33#include <Library/MemoryAllocationLib.h>\r
80408db0 34\r
35//\r
36// Please make sure the PCD Serivce PEIM Version is consistent with\r
e9d97d08 37// the version of the generated PEIM PCD Database by build tool.\r
80408db0 38//\r
b6e89910 39#define PCD_SERVICE_PEIM_VERSION 6\r
80408db0 40\r
41//\r
e9d97d08 42// PCD_PEI_SERVICE_DRIVER_VERSION is defined in Autogen.h.\r
80408db0 43//\r
e9d97d08
LG
44#if (PCD_SERVICE_PEIM_VERSION != PCD_PEI_SERVICE_DRIVER_VERSION)\r
45 #error "Please make sure the version of PCD PEIM Service and the generated PCD PEI Database match."\r
46#endif\r
80408db0 47\r
96d6d004
SZ
48/**\r
49 Retrieve additional information associated with a PCD token in the default token space.\r
50\r
51 This includes information such as the type of value the TokenNumber is associated with as well as possible\r
52 human readable name that is associated with the token.\r
53\r
54 @param[in] TokenNumber The PCD token number.\r
55 @param[out] PcdInfo The returned information associated with the requested TokenNumber.\r
56 The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.\r
57\r
58 @retval EFI_SUCCESS The PCD information was returned successfully.\r
59 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
60**/\r
61EFI_STATUS\r
62EFIAPI\r
63PeiGetPcdInfoGetInfo (\r
64 IN UINTN TokenNumber,\r
65 OUT EFI_PCD_INFO *PcdInfo\r
66 );\r
67\r
68/**\r
69 Retrieve additional information associated with a PCD token.\r
70\r
71 This includes information such as the type of value the TokenNumber is associated with as well as possible\r
72 human readable name that is associated with the token.\r
73\r
74 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
75 @param[in] TokenNumber The PCD token number.\r
76 @param[out] PcdInfo The returned information associated with the requested TokenNumber.\r
77 The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.\r
78\r
79 @retval EFI_SUCCESS The PCD information was returned successfully.\r
80 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
81**/\r
82EFI_STATUS\r
83EFIAPI\r
84PeiGetPcdInfoGetInfoEx (\r
85 IN CONST EFI_GUID *Guid,\r
86 IN UINTN TokenNumber,\r
87 OUT EFI_PCD_INFO *PcdInfo\r
88 );\r
89\r
90/**\r
91 Retrieve the currently set SKU Id.\r
92\r
93 @return The currently set SKU Id. If the platform has not set at a SKU Id, then the\r
94 default SKU Id value of 0 is returned. If the platform has set a SKU Id, then the currently set SKU\r
95 Id is returned.\r
96**/\r
97UINTN\r
98EFIAPI\r
99PeiGetPcdInfoGetSku (\r
100 VOID\r
101 );\r
102\r
80408db0 103//\r
104// PPI Interface Implementation Declaration.\r
105//\r
fc547e08 106\r
107/**\r
108 Sets the SKU value for subsequent calls to set or get PCD token values.\r
109\r
110 SetSku() sets the SKU Id to be used for subsequent calls to set or get PCD values. \r
111 SetSku() is normally called only once by the system.\r
112\r
113 For each item (token), the database can hold a single value that applies to all SKUs, \r
114 or multiple values, where each value is associated with a specific SKU Id. Items with multiple, \r
115 SKU-specific values are called SKU enabled. \r
116 \r
117 The SKU Id of zero is reserved as a default. The valid SkuId range is 1 to 255. \r
118 For tokens that are not SKU enabled, the system ignores any set SKU Id and works with the \r
119 single value for that token. For SKU-enabled tokens, the system will use the SKU Id set by the \r
120 last call to SetSku(). If no SKU Id is set or the currently set SKU Id isn't valid for the specified token, \r
121 the system uses the default SKU Id. If the system attempts to use the default SKU Id and no value has been \r
122 set for that Id, the results are unpredictable.\r
123\r
124 @param[in] SkuId The SKU value that will be used when the PCD service will retrieve and \r
125 set values associated with a PCD token.\r
126\r
fc547e08 127**/\r
80408db0 128VOID\r
129EFIAPI\r
130PeiPcdSetSku (\r
131 IN UINTN SkuId\r
ed66e1bc 132 );\r
80408db0 133\r
fc547e08 134/**\r
135 Retrieves an 8-bit value for a given PCD token.\r
136\r
137 Retrieves the current byte-sized value for a PCD token number. \r
138 If the TokenNumber is invalid, the results are unpredictable.\r
139 \r
140 @param[in] TokenNumber The PCD token number. \r
80408db0 141\r
fc547e08 142 @return The UINT8 value.\r
143 \r
144**/\r
80408db0 145UINT8\r
146EFIAPI\r
147PeiPcdGet8 (\r
148 IN UINTN TokenNumber\r
ed66e1bc 149 );\r
80408db0 150\r
fc547e08 151/**\r
152 Retrieves an 16-bit value for a given PCD token.\r
153\r
154 Retrieves the current 16-bits value for a PCD token number. \r
155 If the TokenNumber is invalid, the results are unpredictable.\r
156 \r
157 @param[in] TokenNumber The PCD token number. \r
80408db0 158\r
fc547e08 159 @return The UINT16 value.\r
160 \r
161**/\r
80408db0 162UINT16\r
163EFIAPI\r
164PeiPcdGet16 (\r
165 IN UINTN TokenNumber\r
ed66e1bc 166 );\r
80408db0 167\r
fc547e08 168/**\r
169 Retrieves an 32-bit value for a given PCD token.\r
170\r
171 Retrieves the current 32-bits value for a PCD token number. \r
172 If the TokenNumber is invalid, the results are unpredictable.\r
173 \r
174 @param[in] TokenNumber The PCD token number. \r
80408db0 175\r
fc547e08 176 @return The UINT32 value.\r
177 \r
178**/\r
80408db0 179UINT32\r
180EFIAPI\r
181PeiPcdGet32 (\r
182 IN UINTN TokenNumber\r
ed66e1bc 183 );\r
80408db0 184\r
fc547e08 185/**\r
186 Retrieves an 64-bit value for a given PCD token.\r
187\r
188 Retrieves the current 64-bits value for a PCD token number. \r
189 If the TokenNumber is invalid, the results are unpredictable.\r
190 \r
191 @param[in] TokenNumber The PCD token number. \r
80408db0 192\r
fc547e08 193 @return The UINT64 value.\r
194 \r
195**/\r
80408db0 196UINT64\r
197EFIAPI\r
198PeiPcdGet64 (\r
199 IN UINTN TokenNumber\r
ed66e1bc 200 );\r
80408db0 201\r
fc547e08 202/**\r
203 Retrieves a pointer to a value for a given PCD token.\r
204\r
205 Retrieves the current pointer to the buffer for a PCD token number. \r
206 Do not make any assumptions about the alignment of the pointer that \r
207 is returned by this function call. If the TokenNumber is invalid, \r
208 the results are unpredictable.\r
80408db0 209\r
fc547e08 210 @param[in] TokenNumber The PCD token number. \r
211\r
212 @return The pointer to the buffer to be retrived.\r
213 \r
214**/\r
80408db0 215VOID *\r
216EFIAPI\r
217PeiPcdGetPtr (\r
218 IN UINTN TokenNumber\r
ed66e1bc 219 );\r
80408db0 220\r
fc547e08 221/**\r
222 Retrieves a Boolean value for a given PCD token.\r
223\r
224 Retrieves the current boolean value for a PCD token number. \r
225 Do not make any assumptions about the alignment of the pointer that \r
226 is returned by this function call. If the TokenNumber is invalid, \r
227 the results are unpredictable.\r
228\r
229 @param[in] TokenNumber The PCD token number. \r
80408db0 230\r
fc547e08 231 @return The Boolean value.\r
232 \r
233**/\r
80408db0 234BOOLEAN\r
235EFIAPI\r
236PeiPcdGetBool (\r
237 IN UINTN TokenNumber\r
ed66e1bc 238 );\r
80408db0 239\r
fc547e08 240/**\r
241 Retrieves the size of the value for a given PCD token.\r
242\r
243 Retrieves the current size of a particular PCD token. \r
244 If the TokenNumber is invalid, the results are unpredictable.\r
80408db0 245\r
fc547e08 246 @param[in] TokenNumber The PCD token number. \r
247\r
248 @return The size of the value for the PCD token.\r
249 \r
250**/\r
80408db0 251UINTN\r
252EFIAPI\r
253PeiPcdGetSize (\r
254 IN UINTN TokenNumber\r
ed66e1bc 255 );\r
80408db0 256\r
fc547e08 257/**\r
258 Retrieves an 8-bit value for a given PCD token.\r
80408db0 259\r
fc547e08 260 Retrieves the 8-bit value of a particular PCD token. \r
261 If the TokenNumber is invalid or the token space\r
262 specified by Guid does not exist, the results are \r
263 unpredictable.\r
264\r
265 @param[in] Guid The token space for the token number.\r
266 @param[in] TokenNumber The PCD token number. \r
267\r
268 @return The size 8-bit value for the PCD token.\r
269 \r
270**/\r
80408db0 271UINT8\r
272EFIAPI\r
273PeiPcdGet8Ex (\r
274 IN CONST EFI_GUID *Guid,\r
275 IN UINTN TokenNumber\r
ed66e1bc 276 );\r
80408db0 277\r
fc547e08 278/**\r
279 Retrieves an 16-bit value for a given PCD token.\r
280\r
281 Retrieves the 16-bit value of a particular PCD token. \r
282 If the TokenNumber is invalid or the token space\r
283 specified by Guid does not exist, the results are \r
284 unpredictable.\r
80408db0 285\r
fc547e08 286 @param[in] Guid The token space for the token number.\r
287 @param[in] TokenNumber The PCD token number. \r
288\r
289 @return The size 16-bit value for the PCD token.\r
290 \r
291**/\r
80408db0 292UINT16\r
293EFIAPI\r
294PeiPcdGet16Ex (\r
295 IN CONST EFI_GUID *Guid,\r
296 IN UINTN TokenNumber\r
ed66e1bc 297 );\r
80408db0 298\r
fc547e08 299/**\r
300 Retrieves an 32-bit value for a given PCD token.\r
301\r
302 Retrieves the 32-bit value of a particular PCD token. \r
303 If the TokenNumber is invalid or the token space\r
304 specified by Guid does not exist, the results are \r
305 unpredictable.\r
306\r
307 @param[in] Guid The token space for the token number.\r
308 @param[in] TokenNumber The PCD token number. \r
309\r
310 @return The size 32-bit value for the PCD token.\r
311 \r
312**/\r
80408db0 313UINT32\r
314EFIAPI\r
315PeiPcdGet32Ex (\r
316 IN CONST EFI_GUID *Guid,\r
317 IN UINTN TokenNumber\r
ed66e1bc 318 );\r
80408db0 319\r
fc547e08 320/**\r
321 Retrieves an 64-bit value for a given PCD token.\r
322\r
323 Retrieves the 64-bit value of a particular PCD token. \r
324 If the TokenNumber is invalid or the token space\r
325 specified by Guid does not exist, the results are \r
326 unpredictable.\r
327\r
328 @param[in] Guid The token space for the token number.\r
329 @param[in] TokenNumber The PCD token number. \r
80408db0 330\r
fc547e08 331 @return The size 64-bit value for the PCD token.\r
332 \r
333**/\r
80408db0 334UINT64\r
335EFIAPI\r
336PeiPcdGet64Ex (\r
337 IN CONST EFI_GUID *Guid,\r
338 IN UINTN TokenNumber\r
ed66e1bc 339 );\r
80408db0 340\r
fc547e08 341/**\r
342 Retrieves a pointer to a value for a given PCD token.\r
343\r
344 Retrieves the current pointer to the buffer for a PCD token number. \r
345 Do not make any assumptions about the alignment of the pointer that \r
346 is returned by this function call. If the TokenNumber is invalid, \r
347 the results are unpredictable.\r
80408db0 348\r
fc547e08 349 @param[in] Guid The token space for the token number.\r
350 @param[in] TokenNumber The PCD token number. \r
351\r
352 @return The pointer to the buffer to be retrived.\r
353 \r
354**/\r
80408db0 355VOID *\r
356EFIAPI\r
357PeiPcdGetPtrEx (\r
358 IN CONST EFI_GUID *Guid,\r
359 IN UINTN TokenNumber\r
ed66e1bc 360 );\r
80408db0 361\r
fc547e08 362/**\r
363 Retrieves an Boolean value for a given PCD token.\r
80408db0 364\r
fc547e08 365 Retrieves the Boolean value of a particular PCD token. \r
366 If the TokenNumber is invalid or the token space\r
367 specified by Guid does not exist, the results are \r
368 unpredictable.\r
369\r
370 @param[in] Guid The token space for the token number.\r
371 @param[in] TokenNumber The PCD token number. \r
372\r
373 @return The size Boolean value for the PCD token.\r
374 \r
375**/\r
80408db0 376BOOLEAN\r
377EFIAPI\r
378PeiPcdGetBoolEx (\r
379 IN CONST EFI_GUID *Guid,\r
380 IN UINTN TokenNumber\r
ed66e1bc 381 );\r
80408db0 382\r
fc547e08 383/**\r
384 Retrieves the size of the value for a given PCD token.\r
385\r
386 Retrieves the current size of a particular PCD token. \r
387 If the TokenNumber is invalid, the results are unpredictable.\r
80408db0 388\r
fc547e08 389 @param[in] Guid The token space for the token number.\r
390 @param[in] TokenNumber The PCD token number. \r
391\r
392 @return The size of the value for the PCD token.\r
393 \r
394**/\r
80408db0 395UINTN\r
396EFIAPI\r
397PeiPcdGetSizeEx (\r
398 IN CONST EFI_GUID *Guid,\r
399 IN UINTN TokenNumber\r
ed66e1bc 400 );\r
80408db0 401\r
fc547e08 402/**\r
403 Sets an 8-bit value for a given PCD token.\r
404\r
405 When the PCD service sets a value, it will check to ensure that the \r
406 size of the value being set is compatible with the Token's existing definition. \r
407 If it is not, an error will be returned.\r
408\r
409 @param[in] TokenNumber The PCD token number. \r
410 @param[in] Value The value to set for the PCD token.\r
80408db0 411\r
fc547e08 412 @retval EFI_SUCCESS Procedure returned successfully.\r
413 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
414 being set was incompatible with a call to this function. \r
415 Use GetSize() to retrieve the size of the target data.\r
416 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
417 \r
418**/\r
80408db0 419EFI_STATUS\r
420EFIAPI\r
421PeiPcdSet8 (\r
422 IN UINTN TokenNumber,\r
423 IN UINT8 Value\r
ed66e1bc 424 );\r
80408db0 425\r
fc547e08 426/**\r
427 Sets an 16-bit value for a given PCD token.\r
428\r
429 When the PCD service sets a value, it will check to ensure that the \r
430 size of the value being set is compatible with the Token's existing definition. \r
431 If it is not, an error will be returned.\r
80408db0 432\r
fc547e08 433 @param[in] TokenNumber The PCD token number. \r
434 @param[in] Value The value to set for the PCD token.\r
435\r
436 @retval EFI_SUCCESS Procedure returned successfully.\r
437 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
438 being set was incompatible with a call to this function. \r
439 Use GetSize() to retrieve the size of the target data.\r
440 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
441 \r
442**/\r
80408db0 443EFI_STATUS\r
444EFIAPI\r
445PeiPcdSet16 (\r
446 IN UINTN TokenNumber,\r
447 IN UINT16 Value\r
ed66e1bc 448 );\r
80408db0 449\r
fc547e08 450/**\r
451 Sets an 32-bit value for a given PCD token.\r
80408db0 452\r
fc547e08 453 When the PCD service sets a value, it will check to ensure that the \r
454 size of the value being set is compatible with the Token's existing definition. \r
455 If it is not, an error will be returned.\r
456\r
457 @param[in] TokenNumber The PCD token number. \r
458 @param[in] Value The value to set for the PCD token.\r
459\r
460 @retval EFI_SUCCESS Procedure returned successfully.\r
461 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
462 being set was incompatible with a call to this function. \r
463 Use GetSize() to retrieve the size of the target data.\r
464 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
465 \r
466**/\r
80408db0 467EFI_STATUS\r
468EFIAPI\r
469PeiPcdSet32 (\r
470 IN UINTN TokenNumber,\r
471 IN UINT32 Value\r
ed66e1bc 472 );\r
80408db0 473\r
fc547e08 474/**\r
475 Sets an 64-bit value for a given PCD token.\r
476\r
477 When the PCD service sets a value, it will check to ensure that the \r
478 size of the value being set is compatible with the Token's existing definition. \r
479 If it is not, an error will be returned.\r
80408db0 480\r
fc547e08 481 @param[in] TokenNumber The PCD token number. \r
482 @param[in] Value The value to set for the PCD token.\r
483\r
484 @retval EFI_SUCCESS Procedure returned successfully.\r
485 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
486 being set was incompatible with a call to this function. \r
487 Use GetSize() to retrieve the size of the target data.\r
488 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
489 \r
490**/\r
80408db0 491EFI_STATUS\r
492EFIAPI\r
493PeiPcdSet64 (\r
494 IN UINTN TokenNumber,\r
495 IN UINT64 Value\r
ed66e1bc 496 );\r
80408db0 497\r
fc547e08 498/**\r
499 Sets a value of a specified size for a given PCD token.\r
500\r
501 When the PCD service sets a value, it will check to ensure that the \r
502 size of the value being set is compatible with the Token's existing definition. \r
503 If it is not, an error will be returned.\r
504\r
505 @param[in] TokenNumber The PCD token number. \r
506 @param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token. \r
507 On input, if the SizeOfValue is greater than the maximum size supported \r
508 for this TokenNumber then the output value of SizeOfValue will reflect \r
509 the maximum size supported for this TokenNumber.\r
510 @param[in] Buffer The buffer to set for the PCD token.\r
511\r
512 @retval EFI_SUCCESS Procedure returned successfully.\r
513 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
514 being set was incompatible with a call to this function. \r
515 Use GetSize() to retrieve the size of the target data.\r
516 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
517 \r
518**/\r
80408db0 519EFI_STATUS\r
520EFIAPI\r
521PeiPcdSetPtr (\r
522 IN UINTN TokenNumber,\r
523 IN OUT UINTN *SizeOfBuffer,\r
524 IN VOID *Buffer\r
ed66e1bc 525 );\r
80408db0 526\r
fc547e08 527/**\r
528 Sets an Boolean value for a given PCD token.\r
529\r
530 When the PCD service sets a value, it will check to ensure that the \r
531 size of the value being set is compatible with the Token's existing definition. \r
532 If it is not, an error will be returned.\r
80408db0 533\r
fc547e08 534 @param[in] TokenNumber The PCD token number. \r
535 @param[in] Value The value to set for the PCD token.\r
536\r
537 @retval EFI_SUCCESS Procedure returned successfully.\r
538 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
539 being set was incompatible with a call to this function. \r
540 Use GetSize() to retrieve the size of the target data.\r
541 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
542 \r
543**/\r
80408db0 544EFI_STATUS\r
545EFIAPI\r
546PeiPcdSetBool (\r
547 IN UINTN TokenNumber,\r
548 IN BOOLEAN Value\r
ed66e1bc 549 );\r
80408db0 550\r
fc547e08 551/**\r
552 Sets an 8-bit value for a given PCD token.\r
553\r
554 When the PCD service sets a value, it will check to ensure that the \r
555 size of the value being set is compatible with the Token's existing definition. \r
556 If it is not, an error will be returned.\r
557\r
558 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
559 @param[in] TokenNumber The PCD token number. \r
560 @param[in] Value The value to set for the PCD token.\r
80408db0 561\r
fc547e08 562 @retval EFI_SUCCESS Procedure returned successfully.\r
563 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
564 being set was incompatible with a call to this function. \r
565 Use GetSize() to retrieve the size of the target data.\r
566 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
567 \r
568**/\r
80408db0 569EFI_STATUS\r
570EFIAPI\r
571PeiPcdSet8Ex (\r
572 IN CONST EFI_GUID *Guid,\r
573 IN UINTN TokenNumber,\r
574 IN UINT8 Value\r
ed66e1bc 575 );\r
80408db0 576\r
fc547e08 577/**\r
578 Sets an 16-bit value for a given PCD token.\r
579\r
580 When the PCD service sets a value, it will check to ensure that the \r
581 size of the value being set is compatible with the Token's existing definition. \r
582 If it is not, an error will be returned.\r
583\r
584 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
585 @param[in] TokenNumber The PCD token number. \r
586 @param[in] Value The value to set for the PCD token.\r
587\r
588 @retval EFI_SUCCESS Procedure returned successfully.\r
589 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
590 being set was incompatible with a call to this function. \r
591 Use GetSize() to retrieve the size of the target data.\r
592 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
593 \r
594**/\r
80408db0 595EFI_STATUS\r
596EFIAPI\r
597PeiPcdSet16Ex (\r
598 IN CONST EFI_GUID *Guid,\r
599 IN UINTN TokenNumber,\r
600 IN UINT16 Value\r
ed66e1bc 601 );\r
80408db0 602\r
fc547e08 603/**\r
604 Sets an 32-bit value for a given PCD token.\r
605\r
606 When the PCD service sets a value, it will check to ensure that the \r
607 size of the value being set is compatible with the Token's existing definition. \r
608 If it is not, an error will be returned.\r
80408db0 609\r
fc547e08 610 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
611 @param[in] TokenNumber The PCD token number. \r
612 @param[in] Value The value to set for the PCD token.\r
613\r
614 @retval EFI_SUCCESS Procedure returned successfully.\r
615 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
616 being set was incompatible with a call to this function. \r
617 Use GetSize() to retrieve the size of the target data.\r
618 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
619 \r
620**/\r
80408db0 621EFI_STATUS\r
622EFIAPI\r
623PeiPcdSet32Ex (\r
624 IN CONST EFI_GUID *Guid,\r
625 IN UINTN TokenNumber,\r
626 IN UINT32 Value\r
ed66e1bc 627 );\r
80408db0 628\r
fc547e08 629/**\r
630 Sets an 64-bit value for a given PCD token.\r
80408db0 631\r
fc547e08 632 When the PCD service sets a value, it will check to ensure that the \r
633 size of the value being set is compatible with the Token's existing definition. \r
634 If it is not, an error will be returned.\r
635\r
636 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
637 @param[in] TokenNumber The PCD token number. \r
638 @param[in] Value The value to set for the PCD token.\r
639\r
640 @retval EFI_SUCCESS Procedure returned successfully.\r
641 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
642 being set was incompatible with a call to this function. \r
643 Use GetSize() to retrieve the size of the target data.\r
644 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
645 \r
646**/\r
80408db0 647EFI_STATUS\r
648EFIAPI\r
649PeiPcdSet64Ex (\r
650 IN CONST EFI_GUID *Guid,\r
651 IN UINTN TokenNumber,\r
652 IN UINT64 Value\r
ed66e1bc 653 );\r
80408db0 654\r
fc547e08 655/**\r
656 Sets a value of a specified size for a given PCD token.\r
657\r
658 When the PCD service sets a value, it will check to ensure that the \r
659 size of the value being set is compatible with the Token's existing definition. \r
660 If it is not, an error will be returned.\r
661\r
662 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
663 @param[in] TokenNumber The PCD token number. \r
664 @param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token. \r
665 On input, if the SizeOfValue is greater than the maximum size supported \r
666 for this TokenNumber then the output value of SizeOfValue will reflect \r
667 the maximum size supported for this TokenNumber.\r
668 @param[in] Buffer The buffer to set for the PCD token.\r
669\r
670 @retval EFI_SUCCESS Procedure returned successfully.\r
671 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
672 being set was incompatible with a call to this function. \r
673 Use GetSize() to retrieve the size of the target data.\r
674 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
675 \r
676**/\r
80408db0 677EFI_STATUS\r
678EFIAPI\r
679PeiPcdSetPtrEx (\r
680 IN CONST EFI_GUID *Guid,\r
681 IN UINTN TokenNumber,\r
682 IN OUT UINTN *SizeOfBuffer,\r
683 IN VOID *Buffer\r
ed66e1bc 684 );\r
80408db0 685\r
fc547e08 686/**\r
687 Sets an Boolean value for a given PCD token.\r
688\r
689 When the PCD service sets a value, it will check to ensure that the \r
690 size of the value being set is compatible with the Token's existing definition. \r
691 If it is not, an error will be returned.\r
80408db0 692\r
fc547e08 693 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
694 @param[in] TokenNumber The PCD token number. \r
695 @param[in] Value The value to set for the PCD token.\r
696\r
697 @retval EFI_SUCCESS Procedure returned successfully.\r
698 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
699 being set was incompatible with a call to this function. \r
700 Use GetSize() to retrieve the size of the target data.\r
701 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
702 \r
703**/\r
80408db0 704EFI_STATUS\r
705EFIAPI\r
706PeiPcdSetBoolEx (\r
707 IN CONST EFI_GUID *Guid,\r
708 IN UINTN TokenNumber,\r
709 IN BOOLEAN Value\r
ed66e1bc 710 );\r
80408db0 711\r
fc547e08 712/**\r
713 Specifies a function to be called anytime the value of a designated token is changed.\r
80408db0 714\r
fc547e08 715 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
716 @param[in] TokenNumber The PCD token number. \r
717 @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set. \r
80408db0 718\r
fc547e08 719 @retval EFI_SUCCESS The PCD service has successfully established a call event \r
720 for the CallBackToken requested.\r
721 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.\r
722\r
723**/\r
80408db0 724EFI_STATUS\r
725EFIAPI\r
726PeiRegisterCallBackOnSet (\r
727 IN CONST EFI_GUID *Guid, OPTIONAL\r
728 IN UINTN TokenNumber,\r
729 IN PCD_PPI_CALLBACK CallBackFunction\r
ed66e1bc 730 );\r
80408db0 731\r
fc547e08 732/**\r
733 Cancels a previously set callback function for a particular PCD token number.\r
734\r
735 @param [in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
736 @param [in] TokenNumber The PCD token number. \r
737 @param [in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set. \r
738\r
739 @retval EFI_SUCCESS The PCD service has successfully established a call event \r
740 for the CallBackToken requested.\r
741 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.\r
80408db0 742\r
fc547e08 743**/\r
80408db0 744EFI_STATUS\r
745EFIAPI\r
746PcdUnRegisterCallBackOnSet (\r
747 IN CONST EFI_GUID *Guid, OPTIONAL\r
748 IN UINTN TokenNumber,\r
749 IN PCD_PPI_CALLBACK CallBackFunction\r
ed66e1bc 750 );\r
80408db0 751\r
fc547e08 752/**\r
90e06556 753 Retrieves the next valid token number in a given namespace. \r
754 \r
755 This is useful since the PCD infrastructure contains a sparse list of token numbers, \r
756 and one cannot a priori know what token numbers are valid in the database. \r
757 \r
758 If TokenNumber is 0 and Guid is not NULL, then the first token from the token space specified by Guid is returned. \r
759 If TokenNumber is not 0 and Guid is not NULL, then the next token in the token space specified by Guid is returned. \r
760 If TokenNumber is 0 and Guid is NULL, then the first token in the default token space is returned. \r
761 If TokenNumber is not 0 and Guid is NULL, then the next token in the default token space is returned. \r
762 The token numbers in the default token space may not be related to token numbers in token spaces that are named by Guid. \r
763 If the next token number can be retrieved, then it is returned in TokenNumber, and EFI_SUCCESS is returned. \r
764 If TokenNumber represents the last token number in the token space specified by Guid, then EFI_NOT_FOUND is returned. \r
765 If TokenNumber is not present in the token space specified by Guid, then EFI_NOT_FOUND is returned.\r
766\r
767\r
768 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value. \r
769 This is an optional parameter that may be NULL. If this parameter is NULL, then a request \r
770 is being made to retrieve tokens from the default token space.\r
771 @param[in, out] TokenNumber A pointer to the PCD token number to use to find the subsequent token number.\r
772 \r
773 @retval EFI_SUCCESS The PCD service has retrieved the next valid token number. \r
774 Or the input token number is already the last valid token number in the PCD database. \r
fc547e08 775 In the later case, *TokenNumber is updated with the value of 0.\r
776 @retval EFI_NOT_FOUND If this input token number and token namespace does not exist on the platform.\r
777\r
778**/\r
80408db0 779EFI_STATUS\r
780EFIAPI\r
781PeiPcdGetNextToken (\r
782 IN CONST EFI_GUID *Guid, OPTIONAL\r
783 IN OUT UINTN *TokenNumber\r
ed66e1bc 784 );\r
80408db0 785\r
fc547e08 786/**\r
787 Retrieves the next valid PCD token namespace for a given namespace.\r
788\r
789 @param[in, out] Guid An indirect pointer to EFI_GUID. On input it designates \r
790 a known token namespace from which the search will start. On output, \r
791 it designates the next valid token namespace on the platform. If the input \r
792 token namespace does not exist on the platform, an error is returned and \r
793 the value of *Guid is undefined. If *Guid is NULL, then the GUID of the \r
794 first token space of the current platform is assigned to *Guid the function \r
795 return EFI_SUCCESS. If *Guid is NULL and there is no namespace exist in \r
796 the platform other than the default (NULL) tokennamespace, *Guid is unchanged \r
797 and the function return EFI_SUCCESS. If this input token namespace is the last \r
798 namespace on the platform, *Guid will be assigned to NULL and the function return \r
799 EFI_SUCCESS. \r
800\r
801 @retval EFI_SUCCESS The PCD service retrieved the next valid token space Guid. \r
802 Or the input token space Guid is already the last valid token space Guid \r
803 in the PCD database. In the later case, *Guid is updated with the value of NULL.\r
804 @retval EFI_NOT_FOUND If the input token namespace does not exist on the platform.\r
80408db0 805\r
fc547e08 806**/\r
80408db0 807EFI_STATUS\r
808EFIAPI\r
809PeiPcdGetNextTokenSpace (\r
fc547e08 810 IN OUT CONST EFI_GUID **Guid\r
ed66e1bc 811 );\r
80408db0 812\r
96d6d004
SZ
813/**\r
814 Retrieve additional information associated with a PCD token.\r
815\r
816 This includes information such as the type of value the TokenNumber is associated with as well as possible\r
817 human readable name that is associated with the token.\r
818\r
819 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
820 @param[in] TokenNumber The PCD token number.\r
821 @param[out] PcdInfo The returned information associated with the requested TokenNumber.\r
822 The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName. \r
823\r
824 @retval EFI_SUCCESS The PCD information was returned successfully\r
825 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
826**/\r
827EFI_STATUS\r
96d6d004
SZ
828PeiGetPcdInfo (\r
829 IN CONST EFI_GUID *Guid,\r
830 IN UINTN TokenNumber,\r
831 OUT EFI_PCD_INFO *PcdInfo\r
832 );\r
80408db0 833\r
834/* Internal Function definitions */\r
fc547e08 835/**\r
836 Get PCD database from GUID HOB in PEI phase.\r
837\r
838 @return Pointer to PCD database.\r
80408db0 839\r
fc547e08 840**/\r
80408db0 841PEI_PCD_DATABASE *\r
842GetPcdDatabase (\r
843 VOID\r
ed66e1bc 844 );\r
80408db0 845\r
fc547e08 846/**\r
847 Wrapper function for setting non-pointer type value for a PCD entry.\r
848\r
849 @param TokenNumber Pcd token number autogenerated by build tools.\r
850 @param Data Value want to be set for PCD entry\r
851 @param Size Size of value.\r
80408db0 852\r
fc547e08 853 @return status of SetWorker.\r
854\r
855**/\r
80408db0 856EFI_STATUS\r
857SetValueWorker (\r
858 IN UINTN TokenNumber,\r
859 IN VOID *Data,\r
860 IN UINTN Size\r
ed66e1bc 861 );\r
80408db0 862\r
fc547e08 863/**\r
864 Set value for an PCD entry\r
80408db0 865\r
fc547e08 866 @param TokenNumber Pcd token number autogenerated by build tools.\r
867 @param Data Value want to be set for PCD entry\r
868 @param Size Size of value.\r
869 @param PtrType If TRUE, the type of PCD entry's value is Pointer.\r
870 If False, the type of PCD entry's value is not Pointer.\r
871\r
872 @retval EFI_INVALID_PARAMETER If this PCD type is VPD, VPD PCD can not be set.\r
873 @retval EFI_INVALID_PARAMETER If Size can not be set to size table.\r
149fb6d6 874 @retval EFI_INVALID_PARAMETER If Size of non-Ptr type PCD does not match the size information in PCD database.\r
fc547e08 875 @retval EFI_NOT_FOUND If value type of PCD entry is intergrate, but not in\r
876 range of UINT8, UINT16, UINT32, UINT64\r
877 @retval EFI_NOT_FOUND Can not find the PCD type according to token number. \r
878**/\r
80408db0 879EFI_STATUS\r
880SetWorker (\r
881 IN UINTN TokenNumber,\r
882 IN VOID *Data,\r
883 IN OUT UINTN *Size,\r
884 IN BOOLEAN PtrType\r
ed66e1bc 885 );\r
80408db0 886\r
fc547e08 887/**\r
888 Wrapper function for set PCD value for non-Pointer type dynamic-ex PCD.\r
80408db0 889\r
fc547e08 890 @param ExTokenNumber Token number for dynamic-ex PCD.\r
891 @param Guid Token space guid for dynamic-ex PCD.\r
892 @param Data Value want to be set.\r
893 @param SetSize The size of value.\r
894\r
895 @return status of ExSetWorker().\r
896\r
897**/\r
80408db0 898EFI_STATUS\r
899ExSetValueWorker (\r
900 IN UINTN ExTokenNumber,\r
901 IN CONST EFI_GUID *Guid,\r
902 IN VOID *Data,\r
903 IN UINTN Size\r
ed66e1bc 904 );\r
80408db0 905\r
fc547e08 906/**\r
907 Set value for a dynamic PCD entry.\r
908 \r
909 This routine find the local token number according to dynamic-ex PCD's token \r
910 space guid and token number firstly, and invoke callback function if this PCD\r
911 entry registered callback function. Finally, invoken general SetWorker to set\r
912 PCD value.\r
913 \r
914 @param ExTokenNumber Dynamic-ex PCD token number.\r
915 @param Guid Token space guid for dynamic-ex PCD.\r
916 @param Data PCD value want to be set\r
917 @param SetSize Size of value.\r
918 @param PtrType If TRUE, this PCD entry is pointer type.\r
919 If FALSE, this PCD entry is not pointer type.\r
920\r
921 @return status of SetWorker().\r
80408db0 922\r
fc547e08 923**/\r
80408db0 924EFI_STATUS\r
925ExSetWorker (\r
926 IN UINTN ExTokenNumber,\r
927 IN CONST EFI_GUID *Guid,\r
928 IN VOID *Data,\r
929 IN OUT UINTN *Size,\r
930 IN BOOLEAN PtrType\r
ed66e1bc 931 );\r
80408db0 932\r
fc547e08 933/**\r
934 Get the PCD entry pointer in PCD database.\r
935 \r
936 This routine will visit PCD database to find the PCD entry according to given\r
937 token number. The given token number is autogened by build tools and it will be \r
938 translated to local token number. Local token number contains PCD's type and \r
939 offset of PCD entry in PCD database.\r
940\r
941 @param TokenNumber Token's number, it is autogened by build tools\r
942 @param GetSize The size of token's value\r
80408db0 943\r
fc547e08 944 @return PCD entry pointer in PCD database\r
80408db0 945\r
fc547e08 946**/\r
80408db0 947VOID *\r
948GetWorker (\r
949 IN UINTN TokenNumber,\r
950 IN UINTN GetSize\r
ed66e1bc 951 );\r
80408db0 952\r
fc547e08 953/**\r
954 Wrapper function for get PCD value for dynamic-ex PCD.\r
955\r
956 @param Guid Token space guid for dynamic-ex PCD.\r
957 @param ExTokenNumber Token number for dyanmic-ex PCD.\r
958 @param GetSize The size of dynamic-ex PCD value.\r
80408db0 959\r
fc547e08 960 @return PCD entry in PCD database.\r
80408db0 961\r
fc547e08 962**/\r
80408db0 963VOID *\r
964ExGetWorker (\r
965 IN CONST EFI_GUID *Guid,\r
966 IN UINTN ExTokenNumber,\r
967 IN UINTN GetSize\r
ed66e1bc 968 );\r
80408db0 969\r
970typedef struct {\r
971 UINTN TokenNumber;\r
972 UINTN Size;\r
973 UINT32 LocalTokenNumberAlias;\r
974} EX_PCD_ENTRY_ATTRIBUTE;\r
975\r
fc547e08 976/**\r
419db80b 977 Get Token Number according to dynamic-ex PCD's {token space guid:token number}\r
fc547e08 978\r
979 A dynamic-ex type PCD, developer must provide pair of token space guid: token number\r
980 in DEC file. PCD database maintain a mapping table that translate pair of {token\r
419db80b 981 space guid: token number} to Token Number.\r
fc547e08 982 \r
983 @param Guid Token space guid for dynamic-ex PCD entry.\r
a5eca427 984 @param ExTokenNumber Token number for dynamic-ex PCD.\r
80408db0 985\r
419db80b 986 @return Token Number for dynamic-ex PCD.\r
fc547e08 987\r
988**/\r
c52fa98c 989UINTN\r
80408db0 990GetExPcdTokenNumber (\r
991 IN CONST EFI_GUID *Guid,\r
992 IN UINTN ExTokenNumber\r
ed66e1bc 993 );\r
80408db0 994\r
96d6d004
SZ
995/**\r
996 Find the local token number according to system SKU ID.\r
997\r
998 @param LocalTokenNumber PCD token number\r
999 @param Size The size of PCD entry.\r
1000\r
1001 @return Token number according to system SKU ID.\r
1002\r
1003**/\r
1004UINT32\r
1005GetSkuEnabledTokenNumber (\r
1006 UINT32 LocalTokenNumber,\r
1007 UINTN Size\r
1008 );\r
1009\r
fc547e08 1010/**\r
1011 The function registers the CallBackOnSet fucntion\r
1012 according to TokenNumber and EFI_GUID space.\r
80408db0 1013\r
fc547e08 1014 @param TokenNumber The token number.\r
1015 @param Guid The GUID space.\r
1016 @param CallBackFunction The Callback function to be registered.\r
1017 @param Register To register or unregister the callback function.\r
80408db0 1018\r
fc547e08 1019 @retval EFI_SUCCESS If the Callback function is registered.\r
1020 @retval EFI_NOT_FOUND If the PCD Entry is not found according to Token Number and GUID space.\r
1021 @retval EFI_OUT_OF_RESOURCES If the callback function can't be registered because there is not free\r
1022 slot left in the CallbackFnTable.\r
1023**/\r
80408db0 1024EFI_STATUS\r
1025PeiRegisterCallBackWorker (\r
1026 IN UINTN TokenNumber,\r
fc547e08 1027 IN CONST EFI_GUID *Guid, OPTIONAL\r
80408db0 1028 IN PCD_PPI_CALLBACK CallBackFunction,\r
1029 IN BOOLEAN Register\r
a3a70b6a 1030 );\r
80408db0 1031\r
fc547e08 1032/**\r
1033 The function builds the PCD database.\r
419db80b
BF
1034\r
1035 @param FileHandle Handle of the file the external PCD database binary located.\r
1036\r
96d6d004
SZ
1037 @return Pointer to PCD database.\r
1038\r
fc547e08 1039**/\r
96d6d004 1040PEI_PCD_DATABASE *\r
80408db0 1041BuildPcdDatabase (\r
419db80b 1042 IN EFI_PEI_FILE_HANDLE FileHandle\r
ed66e1bc 1043 );\r
80408db0 1044\r
fc547e08 1045/**\r
1046 Get SKU ID tabble from PCD database.\r
1047\r
1048 @param LocalTokenNumberTableIdx Index of local token number in token number table.\r
1049 @param Database PCD Database in PEI phase\r
1050\r
1051 @return Pointer to SKU ID array table\r
1052\r
1053**/\r
80408db0 1054SKU_ID *\r
1055GetSkuIdArray (\r
1056 IN UINTN LocalTokenNumberTableIdx,\r
1057 IN PEI_PCD_DATABASE *Database\r
ed66e1bc 1058 );\r
80408db0 1059\r
fc547e08 1060/**\r
1061 Get index of PCD entry in size table.\r
1062\r
1063 @param LocalTokenNumberTableIdx Index of this PCD in local token number table.\r
1064 @param Database Pointer to PCD database.\r
1065\r
1066 @return index of PCD entry in size table.\r
1067\r
1068**/\r
80408db0 1069UINTN\r
1070GetSizeTableIndex (\r
1071 IN UINTN LocalTokenNumberTableIdx,\r
1072 IN PEI_PCD_DATABASE *Database\r
ed66e1bc 1073 );\r
80408db0 1074\r
fc547e08 1075/**\r
1076 Get PCD value's size for POINTER type PCD.\r
1077 \r
1078 The POINTER type PCD's value will be stored into a buffer in specificed size.\r
1079 The max size of this PCD's value is described in PCD's definition in DEC file.\r
1080\r
1081 @param LocalTokenNumberTableIdx Index of PCD token number in PCD token table\r
1082 @param MaxSize Maxmium size of PCD's value\r
1083 @param Database Pcd database in PEI phase.\r
1084\r
1085 @return PCD value's size for POINTER type PCD.\r
1086\r
1087**/\r
80408db0 1088UINTN\r
1089GetPtrTypeSize (\r
1090 IN UINTN LocalTokenNumberTableIdx,\r
1091 OUT UINTN *MaxSize,\r
1092 IN PEI_PCD_DATABASE *Database\r
ed66e1bc 1093 );\r
80408db0 1094\r
fc547e08 1095/**\r
1096 Set PCD value's size for POINTER type PCD.\r
1097 \r
1098 The POINTER type PCD's value will be stored into a buffer in specificed size.\r
1099 The max size of this PCD's value is described in PCD's definition in DEC file.\r
80408db0 1100\r
fc547e08 1101 @param LocalTokenNumberTableIdx Index of PCD token number in PCD token table\r
1102 @param CurrentSize Maxmium size of PCD's value\r
1103 @param Database Pcd database in PEI phase.\r
80408db0 1104\r
fc547e08 1105 @retval TRUE Success to set PCD's value size, which is not exceed maxmium size\r
1106 @retval FALSE Fail to set PCD's value size, which maybe exceed maxmium size\r
1107\r
1108**/\r
80408db0 1109BOOLEAN\r
1110SetPtrTypeSize (\r
1111 IN UINTN LocalTokenNumberTableIdx,\r
1112 IN OUT UINTN *CurrentSize,\r
1113 IN PEI_PCD_DATABASE *Database\r
ed66e1bc 1114 );\r
80408db0 1115\r
80408db0 1116#endif\r
a5eca427 1117\r