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