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