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