]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/PCD/Pei/Service.h
Make PcdPeim/PcdDxe driver also produce EFI_PCD_PPI/EFI_PCD_PROTOCOL defined in PI...
[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
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
796 @retval EFI_NOT_FOUND If value type of PCD entry is intergrate, but not in\r
797 range of UINT8, UINT16, UINT32, UINT64\r
798 @retval EFI_NOT_FOUND Can not find the PCD type according to token number. \r
799**/\r
80408db0 800EFI_STATUS\r
801SetWorker (\r
802 IN UINTN TokenNumber,\r
803 IN VOID *Data,\r
804 IN OUT UINTN *Size,\r
805 IN BOOLEAN PtrType\r
ed66e1bc 806 );\r
80408db0 807\r
fc547e08 808/**\r
809 Wrapper function for set PCD value for non-Pointer type dynamic-ex PCD.\r
80408db0 810\r
fc547e08 811 @param ExTokenNumber Token number for dynamic-ex PCD.\r
812 @param Guid Token space guid for dynamic-ex PCD.\r
813 @param Data Value want to be set.\r
814 @param SetSize The size of value.\r
815\r
816 @return status of ExSetWorker().\r
817\r
818**/\r
80408db0 819EFI_STATUS\r
820ExSetValueWorker (\r
821 IN UINTN ExTokenNumber,\r
822 IN CONST EFI_GUID *Guid,\r
823 IN VOID *Data,\r
824 IN UINTN Size\r
ed66e1bc 825 );\r
80408db0 826\r
fc547e08 827/**\r
828 Set value for a dynamic PCD entry.\r
829 \r
830 This routine find the local token number according to dynamic-ex PCD's token \r
831 space guid and token number firstly, and invoke callback function if this PCD\r
832 entry registered callback function. Finally, invoken general SetWorker to set\r
833 PCD value.\r
834 \r
835 @param ExTokenNumber Dynamic-ex PCD token number.\r
836 @param Guid Token space guid for dynamic-ex PCD.\r
837 @param Data PCD value want to be set\r
838 @param SetSize Size of value.\r
839 @param PtrType If TRUE, this PCD entry is pointer type.\r
840 If FALSE, this PCD entry is not pointer type.\r
841\r
842 @return status of SetWorker().\r
80408db0 843\r
fc547e08 844**/\r
80408db0 845EFI_STATUS\r
846ExSetWorker (\r
847 IN UINTN ExTokenNumber,\r
848 IN CONST EFI_GUID *Guid,\r
849 IN VOID *Data,\r
850 IN OUT UINTN *Size,\r
851 IN BOOLEAN PtrType\r
ed66e1bc 852 );\r
80408db0 853\r
fc547e08 854/**\r
855 Get the PCD entry pointer in PCD database.\r
856 \r
857 This routine will visit PCD database to find the PCD entry according to given\r
858 token number. The given token number is autogened by build tools and it will be \r
859 translated to local token number. Local token number contains PCD's type and \r
860 offset of PCD entry in PCD database.\r
861\r
862 @param TokenNumber Token's number, it is autogened by build tools\r
863 @param GetSize The size of token's value\r
80408db0 864\r
fc547e08 865 @return PCD entry pointer in PCD database\r
80408db0 866\r
fc547e08 867**/\r
80408db0 868VOID *\r
869GetWorker (\r
870 IN UINTN TokenNumber,\r
871 IN UINTN GetSize\r
ed66e1bc 872 );\r
80408db0 873\r
fc547e08 874/**\r
875 Wrapper function for get PCD value for dynamic-ex PCD.\r
876\r
877 @param Guid Token space guid for dynamic-ex PCD.\r
878 @param ExTokenNumber Token number for dyanmic-ex PCD.\r
879 @param GetSize The size of dynamic-ex PCD value.\r
80408db0 880\r
fc547e08 881 @return PCD entry in PCD database.\r
80408db0 882\r
fc547e08 883**/\r
80408db0 884VOID *\r
885ExGetWorker (\r
886 IN CONST EFI_GUID *Guid,\r
887 IN UINTN ExTokenNumber,\r
888 IN UINTN GetSize\r
ed66e1bc 889 );\r
80408db0 890\r
891typedef struct {\r
892 UINTN TokenNumber;\r
893 UINTN Size;\r
894 UINT32 LocalTokenNumberAlias;\r
895} EX_PCD_ENTRY_ATTRIBUTE;\r
896\r
fc547e08 897/**\r
898 Get local token number according to dynamic-ex PCD's {token space guid:token number}\r
899\r
900 A dynamic-ex type PCD, developer must provide pair of token space guid: token number\r
901 in DEC file. PCD database maintain a mapping table that translate pair of {token\r
902 space guid: token number} to local token number.\r
903 \r
904 @param Guid Token space guid for dynamic-ex PCD entry.\r
a5eca427 905 @param ExTokenNumber Token number for dynamic-ex PCD.\r
80408db0 906\r
fc547e08 907 @return local token number for dynamic-ex PCD.\r
908\r
909**/\r
c52fa98c 910UINTN\r
80408db0 911GetExPcdTokenNumber (\r
912 IN CONST EFI_GUID *Guid,\r
913 IN UINTN ExTokenNumber\r
ed66e1bc 914 );\r
80408db0 915\r
fc547e08 916/**\r
917 The function registers the CallBackOnSet fucntion\r
918 according to TokenNumber and EFI_GUID space.\r
80408db0 919\r
fc547e08 920 @param TokenNumber The token number.\r
921 @param Guid The GUID space.\r
922 @param CallBackFunction The Callback function to be registered.\r
923 @param Register To register or unregister the callback function.\r
80408db0 924\r
fc547e08 925 @retval EFI_SUCCESS If the Callback function is registered.\r
926 @retval EFI_NOT_FOUND If the PCD Entry is not found according to Token Number and GUID space.\r
927 @retval EFI_OUT_OF_RESOURCES If the callback function can't be registered because there is not free\r
928 slot left in the CallbackFnTable.\r
929**/\r
80408db0 930EFI_STATUS\r
931PeiRegisterCallBackWorker (\r
932 IN UINTN TokenNumber,\r
fc547e08 933 IN CONST EFI_GUID *Guid, OPTIONAL\r
80408db0 934 IN PCD_PPI_CALLBACK CallBackFunction,\r
935 IN BOOLEAN Register\r
a3a70b6a 936 );\r
80408db0 937\r
fc547e08 938/**\r
939 The function builds the PCD database.\r
940**/\r
80408db0 941VOID\r
942BuildPcdDatabase (\r
943 VOID\r
ed66e1bc 944 );\r
80408db0 945\r
fc547e08 946/**\r
947 Get SKU ID tabble from PCD database.\r
948\r
949 @param LocalTokenNumberTableIdx Index of local token number in token number table.\r
950 @param Database PCD Database in PEI phase\r
951\r
952 @return Pointer to SKU ID array table\r
953\r
954**/\r
80408db0 955SKU_ID *\r
956GetSkuIdArray (\r
957 IN UINTN LocalTokenNumberTableIdx,\r
958 IN PEI_PCD_DATABASE *Database\r
ed66e1bc 959 );\r
80408db0 960\r
fc547e08 961/**\r
962 Get index of PCD entry in size table.\r
963\r
964 @param LocalTokenNumberTableIdx Index of this PCD in local token number table.\r
965 @param Database Pointer to PCD database.\r
966\r
967 @return index of PCD entry in size table.\r
968\r
969**/\r
80408db0 970UINTN\r
971GetSizeTableIndex (\r
972 IN UINTN LocalTokenNumberTableIdx,\r
973 IN PEI_PCD_DATABASE *Database\r
ed66e1bc 974 );\r
80408db0 975\r
fc547e08 976/**\r
977 Get PCD value's size for POINTER type PCD.\r
978 \r
979 The POINTER type PCD's value will be stored into a buffer in specificed size.\r
980 The max size of this PCD's value is described in PCD's definition in DEC file.\r
981\r
982 @param LocalTokenNumberTableIdx Index of PCD token number in PCD token table\r
983 @param MaxSize Maxmium size of PCD's value\r
984 @param Database Pcd database in PEI phase.\r
985\r
986 @return PCD value's size for POINTER type PCD.\r
987\r
988**/\r
80408db0 989UINTN\r
990GetPtrTypeSize (\r
991 IN UINTN LocalTokenNumberTableIdx,\r
992 OUT UINTN *MaxSize,\r
993 IN PEI_PCD_DATABASE *Database\r
ed66e1bc 994 );\r
80408db0 995\r
fc547e08 996/**\r
997 Set PCD value's size for POINTER type PCD.\r
998 \r
999 The POINTER type PCD's value will be stored into a buffer in specificed size.\r
1000 The max size of this PCD's value is described in PCD's definition in DEC file.\r
80408db0 1001\r
fc547e08 1002 @param LocalTokenNumberTableIdx Index of PCD token number in PCD token table\r
1003 @param CurrentSize Maxmium size of PCD's value\r
1004 @param Database Pcd database in PEI phase.\r
80408db0 1005\r
fc547e08 1006 @retval TRUE Success to set PCD's value size, which is not exceed maxmium size\r
1007 @retval FALSE Fail to set PCD's value size, which maybe exceed maxmium size\r
1008\r
1009**/\r
80408db0 1010BOOLEAN\r
1011SetPtrTypeSize (\r
1012 IN UINTN LocalTokenNumberTableIdx,\r
1013 IN OUT UINTN *CurrentSize,\r
1014 IN PEI_PCD_DATABASE *Database\r
ed66e1bc 1015 );\r
80408db0 1016\r
cebc8d48
LG
1017//\r
1018// The init Database created by PCD Database generation tool\r
1019//\r
80408db0 1020extern PEI_PCD_DATABASE_INIT gPEIPcdDbInit;\r
1021\r
1022#endif\r
a5eca427 1023\r