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