]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/PCD/Dxe/Service.h
Add function header and pass ECC tools
[mirror_edk2.git] / MdeModulePkg / Universal / PCD / Dxe / Service.h
CommitLineData
80408db0 1/** @file\r
2Private functions used by PCD DXE driver.\r
3\r
c52fa98c 4Copyright (c) 2006 - 2007, 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
2ab6330e 18#ifndef _PCD_DXE_SERVICE_H_\r
19#define _PCD_DXE_SERVICE_H_\r
80408db0 20\r
859b72fa
A
21#include <PiDxe.h>\r
22#include <Protocol/Pcd.h>\r
23#include <Library/BaseLib.h>\r
24#include <Library/DebugLib.h>\r
25#include <Library/UefiLib.h>\r
26#include <Library/UefiDriverEntryPoint.h>\r
27#include <Library/PcdLib.h>\r
28#include <Library/HobLib.h>\r
29#include <Library/MemoryAllocationLib.h>\r
30#include <Library/UefiBootServicesTableLib.h>\r
31#include <Library/BaseMemoryLib.h>\r
32#include <Library/UefiRuntimeServicesTableLib.h>\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_DXE_DRIVER_VERSION 2\r
39\r
40//\r
41// PCD_DXE_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_DXE_DRIVER_VERSION != PCD_DXE_SERVICE_DRIVER_AUTOGEN_VERSION)\r
be82f9ff 45// #error "Please make sure the version of PCD Service DXE Driver and PCD DXE Database Generation Tool matches"\r
c52fa98c 46//#endif\r
80408db0 47\r
48//\r
49// Protocol Interface function declaration.\r
50//\r
2ab6330e 51/**\r
52 Sets the SKU value for subsequent calls to set or get PCD token values.\r
53\r
54 SetSku() sets the SKU Id to be used for subsequent calls to set or get PCD values. \r
55 SetSku() is normally called only once by the system.\r
56\r
57 For each item (token), the database can hold a single value that applies to all SKUs, \r
58 or multiple values, where each value is associated with a specific SKU Id. Items with multiple, \r
59 SKU-specific values are called SKU enabled. \r
60 \r
61 The SKU Id of zero is reserved as a default. The valid SkuId range is 1 to 255. \r
62 For tokens that are not SKU enabled, the system ignores any set SKU Id and works with the \r
63 single value for that token. For SKU-enabled tokens, the system will use the SKU Id set by the \r
64 last call to SetSku(). If no SKU Id is set or the currently set SKU Id isn't valid for the specified token, \r
65 the system uses the default SKU Id. If the system attempts to use the default SKU Id and no value has been \r
66 set for that Id, the results are unpredictable.\r
67\r
68 @param[in] SkuId The SKU value that will be used when the PCD service will retrieve and \r
69 set values associated with a PCD token.\r
70\r
71 @retval VOID\r
72\r
73**/\r
80408db0 74VOID\r
75EFIAPI\r
76DxePcdSetSku (\r
77 IN UINTN SkuId\r
78 )\r
79;\r
80\r
2ab6330e 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
2ab6330e 89 @return The UINT8 value.\r
90 \r
91**/\r
80408db0 92UINT8\r
93EFIAPI\r
94DxePcdGet8 (\r
95 IN UINTN TokenNumber\r
96 )\r
97;\r
98\r
2ab6330e 99/**\r
100 Retrieves an 16-bit value for a given PCD token.\r
80408db0 101\r
2ab6330e 102 Retrieves the current 16-bits value for a PCD token number. \r
103 If the TokenNumber is invalid, the results are unpredictable.\r
104 \r
105 @param[in] TokenNumber The PCD token number. \r
106\r
107 @return The UINT16 value.\r
108 \r
109**/\r
80408db0 110UINT16\r
111EFIAPI\r
112DxePcdGet16 (\r
113 IN UINTN TokenNumber\r
114 )\r
115;\r
116\r
2ab6330e 117/**\r
118 Retrieves an 32-bit value for a given PCD token.\r
80408db0 119\r
2ab6330e 120 Retrieves the current 32-bits value for a PCD token number. \r
121 If the TokenNumber is invalid, the results are unpredictable.\r
122 \r
123 @param[in] TokenNumber The PCD token number. \r
124\r
125 @return The UINT32 value.\r
126 \r
127**/\r
80408db0 128UINT32\r
129EFIAPI\r
130DxePcdGet32 (\r
131 IN UINTN TokenNumber\r
132 )\r
133;\r
134\r
2ab6330e 135/**\r
136 Retrieves an 64-bit value for a given PCD token.\r
137\r
138 Retrieves the current 64-bits value for a PCD token number. \r
139 If the TokenNumber is invalid, the results are unpredictable.\r
140 \r
141 @param[in] TokenNumber The PCD token number. \r
80408db0 142\r
2ab6330e 143 @return The UINT64 value.\r
144 \r
145**/\r
80408db0 146UINT64\r
147EFIAPI\r
148DxePcdGet64 (\r
149 IN UINTN TokenNumber\r
150 )\r
151;\r
152\r
2ab6330e 153/**\r
154 Retrieves a pointer to a value for a given PCD token.\r
155\r
156 Retrieves the current pointer to the buffer for a PCD token number. \r
157 Do not make any assumptions about the alignment of the pointer that \r
158 is returned by this function call. If the TokenNumber is invalid, \r
159 the results are unpredictable.\r
80408db0 160\r
2ab6330e 161 @param[in] TokenNumber The PCD token number. \r
162\r
163 @return The pointer to the buffer to be retrived.\r
164 \r
165**/\r
80408db0 166VOID *\r
167EFIAPI\r
168DxePcdGetPtr (\r
169 IN UINTN TokenNumber\r
170 )\r
171;\r
172\r
2ab6330e 173/**\r
174 Retrieves a Boolean value for a given PCD token.\r
175\r
176 Retrieves the current boolean value for a PCD token number. \r
177 Do not make any assumptions about the alignment of the pointer that \r
178 is returned by this function call. If the TokenNumber is invalid, \r
179 the results are unpredictable.\r
180\r
181 @param[in] TokenNumber The PCD token number. \r
80408db0 182\r
2ab6330e 183 @return The Boolean value.\r
184 \r
185**/\r
80408db0 186BOOLEAN\r
187EFIAPI\r
188DxePcdGetBool (\r
189 IN UINTN TokenNumber\r
190 )\r
191;\r
192\r
2ab6330e 193/**\r
194 Retrieves the size of the value for a given PCD token.\r
195\r
196 Retrieves the current size of a particular PCD token. \r
197 If the TokenNumber is invalid, the results are unpredictable.\r
198\r
199 @param[in] TokenNumber The PCD token number. \r
80408db0 200\r
2ab6330e 201 @return The size of the value for the PCD token.\r
202 \r
203**/\r
80408db0 204UINTN\r
205EFIAPI\r
206DxePcdGetSize (\r
207 IN UINTN TokenNumber\r
208 )\r
209;\r
210\r
2ab6330e 211/**\r
212 Retrieves an 8-bit value for a given PCD token.\r
213\r
214 Retrieves the 8-bit value of a particular PCD token. \r
215 If the TokenNumber is invalid or the token space\r
216 specified by Guid does not exist, the results are \r
217 unpredictable.\r
80408db0 218\r
2ab6330e 219 @param[in] Guid The token space for the token number.\r
220 @param[in] TokenNumber The PCD token number. \r
221\r
222 @return The size 8-bit value for the PCD token.\r
223 \r
224**/\r
80408db0 225UINT8\r
226EFIAPI\r
227DxePcdGet8Ex (\r
228 IN CONST EFI_GUID *Guid,\r
229 IN UINTN TokenNumber\r
230 )\r
231;\r
232\r
2ab6330e 233/**\r
234 Retrieves an 16-bit value for a given PCD token.\r
235\r
236 Retrieves the 16-bit value of a particular PCD token. \r
237 If the TokenNumber is invalid or the token space\r
238 specified by Guid does not exist, the results are \r
239 unpredictable.\r
240\r
241 @param[in] Guid The token space for the token number.\r
242 @param[in] TokenNumber The PCD token number. \r
80408db0 243\r
2ab6330e 244 @return The size 16-bit value for the PCD token.\r
245 \r
246**/\r
80408db0 247UINT16\r
248EFIAPI\r
249DxePcdGet16Ex (\r
250 IN CONST EFI_GUID *Guid,\r
251 IN UINTN TokenNumber\r
252 )\r
253;\r
254\r
2ab6330e 255/**\r
256 Retrieves an 32-bit value for a given PCD token.\r
257\r
258 Retrieves the 32-bit value of a particular PCD token. \r
259 If the TokenNumber is invalid or the token space\r
260 specified by Guid does not exist, the results are \r
261 unpredictable.\r
262\r
263 @param[in] Guid The token space for the token number.\r
264 @param[in] TokenNumber The PCD token number. \r
80408db0 265\r
2ab6330e 266 @return The size 32-bit value for the PCD token.\r
267 \r
268**/\r
80408db0 269UINT32\r
270EFIAPI\r
271DxePcdGet32Ex (\r
272 IN CONST EFI_GUID *Guid,\r
273 IN UINTN TokenNumber\r
274 )\r
275;\r
276\r
2ab6330e 277/**\r
278 Retrieves an 64-bit value for a given PCD token.\r
279\r
280 Retrieves the 64-bit value of a particular PCD token. \r
281 If the TokenNumber is invalid or the token space\r
282 specified by Guid does not exist, the results are \r
283 unpredictable.\r
80408db0 284\r
2ab6330e 285 @param[in] Guid The token space for the token number.\r
286 @param[in] TokenNumber The PCD token number. \r
80408db0 287\r
2ab6330e 288 @return The size 64-bit value for the PCD token.\r
289 \r
290**/\r
80408db0 291UINT64\r
292EFIAPI\r
293DxePcdGet64Ex (\r
294 IN CONST EFI_GUID *Guid,\r
295 IN UINTN TokenNumber\r
296 )\r
297;\r
298\r
2ab6330e 299/**\r
300 Retrieves a pointer to a value for a given PCD token.\r
301\r
302 Retrieves the current pointer to the buffer for a PCD token number. \r
303 Do not make any assumptions about the alignment of the pointer that \r
304 is returned by this function call. If the TokenNumber is invalid, \r
305 the results are unpredictable.\r
80408db0 306\r
2ab6330e 307 @param[in] Guid The token space for the token number.\r
308 @param[in] TokenNumber The PCD token number. \r
80408db0 309\r
2ab6330e 310 @return The pointer to the buffer to be retrived.\r
311 \r
312**/\r
80408db0 313VOID *\r
314EFIAPI\r
315DxePcdGetPtrEx (\r
316 IN CONST EFI_GUID *Guid,\r
317 IN UINTN TokenNumber\r
318 )\r
319;\r
320\r
2ab6330e 321/**\r
322 Retrieves an Boolean value for a given PCD token.\r
323\r
324 Retrieves the Boolean value of a particular PCD token. \r
325 If the TokenNumber is invalid or the token space\r
326 specified by Guid does not exist, the results are \r
327 unpredictable.\r
80408db0 328\r
2ab6330e 329 @param[in] Guid The token space for the token number.\r
330 @param[in] TokenNumber The PCD token number. \r
331\r
332 @return The size Boolean value for the PCD token.\r
333 \r
334**/\r
80408db0 335BOOLEAN\r
336EFIAPI\r
337DxePcdGetBoolEx (\r
338 IN CONST EFI_GUID *Guid,\r
339 IN UINTN TokenNumber\r
340 )\r
341;\r
342\r
2ab6330e 343/**\r
344 Retrieves the size of the value for a given PCD token.\r
345\r
346 Retrieves the current size of a particular PCD token. \r
347 If the TokenNumber is invalid, the results are unpredictable.\r
80408db0 348\r
2ab6330e 349 @param[in] Guid The token space for the token number.\r
350 @param[in] TokenNumber The PCD token number. \r
351\r
352 @return The size of the value for the PCD token.\r
353 \r
354**/\r
80408db0 355UINTN\r
356EFIAPI\r
357DxePcdGetSizeEx (\r
358 IN CONST EFI_GUID *Guid,\r
359 IN UINTN TokenNumber\r
360 )\r
361;\r
362\r
2ab6330e 363/**\r
364 Sets an 8-bit value for a given PCD token.\r
80408db0 365\r
2ab6330e 366 When the PCD service sets a value, it will check to ensure that the \r
367 size of the value being set is compatible with the Token's existing definition. \r
368 If it is not, an error will be returned.\r
369\r
370 @param[in] TokenNumber The PCD token number. \r
371 @param[in] Value The value to set for the PCD token.\r
372\r
373 @retval EFI_SUCCESS Procedure returned successfully.\r
374 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
375 being set was incompatible with a call to this function. \r
376 Use GetSize() to retrieve the size of the target data.\r
377 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
378 \r
379**/\r
80408db0 380EFI_STATUS\r
381EFIAPI\r
382DxePcdSet8 (\r
383 IN UINTN TokenNumber,\r
384 IN UINT8 Value\r
385 )\r
386;\r
387\r
2ab6330e 388/**\r
389 Sets an 16-bit value for a given PCD token.\r
390\r
391 When the PCD service sets a value, it will check to ensure that the \r
392 size of the value being set is compatible with the Token's existing definition. \r
393 If it is not, an error will be returned.\r
394\r
395 @param[in] TokenNumber The PCD token number. \r
396 @param[in] Value The value to set for the PCD token.\r
80408db0 397\r
2ab6330e 398 @retval EFI_SUCCESS Procedure returned successfully.\r
399 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
400 being set was incompatible with a call to this function. \r
401 Use GetSize() to retrieve the size of the target data.\r
402 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
403 \r
404**/\r
80408db0 405EFI_STATUS\r
406EFIAPI\r
407DxePcdSet16 (\r
408 IN UINTN TokenNumber,\r
409 IN UINT16 Value\r
410 )\r
411;\r
412\r
2ab6330e 413/**\r
414 Sets an 32-bit value for a given PCD token.\r
415\r
416 When the PCD service sets a value, it will check to ensure that the \r
417 size of the value being set is compatible with the Token's existing definition. \r
418 If it is not, an error will be returned.\r
419\r
420 @param[in] TokenNumber The PCD token number. \r
421 @param[in] Value The value to set for the PCD token.\r
80408db0 422\r
2ab6330e 423 @retval EFI_SUCCESS Procedure returned successfully.\r
424 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
425 being set was incompatible with a call to this function. \r
426 Use GetSize() to retrieve the size of the target data.\r
427 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
428 \r
429**/\r
80408db0 430EFI_STATUS\r
431EFIAPI\r
432DxePcdSet32 (\r
433 IN UINTN TokenNumber,\r
434 IN UINT32 Value\r
435 )\r
436;\r
437\r
2ab6330e 438/**\r
439 Sets an 64-bit value for a given PCD token.\r
440\r
441 When the PCD service sets a value, it will check to ensure that the \r
442 size of the value being set is compatible with the Token's existing definition. \r
443 If it is not, an error will be returned.\r
80408db0 444\r
2ab6330e 445 @param[in] TokenNumber The PCD token number. \r
446 @param[in] Value The value to set for the PCD token.\r
447\r
448 @retval EFI_SUCCESS Procedure returned successfully.\r
449 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
450 being set was incompatible with a call to this function. \r
451 Use GetSize() to retrieve the size of the target data.\r
452 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
453 \r
454**/\r
80408db0 455EFI_STATUS\r
456EFIAPI\r
457DxePcdSet64 (\r
458 IN UINTN TokenNumber,\r
459 IN UINT64 Value\r
460 )\r
461;\r
462\r
463\r
2ab6330e 464/**\r
465 Sets a value of a specified size for a given PCD token.\r
466\r
467 When the PCD service sets a value, it will check to ensure that the \r
468 size of the value being set is compatible with the Token's existing definition. \r
469 If it is not, an error will be returned.\r
470\r
471 @param[in] TokenNumber The PCD token number. \r
472 @param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token. \r
473 On input, if the SizeOfValue is greater than the maximum size supported \r
474 for this TokenNumber then the output value of SizeOfValue will reflect \r
475 the maximum size supported for this TokenNumber.\r
476 @param[in] Buffer The buffer 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
487DxePcdSetPtr (\r
488 IN UINTN TokenNumber,\r
2ab6330e 489 IN OUT UINTN *SizeOfBuffer,\r
80408db0 490 IN VOID *Buffer\r
491 )\r
492;\r
493\r
2ab6330e 494/**\r
495 Sets an Boolean 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] TokenNumber The PCD token number. \r
502 @param[in] Value The value to set for the PCD token.\r
80408db0 503\r
2ab6330e 504 @retval EFI_SUCCESS Procedure returned successfully.\r
505 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
506 being set was incompatible with a call to this function. \r
507 Use GetSize() to retrieve the size of the target data.\r
508 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
509 \r
510**/\r
80408db0 511EFI_STATUS\r
512EFIAPI\r
513DxePcdSetBool (\r
514 IN UINTN TokenNumber,\r
515 IN BOOLEAN Value\r
516 )\r
517;\r
518\r
519\r
2ab6330e 520/**\r
521 Sets an 8-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
540DxePcdSet8Ex (\r
541 IN CONST EFI_GUID *Guid,\r
542 IN UINTN TokenNumber,\r
543 IN UINT8 Value\r
544 )\r
545;\r
546\r
2ab6330e 547/**\r
548 Sets an 16-bit value for a given PCD token.\r
549\r
550 When the PCD service sets a value, it will check to ensure that the \r
551 size of the value being set is compatible with the Token's existing definition. \r
552 If it is not, an error will be returned.\r
553\r
554 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
555 @param[in] TokenNumber The PCD token number. \r
556 @param[in] Value The value to set for the PCD token.\r
80408db0 557\r
2ab6330e 558 @retval EFI_SUCCESS Procedure returned successfully.\r
559 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
560 being set was incompatible with a call to this function. \r
561 Use GetSize() to retrieve the size of the target data.\r
562 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
563 \r
564**/\r
80408db0 565EFI_STATUS\r
566EFIAPI\r
567DxePcdSet16Ex (\r
568 IN CONST EFI_GUID *Guid,\r
569 IN UINTN TokenNumber,\r
570 IN UINT16 Value\r
571 )\r
572;\r
573\r
2ab6330e 574/**\r
575 Sets an 32-bit value for a given PCD token.\r
576\r
577 When the PCD service sets a value, it will check to ensure that the \r
578 size of the value being set is compatible with the Token's existing definition. \r
579 If it is not, an error will be returned.\r
80408db0 580\r
2ab6330e 581 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
582 @param[in] TokenNumber The PCD token number. \r
583 @param[in] Value The value to set for the PCD token.\r
584\r
585 @retval EFI_SUCCESS Procedure returned successfully.\r
586 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
587 being set was incompatible with a call to this function. \r
588 Use GetSize() to retrieve the size of the target data.\r
589 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
590 \r
591**/\r
80408db0 592EFI_STATUS\r
593EFIAPI\r
594DxePcdSet32Ex (\r
595 IN CONST EFI_GUID *Guid,\r
596 IN UINTN TokenNumber,\r
597 IN UINT32 Value\r
598 )\r
599;\r
600\r
2ab6330e 601/**\r
602 Sets an 64-bit value for a given PCD token.\r
603\r
604 When the PCD service sets a value, it will check to ensure that the \r
605 size of the value being set is compatible with the Token's existing definition. \r
606 If it is not, an error will be returned.\r
607\r
608 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
609 @param[in] TokenNumber The PCD token number. \r
610 @param[in] Value The value to set for the PCD token.\r
80408db0 611\r
2ab6330e 612 @retval EFI_SUCCESS Procedure returned successfully.\r
613 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
614 being set was incompatible with a call to this function. \r
615 Use GetSize() to retrieve the size of the target data.\r
616 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
617 \r
618**/\r
80408db0 619EFI_STATUS\r
620EFIAPI\r
621DxePcdSet64Ex (\r
622 IN CONST EFI_GUID *Guid,\r
623 IN UINTN TokenNumber,\r
624 IN UINT64 Value\r
625 )\r
626;\r
627\r
2ab6330e 628/**\r
629 Sets a value of a specified size for a given PCD token.\r
630\r
631 When the PCD service sets a value, it will check to ensure that the \r
632 size of the value being set is compatible with the Token's existing definition. \r
633 If it is not, an error will be returned.\r
634\r
635 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
636 @param[in] TokenNumber The PCD token number. \r
637 @param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token. \r
638 On input, if the SizeOfValue is greater than the maximum size supported \r
639 for this TokenNumber then the output value of SizeOfValue will reflect \r
640 the maximum size supported for this TokenNumber.\r
641 @param[in] Buffer The buffer to set for the PCD token.\r
642\r
643 @retval EFI_SUCCESS Procedure returned successfully.\r
644 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
645 being set was incompatible with a call to this function. \r
646 Use GetSize() to retrieve the size of the target data.\r
647 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
648 \r
649**/\r
80408db0 650EFI_STATUS\r
651EFIAPI\r
652DxePcdSetPtrEx (\r
653 IN CONST EFI_GUID *Guid,\r
654 IN UINTN TokenNumber,\r
655 IN OUT UINTN *SizeOfBuffer,\r
656 IN VOID *Buffer\r
657 )\r
658;\r
659\r
2ab6330e 660/**\r
661 Sets an Boolean value for a given PCD token.\r
662\r
663 When the PCD service sets a value, it will check to ensure that the \r
664 size of the value being set is compatible with the Token's existing definition. \r
665 If it is not, an error will be returned.\r
666\r
667 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
668 @param[in] TokenNumber The PCD token number. \r
669 @param[in] Value The value to set for the PCD token.\r
80408db0 670\r
2ab6330e 671 @retval EFI_SUCCESS Procedure returned successfully.\r
672 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data \r
673 being set was incompatible with a call to this function. \r
674 Use GetSize() to retrieve the size of the target data.\r
675 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
676 \r
677**/\r
80408db0 678EFI_STATUS\r
679EFIAPI\r
680DxePcdSetBoolEx (\r
681 IN CONST EFI_GUID *Guid,\r
682 IN UINTN TokenNumber,\r
683 IN BOOLEAN Value\r
684 )\r
685;\r
686\r
2ab6330e 687/**\r
688 Specifies a function to be called anytime the value of a designated token is changed.\r
689\r
690 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
691 @param[in] TokenNumber The PCD token number. \r
692 @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set. \r
80408db0 693\r
2ab6330e 694 @retval EFI_SUCCESS The PCD service has successfully established a call event \r
695 for the CallBackToken requested.\r
696 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.\r
80408db0 697\r
2ab6330e 698**/\r
80408db0 699EFI_STATUS\r
700EFIAPI\r
701DxeRegisterCallBackOnSet (\r
702 IN CONST EFI_GUID *Guid, OPTIONAL\r
703 IN UINTN TokenNumber,\r
704 IN PCD_PROTOCOL_CALLBACK CallBackFunction\r
705 )\r
706;\r
707\r
2ab6330e 708/**\r
709 Cancels a previously set callback function for a particular PCD token number.\r
710\r
711 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
712 @param[in] TokenNumber The PCD token number. \r
713 @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set. \r
714\r
715 @retval EFI_SUCCESS The PCD service has successfully established a call event \r
716 for the CallBackToken requested.\r
717 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.\r
80408db0 718\r
2ab6330e 719**/\r
80408db0 720EFI_STATUS\r
721EFIAPI\r
722DxeUnRegisterCallBackOnSet (\r
723 IN CONST EFI_GUID *Guid, OPTIONAL\r
724 IN UINTN TokenNumber,\r
725 IN PCD_PROTOCOL_CALLBACK CallBackFunction\r
726 )\r
727;\r
728\r
2ab6330e 729/**\r
730 Retrieves the next valid PCD token for a given namespace.\r
731\r
732 @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r
733 @param[in, out] TokenNumber A pointer to the PCD token number to use to find the subsequent token number. \r
734 If the input token namespace or token number does not exist on the platform, \r
735 an error is returned and the value of *TokenNumber is undefined. To retrieve the "first" token, \r
736 have the pointer reference a TokenNumber value of 0. If the input token number is 0 and \r
737 there is no valid token number for this token namespace, *TokenNumber will be assigned to \r
738 0 and the function return EFI_SUCCESS. If the token number is the last valid token number, \r
739 *TokenNumber will be assigned to 0 and the function return EFI_SUCCESS.\r
740\r
741 @retval EFI_SUCCESS The PCD service retrieved the next valid token number. Or the input token number \r
742 is already the last valid token number in the PCD database. \r
743 In the later case, *TokenNumber is updated with the value of 0.\r
744 @retval EFI_NOT_FOUND If this input token number and token namespace does not exist on the platform.\r
80408db0 745\r
2ab6330e 746**/\r
80408db0 747EFI_STATUS\r
748EFIAPI\r
749DxePcdGetNextToken (\r
750 IN CONST EFI_GUID *Guid, OPTIONAL\r
751 IN OUT UINTN *TokenNumber\r
752 )\r
753;\r
754\r
2ab6330e 755/**\r
756 Get next token space in PCD database according to given token space guid.\r
757 \r
758 This routine is enable only when feature flag PCD PcdDxePcdDatabaseTraverseEnabled \r
759 is TRUE.\r
760 \r
761 @param Guid Given token space guid. If NULL, then Guid will be set to \r
762 the first PCD token space in PCD database, If not NULL, then\r
763 Guid will be set to next PCD token space.\r
764\r
765 @retval EFI_UNSUPPORTED If feature flag PCD PcdDxePcdDatabaseTraverseEnabled is FALSE.\r
766 @retval EFI_NOT_FOUND If PCD database has no token space table or can not find given\r
767 token space in PCD database.\r
768 @retval EFI_SUCCESS Success to get next token space guid.\r
769**/\r
80408db0 770EFI_STATUS\r
771EFIAPI\r
772DxePcdGetNextTokenSpace (\r
773 IN OUT CONST EFI_GUID **Guid\r
774 )\r
775;\r
776\r
80408db0 777typedef struct {\r
778 LIST_ENTRY Node;\r
779 PCD_PROTOCOL_CALLBACK CallbackFn;\r
780} CALLBACK_FN_ENTRY;\r
781\r
782#define CR_FNENTRY_FROM_LISTNODE(Record, Type, Field) _CR(Record, Type, Field)\r
783\r
784//\r
785// Internal Functions\r
786//\r
787\r
2ab6330e 788/**\r
789 Wrapper function for setting non-pointer type value for a PCD entry.\r
790\r
791 @param TokenNumber Pcd token number autogenerated by build tools.\r
792 @param Data Value want to be set for PCD entry\r
793 @param Size Size of value.\r
794\r
795 @return status of SetWorker.\r
796\r
797**/\r
80408db0 798EFI_STATUS\r
799SetValueWorker (\r
800 IN UINTN TokenNumber,\r
801 IN VOID *Data,\r
802 IN UINTN Size\r
803 )\r
804;\r
805\r
2ab6330e 806/**\r
807 Set value for an PCD entry\r
808\r
809 @param TokenNumber Pcd token number autogenerated by build tools.\r
810 @param Data Value want to be set for PCD entry\r
811 @param Size Size of value.\r
812 @param PtrType If TRUE, the type of PCD entry's value is Pointer.\r
813 If False, the type of PCD entry's value is not Pointer.\r
814\r
815 @retval EFI_INVALID_PARAMETER If this PCD type is VPD, VPD PCD can not be set.\r
816 @retval EFI_INVALID_PARAMETER If Size can not be set to size table.\r
817 @retval EFI_NOT_FOUND If value type of PCD entry is intergrate, but not in\r
818 range of UINT8, UINT16, UINT32, UINT64\r
819 @retval EFI_NOT_FOUND Can not find the PCD type according to token number. \r
820**/\r
80408db0 821EFI_STATUS\r
822SetWorker (\r
823 IN UINTN TokenNumber,\r
824 IN VOID *Data,\r
825 IN OUT UINTN *Size,\r
826 IN BOOLEAN PtrType\r
827 )\r
828;\r
829\r
2ab6330e 830/**\r
831 Wrapper function for set PCD value for non-Pointer type dynamic-ex PCD.\r
832\r
833 @param ExTokenNumber Token number for dynamic-ex PCD.\r
834 @param Guid Token space guid for dynamic-ex PCD.\r
835 @param Data Value want to be set.\r
836 @param SetSize The size of value.\r
80408db0 837\r
2ab6330e 838 @return status of ExSetWorker().\r
839\r
840**/\r
80408db0 841EFI_STATUS\r
842ExSetValueWorker (\r
843 IN UINTN ExTokenNumber,\r
844 IN CONST EFI_GUID *Guid,\r
845 IN VOID *Data,\r
846 IN UINTN SetSize\r
847 )\r
848;\r
849\r
2ab6330e 850/**\r
851 Set value for a dynamic PCD entry.\r
852 \r
853 This routine find the local token number according to dynamic-ex PCD's token \r
854 space guid and token number firstly, and invoke callback function if this PCD\r
855 entry registered callback function. Finally, invoken general SetWorker to set\r
856 PCD value.\r
857 \r
858 @param ExTokenNumber Dynamic-ex PCD token number.\r
859 @param Guid Token space guid for dynamic-ex PCD.\r
860 @param Data PCD value want to be set\r
861 @param SetSize Size of value.\r
862 @param PtrType If TRUE, this PCD entry is pointer type.\r
863 If FALSE, this PCD entry is not pointer type.\r
864\r
865 @return status of SetWorker().\r
80408db0 866\r
2ab6330e 867**/\r
80408db0 868EFI_STATUS\r
869ExSetWorker (\r
870 IN UINTN ExTokenNumber,\r
871 IN CONST EFI_GUID *Guid,\r
872 IN VOID *Data,\r
873 IN OUT UINTN *Size,\r
874 IN BOOLEAN PtrType\r
875 )\r
876;\r
877\r
2ab6330e 878/**\r
879 Get the PCD entry pointer in PCD database.\r
880 \r
881 This routine will visit PCD database to find the PCD entry according to given\r
882 token number. The given token number is autogened by build tools and it will be \r
883 translated to local token number. Local token number contains PCD's type and \r
884 offset of PCD entry in PCD database.\r
885\r
886 @param TokenNumber Token's number, it is autogened by build tools\r
887 @param GetSize The size of token's value\r
80408db0 888\r
2ab6330e 889 @return PCD entry pointer in PCD database\r
890\r
891**/\r
80408db0 892VOID *\r
893GetWorker (\r
894 IN UINTN TokenNumber,\r
895 IN UINTN GetSize\r
896 )\r
897;\r
898\r
2ab6330e 899/**\r
900 Wrapper function for get PCD value for dynamic-ex PCD.\r
901\r
902 @param Guid Token space guid for dynamic-ex PCD.\r
903 @param ExTokenNumber Token number for dyanmic-ex PCD.\r
904 @param GetSize The size of dynamic-ex PCD value.\r
905\r
906 @return PCD entry in PCD database.\r
907\r
908**/\r
80408db0 909VOID *\r
910ExGetWorker (\r
911 IN CONST EFI_GUID *Guid,\r
912 IN UINTN ExTokenNumber,\r
913 IN UINTN GetSize\r
c52fa98c 914 )\r
80408db0 915;\r
916\r
2ab6330e 917/**\r
918 Find the local token number according to system SKU ID.\r
919\r
920 @param LocalTokenNumber PCD token number\r
921 @param Size The size of PCD entry.\r
922 @param IsPeiDb If TRUE, the PCD entry is initialized in PEI phase.\r
923 If False, the PCD entry is initialized in DXE phase.\r
924\r
925 @return Token number according to system SKU ID.\r
926\r
927**/\r
80408db0 928UINT32\r
929GetSkuEnabledTokenNumber (\r
930 UINT32 LocalTokenNumber,\r
931 UINTN Size,\r
932 BOOLEAN IsPeiDb\r
c52fa98c 933 )\r
80408db0 934;\r
935\r
2ab6330e 936/**\r
937 Get Variable which contains HII type PCD entry.\r
938\r
939 @param VariableGuid Variable's guid\r
940 @param VariableName Variable's unicode name string\r
941 @param VariableData Variable's data pointer, \r
942 @param VariableSize Variable's size.\r
943\r
944 @return the status of gRT->GetVariable\r
945**/\r
80408db0 946EFI_STATUS\r
947GetHiiVariable (\r
948 IN EFI_GUID *VariableGuid,\r
949 IN UINT16 *VariableName,\r
950 OUT UINT8 **VariableData,\r
951 OUT UINTN *VariableSize\r
952 )\r
953;\r
954\r
2ab6330e 955/**\r
956 Set value for HII-type PCD.\r
957\r
958 A HII-type PCD's value is stored in a variable. Setting/Getting the value of \r
959 HII-type PCD is to visit this variable.\r
960 \r
961 @param VariableGuid Guid of variable which stored value of a HII-type PCD.\r
962 @param VariableName Unicode name of variable which stored value of a HII-type PCD.\r
963 @param Data Value want to be set.\r
964 @param DataSize Size of value\r
965 @param Offset Value offset of HII-type PCD in variable.\r
966\r
967 @return status of GetVariable()/SetVariable().\r
968\r
969**/\r
80408db0 970EFI_STATUS\r
971SetHiiVariable (\r
972 IN EFI_GUID *VariableGuid,\r
973 IN UINT16 *VariableName,\r
974 IN CONST VOID *Data,\r
975 IN UINTN DataSize,\r
976 IN UINTN Offset\r
977 )\r
978;\r
979\r
2ab6330e 980/**\r
981 Register the callback function for a PCD entry.\r
982\r
983 This routine will register a callback function to a PCD entry by given token number\r
984 and token space guid.\r
985 \r
986 @param TokenNumber PCD token's number, it is autogened by build tools.\r
987 @param Guid PCD token space's guid, \r
988 if not NULL, this PCD is dynamicEx type PCD.\r
989 @param CallBackFunction Callback function pointer\r
990\r
991 @return EFI_SUCCESS Always success for registering callback function.\r
992\r
993**/\r
80408db0 994EFI_STATUS\r
995DxeRegisterCallBackWorker (\r
996 IN UINTN TokenNumber,\r
997 IN CONST EFI_GUID *Guid, OPTIONAL\r
998 IN PCD_PROTOCOL_CALLBACK CallBackFunction\r
2ab6330e 999 )\r
1000;\r
1001\r
1002/**\r
1003 UnRegister the callback function for a PCD entry.\r
80408db0 1004\r
2ab6330e 1005 This routine will unregister a callback function to a PCD entry by given token number\r
1006 and token space guid.\r
1007\r
1008 @param TokenNumber PCD token's number, it is autogened by build tools.\r
1009 @param Guid PCD token space's guid.\r
1010 if not NULL, this PCD is dynamicEx type PCD.\r
1011 @param CallBackFunction Callback function pointer\r
1012\r
1013 @retval EFI_SUCCESS Callback function is success to be unregister.\r
1014 @retval EFI_INVALID_PARAMETER Can not find the PCD entry by given token number.\r
1015**/\r
80408db0 1016EFI_STATUS\r
1017DxeUnRegisterCallBackWorker (\r
1018 IN UINTN TokenNumber,\r
1019 IN CONST EFI_GUID *Guid, OPTIONAL\r
1020 IN PCD_PROTOCOL_CALLBACK CallBackFunction\r
2ab6330e 1021 )\r
1022;\r
80408db0 1023\r
2ab6330e 1024/**\r
1025 Initialize the PCD database in DXE phase.\r
1026 \r
1027 PCD database in DXE phase also contains PCD database in PEI phase which is copied\r
1028 from GUID Hob.\r
1029\r
1030**/\r
80408db0 1031VOID\r
1032BuildPcdDxeDataBase (\r
1033 VOID\r
2ab6330e 1034 )\r
1035;\r
80408db0 1036\r
2ab6330e 1037/**\r
1038 Get local token number according to dynamic-ex PCD's {token space guid:token number}\r
80408db0 1039\r
2ab6330e 1040 A dynamic-ex type PCD, developer must provide pair of token space guid: token number\r
1041 in DEC file. PCD database maintain a mapping table that translate pair of {token\r
1042 space guid: token number} to local token number.\r
1043 \r
1044 @param Guid Token space guid for dynamic-ex PCD entry.\r
1045 @param ExTokenNumber EDES_TODO: Add parameter description\r
1046\r
1047 @return local token number for dynamic-ex PCD.\r
1048\r
1049**/\r
c52fa98c 1050UINTN\r
80408db0 1051GetExPcdTokenNumber (\r
1052 IN CONST EFI_GUID *Guid,\r
1053 IN UINT32 ExTokenNumber\r
1054 )\r
1055;\r
1056\r
2ab6330e 1057/**\r
1058 Get next token number in given token space.\r
1059 \r
1060 This routine is used for dynamicEx type PCD. It will firstly scan token space\r
1061 table to get token space according to given token space guid. Then scan given \r
1062 token number in found token space, if found, then return next token number in \r
1063 this token space.\r
1064\r
1065 @param Guid Token space guid. Next token number will be scaned in \r
1066 this token space.\r
1067 @param TokenNumber Token number. \r
1068 If PCD_INVALID_TOKEN_NUMBER, return first token number in \r
1069 token space table.\r
1070 If not PCD_INVALID_TOKEN_NUMBER, return next token number\r
1071 in token space table.\r
1072 @param GuidTable Token space guid table. It will be used for scan token space\r
1073 by given token space guid.\r
1074 @param SizeOfGuidTable The size of guid table.\r
1075 @param ExMapTable DynamicEx token number mapping table.\r
1076 @param SizeOfExMapTable The size of dynamicEx token number mapping table.\r
1077\r
1078 @retval EFI_NOT_FOUND Can not given token space or token number.\r
1079 @retval EFI_SUCCESS Success to get next token number.\r
80408db0 1080\r
2ab6330e 1081**/\r
c52fa98c 1082EFI_STATUS\r
80408db0 1083ExGetNextTokeNumber (\r
1084 IN CONST EFI_GUID *Guid,\r
1085 IN OUT UINTN *TokenNumber,\r
1086 IN EFI_GUID *GuidTable,\r
1087 IN UINTN SizeOfGuidTable,\r
1088 IN DYNAMICEX_MAPPING *ExMapTable,\r
1089 IN UINTN SizeOfExMapTable\r
1090 )\r
1091;\r
1092\r
2ab6330e 1093/**\r
1094 Get size of POINTER type PCD value.\r
80408db0 1095\r
2ab6330e 1096 @param LocalTokenNumberTableIdx Index of local token number in local token number table.\r
1097 @param MaxSize Maxmium size of POINTER type PCD value.\r
1098\r
1099 @return size of POINTER type PCD value.\r
1100\r
1101**/\r
80408db0 1102UINTN\r
1103GetPtrTypeSize (\r
1104 IN UINTN LocalTokenNumberTableIdx,\r
1105 OUT UINTN *MaxSize\r
1106 )\r
1107;\r
1108\r
2ab6330e 1109/**\r
1110 Set size of POINTER type PCD value. The size should not exceed the maxmium size\r
1111 of this PCD value.\r
80408db0 1112\r
2ab6330e 1113 @param LocalTokenNumberTableIdx Index of local token number in local token number table.\r
1114 @param CurrentSize Size of POINTER type PCD value.\r
80408db0 1115\r
2ab6330e 1116 @retval TRUE Success to set size of PCD value.\r
1117 @retval FALSE Fail to set size of PCD value.\r
1118**/\r
80408db0 1119BOOLEAN\r
1120SetPtrTypeSize (\r
1121 IN UINTN LocalTokenNumberTableIdx,\r
1122 IN OUT UINTN *CurrentSize\r
1123 )\r
1124;\r
1125\r
1126extern EFI_GUID gPcdDataBaseHobGuid;\r
1127\r
1128extern PCD_DATABASE * mPcdDatabase;\r
1129\r
1130extern DXE_PCD_DATABASE_INIT gDXEPcdDbInit;\r
1131\r
1132extern EFI_LOCK mPcdDatabaseLock;\r
1133\r
1134#endif\r