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