Commit | Line | Data |
---|---|---|
80408db0 | 1 | /** @file\r |
2 | Private functions used by PCD DXE driver.\r | |
3 | \r | |
d1102dba | 4 | Copyright (c) 2006 - 2018, 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 | |
7c736265 | 42 | #define PCD_SERVICE_DXE_VERSION 7\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 | |
d1102dba | 112 | SetSku() sets the SKU Id to be used for subsequent calls to set or get PCD values.\r |
2ab6330e | 113 | SetSku() is normally called only once by the system.\r |
114 | \r | |
d1102dba LG |
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 | |
2ab6330e | 124 | set for that Id, the results are unpredictable.\r |
125 | \r | |
d1102dba | 126 | @param[in] SkuId The SKU value that will be used when the PCD service will retrieve and\r |
2ab6330e | 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 | |
d1102dba | 139 | Retrieves the current byte-sized value for a PCD token number.\r |
2ab6330e | 140 | If the TokenNumber is invalid, the results are unpredictable.\r |
d1102dba LG |
141 | \r |
142 | @param[in] TokenNumber The PCD token number.\r | |
80408db0 | 143 | \r |
2ab6330e | 144 | @return The UINT8 value.\r |
d1102dba | 145 | \r |
2ab6330e | 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 |
d1102dba | 156 | Retrieves the current 16-bits value for a PCD token number.\r |
2ab6330e | 157 | If the TokenNumber is invalid, the results are unpredictable.\r |
d1102dba LG |
158 | \r |
159 | @param[in] TokenNumber The PCD token number.\r | |
2ab6330e | 160 | \r |
161 | @return The UINT16 value.\r | |
d1102dba | 162 | \r |
2ab6330e | 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 |
d1102dba | 173 | Retrieves the current 32-bits value for a PCD token number.\r |
2ab6330e | 174 | If the TokenNumber is invalid, the results are unpredictable.\r |
d1102dba LG |
175 | \r |
176 | @param[in] TokenNumber The PCD token number.\r | |
2ab6330e | 177 | \r |
178 | @return The UINT32 value.\r | |
d1102dba | 179 | \r |
2ab6330e | 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 | |
d1102dba | 190 | Retrieves the current 64-bits value for a PCD token number.\r |
2ab6330e | 191 | If the TokenNumber is invalid, the results are unpredictable.\r |
d1102dba LG |
192 | \r |
193 | @param[in] TokenNumber The PCD token number.\r | |
80408db0 | 194 | \r |
2ab6330e | 195 | @return The UINT64 value.\r |
d1102dba | 196 | \r |
2ab6330e | 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 | |
d1102dba LG |
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 | |
2ab6330e | 210 | the results are unpredictable.\r |
80408db0 | 211 | \r |
d1102dba | 212 | @param[in] TokenNumber The PCD token number.\r |
2ab6330e | 213 | \r |
3fd8027e | 214 | @return The pointer to the buffer to be retrieved.\r |
d1102dba | 215 | \r |
2ab6330e | 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 | |
d1102dba LG |
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 | |
2ab6330e | 229 | the results are unpredictable.\r |
230 | \r | |
d1102dba | 231 | @param[in] TokenNumber The PCD token number.\r |
80408db0 | 232 | \r |
2ab6330e | 233 | @return The Boolean value.\r |
d1102dba | 234 | \r |
2ab6330e | 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 | |
d1102dba | 245 | Retrieves the current size of a particular PCD token.\r |
2ab6330e | 246 | If the TokenNumber is invalid, the results are unpredictable.\r |
247 | \r | |
d1102dba | 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 |
d1102dba | 251 | \r |
2ab6330e | 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 | |
d1102dba | 262 | Retrieves the 8-bit value of a particular PCD token.\r |
2ab6330e | 263 | If the TokenNumber is invalid or the token space\r |
d1102dba | 264 | specified by Guid does not exist, the results are\r |
2ab6330e | 265 | unpredictable.\r |
80408db0 | 266 | \r |
2ab6330e | 267 | @param[in] Guid The token space for the token number.\r |
d1102dba | 268 | @param[in] TokenNumber The PCD token number.\r |
2ab6330e | 269 | \r |
270 | @return The size 8-bit value for the PCD token.\r | |
d1102dba | 271 | \r |
2ab6330e | 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 | |
d1102dba | 283 | Retrieves the 16-bit value of a particular PCD token.\r |
2ab6330e | 284 | If the TokenNumber is invalid or the token space\r |
d1102dba | 285 | specified by Guid does not exist, the results are\r |
2ab6330e | 286 | unpredictable.\r |
287 | \r | |
288 | @param[in] Guid The token space for the token number.\r | |
d1102dba | 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 |
d1102dba | 292 | \r |
2ab6330e | 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 | |
d1102dba | 304 | Retrieves the 32-bit value of a particular PCD token.\r |
2ab6330e | 305 | If the TokenNumber is invalid or the token space\r |
d1102dba | 306 | specified by Guid does not exist, the results are\r |
2ab6330e | 307 | unpredictable.\r |
308 | \r | |
309 | @param[in] Guid The token space for the token number.\r | |
d1102dba | 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 |
d1102dba | 313 | \r |
2ab6330e | 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 | |
d1102dba | 325 | Retrieves the 64-bit value of a particular PCD token.\r |
2ab6330e | 326 | If the TokenNumber is invalid or the token space\r |
d1102dba | 327 | specified by Guid does not exist, the results are\r |
2ab6330e | 328 | unpredictable.\r |
80408db0 | 329 | \r |
2ab6330e | 330 | @param[in] Guid The token space for the token number.\r |
d1102dba | 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 |
d1102dba | 334 | \r |
2ab6330e | 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 | |
d1102dba LG |
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 | |
2ab6330e | 349 | the results are unpredictable.\r |
80408db0 | 350 | \r |
2ab6330e | 351 | @param[in] Guid The token space for the token number.\r |
d1102dba | 352 | @param[in] TokenNumber The PCD token number.\r |
80408db0 | 353 | \r |
3fd8027e | 354 | @return The pointer to the buffer to be retrieved.\r |
d1102dba | 355 | \r |
2ab6330e | 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 | |
d1102dba | 367 | Retrieves the Boolean value of a particular PCD token.\r |
2ab6330e | 368 | If the TokenNumber is invalid or the token space\r |
d1102dba | 369 | specified by Guid does not exist, the results are\r |
2ab6330e | 370 | unpredictable.\r |
80408db0 | 371 | \r |
2ab6330e | 372 | @param[in] Guid The token space for the token number.\r |
d1102dba | 373 | @param[in] TokenNumber The PCD token number.\r |
2ab6330e | 374 | \r |
375 | @return The size Boolean value for the PCD token.\r | |
d1102dba | 376 | \r |
2ab6330e | 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 | |
d1102dba | 388 | Retrieves the current size of a particular PCD token.\r |
2ab6330e | 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 |
d1102dba | 392 | @param[in] TokenNumber The PCD token number.\r |
2ab6330e | 393 | \r |
394 | @return The size of the value for the PCD token.\r | |
d1102dba | 395 | \r |
2ab6330e | 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 |
d1102dba LG |
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 | |
2ab6330e | 409 | If it is not, an error will be returned.\r |
410 | \r | |
d1102dba | 411 | @param[in] TokenNumber The PCD token number.\r |
2ab6330e | 412 | @param[in] Value The value to set for the PCD token.\r |
413 | \r | |
414 | @retval EFI_SUCCESS Procedure returned successfully.\r | |
d1102dba LG |
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 | |
2ab6330e | 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 | |
d1102dba | 419 | \r |
2ab6330e | 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 | |
d1102dba LG |
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 | |
2ab6330e | 433 | If it is not, an error will be returned.\r |
434 | \r | |
d1102dba | 435 | @param[in] TokenNumber The PCD token number.\r |
2ab6330e | 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 |
d1102dba LG |
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 | |
2ab6330e | 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 | |
d1102dba | 443 | \r |
2ab6330e | 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 | |
d1102dba LG |
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 | |
2ab6330e | 457 | If it is not, an error will be returned.\r |
458 | \r | |
d1102dba | 459 | @param[in] TokenNumber The PCD token number.\r |
2ab6330e | 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 |
d1102dba LG |
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 | |
2ab6330e | 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 | |
d1102dba | 467 | \r |
2ab6330e | 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 | |
d1102dba LG |
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 | |
2ab6330e | 481 | If it is not, an error will be returned.\r |
80408db0 | 482 | \r |
d1102dba | 483 | @param[in] TokenNumber The PCD token number.\r |
2ab6330e | 484 | @param[in] Value The value to set for the PCD token.\r |
485 | \r | |
486 | @retval EFI_SUCCESS Procedure returned successfully.\r | |
d1102dba LG |
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 | |
2ab6330e | 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 | |
d1102dba | 491 | \r |
2ab6330e | 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 | |
d1102dba LG |
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 | |
2ab6330e | 506 | If it is not, an error will be returned.\r |
507 | \r | |
d1102dba LG |
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 | |
2ab6330e | 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 | |
d1102dba LG |
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 | |
2ab6330e | 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 | |
d1102dba | 520 | \r |
2ab6330e | 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 | |
d1102dba LG |
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 | |
2ab6330e | 535 | If it is not, an error will be returned.\r |
536 | \r | |
d1102dba | 537 | @param[in] TokenNumber The PCD token number.\r |
2ab6330e | 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 |
d1102dba LG |
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 | |
2ab6330e | 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 | |
d1102dba | 545 | \r |
2ab6330e | 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 | |
d1102dba LG |
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 | |
2ab6330e | 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 | |
d1102dba | 563 | @param[in] TokenNumber The PCD token number.\r |
2ab6330e | 564 | @param[in] Value The value to set for the PCD token.\r |
565 | \r | |
566 | @retval EFI_SUCCESS Procedure returned successfully.\r | |
d1102dba LG |
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 | |
2ab6330e | 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 | |
d1102dba | 571 | \r |
2ab6330e | 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 | |
d1102dba LG |
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 | |
2ab6330e | 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 | |
d1102dba | 589 | @param[in] TokenNumber The PCD token number.\r |
2ab6330e | 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 |
d1102dba LG |
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 | |
2ab6330e | 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 | |
d1102dba | 597 | \r |
2ab6330e | 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 | |
d1102dba LG |
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 | |
2ab6330e | 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 |
d1102dba | 615 | @param[in] TokenNumber The PCD token number.\r |
2ab6330e | 616 | @param[in] Value The value to set for the PCD token.\r |
617 | \r | |
618 | @retval EFI_SUCCESS Procedure returned successfully.\r | |
d1102dba LG |
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 | |
2ab6330e | 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 | |
d1102dba | 623 | \r |
2ab6330e | 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 | |
d1102dba LG |
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 | |
2ab6330e | 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 | |
d1102dba | 641 | @param[in] TokenNumber The PCD token number.\r |
2ab6330e | 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 |
d1102dba LG |
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 | |
2ab6330e | 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 | |
d1102dba | 649 | \r |
2ab6330e | 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 | |
d1102dba LG |
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 | |
2ab6330e | 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 | |
d1102dba LG |
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 | |
2ab6330e | 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 | |
d1102dba LG |
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 | |
2ab6330e | 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 | |
d1102dba | 679 | \r |
2ab6330e | 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 | |
d1102dba LG |
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 | |
2ab6330e | 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 | |
d1102dba | 698 | @param[in] TokenNumber The PCD token number.\r |
2ab6330e | 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 |
d1102dba LG |
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 | |
2ab6330e | 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 | |
d1102dba | 706 | \r |
2ab6330e | 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 | |
d1102dba LG |
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 |
d1102dba | 723 | @retval EFI_SUCCESS The PCD service has successfully established a call event\r |
2ab6330e | 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 | |
d1102dba LG |
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 | |
2ab6330e | 742 | \r |
d1102dba | 743 | @retval EFI_SUCCESS The PCD service has successfully established a call event\r |
2ab6330e | 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 |
d1102dba LG |
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 | |
90e06556 | 769 | If TokenNumber is not present in the token space specified by Guid, then EFI_NOT_FOUND is returned.\r |
770 | \r | |
771 | \r | |
d1102dba LG |
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 | |
90e06556 | 774 | being made to retrieve tokens from the default token space.\r |
d1102dba LG |
775 | @param[in, out] TokenNumber\r |
776 | A pointer to the PCD token number to use to find the subsequent token number.\r | |
90e06556 | 777 | \r |
d1102dba LG |
778 | @retval EFI_SUCCESS The PCD service retrieved the next valid token number. Or the input token number\r |
779 | is already the last valid token number in the PCD database.\r | |
2ab6330e | 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 | |
d1102dba LG |
793 | \r |
794 | @param Guid Given token space guid. If NULL, then Guid will be set to\r | |
2ab6330e | 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 | |
d1102dba | 828 | The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.\r |
96d6d004 SZ |
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 | |
d1102dba | 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 | |
d1102dba | 871 | @retval EFI_NOT_FOUND Can not find the PCD type according to token number.\r |
2ab6330e | 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 | |
d1102dba LG |
902 | \r |
903 | This routine find the local token number according to dynamic-ex PCD's token\r | |
2ab6330e | 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 | |
d1102dba | 907 | \r |
2ab6330e | 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 | |
d1102dba | 929 | \r |
2ab6330e | 930 | This routine will visit PCD database to find the PCD entry according to given\r |
d1102dba LG |
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 | |
2ab6330e | 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 | Get Variable which contains HII type PCD entry.\r | |
966 | \r | |
967 | @param VariableGuid Variable's guid\r | |
968 | @param VariableName Variable's unicode name string\r | |
d1102dba | 969 | @param VariableData Variable's data pointer,\r |
2ab6330e | 970 | @param VariableSize Variable's size.\r |
971 | \r | |
972 | @return the status of gRT->GetVariable\r | |
973 | **/\r | |
80408db0 | 974 | EFI_STATUS\r |
975 | GetHiiVariable (\r | |
976 | IN EFI_GUID *VariableGuid,\r | |
977 | IN UINT16 *VariableName,\r | |
978 | OUT UINT8 **VariableData,\r | |
979 | OUT UINTN *VariableSize\r | |
ed66e1bc | 980 | );\r |
80408db0 | 981 | \r |
2ab6330e | 982 | /**\r |
983 | Set value for HII-type PCD.\r | |
984 | \r | |
d1102dba | 985 | A HII-type PCD's value is stored in a variable. Setting/Getting the value of\r |
2ab6330e | 986 | HII-type PCD is to visit this variable.\r |
d1102dba | 987 | \r |
2ab6330e | 988 | @param VariableGuid Guid of variable which stored value of a HII-type PCD.\r |
989 | @param VariableName Unicode name of variable which stored value of a HII-type PCD.\r | |
23f3e119 | 990 | @param SetAttributes Attributes bitmask to set for the variable.\r |
2ab6330e | 991 | @param Data Value want to be set.\r |
992 | @param DataSize Size of value\r | |
993 | @param Offset Value offset of HII-type PCD in variable.\r | |
994 | \r | |
995 | @return status of GetVariable()/SetVariable().\r | |
996 | \r | |
997 | **/\r | |
80408db0 | 998 | EFI_STATUS\r |
999 | SetHiiVariable (\r | |
1000 | IN EFI_GUID *VariableGuid,\r | |
1001 | IN UINT16 *VariableName,\r | |
23f3e119 | 1002 | IN UINT32 SetAttributes,\r |
80408db0 | 1003 | IN CONST VOID *Data,\r |
1004 | IN UINTN DataSize,\r | |
1005 | IN UINTN Offset\r | |
ed66e1bc | 1006 | );\r |
80408db0 | 1007 | \r |
2ab6330e | 1008 | /**\r |
1009 | Register the callback function for a PCD entry.\r | |
1010 | \r | |
1011 | This routine will register a callback function to a PCD entry by given token number\r | |
1012 | and token space guid.\r | |
d1102dba | 1013 | \r |
2ab6330e | 1014 | @param TokenNumber PCD token's number, it is autogened by build tools.\r |
d1102dba | 1015 | @param Guid PCD token space's guid,\r |
2ab6330e | 1016 | if not NULL, this PCD is dynamicEx type PCD.\r |
1017 | @param CallBackFunction Callback function pointer\r | |
1018 | \r | |
1019 | @return EFI_SUCCESS Always success for registering callback function.\r | |
1020 | \r | |
1021 | **/\r | |
80408db0 | 1022 | EFI_STATUS\r |
1023 | DxeRegisterCallBackWorker (\r | |
1024 | IN UINTN TokenNumber,\r | |
1025 | IN CONST EFI_GUID *Guid, OPTIONAL\r | |
1026 | IN PCD_PROTOCOL_CALLBACK CallBackFunction\r | |
ed66e1bc | 1027 | );\r |
2ab6330e | 1028 | \r |
1029 | /**\r | |
1030 | UnRegister the callback function for a PCD entry.\r | |
80408db0 | 1031 | \r |
2ab6330e | 1032 | This routine will unregister a callback function to a PCD entry by given token number\r |
1033 | and token space guid.\r | |
1034 | \r | |
1035 | @param TokenNumber PCD token's number, it is autogened by build tools.\r | |
1036 | @param Guid PCD token space's guid.\r | |
1037 | if not NULL, this PCD is dynamicEx type PCD.\r | |
1038 | @param CallBackFunction Callback function pointer\r | |
1039 | \r | |
1040 | @retval EFI_SUCCESS Callback function is success to be unregister.\r | |
1041 | @retval EFI_INVALID_PARAMETER Can not find the PCD entry by given token number.\r | |
1042 | **/\r | |
80408db0 | 1043 | EFI_STATUS\r |
1044 | DxeUnRegisterCallBackWorker (\r | |
1045 | IN UINTN TokenNumber,\r | |
1046 | IN CONST EFI_GUID *Guid, OPTIONAL\r | |
1047 | IN PCD_PROTOCOL_CALLBACK CallBackFunction\r | |
ed66e1bc | 1048 | );\r |
80408db0 | 1049 | \r |
2ab6330e | 1050 | /**\r |
1051 | Initialize the PCD database in DXE phase.\r | |
d1102dba | 1052 | \r |
2ab6330e | 1053 | PCD database in DXE phase also contains PCD database in PEI phase which is copied\r |
1054 | from GUID Hob.\r | |
1055 | \r | |
1056 | **/\r | |
80408db0 | 1057 | VOID\r |
1058 | BuildPcdDxeDataBase (\r | |
1059 | VOID\r | |
ed66e1bc | 1060 | );\r |
80408db0 | 1061 | \r |
2ab6330e | 1062 | /**\r |
419db80b | 1063 | Get Token Number according to dynamic-ex PCD's {token space guid:token number}\r |
80408db0 | 1064 | \r |
2ab6330e | 1065 | A dynamic-ex type PCD, developer must provide pair of token space guid: token number\r |
1066 | in DEC file. PCD database maintain a mapping table that translate pair of {token\r | |
419db80b | 1067 | space guid: token number} to Token Number.\r |
d1102dba | 1068 | \r |
2ab6330e | 1069 | @param Guid Token space guid for dynamic-ex PCD entry.\r |
b9982883 | 1070 | @param ExTokenNumber Dynamic-ex PCD token number.\r |
2ab6330e | 1071 | \r |
419db80b | 1072 | @return Token Number for dynamic-ex PCD.\r |
2ab6330e | 1073 | \r |
1074 | **/\r | |
c52fa98c | 1075 | UINTN\r |
80408db0 | 1076 | GetExPcdTokenNumber (\r |
1077 | IN CONST EFI_GUID *Guid,\r | |
1078 | IN UINT32 ExTokenNumber\r | |
ed66e1bc | 1079 | );\r |
80408db0 | 1080 | \r |
2ab6330e | 1081 | /**\r |
1082 | Get next token number in given token space.\r | |
d1102dba | 1083 | \r |
2ab6330e | 1084 | This routine is used for dynamicEx type PCD. It will firstly scan token space\r |
d1102dba LG |
1085 | table to get token space according to given token space guid. Then scan given\r |
1086 | token number in found token space, if found, then return next token number in\r | |
2ab6330e | 1087 | this token space.\r |
1088 | \r | |
d1102dba | 1089 | @param Guid Token space guid. Next token number will be scaned in\r |
2ab6330e | 1090 | this token space.\r |
d1102dba LG |
1091 | @param TokenNumber Token number.\r |
1092 | If PCD_INVALID_TOKEN_NUMBER, return first token number in\r | |
2ab6330e | 1093 | token space table.\r |
1094 | If not PCD_INVALID_TOKEN_NUMBER, return next token number\r | |
1095 | in token space table.\r | |
1096 | @param GuidTable Token space guid table. It will be used for scan token space\r | |
1097 | by given token space guid.\r | |
1098 | @param SizeOfGuidTable The size of guid table.\r | |
1099 | @param ExMapTable DynamicEx token number mapping table.\r | |
1100 | @param SizeOfExMapTable The size of dynamicEx token number mapping table.\r | |
1101 | \r | |
1102 | @retval EFI_NOT_FOUND Can not given token space or token number.\r | |
1103 | @retval EFI_SUCCESS Success to get next token number.\r | |
80408db0 | 1104 | \r |
2ab6330e | 1105 | **/\r |
c52fa98c | 1106 | EFI_STATUS\r |
80408db0 | 1107 | ExGetNextTokeNumber (\r |
1108 | IN CONST EFI_GUID *Guid,\r | |
1109 | IN OUT UINTN *TokenNumber,\r | |
1110 | IN EFI_GUID *GuidTable,\r | |
1111 | IN UINTN SizeOfGuidTable,\r | |
1112 | IN DYNAMICEX_MAPPING *ExMapTable,\r | |
1113 | IN UINTN SizeOfExMapTable\r | |
ed66e1bc | 1114 | );\r |
80408db0 | 1115 | \r |
2ab6330e | 1116 | /**\r |
1117 | Get size of POINTER type PCD value.\r | |
80408db0 | 1118 | \r |
2ab6330e | 1119 | @param LocalTokenNumberTableIdx Index of local token number in local token number table.\r |
3fd8027e | 1120 | @param MaxSize Maximum size of POINTER type PCD value.\r |
2ab6330e | 1121 | \r |
1122 | @return size of POINTER type PCD value.\r | |
1123 | \r | |
1124 | **/\r | |
80408db0 | 1125 | UINTN\r |
1126 | GetPtrTypeSize (\r | |
1127 | IN UINTN LocalTokenNumberTableIdx,\r | |
1128 | OUT UINTN *MaxSize\r | |
ed66e1bc | 1129 | );\r |
80408db0 | 1130 | \r |
2ab6330e | 1131 | /**\r |
3fd8027e | 1132 | Set size of POINTER type PCD value. The size should not exceed the maximum size\r |
2ab6330e | 1133 | of this PCD value.\r |
80408db0 | 1134 | \r |
2ab6330e | 1135 | @param LocalTokenNumberTableIdx Index of local token number in local token number table.\r |
1136 | @param CurrentSize Size of POINTER type PCD value.\r | |
80408db0 | 1137 | \r |
2ab6330e | 1138 | @retval TRUE Success to set size of PCD value.\r |
1139 | @retval FALSE Fail to set size of PCD value.\r | |
1140 | **/\r | |
80408db0 | 1141 | BOOLEAN\r |
1142 | SetPtrTypeSize (\r | |
1143 | IN UINTN LocalTokenNumberTableIdx,\r | |
1144 | IN OUT UINTN *CurrentSize\r | |
ed66e1bc | 1145 | );\r |
80408db0 | 1146 | \r |
23f3e119 SZ |
1147 | /**\r |
1148 | VariableLockProtocol callback\r | |
1149 | to lock the variables referenced by DynamicHii PCDs with RO property set in *.dsc.\r | |
1150 | \r | |
1151 | @param[in] Event Event whose notification function is being invoked.\r | |
1152 | @param[in] Context Pointer to the notification function's context.\r | |
1153 | \r | |
1154 | **/\r | |
1155 | VOID\r | |
1156 | EFIAPI\r | |
1157 | VariableLockCallBack (\r | |
1158 | IN EFI_EVENT Event,\r | |
1159 | IN VOID *Context\r | |
1160 | );\r | |
1161 | \r | |
7c736265 LG |
1162 | /**\r |
1163 | Update PCD database base on current SkuId\r | |
1164 | \r | |
1165 | @param SkuId Current SkuId\r | |
1166 | @param IsPeiDb Whether to update PEI PCD database.\r | |
1167 | \r | |
1168 | @retval EFI_SUCCESS Update PCD database successfully.\r | |
1169 | @retval EFI_NOT_FOUND Not found PCD database for current SkuId.\r | |
1170 | **/\r | |
1171 | EFI_STATUS\r | |
1172 | UpdatePcdDatabase (\r | |
1173 | IN SKU_ID SkuId,\r | |
1174 | IN BOOLEAN IsPeiDb\r | |
1175 | );\r | |
1176 | \r | |
419db80b | 1177 | extern PCD_DATABASE mPcdDatabase;\r |
80408db0 | 1178 | \r |
d1102dba LG |
1179 | extern UINT32 mPcdTotalTokenCount;\r |
1180 | extern UINT32 mPeiLocalTokenCount;\r | |
1181 | extern UINT32 mDxeLocalTokenCount;\r | |
1182 | extern UINT32 mPeiNexTokenCount;\r | |
1183 | extern UINT32 mDxeNexTokenCount;\r | |
419db80b BF |
1184 | extern UINT32 mPeiExMapppingTableSize;\r |
1185 | extern UINT32 mDxeExMapppingTableSize;\r | |
1186 | extern UINT32 mPeiGuidTableSize;\r | |
1187 | extern UINT32 mDxeGuidTableSize;\r | |
1188 | \r | |
d1102dba LG |
1189 | extern BOOLEAN mPeiExMapTableEmpty;\r |
1190 | extern BOOLEAN mDxeExMapTableEmpty;\r | |
419db80b BF |
1191 | extern BOOLEAN mPeiDatabaseEmpty;\r |
1192 | \r | |
1193 | extern EFI_GUID **TmpTokenSpaceBuffer;\r | |
1194 | extern UINTN TmpTokenSpaceBufferCount;\r | |
80408db0 | 1195 | \r |
1196 | extern EFI_LOCK mPcdDatabaseLock;\r | |
1197 | \r | |
1198 | #endif\r | |
599a55a5 | 1199 | \r |