]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/PCD/Dxe/Service.h
IntelSiliconPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Universal / PCD / Dxe / Service.h
CommitLineData
80408db0 1/** @file\r
2Private functions used by PCD DXE driver.\r
3\r
d1102dba 4Copyright (c) 2006 - 2018, 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
2ab6330e 15#ifndef _PCD_DXE_SERVICE_H_\r
16#define _PCD_DXE_SERVICE_H_\r
80408db0 17\r
859b72fa 18#include <PiDxe.h>\r
98b15cf1 19#include <Guid/PcdDataBaseHobGuid.h>\r
419db80b 20#include <Guid/PcdDataBaseSignatureGuid.h>\r
859b72fa 21#include <Protocol/Pcd.h>\r
c896d682 22#include <Protocol/PiPcd.h>\r
96d6d004
SZ
23#include <Protocol/PcdInfo.h>\r
24#include <Protocol/PiPcdInfo.h>\r
23f3e119
SZ
25#include <Protocol/VarCheck.h>\r
26#include <Protocol/VariableLock.h>\r
859b72fa
A
27#include <Library/BaseLib.h>\r
28#include <Library/DebugLib.h>\r
29#include <Library/UefiLib.h>\r
30#include <Library/UefiDriverEntryPoint.h>\r
31#include <Library/PcdLib.h>\r
32#include <Library/HobLib.h>\r
33#include <Library/MemoryAllocationLib.h>\r
34#include <Library/UefiBootServicesTableLib.h>\r
35#include <Library/BaseMemoryLib.h>\r
36#include <Library/UefiRuntimeServicesTableLib.h>\r
80408db0 37\r
e9d97d08
LG
38//\r
39// Please make sure the PCD Serivce DXE Version is consistent with\r
40// the version of the generated DXE PCD Database by build tool.\r
41//\r
7c736265 42#define PCD_SERVICE_DXE_VERSION 7\r
e9d97d08
LG
43\r
44//\r
45// PCD_DXE_SERVICE_DRIVER_VERSION is defined in Autogen.h.\r
46//\r
47#if (PCD_SERVICE_DXE_VERSION != PCD_DXE_SERVICE_DRIVER_VERSION)\r
48 #error "Please make sure the version of PCD DXE Service and the generated PCD DXE Database match."\r
49#endif\r
50\r
534efca0
LG
51extern UINTN mVpdBaseAddress;\r
52\r
96d6d004
SZ
53/**\r
54 Retrieve additional information associated with a PCD token in the default token space.\r
55\r
56 This includes information such as the type of value the TokenNumber is associated with as well as possible\r
57 human readable name that is associated with the token.\r
58\r
59 @param[in] TokenNumber The PCD token number.\r
60 @param[out] PcdInfo The returned information associated with the requested TokenNumber.\r
61 The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.\r
62\r
63 @retval EFI_SUCCESS The PCD information was returned successfully.\r
64 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
65**/\r
66EFI_STATUS\r
67EFIAPI\r
68DxeGetPcdInfoGetInfo (\r
69 IN UINTN TokenNumber,\r
70 OUT EFI_PCD_INFO *PcdInfo\r
71 );\r
72\r
73/**\r
74 Retrieve additional information associated with a PCD token.\r
75\r
76 This includes information such as the type of value the TokenNumber is associated with as well as possible\r
77 human readable name that is associated with the token.\r
78\r
79 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
80 @param[in] TokenNumber The PCD token number.\r
81 @param[out] PcdInfo The returned information associated with the requested TokenNumber.\r
82 The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.\r
83\r
84 @retval EFI_SUCCESS The PCD information was returned successfully.\r
85 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
86**/\r
87EFI_STATUS\r
88EFIAPI\r
89DxeGetPcdInfoGetInfoEx (\r
90 IN CONST EFI_GUID *Guid,\r
91 IN UINTN TokenNumber,\r
92 OUT EFI_PCD_INFO *PcdInfo\r
93 );\r
94\r
95/**\r
96 Retrieve the currently set SKU Id.\r
97\r
98 @return The currently set SKU Id. If the platform has not set at a SKU Id, then the\r
99 default SKU Id value of 0 is returned. If the platform has set a SKU Id, then the currently set SKU\r
100 Id is returned.\r
101**/\r
102UINTN\r
103EFIAPI\r
104DxeGetPcdInfoGetSku (\r
105 VOID\r
106 );\r
107\r
80408db0 108//\r
109// Protocol Interface function declaration.\r
110//\r
2ab6330e 111/**\r
112 Sets the SKU value for subsequent calls to set or get PCD token values.\r
113\r
d1102dba 114 SetSku() sets the SKU Id to be used for subsequent calls to set or get PCD values.\r
2ab6330e 115 SetSku() is normally called only once by the system.\r
116\r
d1102dba
LG
117 For each item (token), the database can hold a single value that applies to all SKUs,\r
118 or multiple values, where each value is associated with a specific SKU Id. Items with multiple,\r
119 SKU-specific values are called SKU enabled.\r
120\r
121 The SKU Id of zero is reserved as a default. The valid SkuId range is 1 to 255.\r
122 For tokens that are not SKU enabled, the system ignores any set SKU Id and works with the\r
123 single value for that token. For SKU-enabled tokens, the system will use the SKU Id set by the\r
124 last call to SetSku(). If no SKU Id is set or the currently set SKU Id isn't valid for the specified token,\r
125 the system uses the default SKU Id. If the system attempts to use the default SKU Id and no value has been\r
2ab6330e 126 set for that Id, the results are unpredictable.\r
127\r
d1102dba 128 @param[in] SkuId The SKU value that will be used when the PCD service will retrieve and\r
2ab6330e 129 set values associated with a PCD token.\r
130\r
2ab6330e 131**/\r
80408db0 132VOID\r
133EFIAPI\r
134DxePcdSetSku (\r
135 IN UINTN SkuId\r
ed66e1bc 136 );\r
80408db0 137\r
2ab6330e 138/**\r
139 Retrieves an 8-bit value for a given PCD token.\r
140\r
d1102dba 141 Retrieves the current byte-sized value for a PCD token number.\r
2ab6330e 142 If the TokenNumber is invalid, the results are unpredictable.\r
d1102dba
LG
143\r
144 @param[in] TokenNumber The PCD token number.\r
80408db0 145\r
2ab6330e 146 @return The UINT8 value.\r
d1102dba 147\r
2ab6330e 148**/\r
80408db0 149UINT8\r
150EFIAPI\r
151DxePcdGet8 (\r
152 IN UINTN TokenNumber\r
ed66e1bc 153 );\r
80408db0 154\r
2ab6330e 155/**\r
156 Retrieves an 16-bit value for a given PCD token.\r
80408db0 157\r
d1102dba 158 Retrieves the current 16-bits value for a PCD token number.\r
2ab6330e 159 If the TokenNumber is invalid, the results are unpredictable.\r
d1102dba
LG
160\r
161 @param[in] TokenNumber The PCD token number.\r
2ab6330e 162\r
163 @return The UINT16 value.\r
d1102dba 164\r
2ab6330e 165**/\r
80408db0 166UINT16\r
167EFIAPI\r
168DxePcdGet16 (\r
169 IN UINTN TokenNumber\r
ed66e1bc 170 );\r
80408db0 171\r
2ab6330e 172/**\r
173 Retrieves an 32-bit value for a given PCD token.\r
80408db0 174\r
d1102dba 175 Retrieves the current 32-bits value for a PCD token number.\r
2ab6330e 176 If the TokenNumber is invalid, the results are unpredictable.\r
d1102dba
LG
177\r
178 @param[in] TokenNumber The PCD token number.\r
2ab6330e 179\r
180 @return The UINT32 value.\r
d1102dba 181\r
2ab6330e 182**/\r
80408db0 183UINT32\r
184EFIAPI\r
185DxePcdGet32 (\r
186 IN UINTN TokenNumber\r
ed66e1bc 187 );\r
80408db0 188\r
2ab6330e 189/**\r
190 Retrieves an 64-bit value for a given PCD token.\r
191\r
d1102dba 192 Retrieves the current 64-bits value for a PCD token number.\r
2ab6330e 193 If the TokenNumber is invalid, the results are unpredictable.\r
d1102dba
LG
194\r
195 @param[in] TokenNumber The PCD token number.\r
80408db0 196\r
2ab6330e 197 @return The UINT64 value.\r
d1102dba 198\r
2ab6330e 199**/\r
80408db0 200UINT64\r
201EFIAPI\r
202DxePcdGet64 (\r
203 IN UINTN TokenNumber\r
ed66e1bc 204 );\r
80408db0 205\r
2ab6330e 206/**\r
207 Retrieves a pointer to a value for a given PCD token.\r
208\r
d1102dba
LG
209 Retrieves the current pointer to the buffer for a PCD token number.\r
210 Do not make any assumptions about the alignment of the pointer that\r
211 is returned by this function call. If the TokenNumber is invalid,\r
2ab6330e 212 the results are unpredictable.\r
80408db0 213\r
d1102dba 214 @param[in] TokenNumber The PCD token number.\r
2ab6330e 215\r
3fd8027e 216 @return The pointer to the buffer to be retrieved.\r
d1102dba 217\r
2ab6330e 218**/\r
80408db0 219VOID *\r
220EFIAPI\r
221DxePcdGetPtr (\r
222 IN UINTN TokenNumber\r
ed66e1bc 223 );\r
80408db0 224\r
2ab6330e 225/**\r
226 Retrieves a Boolean value for a given PCD token.\r
227\r
d1102dba
LG
228 Retrieves the current boolean value for a PCD token number.\r
229 Do not make any assumptions about the alignment of the pointer that\r
230 is returned by this function call. If the TokenNumber is invalid,\r
2ab6330e 231 the results are unpredictable.\r
232\r
d1102dba 233 @param[in] TokenNumber The PCD token number.\r
80408db0 234\r
2ab6330e 235 @return The Boolean value.\r
d1102dba 236\r
2ab6330e 237**/\r
80408db0 238BOOLEAN\r
239EFIAPI\r
240DxePcdGetBool (\r
241 IN UINTN TokenNumber\r
ed66e1bc 242 );\r
80408db0 243\r
2ab6330e 244/**\r
245 Retrieves the size of the value for a given PCD token.\r
246\r
d1102dba 247 Retrieves the current size of a particular PCD token.\r
2ab6330e 248 If the TokenNumber is invalid, the results are unpredictable.\r
249\r
d1102dba 250 @param[in] TokenNumber The PCD token number.\r
80408db0 251\r
2ab6330e 252 @return The size of the value for the PCD token.\r
d1102dba 253\r
2ab6330e 254**/\r
80408db0 255UINTN\r
256EFIAPI\r
257DxePcdGetSize (\r
258 IN UINTN TokenNumber\r
ed66e1bc 259 );\r
80408db0 260\r
2ab6330e 261/**\r
262 Retrieves an 8-bit value for a given PCD token.\r
263\r
d1102dba 264 Retrieves the 8-bit value of a particular PCD token.\r
2ab6330e 265 If the TokenNumber is invalid or the token space\r
d1102dba 266 specified by Guid does not exist, the results are\r
2ab6330e 267 unpredictable.\r
80408db0 268\r
2ab6330e 269 @param[in] Guid The token space for the token number.\r
d1102dba 270 @param[in] TokenNumber The PCD token number.\r
2ab6330e 271\r
272 @return The size 8-bit value for the PCD token.\r
d1102dba 273\r
2ab6330e 274**/\r
80408db0 275UINT8\r
276EFIAPI\r
277DxePcdGet8Ex (\r
278 IN CONST EFI_GUID *Guid,\r
279 IN UINTN TokenNumber\r
ed66e1bc 280 );\r
80408db0 281\r
2ab6330e 282/**\r
283 Retrieves an 16-bit value for a given PCD token.\r
284\r
d1102dba 285 Retrieves the 16-bit value of a particular PCD token.\r
2ab6330e 286 If the TokenNumber is invalid or the token space\r
d1102dba 287 specified by Guid does not exist, the results are\r
2ab6330e 288 unpredictable.\r
289\r
290 @param[in] Guid The token space for the token number.\r
d1102dba 291 @param[in] TokenNumber The PCD token number.\r
80408db0 292\r
2ab6330e 293 @return The size 16-bit value for the PCD token.\r
d1102dba 294\r
2ab6330e 295**/\r
80408db0 296UINT16\r
297EFIAPI\r
298DxePcdGet16Ex (\r
299 IN CONST EFI_GUID *Guid,\r
300 IN UINTN TokenNumber\r
ed66e1bc 301 );\r
80408db0 302\r
2ab6330e 303/**\r
304 Retrieves an 32-bit value for a given PCD token.\r
305\r
d1102dba 306 Retrieves the 32-bit value of a particular PCD token.\r
2ab6330e 307 If the TokenNumber is invalid or the token space\r
d1102dba 308 specified by Guid does not exist, the results are\r
2ab6330e 309 unpredictable.\r
310\r
311 @param[in] Guid The token space for the token number.\r
d1102dba 312 @param[in] TokenNumber The PCD token number.\r
80408db0 313\r
2ab6330e 314 @return The size 32-bit value for the PCD token.\r
d1102dba 315\r
2ab6330e 316**/\r
80408db0 317UINT32\r
318EFIAPI\r
319DxePcdGet32Ex (\r
320 IN CONST EFI_GUID *Guid,\r
321 IN UINTN TokenNumber\r
ed66e1bc 322 );\r
80408db0 323\r
2ab6330e 324/**\r
325 Retrieves an 64-bit value for a given PCD token.\r
326\r
d1102dba 327 Retrieves the 64-bit value of a particular PCD token.\r
2ab6330e 328 If the TokenNumber is invalid or the token space\r
d1102dba 329 specified by Guid does not exist, the results are\r
2ab6330e 330 unpredictable.\r
80408db0 331\r
2ab6330e 332 @param[in] Guid The token space for the token number.\r
d1102dba 333 @param[in] TokenNumber The PCD token number.\r
80408db0 334\r
2ab6330e 335 @return The size 64-bit value for the PCD token.\r
d1102dba 336\r
2ab6330e 337**/\r
80408db0 338UINT64\r
339EFIAPI\r
340DxePcdGet64Ex (\r
341 IN CONST EFI_GUID *Guid,\r
342 IN UINTN TokenNumber\r
ed66e1bc 343 );\r
80408db0 344\r
2ab6330e 345/**\r
346 Retrieves a pointer to a value for a given PCD token.\r
347\r
d1102dba
LG
348 Retrieves the current pointer to the buffer for a PCD token number.\r
349 Do not make any assumptions about the alignment of the pointer that\r
350 is returned by this function call. If the TokenNumber is invalid,\r
2ab6330e 351 the results are unpredictable.\r
80408db0 352\r
2ab6330e 353 @param[in] Guid The token space for the token number.\r
d1102dba 354 @param[in] TokenNumber The PCD token number.\r
80408db0 355\r
3fd8027e 356 @return The pointer to the buffer to be retrieved.\r
d1102dba 357\r
2ab6330e 358**/\r
80408db0 359VOID *\r
360EFIAPI\r
361DxePcdGetPtrEx (\r
362 IN CONST EFI_GUID *Guid,\r
363 IN UINTN TokenNumber\r
ed66e1bc 364 );\r
80408db0 365\r
2ab6330e 366/**\r
367 Retrieves an Boolean value for a given PCD token.\r
368\r
d1102dba 369 Retrieves the Boolean value of a particular PCD token.\r
2ab6330e 370 If the TokenNumber is invalid or the token space\r
d1102dba 371 specified by Guid does not exist, the results are\r
2ab6330e 372 unpredictable.\r
80408db0 373\r
2ab6330e 374 @param[in] Guid The token space for the token number.\r
d1102dba 375 @param[in] TokenNumber The PCD token number.\r
2ab6330e 376\r
377 @return The size Boolean value for the PCD token.\r
d1102dba 378\r
2ab6330e 379**/\r
80408db0 380BOOLEAN\r
381EFIAPI\r
382DxePcdGetBoolEx (\r
383 IN CONST EFI_GUID *Guid,\r
384 IN UINTN TokenNumber\r
ed66e1bc 385 );\r
80408db0 386\r
2ab6330e 387/**\r
388 Retrieves the size of the value for a given PCD token.\r
389\r
d1102dba 390 Retrieves the current size of a particular PCD token.\r
2ab6330e 391 If the TokenNumber is invalid, the results are unpredictable.\r
80408db0 392\r
2ab6330e 393 @param[in] Guid The token space for the token number.\r
d1102dba 394 @param[in] TokenNumber The PCD token number.\r
2ab6330e 395\r
396 @return The size of the value for the PCD token.\r
d1102dba 397\r
2ab6330e 398**/\r
80408db0 399UINTN\r
400EFIAPI\r
401DxePcdGetSizeEx (\r
402 IN CONST EFI_GUID *Guid,\r
403 IN UINTN TokenNumber\r
ed66e1bc 404 );\r
80408db0 405\r
2ab6330e 406/**\r
407 Sets an 8-bit value for a given PCD token.\r
80408db0 408\r
d1102dba
LG
409 When the PCD service sets a value, it will check to ensure that the\r
410 size of the value being set is compatible with the Token's existing definition.\r
2ab6330e 411 If it is not, an error will be returned.\r
412\r
d1102dba 413 @param[in] TokenNumber The PCD token number.\r
2ab6330e 414 @param[in] Value The value to set for the PCD token.\r
415\r
416 @retval EFI_SUCCESS Procedure returned successfully.\r
d1102dba
LG
417 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data\r
418 being set was incompatible with a call to this function.\r
2ab6330e 419 Use GetSize() to retrieve the size of the target data.\r
420 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
d1102dba 421\r
2ab6330e 422**/\r
80408db0 423EFI_STATUS\r
424EFIAPI\r
425DxePcdSet8 (\r
426 IN UINTN TokenNumber,\r
427 IN UINT8 Value\r
ed66e1bc 428 );\r
80408db0 429\r
2ab6330e 430/**\r
431 Sets an 16-bit value for a given PCD token.\r
432\r
d1102dba
LG
433 When the PCD service sets a value, it will check to ensure that the\r
434 size of the value being set is compatible with the Token's existing definition.\r
2ab6330e 435 If it is not, an error will be returned.\r
436\r
d1102dba 437 @param[in] TokenNumber The PCD token number.\r
2ab6330e 438 @param[in] Value The value to set for the PCD token.\r
80408db0 439\r
2ab6330e 440 @retval EFI_SUCCESS Procedure returned successfully.\r
d1102dba
LG
441 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data\r
442 being set was incompatible with a call to this function.\r
2ab6330e 443 Use GetSize() to retrieve the size of the target data.\r
444 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
d1102dba 445\r
2ab6330e 446**/\r
80408db0 447EFI_STATUS\r
448EFIAPI\r
449DxePcdSet16 (\r
450 IN UINTN TokenNumber,\r
451 IN UINT16 Value\r
ed66e1bc 452 );\r
80408db0 453\r
2ab6330e 454/**\r
455 Sets an 32-bit value for a given PCD token.\r
456\r
d1102dba
LG
457 When the PCD service sets a value, it will check to ensure that the\r
458 size of the value being set is compatible with the Token's existing definition.\r
2ab6330e 459 If it is not, an error will be returned.\r
460\r
d1102dba 461 @param[in] TokenNumber The PCD token number.\r
2ab6330e 462 @param[in] Value The value to set for the PCD token.\r
80408db0 463\r
2ab6330e 464 @retval EFI_SUCCESS Procedure returned successfully.\r
d1102dba
LG
465 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data\r
466 being set was incompatible with a call to this function.\r
2ab6330e 467 Use GetSize() to retrieve the size of the target data.\r
468 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
d1102dba 469\r
2ab6330e 470**/\r
80408db0 471EFI_STATUS\r
472EFIAPI\r
473DxePcdSet32 (\r
474 IN UINTN TokenNumber,\r
475 IN UINT32 Value\r
ed66e1bc 476 );\r
80408db0 477\r
2ab6330e 478/**\r
479 Sets an 64-bit value for a given PCD token.\r
480\r
d1102dba
LG
481 When the PCD service sets a value, it will check to ensure that the\r
482 size of the value being set is compatible with the Token's existing definition.\r
2ab6330e 483 If it is not, an error will be returned.\r
80408db0 484\r
d1102dba 485 @param[in] TokenNumber The PCD token number.\r
2ab6330e 486 @param[in] Value The value to set for the PCD token.\r
487\r
488 @retval EFI_SUCCESS Procedure returned successfully.\r
d1102dba
LG
489 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data\r
490 being set was incompatible with a call to this function.\r
2ab6330e 491 Use GetSize() to retrieve the size of the target data.\r
492 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
d1102dba 493\r
2ab6330e 494**/\r
80408db0 495EFI_STATUS\r
496EFIAPI\r
497DxePcdSet64 (\r
498 IN UINTN TokenNumber,\r
499 IN UINT64 Value\r
ed66e1bc 500 );\r
80408db0 501\r
502\r
2ab6330e 503/**\r
504 Sets a value of a specified size for a given PCD token.\r
505\r
d1102dba
LG
506 When the PCD service sets a value, it will check to ensure that the\r
507 size of the value being set is compatible with the Token's existing definition.\r
2ab6330e 508 If it is not, an error will be returned.\r
509\r
d1102dba
LG
510 @param[in] TokenNumber The PCD token number.\r
511 @param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token.\r
512 On input, if the SizeOfValue is greater than the maximum size supported\r
513 for this TokenNumber then the output value of SizeOfValue will reflect\r
2ab6330e 514 the maximum size supported for this TokenNumber.\r
515 @param[in] Buffer The buffer to set for the PCD token.\r
516\r
517 @retval EFI_SUCCESS Procedure returned successfully.\r
d1102dba
LG
518 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data\r
519 being set was incompatible with a call to this function.\r
2ab6330e 520 Use GetSize() to retrieve the size of the target data.\r
521 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
d1102dba 522\r
2ab6330e 523**/\r
80408db0 524EFI_STATUS\r
525EFIAPI\r
526DxePcdSetPtr (\r
527 IN UINTN TokenNumber,\r
2ab6330e 528 IN OUT UINTN *SizeOfBuffer,\r
80408db0 529 IN VOID *Buffer\r
ed66e1bc 530 );\r
80408db0 531\r
2ab6330e 532/**\r
533 Sets an Boolean value for a given PCD token.\r
534\r
d1102dba
LG
535 When the PCD service sets a value, it will check to ensure that the\r
536 size of the value being set is compatible with the Token's existing definition.\r
2ab6330e 537 If it is not, an error will be returned.\r
538\r
d1102dba 539 @param[in] TokenNumber The PCD token number.\r
2ab6330e 540 @param[in] Value The value to set for the PCD token.\r
80408db0 541\r
2ab6330e 542 @retval EFI_SUCCESS Procedure returned successfully.\r
d1102dba
LG
543 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data\r
544 being set was incompatible with a call to this function.\r
2ab6330e 545 Use GetSize() to retrieve the size of the target data.\r
546 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
d1102dba 547\r
2ab6330e 548**/\r
80408db0 549EFI_STATUS\r
550EFIAPI\r
551DxePcdSetBool (\r
552 IN UINTN TokenNumber,\r
553 IN BOOLEAN Value\r
ed66e1bc 554 );\r
80408db0 555\r
556\r
2ab6330e 557/**\r
558 Sets an 8-bit value for a given PCD token.\r
559\r
d1102dba
LG
560 When the PCD service sets a value, it will check to ensure that the\r
561 size of the value being set is compatible with the Token's existing definition.\r
2ab6330e 562 If it is not, an error will be returned.\r
563\r
564 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
d1102dba 565 @param[in] TokenNumber The PCD token number.\r
2ab6330e 566 @param[in] Value The value to set for the PCD token.\r
567\r
568 @retval EFI_SUCCESS Procedure returned successfully.\r
d1102dba
LG
569 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data\r
570 being set was incompatible with a call to this function.\r
2ab6330e 571 Use GetSize() to retrieve the size of the target data.\r
572 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
d1102dba 573\r
2ab6330e 574**/\r
80408db0 575EFI_STATUS\r
576EFIAPI\r
577DxePcdSet8Ex (\r
578 IN CONST EFI_GUID *Guid,\r
579 IN UINTN TokenNumber,\r
580 IN UINT8 Value\r
ed66e1bc 581 );\r
80408db0 582\r
2ab6330e 583/**\r
584 Sets an 16-bit value for a given PCD token.\r
585\r
d1102dba
LG
586 When the PCD service sets a value, it will check to ensure that the\r
587 size of the value being set is compatible with the Token's existing definition.\r
2ab6330e 588 If it is not, an error will be returned.\r
589\r
590 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
d1102dba 591 @param[in] TokenNumber The PCD token number.\r
2ab6330e 592 @param[in] Value The value to set for the PCD token.\r
80408db0 593\r
2ab6330e 594 @retval EFI_SUCCESS Procedure returned successfully.\r
d1102dba
LG
595 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data\r
596 being set was incompatible with a call to this function.\r
2ab6330e 597 Use GetSize() to retrieve the size of the target data.\r
598 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
d1102dba 599\r
2ab6330e 600**/\r
80408db0 601EFI_STATUS\r
602EFIAPI\r
603DxePcdSet16Ex (\r
604 IN CONST EFI_GUID *Guid,\r
605 IN UINTN TokenNumber,\r
606 IN UINT16 Value\r
ed66e1bc 607 );\r
80408db0 608\r
2ab6330e 609/**\r
610 Sets an 32-bit value for a given PCD token.\r
611\r
d1102dba
LG
612 When the PCD service sets a value, it will check to ensure that the\r
613 size of the value being set is compatible with the Token's existing definition.\r
2ab6330e 614 If it is not, an error will be returned.\r
80408db0 615\r
2ab6330e 616 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
d1102dba 617 @param[in] TokenNumber The PCD token number.\r
2ab6330e 618 @param[in] Value The value to set for the PCD token.\r
619\r
620 @retval EFI_SUCCESS Procedure returned successfully.\r
d1102dba
LG
621 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data\r
622 being set was incompatible with a call to this function.\r
2ab6330e 623 Use GetSize() to retrieve the size of the target data.\r
624 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
d1102dba 625\r
2ab6330e 626**/\r
80408db0 627EFI_STATUS\r
628EFIAPI\r
629DxePcdSet32Ex (\r
630 IN CONST EFI_GUID *Guid,\r
631 IN UINTN TokenNumber,\r
632 IN UINT32 Value\r
ed66e1bc 633 );\r
80408db0 634\r
2ab6330e 635/**\r
636 Sets an 64-bit value for a given PCD token.\r
637\r
d1102dba
LG
638 When the PCD service sets a value, it will check to ensure that the\r
639 size of the value being set is compatible with the Token's existing definition.\r
2ab6330e 640 If it is not, an error will be returned.\r
641\r
642 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
d1102dba 643 @param[in] TokenNumber The PCD token number.\r
2ab6330e 644 @param[in] Value The value to set for the PCD token.\r
80408db0 645\r
2ab6330e 646 @retval EFI_SUCCESS Procedure returned successfully.\r
d1102dba
LG
647 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data\r
648 being set was incompatible with a call to this function.\r
2ab6330e 649 Use GetSize() to retrieve the size of the target data.\r
650 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
d1102dba 651\r
2ab6330e 652**/\r
80408db0 653EFI_STATUS\r
654EFIAPI\r
655DxePcdSet64Ex (\r
656 IN CONST EFI_GUID *Guid,\r
657 IN UINTN TokenNumber,\r
658 IN UINT64 Value\r
ed66e1bc 659 );\r
80408db0 660\r
2ab6330e 661/**\r
662 Sets a value of a specified size for a given PCD token.\r
663\r
d1102dba
LG
664 When the PCD service sets a value, it will check to ensure that the\r
665 size of the value being set is compatible with the Token's existing definition.\r
2ab6330e 666 If it is not, an error will be returned.\r
667\r
668 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
d1102dba
LG
669 @param[in] TokenNumber The PCD token number.\r
670 @param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token.\r
671 On input, if the SizeOfValue is greater than the maximum size supported\r
672 for this TokenNumber then the output value of SizeOfValue will reflect\r
2ab6330e 673 the maximum size supported for this TokenNumber.\r
674 @param[in] Buffer The buffer to set for the PCD token.\r
675\r
676 @retval EFI_SUCCESS Procedure returned successfully.\r
d1102dba
LG
677 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data\r
678 being set was incompatible with a call to this function.\r
2ab6330e 679 Use GetSize() to retrieve the size of the target data.\r
680 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
d1102dba 681\r
2ab6330e 682**/\r
80408db0 683EFI_STATUS\r
684EFIAPI\r
685DxePcdSetPtrEx (\r
686 IN CONST EFI_GUID *Guid,\r
687 IN UINTN TokenNumber,\r
688 IN OUT UINTN *SizeOfBuffer,\r
689 IN VOID *Buffer\r
ed66e1bc 690 );\r
80408db0 691\r
2ab6330e 692/**\r
693 Sets an Boolean value for a given PCD token.\r
694\r
d1102dba
LG
695 When the PCD service sets a value, it will check to ensure that the\r
696 size of the value being set is compatible with the Token's existing definition.\r
2ab6330e 697 If it is not, an error will be returned.\r
698\r
699 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
d1102dba 700 @param[in] TokenNumber The PCD token number.\r
2ab6330e 701 @param[in] Value The value to set for the PCD token.\r
80408db0 702\r
2ab6330e 703 @retval EFI_SUCCESS Procedure returned successfully.\r
d1102dba
LG
704 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data\r
705 being set was incompatible with a call to this function.\r
2ab6330e 706 Use GetSize() to retrieve the size of the target data.\r
707 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
d1102dba 708\r
2ab6330e 709**/\r
80408db0 710EFI_STATUS\r
711EFIAPI\r
712DxePcdSetBoolEx (\r
713 IN CONST EFI_GUID *Guid,\r
714 IN UINTN TokenNumber,\r
715 IN BOOLEAN Value\r
ed66e1bc 716 );\r
80408db0 717\r
2ab6330e 718/**\r
719 Specifies a function to be called anytime the value of a designated token is changed.\r
720\r
721 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
d1102dba
LG
722 @param[in] TokenNumber The PCD token number.\r
723 @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.\r
80408db0 724\r
d1102dba 725 @retval EFI_SUCCESS The PCD service has successfully established a call event\r
2ab6330e 726 for the CallBackToken requested.\r
727 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.\r
80408db0 728\r
2ab6330e 729**/\r
80408db0 730EFI_STATUS\r
731EFIAPI\r
732DxeRegisterCallBackOnSet (\r
733 IN CONST EFI_GUID *Guid, OPTIONAL\r
734 IN UINTN TokenNumber,\r
735 IN PCD_PROTOCOL_CALLBACK CallBackFunction\r
ed66e1bc 736 );\r
80408db0 737\r
2ab6330e 738/**\r
739 Cancels a previously set callback function for a particular PCD token number.\r
740\r
741 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
d1102dba
LG
742 @param[in] TokenNumber The PCD token number.\r
743 @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.\r
2ab6330e 744\r
d1102dba 745 @retval EFI_SUCCESS The PCD service has successfully established a call event\r
2ab6330e 746 for the CallBackToken requested.\r
747 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.\r
80408db0 748\r
2ab6330e 749**/\r
80408db0 750EFI_STATUS\r
751EFIAPI\r
752DxeUnRegisterCallBackOnSet (\r
753 IN CONST EFI_GUID *Guid, OPTIONAL\r
754 IN UINTN TokenNumber,\r
755 IN PCD_PROTOCOL_CALLBACK CallBackFunction\r
ed66e1bc 756 );\r
80408db0 757\r
2ab6330e 758/**\r
d1102dba
LG
759 Retrieves the next valid token number in a given namespace.\r
760\r
761 This is useful since the PCD infrastructure contains a sparse list of token numbers,\r
762 and one cannot a priori know what token numbers are valid in the database.\r
763\r
764 If TokenNumber is 0 and Guid is not NULL, then the first token from the token space specified by Guid is returned.\r
765 If TokenNumber is not 0 and Guid is not NULL, then the next token in the token space specified by Guid is returned.\r
766 If TokenNumber is 0 and Guid is NULL, then the first token in the default token space is returned.\r
767 If TokenNumber is not 0 and Guid is NULL, then the next token in the default token space is returned.\r
768 The token numbers in the default token space may not be related to token numbers in token spaces that are named by Guid.\r
769 If the next token number can be retrieved, then it is returned in TokenNumber, and EFI_SUCCESS is returned.\r
770 If TokenNumber represents the last token number in the token space specified by Guid, then EFI_NOT_FOUND is returned.\r
90e06556 771 If TokenNumber is not present in the token space specified by Guid, then EFI_NOT_FOUND is returned.\r
772\r
773\r
d1102dba
LG
774 @param[in] Guid The 128-bit unique value that designates the namespace from which to retrieve the next token.\r
775 This is an optional parameter that may be NULL. If this parameter is NULL, then a request is\r
90e06556 776 being made to retrieve tokens from the default token space.\r
d1102dba
LG
777 @param[in, out] TokenNumber\r
778 A pointer to the PCD token number to use to find the subsequent token number.\r
90e06556 779\r
d1102dba
LG
780 @retval EFI_SUCCESS The PCD service retrieved the next valid token number. Or the input token number\r
781 is already the last valid token number in the PCD database.\r
2ab6330e 782 In the later case, *TokenNumber is updated with the value of 0.\r
783 @retval EFI_NOT_FOUND If this input token number and token namespace does not exist on the platform.\r
80408db0 784\r
2ab6330e 785**/\r
80408db0 786EFI_STATUS\r
787EFIAPI\r
788DxePcdGetNextToken (\r
789 IN CONST EFI_GUID *Guid, OPTIONAL\r
790 IN OUT UINTN *TokenNumber\r
ed66e1bc 791 );\r
80408db0 792\r
2ab6330e 793/**\r
794 Get next token space in PCD database according to given token space guid.\r
d1102dba
LG
795\r
796 @param Guid Given token space guid. If NULL, then Guid will be set to\r
2ab6330e 797 the first PCD token space in PCD database, If not NULL, then\r
798 Guid will be set to next PCD token space.\r
799\r
2ab6330e 800 @retval EFI_NOT_FOUND If PCD database has no token space table or can not find given\r
801 token space in PCD database.\r
802 @retval EFI_SUCCESS Success to get next token space guid.\r
803**/\r
80408db0 804EFI_STATUS\r
805EFIAPI\r
806DxePcdGetNextTokenSpace (\r
807 IN OUT CONST EFI_GUID **Guid\r
ed66e1bc 808 );\r
80408db0 809\r
80408db0 810typedef struct {\r
811 LIST_ENTRY Node;\r
812 PCD_PROTOCOL_CALLBACK CallbackFn;\r
813} CALLBACK_FN_ENTRY;\r
814\r
50d7ebad 815#define CR_FNENTRY_FROM_LISTNODE(Record, Type, Field) BASE_CR(Record, Type, Field)\r
80408db0 816\r
817//\r
818// Internal Functions\r
819//\r
820\r
96d6d004
SZ
821/**\r
822 Retrieve additional information associated with a PCD token.\r
823\r
824 This includes information such as the type of value the TokenNumber is associated with as well as possible\r
825 human readable name that is associated with the token.\r
826\r
827 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
828 @param[in] TokenNumber The PCD token number.\r
829 @param[out] PcdInfo The returned information associated with the requested TokenNumber.\r
d1102dba 830 The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.\r
96d6d004
SZ
831\r
832 @retval EFI_SUCCESS The PCD information was returned successfully\r
833 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
834**/\r
835EFI_STATUS\r
836DxeGetPcdInfo (\r
837 IN CONST EFI_GUID *Guid,\r
838 IN UINTN TokenNumber,\r
839 OUT EFI_PCD_INFO *PcdInfo\r
840 );\r
841\r
2ab6330e 842/**\r
843 Wrapper function for setting non-pointer type value for a PCD entry.\r
844\r
845 @param TokenNumber Pcd token number autogenerated by build tools.\r
846 @param Data Value want to be set for PCD entry\r
847 @param Size Size of value.\r
848\r
849 @return status of SetWorker.\r
850\r
851**/\r
80408db0 852EFI_STATUS\r
853SetValueWorker (\r
854 IN UINTN TokenNumber,\r
855 IN VOID *Data,\r
856 IN UINTN Size\r
ed66e1bc 857 );\r
80408db0 858\r
2ab6330e 859/**\r
860 Set value for an PCD entry\r
861\r
862 @param TokenNumber Pcd token number autogenerated by build tools.\r
863 @param Data Value want to be set for PCD entry\r
864 @param Size Size of value.\r
865 @param PtrType If TRUE, the type of PCD entry's value is Pointer.\r
866 If False, the type of PCD entry's value is not Pointer.\r
867\r
868 @retval EFI_INVALID_PARAMETER If this PCD type is VPD, VPD PCD can not be set.\r
869 @retval EFI_INVALID_PARAMETER If Size can not be set to size table.\r
d1102dba 870 @retval EFI_INVALID_PARAMETER If Size of non-Ptr type PCD does not match the size information in PCD database.\r
2ab6330e 871 @retval EFI_NOT_FOUND If value type of PCD entry is intergrate, but not in\r
872 range of UINT8, UINT16, UINT32, UINT64\r
d1102dba 873 @retval EFI_NOT_FOUND Can not find the PCD type according to token number.\r
2ab6330e 874**/\r
80408db0 875EFI_STATUS\r
876SetWorker (\r
877 IN UINTN TokenNumber,\r
878 IN VOID *Data,\r
879 IN OUT UINTN *Size,\r
880 IN BOOLEAN PtrType\r
ed66e1bc 881 );\r
80408db0 882\r
2ab6330e 883/**\r
884 Wrapper function for set PCD value for non-Pointer type dynamic-ex PCD.\r
885\r
886 @param ExTokenNumber Token number for dynamic-ex PCD.\r
887 @param Guid Token space guid for dynamic-ex PCD.\r
888 @param Data Value want to be set.\r
889 @param SetSize The size of value.\r
80408db0 890\r
2ab6330e 891 @return status of ExSetWorker().\r
892\r
893**/\r
80408db0 894EFI_STATUS\r
895ExSetValueWorker (\r
896 IN UINTN ExTokenNumber,\r
897 IN CONST EFI_GUID *Guid,\r
898 IN VOID *Data,\r
899 IN UINTN SetSize\r
ed66e1bc 900 );\r
80408db0 901\r
2ab6330e 902/**\r
903 Set value for a dynamic PCD entry.\r
d1102dba
LG
904\r
905 This routine find the local token number according to dynamic-ex PCD's token\r
2ab6330e 906 space guid and token number firstly, and invoke callback function if this PCD\r
907 entry registered callback function. Finally, invoken general SetWorker to set\r
908 PCD value.\r
d1102dba 909\r
2ab6330e 910 @param ExTokenNumber Dynamic-ex PCD token number.\r
911 @param Guid Token space guid for dynamic-ex PCD.\r
912 @param Data PCD value want to be set\r
913 @param SetSize Size of value.\r
914 @param PtrType If TRUE, this PCD entry is pointer type.\r
915 If FALSE, this PCD entry is not pointer type.\r
916\r
917 @return status of SetWorker().\r
80408db0 918\r
2ab6330e 919**/\r
80408db0 920EFI_STATUS\r
921ExSetWorker (\r
922 IN UINTN ExTokenNumber,\r
923 IN CONST EFI_GUID *Guid,\r
924 IN VOID *Data,\r
925 IN OUT UINTN *Size,\r
926 IN BOOLEAN PtrType\r
ed66e1bc 927 );\r
80408db0 928\r
2ab6330e 929/**\r
930 Get the PCD entry pointer in PCD database.\r
d1102dba 931\r
2ab6330e 932 This routine will visit PCD database to find the PCD entry according to given\r
d1102dba
LG
933 token number. The given token number is autogened by build tools and it will be\r
934 translated to local token number. Local token number contains PCD's type and\r
2ab6330e 935 offset of PCD entry in PCD database.\r
936\r
937 @param TokenNumber Token's number, it is autogened by build tools\r
938 @param GetSize The size of token's value\r
80408db0 939\r
2ab6330e 940 @return PCD entry pointer in PCD database\r
941\r
942**/\r
80408db0 943VOID *\r
944GetWorker (\r
945 IN UINTN TokenNumber,\r
946 IN UINTN GetSize\r
ed66e1bc 947 );\r
80408db0 948\r
2ab6330e 949/**\r
950 Wrapper function for get PCD value for dynamic-ex PCD.\r
951\r
952 @param Guid Token space guid for dynamic-ex PCD.\r
3fd8027e 953 @param ExTokenNumber Token number for dynamic-ex PCD.\r
2ab6330e 954 @param GetSize The size of dynamic-ex PCD value.\r
955\r
956 @return PCD entry in PCD database.\r
957\r
958**/\r
80408db0 959VOID *\r
960ExGetWorker (\r
961 IN CONST EFI_GUID *Guid,\r
962 IN UINTN ExTokenNumber,\r
963 IN UINTN GetSize\r
ed66e1bc 964 );\r
80408db0 965\r
2ab6330e 966/**\r
967 Get Variable which contains HII type PCD entry.\r
968\r
969 @param VariableGuid Variable's guid\r
970 @param VariableName Variable's unicode name string\r
d1102dba 971 @param VariableData Variable's data pointer,\r
2ab6330e 972 @param VariableSize Variable's size.\r
973\r
974 @return the status of gRT->GetVariable\r
975**/\r
80408db0 976EFI_STATUS\r
977GetHiiVariable (\r
978 IN EFI_GUID *VariableGuid,\r
979 IN UINT16 *VariableName,\r
980 OUT UINT8 **VariableData,\r
981 OUT UINTN *VariableSize\r
ed66e1bc 982 );\r
80408db0 983\r
2ab6330e 984/**\r
985 Set value for HII-type PCD.\r
986\r
d1102dba 987 A HII-type PCD's value is stored in a variable. Setting/Getting the value of\r
2ab6330e 988 HII-type PCD is to visit this variable.\r
d1102dba 989\r
2ab6330e 990 @param VariableGuid Guid of variable which stored value of a HII-type PCD.\r
991 @param VariableName Unicode name of variable which stored value of a HII-type PCD.\r
23f3e119 992 @param SetAttributes Attributes bitmask to set for the variable.\r
2ab6330e 993 @param Data Value want to be set.\r
994 @param DataSize Size of value\r
995 @param Offset Value offset of HII-type PCD in variable.\r
996\r
997 @return status of GetVariable()/SetVariable().\r
998\r
999**/\r
80408db0 1000EFI_STATUS\r
1001SetHiiVariable (\r
1002 IN EFI_GUID *VariableGuid,\r
1003 IN UINT16 *VariableName,\r
23f3e119 1004 IN UINT32 SetAttributes,\r
80408db0 1005 IN CONST VOID *Data,\r
1006 IN UINTN DataSize,\r
1007 IN UINTN Offset\r
ed66e1bc 1008 );\r
80408db0 1009\r
2ab6330e 1010/**\r
1011 Register the callback function for a PCD entry.\r
1012\r
1013 This routine will register a callback function to a PCD entry by given token number\r
1014 and token space guid.\r
d1102dba 1015\r
2ab6330e 1016 @param TokenNumber PCD token's number, it is autogened by build tools.\r
d1102dba 1017 @param Guid PCD token space's guid,\r
2ab6330e 1018 if not NULL, this PCD is dynamicEx type PCD.\r
1019 @param CallBackFunction Callback function pointer\r
1020\r
1021 @return EFI_SUCCESS Always success for registering callback function.\r
1022\r
1023**/\r
80408db0 1024EFI_STATUS\r
1025DxeRegisterCallBackWorker (\r
1026 IN UINTN TokenNumber,\r
1027 IN CONST EFI_GUID *Guid, OPTIONAL\r
1028 IN PCD_PROTOCOL_CALLBACK CallBackFunction\r
ed66e1bc 1029 );\r
2ab6330e 1030\r
1031/**\r
1032 UnRegister the callback function for a PCD entry.\r
80408db0 1033\r
2ab6330e 1034 This routine will unregister a callback function to a PCD entry by given token number\r
1035 and token space guid.\r
1036\r
1037 @param TokenNumber PCD token's number, it is autogened by build tools.\r
1038 @param Guid PCD token space's guid.\r
1039 if not NULL, this PCD is dynamicEx type PCD.\r
1040 @param CallBackFunction Callback function pointer\r
1041\r
1042 @retval EFI_SUCCESS Callback function is success to be unregister.\r
1043 @retval EFI_INVALID_PARAMETER Can not find the PCD entry by given token number.\r
1044**/\r
80408db0 1045EFI_STATUS\r
1046DxeUnRegisterCallBackWorker (\r
1047 IN UINTN TokenNumber,\r
1048 IN CONST EFI_GUID *Guid, OPTIONAL\r
1049 IN PCD_PROTOCOL_CALLBACK CallBackFunction\r
ed66e1bc 1050 );\r
80408db0 1051\r
2ab6330e 1052/**\r
1053 Initialize the PCD database in DXE phase.\r
d1102dba 1054\r
2ab6330e 1055 PCD database in DXE phase also contains PCD database in PEI phase which is copied\r
1056 from GUID Hob.\r
1057\r
1058**/\r
80408db0 1059VOID\r
1060BuildPcdDxeDataBase (\r
1061 VOID\r
ed66e1bc 1062 );\r
80408db0 1063\r
2ab6330e 1064/**\r
419db80b 1065 Get Token Number according to dynamic-ex PCD's {token space guid:token number}\r
80408db0 1066\r
2ab6330e 1067 A dynamic-ex type PCD, developer must provide pair of token space guid: token number\r
1068 in DEC file. PCD database maintain a mapping table that translate pair of {token\r
419db80b 1069 space guid: token number} to Token Number.\r
d1102dba 1070\r
2ab6330e 1071 @param Guid Token space guid for dynamic-ex PCD entry.\r
b9982883 1072 @param ExTokenNumber Dynamic-ex PCD token number.\r
2ab6330e 1073\r
419db80b 1074 @return Token Number for dynamic-ex PCD.\r
2ab6330e 1075\r
1076**/\r
c52fa98c 1077UINTN\r
80408db0 1078GetExPcdTokenNumber (\r
1079 IN CONST EFI_GUID *Guid,\r
1080 IN UINT32 ExTokenNumber\r
ed66e1bc 1081 );\r
80408db0 1082\r
2ab6330e 1083/**\r
1084 Get next token number in given token space.\r
d1102dba 1085\r
2ab6330e 1086 This routine is used for dynamicEx type PCD. It will firstly scan token space\r
d1102dba
LG
1087 table to get token space according to given token space guid. Then scan given\r
1088 token number in found token space, if found, then return next token number in\r
2ab6330e 1089 this token space.\r
1090\r
d1102dba 1091 @param Guid Token space guid. Next token number will be scaned in\r
2ab6330e 1092 this token space.\r
d1102dba
LG
1093 @param TokenNumber Token number.\r
1094 If PCD_INVALID_TOKEN_NUMBER, return first token number in\r
2ab6330e 1095 token space table.\r
1096 If not PCD_INVALID_TOKEN_NUMBER, return next token number\r
1097 in token space table.\r
1098 @param GuidTable Token space guid table. It will be used for scan token space\r
1099 by given token space guid.\r
1100 @param SizeOfGuidTable The size of guid table.\r
1101 @param ExMapTable DynamicEx token number mapping table.\r
1102 @param SizeOfExMapTable The size of dynamicEx token number mapping table.\r
1103\r
1104 @retval EFI_NOT_FOUND Can not given token space or token number.\r
1105 @retval EFI_SUCCESS Success to get next token number.\r
80408db0 1106\r
2ab6330e 1107**/\r
c52fa98c 1108EFI_STATUS\r
80408db0 1109ExGetNextTokeNumber (\r
1110 IN CONST EFI_GUID *Guid,\r
1111 IN OUT UINTN *TokenNumber,\r
1112 IN EFI_GUID *GuidTable,\r
1113 IN UINTN SizeOfGuidTable,\r
1114 IN DYNAMICEX_MAPPING *ExMapTable,\r
1115 IN UINTN SizeOfExMapTable\r
ed66e1bc 1116 );\r
80408db0 1117\r
2ab6330e 1118/**\r
1119 Get size of POINTER type PCD value.\r
80408db0 1120\r
2ab6330e 1121 @param LocalTokenNumberTableIdx Index of local token number in local token number table.\r
3fd8027e 1122 @param MaxSize Maximum size of POINTER type PCD value.\r
2ab6330e 1123\r
1124 @return size of POINTER type PCD value.\r
1125\r
1126**/\r
80408db0 1127UINTN\r
1128GetPtrTypeSize (\r
1129 IN UINTN LocalTokenNumberTableIdx,\r
1130 OUT UINTN *MaxSize\r
ed66e1bc 1131 );\r
80408db0 1132\r
2ab6330e 1133/**\r
3fd8027e 1134 Set size of POINTER type PCD value. The size should not exceed the maximum size\r
2ab6330e 1135 of this PCD value.\r
80408db0 1136\r
2ab6330e 1137 @param LocalTokenNumberTableIdx Index of local token number in local token number table.\r
1138 @param CurrentSize Size of POINTER type PCD value.\r
80408db0 1139\r
2ab6330e 1140 @retval TRUE Success to set size of PCD value.\r
1141 @retval FALSE Fail to set size of PCD value.\r
1142**/\r
80408db0 1143BOOLEAN\r
1144SetPtrTypeSize (\r
1145 IN UINTN LocalTokenNumberTableIdx,\r
1146 IN OUT UINTN *CurrentSize\r
ed66e1bc 1147 );\r
80408db0 1148\r
23f3e119
SZ
1149/**\r
1150 VariableLockProtocol callback\r
1151 to lock the variables referenced by DynamicHii PCDs with RO property set in *.dsc.\r
1152\r
1153 @param[in] Event Event whose notification function is being invoked.\r
1154 @param[in] Context Pointer to the notification function's context.\r
1155\r
1156**/\r
1157VOID\r
1158EFIAPI\r
1159VariableLockCallBack (\r
1160 IN EFI_EVENT Event,\r
1161 IN VOID *Context\r
1162 );\r
1163\r
7c736265
LG
1164/**\r
1165 Update PCD database base on current SkuId\r
1166\r
1167 @param SkuId Current SkuId\r
1168 @param IsPeiDb Whether to update PEI PCD database.\r
1169\r
1170 @retval EFI_SUCCESS Update PCD database successfully.\r
1171 @retval EFI_NOT_FOUND Not found PCD database for current SkuId.\r
1172**/\r
1173EFI_STATUS\r
1174UpdatePcdDatabase (\r
1175 IN SKU_ID SkuId,\r
1176 IN BOOLEAN IsPeiDb\r
1177 );\r
1178\r
419db80b 1179extern PCD_DATABASE mPcdDatabase;\r
80408db0 1180\r
d1102dba
LG
1181extern UINT32 mPcdTotalTokenCount;\r
1182extern UINT32 mPeiLocalTokenCount;\r
1183extern UINT32 mDxeLocalTokenCount;\r
1184extern UINT32 mPeiNexTokenCount;\r
1185extern UINT32 mDxeNexTokenCount;\r
419db80b
BF
1186extern UINT32 mPeiExMapppingTableSize;\r
1187extern UINT32 mDxeExMapppingTableSize;\r
1188extern UINT32 mPeiGuidTableSize;\r
1189extern UINT32 mDxeGuidTableSize;\r
1190\r
d1102dba
LG
1191extern BOOLEAN mPeiExMapTableEmpty;\r
1192extern BOOLEAN mDxeExMapTableEmpty;\r
419db80b
BF
1193extern BOOLEAN mPeiDatabaseEmpty;\r
1194\r
1195extern EFI_GUID **TmpTokenSpaceBuffer;\r
1196extern UINTN TmpTokenSpaceBufferCount;\r
80408db0 1197\r
1198extern EFI_LOCK mPcdDatabaseLock;\r
1199\r
1200#endif\r
599a55a5 1201\r