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