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