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