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