]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/PCD/Pei/Service.h
Use single one PcdFrameworkCompatibilitySupport PCD to support framework HII and...
[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
cebc8d48 4Copyright (c) 2006 - 2008, Intel Corporation\r
c52fa98c 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
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
98b15cf1 21#include <Guid/PcdDataBaseHobGuid.h>\r
97a079ed
A
22#include <Library/DebugLib.h>\r
23#include <Library/PeimEntryPoint.h>\r
24#include <Library/BaseLib.h>\r
25#include <Library/HobLib.h>\r
26#include <Library/PeiServicesLib.h>\r
27#include <Library/PcdLib.h>\r
97a079ed
A
28#include <Library/BaseMemoryLib.h>\r
29\r
80408db0 30\r
31//\r
32// Please make sure the PCD Serivce PEIM Version is consistent with\r
33// the version of PCD Database generation tool\r
34//\r
35#define PCD_SERVICE_PEIM_VERSION 2\r
36\r
37//\r
38// PCD_PEI_DATABASE_GENTOOL_VERSION is defined in Autogen.h\r
39// and generated by PCD Database generation tool.\r
40//\r
c52fa98c 41//#if (PCD_SERVICE_PEIM_VERSION != PCD_PEI_SERVICE_DRIVER_AUTOGEN_VERSION )\r
be82f9ff 42// #error "Please make sure the version of PCD Service PEIM and PCD PEI Database Generation Tool matches"\r
c52fa98c 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
695 Retrieves the next valid PCD token for a given namespace.\r
696\r
697 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
698 @param[in, out] TokenNumber A pointer to the PCD token number to use to find the subsequent token number. \r
699 If the input token namespace or token number does not exist on the platform, \r
700 an error is returned and the value of *TokenNumber is undefined. To retrieve the "first" token, \r
701 have the pointer reference a TokenNumber value of 0. If the input token number is 0 and \r
702 there is no valid token number for this token namespace, *TokenNumber will be assigned to \r
703 0 and the function return EFI_SUCCESS. If the token number is the last valid token number, \r
704 *TokenNumber will be assigned to 0 and the function return EFI_SUCCESS.\r
80408db0 705\r
fc547e08 706 @retval EFI_SUCCESS The PCD service retrieved the next valid token number. Or the input token number \r
707 is already the last valid token number in the PCD database. \r
708 In the later case, *TokenNumber is updated with the value of 0.\r
709 @retval EFI_NOT_FOUND If this input token number and token namespace does not exist on the platform.\r
710\r
711**/\r
80408db0 712EFI_STATUS\r
713EFIAPI\r
714PeiPcdGetNextToken (\r
715 IN CONST EFI_GUID *Guid, OPTIONAL\r
716 IN OUT UINTN *TokenNumber\r
ed66e1bc 717 );\r
80408db0 718\r
fc547e08 719/**\r
720 Retrieves the next valid PCD token namespace for a given namespace.\r
721\r
722 @param[in, out] Guid An indirect pointer to EFI_GUID. On input it designates \r
723 a known token namespace from which the search will start. On output, \r
724 it designates the next valid token namespace on the platform. If the input \r
725 token namespace does not exist on the platform, an error is returned and \r
726 the value of *Guid is undefined. If *Guid is NULL, then the GUID of the \r
727 first token space of the current platform is assigned to *Guid the function \r
728 return EFI_SUCCESS. If *Guid is NULL and there is no namespace exist in \r
729 the platform other than the default (NULL) tokennamespace, *Guid is unchanged \r
730 and the function return EFI_SUCCESS. If this input token namespace is the last \r
731 namespace on the platform, *Guid will be assigned to NULL and the function return \r
732 EFI_SUCCESS. \r
733\r
734 @retval EFI_SUCCESS The PCD service retrieved the next valid token space Guid. \r
735 Or the input token space Guid is already the last valid token space Guid \r
736 in the PCD database. In the later case, *Guid is updated with the value of NULL.\r
737 @retval EFI_NOT_FOUND If the input token namespace does not exist on the platform.\r
80408db0 738\r
fc547e08 739**/\r
80408db0 740EFI_STATUS\r
741EFIAPI\r
742PeiPcdGetNextTokenSpace (\r
fc547e08 743 IN OUT CONST EFI_GUID **Guid\r
ed66e1bc 744 );\r
80408db0 745\r
746\r
747/* Internal Function definitions */\r
fc547e08 748/**\r
749 Get PCD database from GUID HOB in PEI phase.\r
750\r
751 @return Pointer to PCD database.\r
80408db0 752\r
fc547e08 753**/\r
80408db0 754PEI_PCD_DATABASE *\r
755GetPcdDatabase (\r
756 VOID\r
ed66e1bc 757 );\r
80408db0 758\r
fc547e08 759/**\r
760 Wrapper function for setting non-pointer type value for a PCD entry.\r
761\r
762 @param TokenNumber Pcd token number autogenerated by build tools.\r
763 @param Data Value want to be set for PCD entry\r
764 @param Size Size of value.\r
80408db0 765\r
fc547e08 766 @return status of SetWorker.\r
767\r
768**/\r
80408db0 769EFI_STATUS\r
770SetValueWorker (\r
771 IN UINTN TokenNumber,\r
772 IN VOID *Data,\r
773 IN UINTN Size\r
ed66e1bc 774 );\r
80408db0 775\r
fc547e08 776/**\r
777 Set value for an PCD entry\r
80408db0 778\r
fc547e08 779 @param TokenNumber Pcd token number autogenerated by build tools.\r
780 @param Data Value want to be set for PCD entry\r
781 @param Size Size of value.\r
782 @param PtrType If TRUE, the type of PCD entry's value is Pointer.\r
783 If False, the type of PCD entry's value is not Pointer.\r
784\r
785 @retval EFI_INVALID_PARAMETER If this PCD type is VPD, VPD PCD can not be set.\r
786 @retval EFI_INVALID_PARAMETER If Size can not be set to size table.\r
787 @retval EFI_NOT_FOUND If value type of PCD entry is intergrate, but not in\r
788 range of UINT8, UINT16, UINT32, UINT64\r
789 @retval EFI_NOT_FOUND Can not find the PCD type according to token number. \r
790**/\r
80408db0 791EFI_STATUS\r
792SetWorker (\r
793 IN UINTN TokenNumber,\r
794 IN VOID *Data,\r
795 IN OUT UINTN *Size,\r
796 IN BOOLEAN PtrType\r
ed66e1bc 797 );\r
80408db0 798\r
fc547e08 799/**\r
800 Wrapper function for set PCD value for non-Pointer type dynamic-ex PCD.\r
80408db0 801\r
fc547e08 802 @param ExTokenNumber Token number for dynamic-ex PCD.\r
803 @param Guid Token space guid for dynamic-ex PCD.\r
804 @param Data Value want to be set.\r
805 @param SetSize The size of value.\r
806\r
807 @return status of ExSetWorker().\r
808\r
809**/\r
80408db0 810EFI_STATUS\r
811ExSetValueWorker (\r
812 IN UINTN ExTokenNumber,\r
813 IN CONST EFI_GUID *Guid,\r
814 IN VOID *Data,\r
815 IN UINTN Size\r
ed66e1bc 816 );\r
80408db0 817\r
fc547e08 818/**\r
819 Set value for a dynamic PCD entry.\r
820 \r
821 This routine find the local token number according to dynamic-ex PCD's token \r
822 space guid and token number firstly, and invoke callback function if this PCD\r
823 entry registered callback function. Finally, invoken general SetWorker to set\r
824 PCD value.\r
825 \r
826 @param ExTokenNumber Dynamic-ex PCD token number.\r
827 @param Guid Token space guid for dynamic-ex PCD.\r
828 @param Data PCD value want to be set\r
829 @param SetSize Size of value.\r
830 @param PtrType If TRUE, this PCD entry is pointer type.\r
831 If FALSE, this PCD entry is not pointer type.\r
832\r
833 @return status of SetWorker().\r
80408db0 834\r
fc547e08 835**/\r
80408db0 836EFI_STATUS\r
837ExSetWorker (\r
838 IN UINTN ExTokenNumber,\r
839 IN CONST EFI_GUID *Guid,\r
840 IN VOID *Data,\r
841 IN OUT UINTN *Size,\r
842 IN BOOLEAN PtrType\r
ed66e1bc 843 );\r
80408db0 844\r
fc547e08 845/**\r
846 Get the PCD entry pointer in PCD database.\r
847 \r
848 This routine will visit PCD database to find the PCD entry according to given\r
849 token number. The given token number is autogened by build tools and it will be \r
850 translated to local token number. Local token number contains PCD's type and \r
851 offset of PCD entry in PCD database.\r
852\r
853 @param TokenNumber Token's number, it is autogened by build tools\r
854 @param GetSize The size of token's value\r
80408db0 855\r
fc547e08 856 @return PCD entry pointer in PCD database\r
80408db0 857\r
fc547e08 858**/\r
80408db0 859VOID *\r
860GetWorker (\r
861 IN UINTN TokenNumber,\r
862 IN UINTN GetSize\r
ed66e1bc 863 );\r
80408db0 864\r
fc547e08 865/**\r
866 Wrapper function for get PCD value for dynamic-ex PCD.\r
867\r
868 @param Guid Token space guid for dynamic-ex PCD.\r
869 @param ExTokenNumber Token number for dyanmic-ex PCD.\r
870 @param GetSize The size of dynamic-ex PCD value.\r
80408db0 871\r
fc547e08 872 @return PCD entry in PCD database.\r
80408db0 873\r
fc547e08 874**/\r
80408db0 875VOID *\r
876ExGetWorker (\r
877 IN CONST EFI_GUID *Guid,\r
878 IN UINTN ExTokenNumber,\r
879 IN UINTN GetSize\r
ed66e1bc 880 );\r
80408db0 881\r
882typedef struct {\r
883 UINTN TokenNumber;\r
884 UINTN Size;\r
885 UINT32 LocalTokenNumberAlias;\r
886} EX_PCD_ENTRY_ATTRIBUTE;\r
887\r
fc547e08 888/**\r
889 Get local token number according to dynamic-ex PCD's {token space guid:token number}\r
890\r
891 A dynamic-ex type PCD, developer must provide pair of token space guid: token number\r
892 in DEC file. PCD database maintain a mapping table that translate pair of {token\r
893 space guid: token number} to local token number.\r
894 \r
895 @param Guid Token space guid for dynamic-ex PCD entry.\r
896 @param ExTokenNumber EDES_TODO: Add parameter description\r
80408db0 897\r
fc547e08 898 @return local token number for dynamic-ex PCD.\r
899\r
900**/\r
c52fa98c 901UINTN\r
80408db0 902GetExPcdTokenNumber (\r
903 IN CONST EFI_GUID *Guid,\r
904 IN UINTN ExTokenNumber\r
ed66e1bc 905 );\r
80408db0 906\r
fc547e08 907/**\r
908 The function registers the CallBackOnSet fucntion\r
909 according to TokenNumber and EFI_GUID space.\r
80408db0 910\r
fc547e08 911 @param TokenNumber The token number.\r
912 @param Guid The GUID space.\r
913 @param CallBackFunction The Callback function to be registered.\r
914 @param Register To register or unregister the callback function.\r
80408db0 915\r
fc547e08 916 @retval EFI_SUCCESS If the Callback function is registered.\r
917 @retval EFI_NOT_FOUND If the PCD Entry is not found according to Token Number and GUID space.\r
918 @retval EFI_OUT_OF_RESOURCES If the callback function can't be registered because there is not free\r
919 slot left in the CallbackFnTable.\r
920**/\r
80408db0 921EFI_STATUS\r
922PeiRegisterCallBackWorker (\r
923 IN UINTN TokenNumber,\r
fc547e08 924 IN CONST EFI_GUID *Guid, OPTIONAL\r
80408db0 925 IN PCD_PPI_CALLBACK CallBackFunction,\r
926 IN BOOLEAN Register\r
a3a70b6a 927 );\r
80408db0 928\r
fc547e08 929/**\r
930 The function builds the PCD database.\r
931**/\r
80408db0 932VOID\r
933BuildPcdDatabase (\r
934 VOID\r
ed66e1bc 935 );\r
80408db0 936\r
fc547e08 937/**\r
938 Get SKU ID tabble from PCD database.\r
939\r
940 @param LocalTokenNumberTableIdx Index of local token number in token number table.\r
941 @param Database PCD Database in PEI phase\r
942\r
943 @return Pointer to SKU ID array table\r
944\r
945**/\r
80408db0 946SKU_ID *\r
947GetSkuIdArray (\r
948 IN UINTN LocalTokenNumberTableIdx,\r
949 IN PEI_PCD_DATABASE *Database\r
ed66e1bc 950 );\r
80408db0 951\r
fc547e08 952/**\r
953 Get index of PCD entry in size table.\r
954\r
955 @param LocalTokenNumberTableIdx Index of this PCD in local token number table.\r
956 @param Database Pointer to PCD database.\r
957\r
958 @return index of PCD entry in size table.\r
959\r
960**/\r
80408db0 961UINTN\r
962GetSizeTableIndex (\r
963 IN UINTN LocalTokenNumberTableIdx,\r
964 IN PEI_PCD_DATABASE *Database\r
ed66e1bc 965 );\r
80408db0 966\r
fc547e08 967/**\r
968 Get PCD value's size for POINTER type PCD.\r
969 \r
970 The POINTER type PCD's value will be stored into a buffer in specificed size.\r
971 The max size of this PCD's value is described in PCD's definition in DEC file.\r
972\r
973 @param LocalTokenNumberTableIdx Index of PCD token number in PCD token table\r
974 @param MaxSize Maxmium size of PCD's value\r
975 @param Database Pcd database in PEI phase.\r
976\r
977 @return PCD value's size for POINTER type PCD.\r
978\r
979**/\r
80408db0 980UINTN\r
981GetPtrTypeSize (\r
982 IN UINTN LocalTokenNumberTableIdx,\r
983 OUT UINTN *MaxSize,\r
984 IN PEI_PCD_DATABASE *Database\r
ed66e1bc 985 );\r
80408db0 986\r
fc547e08 987/**\r
988 Set PCD value's size for POINTER type PCD.\r
989 \r
990 The POINTER type PCD's value will be stored into a buffer in specificed size.\r
991 The max size of this PCD's value is described in PCD's definition in DEC file.\r
80408db0 992\r
fc547e08 993 @param LocalTokenNumberTableIdx Index of PCD token number in PCD token table\r
994 @param CurrentSize Maxmium size of PCD's value\r
995 @param Database Pcd database in PEI phase.\r
80408db0 996\r
fc547e08 997 @retval TRUE Success to set PCD's value size, which is not exceed maxmium size\r
998 @retval FALSE Fail to set PCD's value size, which maybe exceed maxmium size\r
999\r
1000**/\r
80408db0 1001BOOLEAN\r
1002SetPtrTypeSize (\r
1003 IN UINTN LocalTokenNumberTableIdx,\r
1004 IN OUT UINTN *CurrentSize,\r
1005 IN PEI_PCD_DATABASE *Database\r
ed66e1bc 1006 );\r
80408db0 1007\r
cebc8d48
LG
1008//\r
1009// The init Database created by PCD Database generation tool\r
1010//\r
80408db0 1011extern PEI_PCD_DATABASE_INIT gPEIPcdDbInit;\r
1012\r
1013#endif\r