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