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