]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/PCD/Pei/Service.h
Update the copyright notice format
[mirror_edk2.git] / MdeModulePkg / Universal / PCD / Pei / Service.h
1 /** @file
2 The internal header file declares the private functions used by PeiPcd driver.
3
4 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
5 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 _PEI_PCD_SERVICE_H_
16 #define _PEI_PCD_SERVICE_H_
17
18 #include <PiPei.h>
19 #include <Ppi/ReadOnlyVariable2.h>
20 #include <Ppi/Pcd.h>
21 #include <Ppi/PiPcd.h>
22 #include <Guid/PcdDataBaseHobGuid.h>
23 #include <Library/DebugLib.h>
24 #include <Library/PeimEntryPoint.h>
25 #include <Library/BaseLib.h>
26 #include <Library/HobLib.h>
27 #include <Library/PeiServicesLib.h>
28 #include <Library/PcdLib.h>
29 #include <Library/BaseMemoryLib.h>
30
31
32 //
33 // Please make sure the PCD Serivce PEIM Version is consistent with
34 // the version of PCD Database generation tool
35 //
36 #define PCD_SERVICE_PEIM_VERSION 2
37
38 //
39 // PCD_PEI_DATABASE_GENTOOL_VERSION is defined in Autogen.h
40 // and generated by PCD Database generation tool.
41 //
42 //#if (PCD_SERVICE_PEIM_VERSION != PCD_PEI_SERVICE_DRIVER_AUTOGEN_VERSION )
43 // #error "Please make sure the version of PCD Service PEIM and PCD PEI Database Generation Tool matches"
44 //#endif
45
46 //
47 // PPI Interface Implementation Declaration.
48 //
49
50 /**
51 Sets the SKU value for subsequent calls to set or get PCD token values.
52
53 SetSku() sets the SKU Id to be used for subsequent calls to set or get PCD values.
54 SetSku() is normally called only once by the system.
55
56 For each item (token), the database can hold a single value that applies to all SKUs,
57 or multiple values, where each value is associated with a specific SKU Id. Items with multiple,
58 SKU-specific values are called SKU enabled.
59
60 The SKU Id of zero is reserved as a default. The valid SkuId range is 1 to 255.
61 For tokens that are not SKU enabled, the system ignores any set SKU Id and works with the
62 single value for that token. For SKU-enabled tokens, the system will use the SKU Id set by the
63 last call to SetSku(). If no SKU Id is set or the currently set SKU Id isn't valid for the specified token,
64 the system uses the default SKU Id. If the system attempts to use the default SKU Id and no value has been
65 set for that Id, the results are unpredictable.
66
67 @param[in] SkuId The SKU value that will be used when the PCD service will retrieve and
68 set values associated with a PCD token.
69
70 **/
71 VOID
72 EFIAPI
73 PeiPcdSetSku (
74 IN UINTN SkuId
75 );
76
77 /**
78 Retrieves an 8-bit value for a given PCD token.
79
80 Retrieves the current byte-sized value for a PCD token number.
81 If the TokenNumber is invalid, the results are unpredictable.
82
83 @param[in] TokenNumber The PCD token number.
84
85 @return The UINT8 value.
86
87 **/
88 UINT8
89 EFIAPI
90 PeiPcdGet8 (
91 IN UINTN TokenNumber
92 );
93
94 /**
95 Retrieves an 16-bit value for a given PCD token.
96
97 Retrieves the current 16-bits value for a PCD token number.
98 If the TokenNumber is invalid, the results are unpredictable.
99
100 @param[in] TokenNumber The PCD token number.
101
102 @return The UINT16 value.
103
104 **/
105 UINT16
106 EFIAPI
107 PeiPcdGet16 (
108 IN UINTN TokenNumber
109 );
110
111 /**
112 Retrieves an 32-bit value for a given PCD token.
113
114 Retrieves the current 32-bits value for a PCD token number.
115 If the TokenNumber is invalid, the results are unpredictable.
116
117 @param[in] TokenNumber The PCD token number.
118
119 @return The UINT32 value.
120
121 **/
122 UINT32
123 EFIAPI
124 PeiPcdGet32 (
125 IN UINTN TokenNumber
126 );
127
128 /**
129 Retrieves an 64-bit value for a given PCD token.
130
131 Retrieves the current 64-bits value for a PCD token number.
132 If the TokenNumber is invalid, the results are unpredictable.
133
134 @param[in] TokenNumber The PCD token number.
135
136 @return The UINT64 value.
137
138 **/
139 UINT64
140 EFIAPI
141 PeiPcdGet64 (
142 IN UINTN TokenNumber
143 );
144
145 /**
146 Retrieves a pointer to a value for a given PCD token.
147
148 Retrieves the current pointer to the buffer for a PCD token number.
149 Do not make any assumptions about the alignment of the pointer that
150 is returned by this function call. If the TokenNumber is invalid,
151 the results are unpredictable.
152
153 @param[in] TokenNumber The PCD token number.
154
155 @return The pointer to the buffer to be retrived.
156
157 **/
158 VOID *
159 EFIAPI
160 PeiPcdGetPtr (
161 IN UINTN TokenNumber
162 );
163
164 /**
165 Retrieves a Boolean value for a given PCD token.
166
167 Retrieves the current boolean value for a PCD token number.
168 Do not make any assumptions about the alignment of the pointer that
169 is returned by this function call. If the TokenNumber is invalid,
170 the results are unpredictable.
171
172 @param[in] TokenNumber The PCD token number.
173
174 @return The Boolean value.
175
176 **/
177 BOOLEAN
178 EFIAPI
179 PeiPcdGetBool (
180 IN UINTN TokenNumber
181 );
182
183 /**
184 Retrieves the size of the value for a given PCD token.
185
186 Retrieves the current size of a particular PCD token.
187 If the TokenNumber is invalid, the results are unpredictable.
188
189 @param[in] TokenNumber The PCD token number.
190
191 @return The size of the value for the PCD token.
192
193 **/
194 UINTN
195 EFIAPI
196 PeiPcdGetSize (
197 IN UINTN TokenNumber
198 );
199
200 /**
201 Retrieves an 8-bit value for a given PCD token.
202
203 Retrieves the 8-bit value of a particular PCD token.
204 If the TokenNumber is invalid or the token space
205 specified by Guid does not exist, the results are
206 unpredictable.
207
208 @param[in] Guid The token space for the token number.
209 @param[in] TokenNumber The PCD token number.
210
211 @return The size 8-bit value for the PCD token.
212
213 **/
214 UINT8
215 EFIAPI
216 PeiPcdGet8Ex (
217 IN CONST EFI_GUID *Guid,
218 IN UINTN TokenNumber
219 );
220
221 /**
222 Retrieves an 16-bit value for a given PCD token.
223
224 Retrieves the 16-bit value of a particular PCD token.
225 If the TokenNumber is invalid or the token space
226 specified by Guid does not exist, the results are
227 unpredictable.
228
229 @param[in] Guid The token space for the token number.
230 @param[in] TokenNumber The PCD token number.
231
232 @return The size 16-bit value for the PCD token.
233
234 **/
235 UINT16
236 EFIAPI
237 PeiPcdGet16Ex (
238 IN CONST EFI_GUID *Guid,
239 IN UINTN TokenNumber
240 );
241
242 /**
243 Retrieves an 32-bit value for a given PCD token.
244
245 Retrieves the 32-bit value of a particular PCD token.
246 If the TokenNumber is invalid or the token space
247 specified by Guid does not exist, the results are
248 unpredictable.
249
250 @param[in] Guid The token space for the token number.
251 @param[in] TokenNumber The PCD token number.
252
253 @return The size 32-bit value for the PCD token.
254
255 **/
256 UINT32
257 EFIAPI
258 PeiPcdGet32Ex (
259 IN CONST EFI_GUID *Guid,
260 IN UINTN TokenNumber
261 );
262
263 /**
264 Retrieves an 64-bit value for a given PCD token.
265
266 Retrieves the 64-bit value of a particular PCD token.
267 If the TokenNumber is invalid or the token space
268 specified by Guid does not exist, the results are
269 unpredictable.
270
271 @param[in] Guid The token space for the token number.
272 @param[in] TokenNumber The PCD token number.
273
274 @return The size 64-bit value for the PCD token.
275
276 **/
277 UINT64
278 EFIAPI
279 PeiPcdGet64Ex (
280 IN CONST EFI_GUID *Guid,
281 IN UINTN TokenNumber
282 );
283
284 /**
285 Retrieves a pointer to a value for a given PCD token.
286
287 Retrieves the current pointer to the buffer for a PCD token number.
288 Do not make any assumptions about the alignment of the pointer that
289 is returned by this function call. If the TokenNumber is invalid,
290 the results are unpredictable.
291
292 @param[in] Guid The token space for the token number.
293 @param[in] TokenNumber The PCD token number.
294
295 @return The pointer to the buffer to be retrived.
296
297 **/
298 VOID *
299 EFIAPI
300 PeiPcdGetPtrEx (
301 IN CONST EFI_GUID *Guid,
302 IN UINTN TokenNumber
303 );
304
305 /**
306 Retrieves an Boolean value for a given PCD token.
307
308 Retrieves the Boolean value of a particular PCD token.
309 If the TokenNumber is invalid or the token space
310 specified by Guid does not exist, the results are
311 unpredictable.
312
313 @param[in] Guid The token space for the token number.
314 @param[in] TokenNumber The PCD token number.
315
316 @return The size Boolean value for the PCD token.
317
318 **/
319 BOOLEAN
320 EFIAPI
321 PeiPcdGetBoolEx (
322 IN CONST EFI_GUID *Guid,
323 IN UINTN TokenNumber
324 );
325
326 /**
327 Retrieves the size of the value for a given PCD token.
328
329 Retrieves the current size of a particular PCD token.
330 If the TokenNumber is invalid, the results are unpredictable.
331
332 @param[in] Guid The token space for the token number.
333 @param[in] TokenNumber The PCD token number.
334
335 @return The size of the value for the PCD token.
336
337 **/
338 UINTN
339 EFIAPI
340 PeiPcdGetSizeEx (
341 IN CONST EFI_GUID *Guid,
342 IN UINTN TokenNumber
343 );
344
345 /**
346 Sets an 8-bit value for a given PCD token.
347
348 When the PCD service sets a value, it will check to ensure that the
349 size of the value being set is compatible with the Token's existing definition.
350 If it is not, an error will be returned.
351
352 @param[in] TokenNumber The PCD token number.
353 @param[in] Value The value to set for the PCD token.
354
355 @retval EFI_SUCCESS Procedure returned successfully.
356 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
357 being set was incompatible with a call to this function.
358 Use GetSize() to retrieve the size of the target data.
359 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
360
361 **/
362 EFI_STATUS
363 EFIAPI
364 PeiPcdSet8 (
365 IN UINTN TokenNumber,
366 IN UINT8 Value
367 );
368
369 /**
370 Sets an 16-bit value for a given PCD token.
371
372 When the PCD service sets a value, it will check to ensure that the
373 size of the value being set is compatible with the Token's existing definition.
374 If it is not, an error will be returned.
375
376 @param[in] TokenNumber The PCD token number.
377 @param[in] Value The value to set for the PCD token.
378
379 @retval EFI_SUCCESS Procedure returned successfully.
380 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
381 being set was incompatible with a call to this function.
382 Use GetSize() to retrieve the size of the target data.
383 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
384
385 **/
386 EFI_STATUS
387 EFIAPI
388 PeiPcdSet16 (
389 IN UINTN TokenNumber,
390 IN UINT16 Value
391 );
392
393 /**
394 Sets an 32-bit value for a given PCD token.
395
396 When the PCD service sets a value, it will check to ensure that the
397 size of the value being set is compatible with the Token's existing definition.
398 If it is not, an error will be returned.
399
400 @param[in] TokenNumber The PCD token number.
401 @param[in] Value The value to set for the PCD token.
402
403 @retval EFI_SUCCESS Procedure returned successfully.
404 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
405 being set was incompatible with a call to this function.
406 Use GetSize() to retrieve the size of the target data.
407 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
408
409 **/
410 EFI_STATUS
411 EFIAPI
412 PeiPcdSet32 (
413 IN UINTN TokenNumber,
414 IN UINT32 Value
415 );
416
417 /**
418 Sets an 64-bit value for a given PCD token.
419
420 When the PCD service sets a value, it will check to ensure that the
421 size of the value being set is compatible with the Token's existing definition.
422 If it is not, an error will be returned.
423
424 @param[in] TokenNumber The PCD token number.
425 @param[in] Value The value to set for the PCD token.
426
427 @retval EFI_SUCCESS Procedure returned successfully.
428 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
429 being set was incompatible with a call to this function.
430 Use GetSize() to retrieve the size of the target data.
431 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
432
433 **/
434 EFI_STATUS
435 EFIAPI
436 PeiPcdSet64 (
437 IN UINTN TokenNumber,
438 IN UINT64 Value
439 );
440
441 /**
442 Sets a value of a specified size for a given PCD token.
443
444 When the PCD service sets a value, it will check to ensure that the
445 size of the value being set is compatible with the Token's existing definition.
446 If it is not, an error will be returned.
447
448 @param[in] TokenNumber The PCD token number.
449 @param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token.
450 On input, if the SizeOfValue is greater than the maximum size supported
451 for this TokenNumber then the output value of SizeOfValue will reflect
452 the maximum size supported for this TokenNumber.
453 @param[in] Buffer The buffer to set for the PCD token.
454
455 @retval EFI_SUCCESS Procedure returned successfully.
456 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
457 being set was incompatible with a call to this function.
458 Use GetSize() to retrieve the size of the target data.
459 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
460
461 **/
462 EFI_STATUS
463 EFIAPI
464 PeiPcdSetPtr (
465 IN UINTN TokenNumber,
466 IN OUT UINTN *SizeOfBuffer,
467 IN VOID *Buffer
468 );
469
470 /**
471 Sets an Boolean value for a given PCD token.
472
473 When the PCD service sets a value, it will check to ensure that the
474 size of the value being set is compatible with the Token's existing definition.
475 If it is not, an error will be returned.
476
477 @param[in] TokenNumber The PCD token number.
478 @param[in] Value The value to set for the PCD token.
479
480 @retval EFI_SUCCESS Procedure returned successfully.
481 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
482 being set was incompatible with a call to this function.
483 Use GetSize() to retrieve the size of the target data.
484 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
485
486 **/
487 EFI_STATUS
488 EFIAPI
489 PeiPcdSetBool (
490 IN UINTN TokenNumber,
491 IN BOOLEAN Value
492 );
493
494 /**
495 Sets an 8-bit 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] Guid The 128-bit unique value that designates the namespace from which to extract the value.
502 @param[in] TokenNumber The PCD token number.
503 @param[in] Value The value to set for the PCD token.
504
505 @retval EFI_SUCCESS Procedure returned successfully.
506 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
507 being set was incompatible with a call to this function.
508 Use GetSize() to retrieve the size of the target data.
509 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
510
511 **/
512 EFI_STATUS
513 EFIAPI
514 PeiPcdSet8Ex (
515 IN CONST EFI_GUID *Guid,
516 IN UINTN TokenNumber,
517 IN UINT8 Value
518 );
519
520 /**
521 Sets an 16-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 PeiPcdSet16Ex (
541 IN CONST EFI_GUID *Guid,
542 IN UINTN TokenNumber,
543 IN UINT16 Value
544 );
545
546 /**
547 Sets an 32-bit value for a given PCD token.
548
549 When the PCD service sets a value, it will check to ensure that the
550 size of the value being set is compatible with the Token's existing definition.
551 If it is not, an error will be returned.
552
553 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
554 @param[in] TokenNumber The PCD token number.
555 @param[in] Value The value to set for the PCD token.
556
557 @retval EFI_SUCCESS Procedure returned successfully.
558 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
559 being set was incompatible with a call to this function.
560 Use GetSize() to retrieve the size of the target data.
561 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
562
563 **/
564 EFI_STATUS
565 EFIAPI
566 PeiPcdSet32Ex (
567 IN CONST EFI_GUID *Guid,
568 IN UINTN TokenNumber,
569 IN UINT32 Value
570 );
571
572 /**
573 Sets an 64-bit value for a given PCD token.
574
575 When the PCD service sets a value, it will check to ensure that the
576 size of the value being set is compatible with the Token's existing definition.
577 If it is not, an error will be returned.
578
579 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
580 @param[in] TokenNumber The PCD token number.
581 @param[in] Value The value to set for the PCD token.
582
583 @retval EFI_SUCCESS Procedure returned successfully.
584 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
585 being set was incompatible with a call to this function.
586 Use GetSize() to retrieve the size of the target data.
587 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
588
589 **/
590 EFI_STATUS
591 EFIAPI
592 PeiPcdSet64Ex (
593 IN CONST EFI_GUID *Guid,
594 IN UINTN TokenNumber,
595 IN UINT64 Value
596 );
597
598 /**
599 Sets a value of a specified size for a given PCD token.
600
601 When the PCD service sets a value, it will check to ensure that the
602 size of the value being set is compatible with the Token's existing definition.
603 If it is not, an error will be returned.
604
605 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
606 @param[in] TokenNumber The PCD token number.
607 @param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token.
608 On input, if the SizeOfValue is greater than the maximum size supported
609 for this TokenNumber then the output value of SizeOfValue will reflect
610 the maximum size supported for this TokenNumber.
611 @param[in] Buffer The buffer to set for the PCD token.
612
613 @retval EFI_SUCCESS Procedure returned successfully.
614 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
615 being set was incompatible with a call to this function.
616 Use GetSize() to retrieve the size of the target data.
617 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
618
619 **/
620 EFI_STATUS
621 EFIAPI
622 PeiPcdSetPtrEx (
623 IN CONST EFI_GUID *Guid,
624 IN UINTN TokenNumber,
625 IN OUT UINTN *SizeOfBuffer,
626 IN VOID *Buffer
627 );
628
629 /**
630 Sets an Boolean value for a given PCD token.
631
632 When the PCD service sets a value, it will check to ensure that the
633 size of the value being set is compatible with the Token's existing definition.
634 If it is not, an error will be returned.
635
636 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
637 @param[in] TokenNumber The PCD token number.
638 @param[in] Value The value to set for the PCD token.
639
640 @retval EFI_SUCCESS Procedure returned successfully.
641 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data
642 being set was incompatible with a call to this function.
643 Use GetSize() to retrieve the size of the target data.
644 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.
645
646 **/
647 EFI_STATUS
648 EFIAPI
649 PeiPcdSetBoolEx (
650 IN CONST EFI_GUID *Guid,
651 IN UINTN TokenNumber,
652 IN BOOLEAN Value
653 );
654
655 /**
656 Specifies a function to be called anytime the value of a designated token is changed.
657
658 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
659 @param[in] TokenNumber The PCD token number.
660 @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.
661
662 @retval EFI_SUCCESS The PCD service has successfully established a call event
663 for the CallBackToken requested.
664 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.
665
666 **/
667 EFI_STATUS
668 EFIAPI
669 PeiRegisterCallBackOnSet (
670 IN CONST EFI_GUID *Guid, OPTIONAL
671 IN UINTN TokenNumber,
672 IN PCD_PPI_CALLBACK CallBackFunction
673 );
674
675 /**
676 Cancels a previously set callback function for a particular PCD token number.
677
678 @param [in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
679 @param [in] TokenNumber The PCD token number.
680 @param [in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.
681
682 @retval EFI_SUCCESS The PCD service has successfully established a call event
683 for the CallBackToken requested.
684 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.
685
686 **/
687 EFI_STATUS
688 EFIAPI
689 PcdUnRegisterCallBackOnSet (
690 IN CONST EFI_GUID *Guid, OPTIONAL
691 IN UINTN TokenNumber,
692 IN PCD_PPI_CALLBACK CallBackFunction
693 );
694
695 /**
696 Retrieves the next valid token number in a given namespace.
697
698 This is useful since the PCD infrastructure contains a sparse list of token numbers,
699 and one cannot a priori know what token numbers are valid in the database.
700
701 If TokenNumber is 0 and Guid is not NULL, then the first token from the token space specified by Guid is returned.
702 If TokenNumber is not 0 and Guid is not NULL, then the next token in the token space specified by Guid is returned.
703 If TokenNumber is 0 and Guid is NULL, then the first token in the default token space is returned.
704 If TokenNumber is not 0 and Guid is NULL, then the next token in the default token space is returned.
705 The token numbers in the default token space may not be related to token numbers in token spaces that are named by Guid.
706 If the next token number can be retrieved, then it is returned in TokenNumber, and EFI_SUCCESS is returned.
707 If TokenNumber represents the last token number in the token space specified by Guid, then EFI_NOT_FOUND is returned.
708 If TokenNumber is not present in the token space specified by Guid, then EFI_NOT_FOUND is returned.
709
710
711 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.
712 This is an optional parameter that may be NULL. If this parameter is NULL, then a request
713 is being made to retrieve tokens from the default token space.
714 @param[in, out] TokenNumber A pointer to the PCD token number to use to find the subsequent token number.
715
716 @retval EFI_SUCCESS The PCD service has retrieved the next valid token number.
717 Or the input token number is already the last valid token number in the PCD database.
718 In the later case, *TokenNumber is updated with the value of 0.
719 @retval EFI_NOT_FOUND If this input token number and token namespace does not exist on the platform.
720
721 **/
722 EFI_STATUS
723 EFIAPI
724 PeiPcdGetNextToken (
725 IN CONST EFI_GUID *Guid, OPTIONAL
726 IN OUT UINTN *TokenNumber
727 );
728
729 /**
730 Retrieves the next valid PCD token namespace for a given namespace.
731
732 @param[in, out] Guid An indirect pointer to EFI_GUID. On input it designates
733 a known token namespace from which the search will start. On output,
734 it designates the next valid token namespace on the platform. If the input
735 token namespace does not exist on the platform, an error is returned and
736 the value of *Guid is undefined. If *Guid is NULL, then the GUID of the
737 first token space of the current platform is assigned to *Guid the function
738 return EFI_SUCCESS. If *Guid is NULL and there is no namespace exist in
739 the platform other than the default (NULL) tokennamespace, *Guid is unchanged
740 and the function return EFI_SUCCESS. If this input token namespace is the last
741 namespace on the platform, *Guid will be assigned to NULL and the function return
742 EFI_SUCCESS.
743
744 @retval EFI_SUCCESS The PCD service retrieved the next valid token space Guid.
745 Or the input token space Guid is already the last valid token space Guid
746 in the PCD database. In the later case, *Guid is updated with the value of NULL.
747 @retval EFI_NOT_FOUND If the input token namespace does not exist on the platform.
748
749 **/
750 EFI_STATUS
751 EFIAPI
752 PeiPcdGetNextTokenSpace (
753 IN OUT CONST EFI_GUID **Guid
754 );
755
756
757 /* Internal Function definitions */
758 /**
759 Get PCD database from GUID HOB in PEI phase.
760
761 @return Pointer to PCD database.
762
763 **/
764 PEI_PCD_DATABASE *
765 GetPcdDatabase (
766 VOID
767 );
768
769 /**
770 Wrapper function for setting non-pointer type value for a PCD entry.
771
772 @param TokenNumber Pcd token number autogenerated by build tools.
773 @param Data Value want to be set for PCD entry
774 @param Size Size of value.
775
776 @return status of SetWorker.
777
778 **/
779 EFI_STATUS
780 SetValueWorker (
781 IN UINTN TokenNumber,
782 IN VOID *Data,
783 IN UINTN Size
784 );
785
786 /**
787 Set value for an PCD entry
788
789 @param TokenNumber Pcd token number autogenerated by build tools.
790 @param Data Value want to be set for PCD entry
791 @param Size Size of value.
792 @param PtrType If TRUE, the type of PCD entry's value is Pointer.
793 If False, the type of PCD entry's value is not Pointer.
794
795 @retval EFI_INVALID_PARAMETER If this PCD type is VPD, VPD PCD can not be set.
796 @retval EFI_INVALID_PARAMETER If Size can not be set to size table.
797 @retval EFI_INVALID_PARAMETER If Size of non-Ptr type PCD does not match the size information in PCD database.
798 @retval EFI_NOT_FOUND If value type of PCD entry is intergrate, but not in
799 range of UINT8, UINT16, UINT32, UINT64
800 @retval EFI_NOT_FOUND Can not find the PCD type according to token number.
801 **/
802 EFI_STATUS
803 SetWorker (
804 IN UINTN TokenNumber,
805 IN VOID *Data,
806 IN OUT UINTN *Size,
807 IN BOOLEAN PtrType
808 );
809
810 /**
811 Wrapper function for set PCD value for non-Pointer type dynamic-ex PCD.
812
813 @param ExTokenNumber Token number for dynamic-ex PCD.
814 @param Guid Token space guid for dynamic-ex PCD.
815 @param Data Value want to be set.
816 @param SetSize The size of value.
817
818 @return status of ExSetWorker().
819
820 **/
821 EFI_STATUS
822 ExSetValueWorker (
823 IN UINTN ExTokenNumber,
824 IN CONST EFI_GUID *Guid,
825 IN VOID *Data,
826 IN UINTN Size
827 );
828
829 /**
830 Set value for a dynamic PCD entry.
831
832 This routine find the local token number according to dynamic-ex PCD's token
833 space guid and token number firstly, and invoke callback function if this PCD
834 entry registered callback function. Finally, invoken general SetWorker to set
835 PCD value.
836
837 @param ExTokenNumber Dynamic-ex PCD token number.
838 @param Guid Token space guid for dynamic-ex PCD.
839 @param Data PCD value want to be set
840 @param SetSize Size of value.
841 @param PtrType If TRUE, this PCD entry is pointer type.
842 If FALSE, this PCD entry is not pointer type.
843
844 @return status of SetWorker().
845
846 **/
847 EFI_STATUS
848 ExSetWorker (
849 IN UINTN ExTokenNumber,
850 IN CONST EFI_GUID *Guid,
851 IN VOID *Data,
852 IN OUT UINTN *Size,
853 IN BOOLEAN PtrType
854 );
855
856 /**
857 Get the PCD entry pointer in PCD database.
858
859 This routine will visit PCD database to find the PCD entry according to given
860 token number. The given token number is autogened by build tools and it will be
861 translated to local token number. Local token number contains PCD's type and
862 offset of PCD entry in PCD database.
863
864 @param TokenNumber Token's number, it is autogened by build tools
865 @param GetSize The size of token's value
866
867 @return PCD entry pointer in PCD database
868
869 **/
870 VOID *
871 GetWorker (
872 IN UINTN TokenNumber,
873 IN UINTN GetSize
874 );
875
876 /**
877 Wrapper function for get PCD value for dynamic-ex PCD.
878
879 @param Guid Token space guid for dynamic-ex PCD.
880 @param ExTokenNumber Token number for dyanmic-ex PCD.
881 @param GetSize The size of dynamic-ex PCD value.
882
883 @return PCD entry in PCD database.
884
885 **/
886 VOID *
887 ExGetWorker (
888 IN CONST EFI_GUID *Guid,
889 IN UINTN ExTokenNumber,
890 IN UINTN GetSize
891 );
892
893 typedef struct {
894 UINTN TokenNumber;
895 UINTN Size;
896 UINT32 LocalTokenNumberAlias;
897 } EX_PCD_ENTRY_ATTRIBUTE;
898
899 /**
900 Get local token number according to dynamic-ex PCD's {token space guid:token number}
901
902 A dynamic-ex type PCD, developer must provide pair of token space guid: token number
903 in DEC file. PCD database maintain a mapping table that translate pair of {token
904 space guid: token number} to local token number.
905
906 @param Guid Token space guid for dynamic-ex PCD entry.
907 @param ExTokenNumber Token number for dynamic-ex PCD.
908
909 @return local token number for dynamic-ex PCD.
910
911 **/
912 UINTN
913 GetExPcdTokenNumber (
914 IN CONST EFI_GUID *Guid,
915 IN UINTN ExTokenNumber
916 );
917
918 /**
919 The function registers the CallBackOnSet fucntion
920 according to TokenNumber and EFI_GUID space.
921
922 @param TokenNumber The token number.
923 @param Guid The GUID space.
924 @param CallBackFunction The Callback function to be registered.
925 @param Register To register or unregister the callback function.
926
927 @retval EFI_SUCCESS If the Callback function is registered.
928 @retval EFI_NOT_FOUND If the PCD Entry is not found according to Token Number and GUID space.
929 @retval EFI_OUT_OF_RESOURCES If the callback function can't be registered because there is not free
930 slot left in the CallbackFnTable.
931 **/
932 EFI_STATUS
933 PeiRegisterCallBackWorker (
934 IN UINTN TokenNumber,
935 IN CONST EFI_GUID *Guid, OPTIONAL
936 IN PCD_PPI_CALLBACK CallBackFunction,
937 IN BOOLEAN Register
938 );
939
940 /**
941 The function builds the PCD database.
942 **/
943 VOID
944 BuildPcdDatabase (
945 VOID
946 );
947
948 /**
949 Get SKU ID tabble from PCD database.
950
951 @param LocalTokenNumberTableIdx Index of local token number in token number table.
952 @param Database PCD Database in PEI phase
953
954 @return Pointer to SKU ID array table
955
956 **/
957 SKU_ID *
958 GetSkuIdArray (
959 IN UINTN LocalTokenNumberTableIdx,
960 IN PEI_PCD_DATABASE *Database
961 );
962
963 /**
964 Get index of PCD entry in size table.
965
966 @param LocalTokenNumberTableIdx Index of this PCD in local token number table.
967 @param Database Pointer to PCD database.
968
969 @return index of PCD entry in size table.
970
971 **/
972 UINTN
973 GetSizeTableIndex (
974 IN UINTN LocalTokenNumberTableIdx,
975 IN PEI_PCD_DATABASE *Database
976 );
977
978 /**
979 Get PCD value's size for POINTER type PCD.
980
981 The POINTER type PCD's value will be stored into a buffer in specificed size.
982 The max size of this PCD's value is described in PCD's definition in DEC file.
983
984 @param LocalTokenNumberTableIdx Index of PCD token number in PCD token table
985 @param MaxSize Maxmium size of PCD's value
986 @param Database Pcd database in PEI phase.
987
988 @return PCD value's size for POINTER type PCD.
989
990 **/
991 UINTN
992 GetPtrTypeSize (
993 IN UINTN LocalTokenNumberTableIdx,
994 OUT UINTN *MaxSize,
995 IN PEI_PCD_DATABASE *Database
996 );
997
998 /**
999 Set PCD value's size for POINTER type PCD.
1000
1001 The POINTER type PCD's value will be stored into a buffer in specificed size.
1002 The max size of this PCD's value is described in PCD's definition in DEC file.
1003
1004 @param LocalTokenNumberTableIdx Index of PCD token number in PCD token table
1005 @param CurrentSize Maxmium size of PCD's value
1006 @param Database Pcd database in PEI phase.
1007
1008 @retval TRUE Success to set PCD's value size, which is not exceed maxmium size
1009 @retval FALSE Fail to set PCD's value size, which maybe exceed maxmium size
1010
1011 **/
1012 BOOLEAN
1013 SetPtrTypeSize (
1014 IN UINTN LocalTokenNumberTableIdx,
1015 IN OUT UINTN *CurrentSize,
1016 IN PEI_PCD_DATABASE *Database
1017 );
1018
1019 //
1020 // The init Database created by PCD Database generation tool
1021 //
1022 extern PEI_PCD_DATABASE_INIT gPEIPcdDbInit;
1023
1024 #endif
1025