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