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