]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/DxePcdLib/DxePcdLib.c
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdePkg / Library / DxePcdLib / DxePcdLib.c
CommitLineData
e386b444 1/** @file\r
2Implementation of PcdLib class library for DXE phase.\r
3\r
9095d37b 4Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
9344f092 5SPDX-License-Identifier: BSD-2-Clause-Patent\r
e386b444 6\r
7\r
e386b444 8**/\r
9\r
c7d265a9 10#include <PiDxe.h>\r
c892d846 11\r
c7d265a9 12#include <Protocol/Pcd.h>\r
ec735bb2 13#include <Protocol/PiPcd.h>\r
96d6d004
SZ
14#include <Protocol/PcdInfo.h>\r
15#include <Protocol/PiPcdInfo.h>\r
c892d846 16\r
c7d265a9 17#include <Library/PcdLib.h>\r
18#include <Library/DebugLib.h>\r
19#include <Library/UefiBootServicesTableLib.h>\r
20#include <Library/BaseMemoryLib.h>\r
e386b444 21\r
2f88bd3a
MK
22PCD_PROTOCOL *mPcd = NULL;\r
23EFI_PCD_PROTOCOL *mPiPcd = NULL;\r
24GET_PCD_INFO_PROTOCOL *mPcdInfo = NULL;\r
25EFI_GET_PCD_INFO_PROTOCOL *mPiPcdInfo = NULL;\r
e386b444 26\r
25366245 27/**\r
b35a5f73 28 Retrieves the PI PCD protocol from the handle database.\r
96d6d004
SZ
29\r
30 @retval EFI_PCD_PROTOCOL * The pointer to the EFI_PCD_PROTOCOL.\r
b35a5f73 31**/\r
32EFI_PCD_PROTOCOL *\r
33EFIAPI\r
34GetPiPcdProtocol (\r
35 VOID\r
36 )\r
37{\r
38 EFI_STATUS Status;\r
a3ac242b 39\r
b35a5f73 40 if (mPiPcd == NULL) {\r
41 //\r
9095d37b 42 // PI Pcd protocol defined in PI 1.2 vol3 should be installed before the module\r
b35a5f73 43 // access DynamicEx type PCD.\r
44 //\r
2f88bd3a 45 Status = gBS->LocateProtocol (&gEfiPcdProtocolGuid, NULL, (VOID **)&mPiPcd);\r
b35a5f73 46 ASSERT_EFI_ERROR (Status);\r
47 ASSERT (mPiPcd != NULL);\r
48 }\r
2f88bd3a 49\r
b35a5f73 50 return mPiPcd;\r
51}\r
e386b444 52\r
b35a5f73 53/**\r
54 Retrieves the PCD protocol from the handle database.\r
96d6d004
SZ
55\r
56 @retval PCD_PROTOCOL * The pointer to the PCD_PROTOCOL.\r
e386b444 57**/\r
b35a5f73 58PCD_PROTOCOL *\r
25366245 59EFIAPI\r
b35a5f73 60GetPcdProtocol (\r
61 VOID\r
e386b444 62 )\r
63{\r
64 EFI_STATUS Status;\r
65\r
b35a5f73 66 if (mPcd == NULL) {\r
67 //\r
68 // PCD protocol need to be installed before the module access Dynamic type PCD.\r
69 // But dynamic type PCD is not required in PI 1.2 specification.\r
9095d37b 70 //\r
b35a5f73 71 Status = gBS->LocateProtocol (&gPcdProtocolGuid, NULL, (VOID **)&mPcd);\r
72 ASSERT_EFI_ERROR (Status);\r
73 ASSERT (mPcd != NULL);\r
74 }\r
2f88bd3a 75\r
b35a5f73 76 return mPcd;\r
e386b444 77}\r
78\r
96d6d004
SZ
79/**\r
80 Retrieves the PI PCD info protocol from the handle database.\r
81\r
82 @retval EFI_GET_PCD_INFO_PROTOCOL * The pointer to the EFI_GET_PCD_INFO_PROTOCOL defined in PI 1.2.1 Vol 3.\r
83**/\r
84EFI_GET_PCD_INFO_PROTOCOL *\r
85GetPiPcdInfoProtocolPointer (\r
86 VOID\r
87 )\r
88{\r
89 EFI_STATUS Status;\r
90\r
91 if (mPiPcdInfo == NULL) {\r
92 Status = gBS->LocateProtocol (&gEfiGetPcdInfoProtocolGuid, NULL, (VOID **)&mPiPcdInfo);\r
93 ASSERT_EFI_ERROR (Status);\r
94 ASSERT (mPiPcdInfo != NULL);\r
95 }\r
2f88bd3a 96\r
96d6d004
SZ
97 return mPiPcdInfo;\r
98}\r
99\r
100/**\r
101 Retrieves the PCD info protocol from the handle database.\r
102\r
103 @retval GET_PCD_INFO_PROTOCOL * The pointer to the GET_PCD_INFO_PROTOCOL.\r
104**/\r
105GET_PCD_INFO_PROTOCOL *\r
106GetPcdInfoProtocolPointer (\r
107 VOID\r
9095d37b 108 )\r
96d6d004
SZ
109{\r
110 EFI_STATUS Status;\r
111\r
112 if (mPcdInfo == NULL) {\r
113 Status = gBS->LocateProtocol (&gGetPcdInfoProtocolGuid, NULL, (VOID **)&mPcdInfo);\r
114 ASSERT_EFI_ERROR (Status);\r
115 ASSERT (mPcdInfo != NULL);\r
116 }\r
2f88bd3a 117\r
96d6d004
SZ
118 return mPcdInfo;\r
119}\r
e386b444 120\r
121/**\r
518db1d9 122 This function provides a means by which SKU support can be established in the PCD infrastructure.\r
123\r
e386b444 124 Sets the current SKU in the PCD database to the value specified by SkuId. SkuId is returned.\r
518db1d9 125\r
c00bdbb1 126 @param SkuId The SKU value that will be used when the PCD service retrieves and sets values\r
127 associated with a PCD token.\r
e386b444 128\r
c00bdbb1 129 @return Return the SKU ID that just be set.\r
e386b444 130\r
131**/\r
132UINTN\r
133EFIAPI\r
134LibPcdSetSku (\r
2f88bd3a 135 IN UINTN SkuId\r
e386b444 136 )\r
137{\r
2f88bd3a 138 GetPcdProtocol ()->SetSku (SkuId);\r
e386b444 139\r
140 return SkuId;\r
141}\r
142\r
e386b444 143/**\r
518db1d9 144 This function provides a means by which to retrieve a value for a given PCD token.\r
9095d37b
LG
145\r
146 Returns the 8-bit value for the token specified by TokenNumber.\r
e386b444 147\r
518db1d9 148 @param[in] TokenNumber The PCD token number to retrieve a current value for.\r
e386b444 149\r
9095d37b 150 @return Returns the 8-bit value for the token specified by TokenNumber.\r
e386b444 151\r
152**/\r
153UINT8\r
154EFIAPI\r
155LibPcdGet8 (\r
2f88bd3a 156 IN UINTN TokenNumber\r
e386b444 157 )\r
158{\r
2f88bd3a 159 return GetPcdProtocol ()->Get8 (TokenNumber);\r
e386b444 160}\r
161\r
e386b444 162/**\r
518db1d9 163 This function provides a means by which to retrieve a value for a given PCD token.\r
9095d37b
LG
164\r
165 Returns the 16-bit value for the token specified by TokenNumber.\r
e386b444 166\r
518db1d9 167 @param[in] TokenNumber The PCD token number to retrieve a current value for.\r
e386b444 168\r
9095d37b 169 @return Returns the 16-bit value for the token specified by TokenNumber.\r
e386b444 170\r
171**/\r
172UINT16\r
173EFIAPI\r
174LibPcdGet16 (\r
2f88bd3a 175 IN UINTN TokenNumber\r
e386b444 176 )\r
177{\r
2f88bd3a 178 return GetPcdProtocol ()->Get16 (TokenNumber);\r
e386b444 179}\r
180\r
e386b444 181/**\r
518db1d9 182 This function provides a means by which to retrieve a value for a given PCD token.\r
9095d37b
LG
183\r
184 Returns the 32-bit value for the token specified by TokenNumber.\r
e386b444 185\r
186 @param[in] TokenNumber The PCD token number to retrieve a current value for.\r
187\r
f73e0ad2 188 @return Returns the 32-bit value for the token specified by TokenNumber.\r
e386b444 189\r
190**/\r
191UINT32\r
192EFIAPI\r
193LibPcdGet32 (\r
2f88bd3a 194 IN UINTN TokenNumber\r
e386b444 195 )\r
196{\r
2f88bd3a 197 return GetPcdProtocol ()->Get32 (TokenNumber);\r
e386b444 198}\r
199\r
e386b444 200/**\r
518db1d9 201 This function provides a means by which to retrieve a value for a given PCD token.\r
9095d37b 202\r
e386b444 203 Returns the 64-bit value for the token specified by TokenNumber.\r
204\r
205 @param[in] TokenNumber The PCD token number to retrieve a current value for.\r
206\r
f73e0ad2 207 @return Returns the 64-bit value for the token specified by TokenNumber.\r
e386b444 208\r
209**/\r
210UINT64\r
211EFIAPI\r
212LibPcdGet64 (\r
2f88bd3a 213 IN UINTN TokenNumber\r
e386b444 214 )\r
215{\r
2f88bd3a 216 return GetPcdProtocol ()->Get64 (TokenNumber);\r
e386b444 217}\r
218\r
e386b444 219/**\r
518db1d9 220 This function provides a means by which to retrieve a value for a given PCD token.\r
9095d37b 221\r
e386b444 222 Returns the pointer to the buffer of the token specified by TokenNumber.\r
223\r
224 @param[in] TokenNumber The PCD token number to retrieve a current value for.\r
225\r
f73e0ad2 226 @return Returns the pointer to the token specified by TokenNumber.\r
e386b444 227\r
228**/\r
229VOID *\r
230EFIAPI\r
231LibPcdGetPtr (\r
2f88bd3a 232 IN UINTN TokenNumber\r
e386b444 233 )\r
234{\r
2f88bd3a 235 return GetPcdProtocol ()->GetPtr (TokenNumber);\r
e386b444 236}\r
237\r
e386b444 238/**\r
518db1d9 239 This function provides a means by which to retrieve a value for a given PCD token.\r
9095d37b
LG
240\r
241 Returns the Boolean value of the token specified by TokenNumber.\r
e386b444 242\r
243 @param[in] TokenNumber The PCD token number to retrieve a current value for.\r
244\r
9095d37b 245 @return Returns the Boolean value of the token specified by TokenNumber.\r
e386b444 246\r
247**/\r
9095d37b 248BOOLEAN\r
e386b444 249EFIAPI\r
250LibPcdGetBool (\r
2f88bd3a 251 IN UINTN TokenNumber\r
e386b444 252 )\r
253{\r
2f88bd3a 254 return GetPcdProtocol ()->GetBool (TokenNumber);\r
e386b444 255}\r
256\r
e386b444 257/**\r
518db1d9 258 This function provides a means by which to retrieve the size of a given PCD token.\r
e386b444 259\r
260 @param[in] TokenNumber The PCD token number to retrieve a current value for.\r
261\r
9095d37b 262 @return Returns the size of the token specified by TokenNumber.\r
e386b444 263\r
264**/\r
265UINTN\r
266EFIAPI\r
267LibPcdGetSize (\r
2f88bd3a 268 IN UINTN TokenNumber\r
e386b444 269 )\r
270{\r
2f88bd3a 271 return GetPcdProtocol ()->GetSize (TokenNumber);\r
e386b444 272}\r
273\r
e386b444 274/**\r
518db1d9 275 This function provides a means by which to retrieve a value for a given PCD token.\r
9095d37b 276\r
e386b444 277 Returns the 8-bit value for the token specified by TokenNumber and Guid.\r
e386b444 278\r
9095d37b
LG
279 If Guid is NULL, then ASSERT().\r
280\r
281 @param[in] Guid The pointer to a 128-bit unique value that designates\r
c00bdbb1 282 which namespace to retrieve a value from.\r
283 @param[in] TokenNumber The PCD token number to retrieve a current value for.\r
e386b444 284\r
f73e0ad2 285 @return Return the UINT8.\r
e386b444 286\r
287**/\r
288UINT8\r
289EFIAPI\r
290LibPcdGetEx8 (\r
2f88bd3a
MK
291 IN CONST GUID *Guid,\r
292 IN UINTN TokenNumber\r
e386b444 293 )\r
294{\r
295 ASSERT (Guid != NULL);\r
9095d37b 296\r
2f88bd3a 297 return GetPiPcdProtocol ()->Get8 (Guid, TokenNumber);\r
e386b444 298}\r
299\r
e386b444 300/**\r
518db1d9 301 This function provides a means by which to retrieve a value for a given PCD token.\r
302\r
e386b444 303 Returns the 16-bit value for the token specified by TokenNumber and Guid.\r
e386b444 304\r
9095d37b
LG
305 If Guid is NULL, then ASSERT().\r
306\r
307 @param[in] Guid The pointer to a 128-bit unique value that designates\r
c00bdbb1 308 which namespace to retrieve a value from.\r
309 @param[in] TokenNumber The PCD token number to retrieve a current value for.\r
e386b444 310\r
f73e0ad2 311 @return Return the UINT16.\r
e386b444 312\r
313**/\r
314UINT16\r
315EFIAPI\r
316LibPcdGetEx16 (\r
2f88bd3a
MK
317 IN CONST GUID *Guid,\r
318 IN UINTN TokenNumber\r
e386b444 319 )\r
320{\r
321 ASSERT (Guid != NULL);\r
322\r
2f88bd3a 323 return GetPiPcdProtocol ()->Get16 (Guid, TokenNumber);\r
e386b444 324}\r
325\r
e386b444 326/**\r
327 Returns the 32-bit value for the token specified by TokenNumber and Guid.\r
9095d37b 328 If Guid is NULL, then ASSERT().\r
e386b444 329\r
9095d37b 330 @param[in] Guid The pointer to a 128-bit unique value that designates\r
c00bdbb1 331 which namespace to retrieve a value from.\r
332 @param[in] TokenNumber The PCD token number to retrieve a current value for.\r
e386b444 333\r
f73e0ad2 334 @return Return the UINT32.\r
e386b444 335\r
336**/\r
337UINT32\r
338EFIAPI\r
339LibPcdGetEx32 (\r
2f88bd3a
MK
340 IN CONST GUID *Guid,\r
341 IN UINTN TokenNumber\r
e386b444 342 )\r
343{\r
344 ASSERT (Guid != NULL);\r
345\r
2f88bd3a 346 return GetPiPcdProtocol ()->Get32 (Guid, TokenNumber);\r
e386b444 347}\r
348\r
e386b444 349/**\r
518db1d9 350 This function provides a means by which to retrieve a value for a given PCD token.\r
9095d37b 351\r
e386b444 352 Returns the 64-bit value for the token specified by TokenNumber and Guid.\r
e386b444 353\r
9095d37b
LG
354 If Guid is NULL, then ASSERT().\r
355\r
356 @param[in] Guid The pointer to a 128-bit unique value that designates\r
518db1d9 357 which namespace to retrieve a value from.\r
358 @param[in] TokenNumber The PCD token number to retrieve a current value for.\r
e386b444 359\r
f73e0ad2 360 @return Return the UINT64.\r
e386b444 361\r
362**/\r
363UINT64\r
364EFIAPI\r
365LibPcdGetEx64 (\r
2f88bd3a
MK
366 IN CONST GUID *Guid,\r
367 IN UINTN TokenNumber\r
e386b444 368 )\r
369{\r
370 ASSERT (Guid != NULL);\r
9095d37b 371\r
2f88bd3a 372 return GetPiPcdProtocol ()->Get64 (Guid, TokenNumber);\r
e386b444 373}\r
374\r
e386b444 375/**\r
518db1d9 376 This function provides a means by which to retrieve a value for a given PCD token.\r
9095d37b 377\r
518db1d9 378 Returns the pointer to the buffer of token specified by TokenNumber and Guid.\r
e386b444 379\r
9095d37b
LG
380 If Guid is NULL, then ASSERT().\r
381\r
382 @param[in] Guid The pointer to a 128-bit unique value that designates\r
518db1d9 383 which namespace to retrieve a value from.\r
384 @param[in] TokenNumber The PCD token number to retrieve a current value for.\r
e386b444 385\r
f73e0ad2 386 @return Return the VOID* pointer.\r
e386b444 387\r
388**/\r
389VOID *\r
390EFIAPI\r
391LibPcdGetExPtr (\r
2f88bd3a
MK
392 IN CONST GUID *Guid,\r
393 IN UINTN TokenNumber\r
e386b444 394 )\r
395{\r
396 ASSERT (Guid != NULL);\r
397\r
2f88bd3a 398 return GetPiPcdProtocol ()->GetPtr (Guid, TokenNumber);\r
e386b444 399}\r
400\r
e386b444 401/**\r
518db1d9 402 This function provides a means by which to retrieve a value for a given PCD token.\r
e386b444 403\r
9095d37b
LG
404 Returns the Boolean value of the token specified by TokenNumber and Guid.\r
405\r
406 If Guid is NULL, then ASSERT().\r
407\r
408 @param[in] Guid The pointer to a 128-bit unique value that designates\r
518db1d9 409 which namespace to retrieve a value from.\r
410 @param[in] TokenNumber The PCD token number to retrieve a current value for.\r
e386b444 411\r
f73e0ad2 412 @return Return the BOOLEAN.\r
e386b444 413\r
414**/\r
415BOOLEAN\r
416EFIAPI\r
417LibPcdGetExBool (\r
2f88bd3a
MK
418 IN CONST GUID *Guid,\r
419 IN UINTN TokenNumber\r
e386b444 420 )\r
421{\r
422 ASSERT (Guid != NULL);\r
423\r
2f88bd3a 424 return GetPiPcdProtocol ()->GetBool (Guid, TokenNumber);\r
e386b444 425}\r
426\r
e386b444 427/**\r
518db1d9 428 This function provides a means by which to retrieve the size of a given PCD token.\r
e386b444 429\r
9095d37b
LG
430 Returns the size of the token specified by TokenNumber and Guid.\r
431\r
432 If Guid is NULL, then ASSERT().\r
433\r
434 @param[in] Guid The pointer to a 128-bit unique value that designates\r
518db1d9 435 which namespace to retrieve a value from.\r
436 @param[in] TokenNumber The PCD token number to retrieve a current value for.\r
e386b444 437\r
f73e0ad2 438 @return Return the size.\r
e386b444 439\r
440**/\r
441UINTN\r
442EFIAPI\r
443LibPcdGetExSize (\r
2f88bd3a
MK
444 IN CONST GUID *Guid,\r
445 IN UINTN TokenNumber\r
e386b444 446 )\r
447{\r
448 ASSERT (Guid != NULL);\r
449\r
2f88bd3a 450 return GetPiPcdProtocol ()->GetSize (Guid, TokenNumber);\r
e386b444 451}\r
452\r
9a355841
SZ
453/**\r
454 This function provides a means by which to set a value for a given PCD token.\r
455\r
456 Sets the 8-bit value for the token specified by TokenNumber\r
457 to the value specified by Value.\r
458\r
459 @param[in] TokenNumber The PCD token number to set a current value for.\r
460 @param[in] Value The 8-bit value to set.\r
461\r
462 @return The status of the set operation.\r
463\r
464**/\r
465RETURN_STATUS\r
466EFIAPI\r
467LibPcdSet8S (\r
2f88bd3a
MK
468 IN UINTN TokenNumber,\r
469 IN UINT8 Value\r
9a355841
SZ
470 )\r
471{\r
2f88bd3a 472 return GetPcdProtocol ()->Set8 (TokenNumber, Value);\r
9a355841
SZ
473}\r
474\r
475/**\r
476 This function provides a means by which to set a value for a given PCD token.\r
477\r
478 Sets the 16-bit value for the token specified by TokenNumber\r
479 to the value specified by Value.\r
480\r
481 @param[in] TokenNumber The PCD token number to set a current value for.\r
482 @param[in] Value The 16-bit value to set.\r
483\r
484 @return The status of the set operation.\r
485\r
486**/\r
487RETURN_STATUS\r
488EFIAPI\r
489LibPcdSet16S (\r
2f88bd3a
MK
490 IN UINTN TokenNumber,\r
491 IN UINT16 Value\r
9a355841
SZ
492 )\r
493{\r
2f88bd3a 494 return GetPcdProtocol ()->Set16 (TokenNumber, Value);\r
9a355841
SZ
495}\r
496\r
497/**\r
498 This function provides a means by which to set a value for a given PCD token.\r
499\r
500 Sets the 32-bit value for the token specified by TokenNumber\r
501 to the value specified by Value.\r
502\r
503 @param[in] TokenNumber The PCD token number to set a current value for.\r
504 @param[in] Value The 32-bit value to set.\r
505\r
506 @return The status of the set operation.\r
507\r
508**/\r
509RETURN_STATUS\r
510EFIAPI\r
511LibPcdSet32S (\r
2f88bd3a
MK
512 IN UINTN TokenNumber,\r
513 IN UINT32 Value\r
9a355841
SZ
514 )\r
515{\r
2f88bd3a 516 return GetPcdProtocol ()->Set32 (TokenNumber, Value);\r
9a355841
SZ
517}\r
518\r
519/**\r
520 This function provides a means by which to set a value for a given PCD token.\r
e386b444 521\r
9a355841
SZ
522 Sets the 64-bit value for the token specified by TokenNumber\r
523 to the value specified by Value.\r
e386b444 524\r
9a355841
SZ
525 @param[in] TokenNumber The PCD token number to set a current value for.\r
526 @param[in] Value The 64-bit value to set.\r
527\r
528 @return The status of the set operation.\r
529\r
530**/\r
531RETURN_STATUS\r
532EFIAPI\r
533LibPcdSet64S (\r
2f88bd3a
MK
534 IN UINTN TokenNumber,\r
535 IN UINT64 Value\r
9a355841
SZ
536 )\r
537{\r
2f88bd3a 538 return GetPcdProtocol ()->Set64 (TokenNumber, Value);\r
9a355841
SZ
539}\r
540\r
541/**\r
542 This function provides a means by which to set a value for a given PCD token.\r
543\r
544 Sets a buffer for the token specified by TokenNumber to the value specified\r
545 by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than the maximum size\r
546 support by TokenNumber, then set SizeOfBuffer to the maximum size supported by\r
547 TokenNumber and return EFI_INVALID_PARAMETER to indicate that the set operation\r
548 was not actually performed.\r
549\r
550 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to the\r
551 maximum size supported by TokenName and EFI_INVALID_PARAMETER must be returned.\r
552\r
553 If SizeOfBuffer is NULL, then ASSERT().\r
554 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().\r
555\r
556 @param[in] TokenNumber The PCD token number to set a current value for.\r
557 @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.\r
558 @param[in] Buffer A pointer to the buffer to set.\r
559\r
560 @return The status of the set operation.\r
561\r
562**/\r
563RETURN_STATUS\r
564EFIAPI\r
565LibPcdSetPtrS (\r
2f88bd3a
MK
566 IN UINTN TokenNumber,\r
567 IN OUT UINTN *SizeOfBuffer,\r
568 IN CONST VOID *Buffer\r
9a355841
SZ
569 )\r
570{\r
571 ASSERT (SizeOfBuffer != NULL);\r
572\r
573 if (*SizeOfBuffer > 0) {\r
574 ASSERT (Buffer != NULL);\r
575 }\r
576\r
2f88bd3a 577 return GetPcdProtocol ()->SetPtr (TokenNumber, SizeOfBuffer, (VOID *)Buffer);\r
9a355841
SZ
578}\r
579\r
580/**\r
581 This function provides a means by which to set a value for a given PCD token.\r
582\r
583 Sets the boolean value for the token specified by TokenNumber\r
584 to the value specified by Value.\r
585\r
586 @param[in] TokenNumber The PCD token number to set a current value for.\r
587 @param[in] Value The boolean value to set.\r
588\r
589 @return The status of the set operation.\r
590\r
591**/\r
592RETURN_STATUS\r
593EFIAPI\r
594LibPcdSetBoolS (\r
2f88bd3a
MK
595 IN UINTN TokenNumber,\r
596 IN BOOLEAN Value\r
9a355841
SZ
597 )\r
598{\r
2f88bd3a 599 return GetPcdProtocol ()->SetBool (TokenNumber, Value);\r
9a355841
SZ
600}\r
601\r
602/**\r
603 This function provides a means by which to set a value for a given PCD token.\r
604\r
605 Sets the 8-bit value for the token specified by TokenNumber\r
606 to the value specified by Value.\r
607\r
608 If Guid is NULL, then ASSERT().\r
609\r
610 @param[in] Guid The pointer to a 128-bit unique value that\r
611 designates which namespace to set a value from.\r
612 @param[in] TokenNumber The PCD token number to set a current value for.\r
613 @param[in] Value The 8-bit value to set.\r
614\r
615 @return The status of the set operation.\r
616\r
617**/\r
618RETURN_STATUS\r
619EFIAPI\r
620LibPcdSetEx8S (\r
2f88bd3a
MK
621 IN CONST GUID *Guid,\r
622 IN UINTN TokenNumber,\r
623 IN UINT8 Value\r
9a355841
SZ
624 )\r
625{\r
626 ASSERT (Guid != NULL);\r
627\r
2f88bd3a 628 return GetPiPcdProtocol ()->Set8 (Guid, TokenNumber, Value);\r
9a355841
SZ
629}\r
630\r
631/**\r
632 This function provides a means by which to set a value for a given PCD token.\r
633\r
634 Sets the 16-bit value for the token specified by TokenNumber\r
635 to the value specified by Value.\r
636\r
637 If Guid is NULL, then ASSERT().\r
638\r
639 @param[in] Guid The pointer to a 128-bit unique value that\r
640 designates which namespace to set a value from.\r
641 @param[in] TokenNumber The PCD token number to set a current value for.\r
642 @param[in] Value The 16-bit value to set.\r
643\r
644 @return The status of the set operation.\r
645\r
646**/\r
647RETURN_STATUS\r
648EFIAPI\r
649LibPcdSetEx16S (\r
2f88bd3a
MK
650 IN CONST GUID *Guid,\r
651 IN UINTN TokenNumber,\r
652 IN UINT16 Value\r
9a355841
SZ
653 )\r
654{\r
655 ASSERT (Guid != NULL);\r
656\r
2f88bd3a 657 return GetPiPcdProtocol ()->Set16 (Guid, TokenNumber, Value);\r
9a355841
SZ
658}\r
659\r
660/**\r
661 This function provides a means by which to set a value for a given PCD token.\r
662\r
663 Sets the 32-bit value for the token specified by TokenNumber\r
664 to the value specified by Value.\r
665\r
666 If Guid is NULL, then ASSERT().\r
667\r
668 @param[in] Guid The pointer to a 128-bit unique value that\r
669 designates which namespace to set a value from.\r
670 @param[in] TokenNumber The PCD token number to set a current value for.\r
671 @param[in] Value The 32-bit value to set.\r
672\r
673 @return The status of the set operation.\r
674\r
675**/\r
676RETURN_STATUS\r
677EFIAPI\r
678LibPcdSetEx32S (\r
2f88bd3a
MK
679 IN CONST GUID *Guid,\r
680 IN UINTN TokenNumber,\r
681 IN UINT32 Value\r
9a355841
SZ
682 )\r
683{\r
684 ASSERT (Guid != NULL);\r
685\r
2f88bd3a 686 return GetPiPcdProtocol ()->Set32 (Guid, TokenNumber, Value);\r
9a355841
SZ
687}\r
688\r
689/**\r
690 This function provides a means by which to set a value for a given PCD token.\r
691\r
692 Sets the 64-bit value for the token specified by TokenNumber\r
693 to the value specified by Value.\r
694\r
695 If Guid is NULL, then ASSERT().\r
696\r
697 @param[in] Guid The pointer to a 128-bit unique value that\r
698 designates which namespace to set a value from.\r
699 @param[in] TokenNumber The PCD token number to set a current value for.\r
700 @param[in] Value The 64-bit value to set.\r
701\r
702 @return The status of the set operation.\r
703\r
704**/\r
705RETURN_STATUS\r
706EFIAPI\r
707LibPcdSetEx64S (\r
2f88bd3a
MK
708 IN CONST GUID *Guid,\r
709 IN UINTN TokenNumber,\r
710 IN UINT64 Value\r
9a355841
SZ
711 )\r
712{\r
713 ASSERT (Guid != NULL);\r
714\r
2f88bd3a 715 return GetPiPcdProtocol ()->Set64 (Guid, TokenNumber, Value);\r
9a355841
SZ
716}\r
717\r
718/**\r
719 This function provides a means by which to set a value for a given PCD token.\r
720\r
721 Sets a buffer for the token specified by TokenNumber to the value specified by\r
722 Buffer and SizeOfBuffer. If SizeOfBuffer is greater than the maximum size\r
723 support by TokenNumber, then set SizeOfBuffer to the maximum size supported by\r
724 TokenNumber and return EFI_INVALID_PARAMETER to indicate that the set operation\r
725 was not actually performed.\r
726\r
727 If Guid is NULL, then ASSERT().\r
728 If SizeOfBuffer is NULL, then ASSERT().\r
729 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().\r
730\r
731 @param[in] Guid Pointer to a 128-bit unique value that\r
732 designates which namespace to set a value from.\r
733 @param[in] TokenNumber The PCD token number to set a current value for.\r
734 @param[in, out] SizeOfBuffer The size, in bytes, of Buffer.\r
735 @param[in] Buffer A pointer to the buffer to set.\r
736\r
737 @return The status of the set operation.\r
738\r
739**/\r
740RETURN_STATUS\r
741EFIAPI\r
742LibPcdSetExPtrS (\r
2f88bd3a
MK
743 IN CONST GUID *Guid,\r
744 IN UINTN TokenNumber,\r
745 IN OUT UINTN *SizeOfBuffer,\r
746 IN VOID *Buffer\r
9a355841
SZ
747 )\r
748{\r
749 ASSERT (Guid != NULL);\r
750\r
751 ASSERT (SizeOfBuffer != NULL);\r
752\r
753 if (*SizeOfBuffer > 0) {\r
754 ASSERT (Buffer != NULL);\r
755 }\r
756\r
2f88bd3a 757 return GetPiPcdProtocol ()->SetPtr (Guid, TokenNumber, SizeOfBuffer, Buffer);\r
9a355841
SZ
758}\r
759\r
760/**\r
761 This function provides a means by which to set a value for a given PCD token.\r
762\r
763 Sets the boolean value for the token specified by TokenNumber\r
764 to the value specified by Value.\r
765\r
766 If Guid is NULL, then ASSERT().\r
767\r
768 @param[in] Guid The pointer to a 128-bit unique value that\r
769 designates which namespace to set a value from.\r
770 @param[in] TokenNumber The PCD token number to set a current value for.\r
771 @param[in] Value The boolean value to set.\r
772\r
773 @return The status of the set operation.\r
774\r
775**/\r
776RETURN_STATUS\r
777EFIAPI\r
778LibPcdSetExBoolS (\r
2f88bd3a
MK
779 IN CONST GUID *Guid,\r
780 IN UINTN TokenNumber,\r
781 IN BOOLEAN Value\r
9a355841
SZ
782 )\r
783{\r
784 ASSERT (Guid != NULL);\r
785\r
2f88bd3a 786 return GetPiPcdProtocol ()->SetBool (Guid, TokenNumber, Value);\r
9a355841 787}\r
e386b444 788\r
789/**\r
518db1d9 790 Set up a notification function that is called when a specified token is set.\r
9095d37b
LG
791\r
792 When the token specified by TokenNumber and Guid is set,\r
793 then notification function specified by NotificationFunction is called.\r
c00bdbb1 794 If Guid is NULL, then the default token space is used.\r
518db1d9 795 If NotificationFunction is NULL, then ASSERT().\r
796\r
9095d37b
LG
797 @param[in] Guid The pointer to a 128-bit unique value that designates which\r
798 namespace to set a value from. If NULL, then the default\r
c00bdbb1 799 token space is used.\r
800 @param[in] TokenNumber The PCD token number to monitor.\r
9095d37b 801 @param[in] NotificationFunction The function to call when the token\r
518db1d9 802 specified by Guid and TokenNumber is set.\r
803\r
e386b444 804**/\r
805VOID\r
806EFIAPI\r
807LibPcdCallbackOnSet (\r
2f88bd3a
MK
808 IN CONST GUID *Guid OPTIONAL,\r
809 IN UINTN TokenNumber,\r
810 IN PCD_CALLBACK NotificationFunction\r
e386b444 811 )\r
812{\r
2f88bd3a 813 EFI_STATUS Status;\r
e386b444 814\r
815 ASSERT (NotificationFunction != NULL);\r
816\r
2f88bd3a 817 Status = GetPiPcdProtocol ()->CallbackOnSet (Guid, TokenNumber, (EFI_PCD_PROTOCOL_CALLBACK)NotificationFunction);\r
e386b444 818 ASSERT_EFI_ERROR (Status);\r
819\r
820 return;\r
821}\r
822\r
e386b444 823/**\r
824 Disable a notification function that was established with LibPcdCallbackonSet().\r
9095d37b 825\r
c00bdbb1 826 Disable a notification function that was previously established with LibPcdCallbackOnSet().\r
e386b444 827 If NotificationFunction is NULL, then ASSERT().\r
9095d37b 828 If LibPcdCallbackOnSet() was not previously called with Guid, TokenNumber,\r
518db1d9 829 and NotificationFunction, then ASSERT().\r
9095d37b 830\r
c00bdbb1 831 @param[in] Guid Specify the GUID token space.\r
832 @param[in] TokenNumber Specify the token number.\r
e386b444 833 @param[in] NotificationFunction The callback function to be unregistered.\r
834\r
e386b444 835**/\r
836VOID\r
837EFIAPI\r
838LibPcdCancelCallback (\r
2f88bd3a
MK
839 IN CONST GUID *Guid OPTIONAL,\r
840 IN UINTN TokenNumber,\r
841 IN PCD_CALLBACK NotificationFunction\r
e386b444 842 )\r
843{\r
2f88bd3a 844 EFI_STATUS Status;\r
e386b444 845\r
846 ASSERT (NotificationFunction != NULL);\r
9095d37b 847\r
2f88bd3a 848 Status = GetPiPcdProtocol ()->CancelCallback (Guid, TokenNumber, (EFI_PCD_PROTOCOL_CALLBACK)NotificationFunction);\r
e386b444 849 ASSERT_EFI_ERROR (Status);\r
850\r
851 return;\r
852}\r
853\r
e386b444 854/**\r
518db1d9 855 Retrieves the next token in a token space.\r
9095d37b
LG
856\r
857 Retrieves the next PCD token number from the token space specified by Guid.\r
858 If Guid is NULL, then the default token space is used. If TokenNumber is 0,\r
859 then the first token number is returned. Otherwise, the token number that\r
860 follows TokenNumber in the token space is returned. If TokenNumber is the last\r
861 token number in the token space, then 0 is returned.\r
862\r
518db1d9 863 If TokenNumber is not 0 and is not in the token space specified by Guid, then ASSERT().\r
e386b444 864\r
9095d37b 865 @param[in] Guid The pointer to a 128-bit unique value that designates which namespace\r
2a254b90 866 to set a value from. If NULL, then the default token space is used.\r
9095d37b 867 @param[in] TokenNumber The previous PCD token number. If 0, then retrieves the first PCD\r
2a254b90 868 token number.\r
e386b444 869\r
f73e0ad2 870 @return The next valid token number.\r
e386b444 871\r
872**/\r
9095d37b 873UINTN\r
e386b444 874EFIAPI\r
875LibPcdGetNextToken (\r
2f88bd3a
MK
876 IN CONST GUID *Guid OPTIONAL,\r
877 IN UINTN TokenNumber\r
e386b444 878 )\r
879{\r
2f88bd3a 880 EFI_STATUS Status;\r
da660118 881\r
2f88bd3a 882 Status = GetPiPcdProtocol ()->GetNextToken (Guid, &TokenNumber);\r
da660118 883 ASSERT (!EFI_ERROR (Status) || TokenNumber == 0);\r
e386b444 884\r
885 return TokenNumber;\r
886}\r
887\r
e386b444 888/**\r
64735d24 889 Used to retrieve the list of available PCD token space GUIDs.\r
9095d37b 890\r
c00bdbb1 891 Returns the PCD token space GUID that follows TokenSpaceGuid in the list of token spaces\r
892 in the platform.\r
893 If TokenSpaceGuid is NULL, then a pointer to the first PCD token spaces returned.\r
894 If TokenSpaceGuid is the last PCD token space GUID in the list, then NULL is returned.\r
9095d37b 895\r
58380e9c 896 @param TokenSpaceGuid The pointer to the a PCD token space GUID.\r
e386b444 897\r
f73e0ad2 898 @return The next valid token namespace.\r
e386b444 899\r
900**/\r
c00bdbb1 901GUID *\r
e386b444 902EFIAPI\r
903LibPcdGetNextTokenSpace (\r
64735d24 904 IN CONST GUID *TokenSpaceGuid\r
e386b444 905 )\r
906{\r
2f88bd3a 907 GetPiPcdProtocol ()->GetNextTokenSpace (&TokenSpaceGuid);\r
e386b444 908\r
b35a5f73 909 return (GUID *)TokenSpaceGuid;\r
e386b444 910}\r
911\r
e386b444 912/**\r
518db1d9 913 Sets a value of a patchable PCD entry that is type pointer.\r
9095d37b
LG
914\r
915 Sets the PCD entry specified by PatchVariable to the value specified by Buffer\r
916 and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than\r
917 MaximumDatumSize, then set SizeOfBuffer to MaximumDatumSize and return\r
918 NULL to indicate that the set operation was not actually performed.\r
919 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to\r
e386b444 920 MaximumDatumSize and NULL must be returned.\r
9095d37b 921\r
e386b444 922 If PatchVariable is NULL, then ASSERT().\r
ef64f703 923 If SizeOfBuffer is NULL, then ASSERT().\r
924 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().\r
e386b444 925\r
9095d37b 926 @param[out] PatchVariable A pointer to the global variable in a module that is\r
e386b444 927 the target of the set operation.\r
928 @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.\r
929 @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.\r
930 @param[in] Buffer A pointer to the buffer to used to set the target variable.\r
9095d37b 931\r
9638ba6d 932 @return Return the pointer to the buffer been set.\r
518db1d9 933\r
e386b444 934**/\r
935VOID *\r
936EFIAPI\r
937LibPatchPcdSetPtr (\r
2f88bd3a
MK
938 OUT VOID *PatchVariable,\r
939 IN UINTN MaximumDatumSize,\r
940 IN OUT UINTN *SizeOfBuffer,\r
941 IN CONST VOID *Buffer\r
e386b444 942 )\r
943{\r
944 ASSERT (PatchVariable != NULL);\r
945 ASSERT (SizeOfBuffer != NULL);\r
9095d37b 946\r
e386b444 947 if (*SizeOfBuffer > 0) {\r
948 ASSERT (Buffer != NULL);\r
949 }\r
950\r
951 if ((*SizeOfBuffer > MaximumDatumSize) ||\r
2f88bd3a
MK
952 (*SizeOfBuffer == MAX_ADDRESS))\r
953 {\r
e386b444 954 *SizeOfBuffer = MaximumDatumSize;\r
955 return NULL;\r
956 }\r
9095d37b 957\r
e386b444 958 CopyMem (PatchVariable, Buffer, *SizeOfBuffer);\r
9095d37b 959\r
2f88bd3a 960 return (VOID *)Buffer;\r
e386b444 961}\r
962\r
9a355841
SZ
963/**\r
964 Sets a value of a patchable PCD entry that is type pointer.\r
965\r
966 Sets the PCD entry specified by PatchVariable to the value specified\r
967 by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than MaximumDatumSize,\r
968 then set SizeOfBuffer to MaximumDatumSize and return RETURN_INVALID_PARAMETER\r
969 to indicate that the set operation was not actually performed.\r
970 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to\r
971 MaximumDatumSize and RETURN_INVALID_PARAMETER must be returned.\r
972\r
973 If PatchVariable is NULL, then ASSERT().\r
974 If SizeOfBuffer is NULL, then ASSERT().\r
975 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().\r
976\r
f8308f0a 977 @param[out] PatchVariable A pointer to the global variable in a module that is\r
9a355841
SZ
978 the target of the set operation.\r
979 @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.\r
980 @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.\r
981 @param[in] Buffer A pointer to the buffer to used to set the target variable.\r
9095d37b 982\r
9a355841
SZ
983 @return The status of the set operation.\r
984\r
985**/\r
986RETURN_STATUS\r
987EFIAPI\r
988LibPatchPcdSetPtrS (\r
2f88bd3a
MK
989 OUT VOID *PatchVariable,\r
990 IN UINTN MaximumDatumSize,\r
991 IN OUT UINTN *SizeOfBuffer,\r
992 IN CONST VOID *Buffer\r
9a355841
SZ
993 )\r
994{\r
995 ASSERT (PatchVariable != NULL);\r
996 ASSERT (SizeOfBuffer != NULL);\r
9095d37b 997\r
9a355841
SZ
998 if (*SizeOfBuffer > 0) {\r
999 ASSERT (Buffer != NULL);\r
1000 }\r
1001\r
1002 if ((*SizeOfBuffer > MaximumDatumSize) ||\r
2f88bd3a
MK
1003 (*SizeOfBuffer == MAX_ADDRESS))\r
1004 {\r
9a355841
SZ
1005 *SizeOfBuffer = MaximumDatumSize;\r
1006 return RETURN_INVALID_PARAMETER;\r
1007 }\r
1008\r
1009 CopyMem (PatchVariable, Buffer, *SizeOfBuffer);\r
1010\r
1011 return RETURN_SUCCESS;\r
1012}\r
1013\r
f8308f0a
LG
1014/**\r
1015 Sets a value and size of a patchable PCD entry that is type pointer.\r
9095d37b
LG
1016\r
1017 Sets the PCD entry specified by PatchVariable to the value specified by Buffer\r
1018 and SizeOfBuffer. Buffer is returned. If SizeOfBuffer is greater than\r
1019 MaximumDatumSize, then set SizeOfBuffer to MaximumDatumSize and return\r
1020 NULL to indicate that the set operation was not actually performed.\r
1021 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to\r
f8308f0a 1022 MaximumDatumSize and NULL must be returned.\r
9095d37b 1023\r
f8308f0a
LG
1024 If PatchVariable is NULL, then ASSERT().\r
1025 If SizeOfPatchVariable is NULL, then ASSERT().\r
1026 If SizeOfBuffer is NULL, then ASSERT().\r
1027 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().\r
1028\r
9095d37b 1029 @param[out] PatchVariable A pointer to the global variable in a module that is\r
f8308f0a
LG
1030 the target of the set operation.\r
1031 @param[out] SizeOfPatchVariable A pointer to the size, in bytes, of PatchVariable.\r
1032 @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.\r
1033 @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.\r
1034 @param[in] Buffer A pointer to the buffer to used to set the target variable.\r
9095d37b 1035\r
f8308f0a
LG
1036 @return Return the pointer to the buffer been set.\r
1037\r
1038**/\r
1039VOID *\r
1040EFIAPI\r
1041LibPatchPcdSetPtrAndSize (\r
2f88bd3a
MK
1042 OUT VOID *PatchVariable,\r
1043 OUT UINTN *SizeOfPatchVariable,\r
1044 IN UINTN MaximumDatumSize,\r
1045 IN OUT UINTN *SizeOfBuffer,\r
1046 IN CONST VOID *Buffer\r
f8308f0a
LG
1047 )\r
1048{\r
1049 ASSERT (PatchVariable != NULL);\r
1050 ASSERT (SizeOfPatchVariable != NULL);\r
1051 ASSERT (SizeOfBuffer != NULL);\r
9095d37b 1052\r
f8308f0a
LG
1053 if (*SizeOfBuffer > 0) {\r
1054 ASSERT (Buffer != NULL);\r
1055 }\r
1056\r
1057 if ((*SizeOfBuffer > MaximumDatumSize) ||\r
2f88bd3a
MK
1058 (*SizeOfBuffer == MAX_ADDRESS))\r
1059 {\r
f8308f0a
LG
1060 *SizeOfBuffer = MaximumDatumSize;\r
1061 return NULL;\r
1062 }\r
9095d37b 1063\r
f8308f0a
LG
1064 CopyMem (PatchVariable, Buffer, *SizeOfBuffer);\r
1065 *SizeOfPatchVariable = *SizeOfBuffer;\r
9095d37b 1066\r
2f88bd3a 1067 return (VOID *)Buffer;\r
f8308f0a
LG
1068}\r
1069\r
1070/**\r
1071 Sets a value and size of a patchable PCD entry that is type pointer.\r
1072\r
1073 Sets the PCD entry specified by PatchVariable to the value specified\r
1074 by Buffer and SizeOfBuffer. If SizeOfBuffer is greater than MaximumDatumSize,\r
1075 then set SizeOfBuffer to MaximumDatumSize and return RETURN_INVALID_PARAMETER\r
1076 to indicate that the set operation was not actually performed.\r
1077 If SizeOfBuffer is set to MAX_ADDRESS, then SizeOfBuffer must be set to\r
1078 MaximumDatumSize and RETURN_INVALID_PARAMETER must be returned.\r
1079\r
1080 If PatchVariable is NULL, then ASSERT().\r
1081 If SizeOfPatchVariable is NULL, then ASSERT().\r
1082 If SizeOfBuffer is NULL, then ASSERT().\r
1083 If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT().\r
1084\r
1085 @param[out] PatchVariable A pointer to the global variable in a module that is\r
1086 the target of the set operation.\r
1087 @param[out] SizeOfPatchVariable A pointer to the size, in bytes, of PatchVariable.\r
1088 @param[in] MaximumDatumSize The maximum size allowed for the PCD entry specified by PatchVariable.\r
1089 @param[in, out] SizeOfBuffer A pointer to the size, in bytes, of Buffer.\r
1090 @param[in] Buffer A pointer to the buffer to used to set the target variable.\r
9095d37b 1091\r
f8308f0a
LG
1092 @return The status of the set operation.\r
1093\r
1094**/\r
1095RETURN_STATUS\r
1096EFIAPI\r
1097LibPatchPcdSetPtrAndSizeS (\r
2f88bd3a
MK
1098 OUT VOID *PatchVariable,\r
1099 OUT UINTN *SizeOfPatchVariable,\r
1100 IN UINTN MaximumDatumSize,\r
1101 IN OUT UINTN *SizeOfBuffer,\r
1102 IN CONST VOID *Buffer\r
f8308f0a
LG
1103 )\r
1104{\r
1105 ASSERT (PatchVariable != NULL);\r
1106 ASSERT (SizeOfPatchVariable != NULL);\r
1107 ASSERT (SizeOfBuffer != NULL);\r
9095d37b 1108\r
f8308f0a
LG
1109 if (*SizeOfBuffer > 0) {\r
1110 ASSERT (Buffer != NULL);\r
1111 }\r
1112\r
1113 if ((*SizeOfBuffer > MaximumDatumSize) ||\r
2f88bd3a
MK
1114 (*SizeOfBuffer == MAX_ADDRESS))\r
1115 {\r
f8308f0a
LG
1116 *SizeOfBuffer = MaximumDatumSize;\r
1117 return RETURN_INVALID_PARAMETER;\r
1118 }\r
1119\r
1120 CopyMem (PatchVariable, Buffer, *SizeOfBuffer);\r
1121 *SizeOfPatchVariable = *SizeOfBuffer;\r
1122\r
1123 return RETURN_SUCCESS;\r
1124}\r
1125\r
96d6d004
SZ
1126/**\r
1127 Retrieve additional information associated with a PCD token.\r
1128\r
1129 This includes information such as the type of value the TokenNumber is associated with as well as possible\r
1130 human readable name that is associated with the token.\r
1131\r
1132 If TokenNumber is not in the default token space specified, then ASSERT().\r
e386b444 1133\r
96d6d004
SZ
1134 @param[in] TokenNumber The PCD token number.\r
1135 @param[out] PcdInfo The returned information associated with the requested TokenNumber.\r
1136 The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.\r
1137**/\r
1138VOID\r
1139EFIAPI\r
1140LibPcdGetInfo (\r
2f88bd3a
MK
1141 IN UINTN TokenNumber,\r
1142 OUT PCD_INFO *PcdInfo\r
96d6d004
SZ
1143 )\r
1144{\r
2f88bd3a 1145 EFI_STATUS Status;\r
96d6d004 1146\r
2f88bd3a 1147 Status = GetPcdInfoProtocolPointer ()->GetInfo (TokenNumber, (EFI_PCD_INFO *)PcdInfo);\r
96d6d004
SZ
1148 ASSERT_EFI_ERROR (Status);\r
1149}\r
1150\r
1151/**\r
1152 Retrieve additional information associated with a PCD token.\r
1153\r
1154 This includes information such as the type of value the TokenNumber is associated with as well as possible\r
1155 human readable name that is associated with the token.\r
1156\r
1157 If TokenNumber is not in the token space specified by Guid, then ASSERT().\r
1158\r
1159 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
1160 @param[in] TokenNumber The PCD token number.\r
1161 @param[out] PcdInfo The returned information associated with the requested TokenNumber.\r
1162 The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.\r
1163**/\r
1164VOID\r
1165EFIAPI\r
1166LibPcdGetInfoEx (\r
2f88bd3a
MK
1167 IN CONST GUID *Guid,\r
1168 IN UINTN TokenNumber,\r
1169 OUT PCD_INFO *PcdInfo\r
96d6d004
SZ
1170 )\r
1171{\r
2f88bd3a 1172 EFI_STATUS Status;\r
96d6d004 1173\r
2f88bd3a 1174 Status = GetPiPcdInfoProtocolPointer ()->GetInfo (Guid, TokenNumber, (EFI_PCD_INFO *)PcdInfo);\r
96d6d004
SZ
1175 ASSERT_EFI_ERROR (Status);\r
1176}\r
1177\r
1178/**\r
1179 Retrieve the currently set SKU Id.\r
1180\r
96d6d004
SZ
1181 @return The currently set SKU Id. If the platform has not set at a SKU Id, then the\r
1182 default SKU Id value of 0 is returned. If the platform has set a SKU Id, then the currently set SKU\r
1183 Id is returned.\r
1184**/\r
1185UINTN\r
1186EFIAPI\r
1187LibPcdGetSku (\r
1188 VOID\r
1189 )\r
1190{\r
2f88bd3a 1191 return GetPiPcdInfoProtocolPointer ()->GetSku ();\r
96d6d004 1192}\r