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