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