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