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