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