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