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