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