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