]>
Commit | Line | Data |
---|---|---|
80408db0 | 1 | /** @file\r |
5944a83b | 2 | The internal header file declares the private functions used by PeiPcd driver.\r |
80408db0 | 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 | |
fc547e08 | 9 | #ifndef _PEI_PCD_SERVICE_H_\r |
10 | #define _PEI_PCD_SERVICE_H_\r | |
80408db0 | 11 | \r |
97a079ed A |
12 | #include <PiPei.h>\r |
13 | #include <Ppi/ReadOnlyVariable2.h>\r | |
14 | #include <Ppi/Pcd.h>\r | |
c896d682 | 15 | #include <Ppi/PiPcd.h>\r |
96d6d004 SZ |
16 | #include <Ppi/PcdInfo.h>\r |
17 | #include <Ppi/PiPcdInfo.h>\r | |
98b15cf1 | 18 | #include <Guid/PcdDataBaseHobGuid.h>\r |
419db80b | 19 | #include <Guid/PcdDataBaseSignatureGuid.h>\r |
219247e1 | 20 | #include <Guid/VariableFormat.h>\r |
97a079ed A |
21 | #include <Library/DebugLib.h>\r |
22 | #include <Library/PeimEntryPoint.h>\r | |
23 | #include <Library/BaseLib.h>\r | |
24 | #include <Library/HobLib.h>\r | |
25 | #include <Library/PeiServicesLib.h>\r | |
26 | #include <Library/PcdLib.h>\r | |
97a079ed | 27 | #include <Library/BaseMemoryLib.h>\r |
96d6d004 | 28 | #include <Library/MemoryAllocationLib.h>\r |
80408db0 | 29 | \r |
30 | //\r | |
31 | // Please make sure the PCD Serivce PEIM Version is consistent with\r | |
e9d97d08 | 32 | // the version of the generated PEIM PCD Database by build tool.\r |
80408db0 | 33 | //\r |
1436aea4 | 34 | #define PCD_SERVICE_PEIM_VERSION 7\r |
80408db0 | 35 | \r |
36 | //\r | |
e9d97d08 | 37 | // PCD_PEI_SERVICE_DRIVER_VERSION is defined in Autogen.h.\r |
80408db0 | 38 | //\r |
e9d97d08 LG |
39 | #if (PCD_SERVICE_PEIM_VERSION != PCD_PEI_SERVICE_DRIVER_VERSION)\r |
40 | #error "Please make sure the version of PCD PEIM Service and the generated PCD PEI Database match."\r | |
41 | #endif\r | |
80408db0 | 42 | \r |
96d6d004 SZ |
43 | /**\r |
44 | Retrieve additional information associated with a PCD token in the default token space.\r | |
45 | \r | |
46 | This includes information such as the type of value the TokenNumber is associated with as well as possible\r | |
47 | human readable name that is associated with the token.\r | |
48 | \r | |
49 | @param[in] TokenNumber The PCD token number.\r | |
50 | @param[out] PcdInfo The returned information associated with the requested TokenNumber.\r | |
51 | The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.\r | |
52 | \r | |
53 | @retval EFI_SUCCESS The PCD information was returned successfully.\r | |
54 | @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r | |
55 | **/\r | |
56 | EFI_STATUS\r | |
57 | EFIAPI\r | |
58 | PeiGetPcdInfoGetInfo (\r | |
1436aea4 MK |
59 | IN UINTN TokenNumber,\r |
60 | OUT EFI_PCD_INFO *PcdInfo\r | |
96d6d004 SZ |
61 | );\r |
62 | \r | |
63 | /**\r | |
64 | Retrieve additional information associated with a PCD token.\r | |
65 | \r | |
66 | This includes information such as the type of value the TokenNumber is associated with as well as possible\r | |
67 | human readable name that is associated with the token.\r | |
68 | \r | |
69 | @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r | |
70 | @param[in] TokenNumber The PCD token number.\r | |
71 | @param[out] PcdInfo The returned information associated with the requested TokenNumber.\r | |
72 | The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.\r | |
73 | \r | |
74 | @retval EFI_SUCCESS The PCD information was returned successfully.\r | |
75 | @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r | |
76 | **/\r | |
77 | EFI_STATUS\r | |
78 | EFIAPI\r | |
79 | PeiGetPcdInfoGetInfoEx (\r | |
1436aea4 MK |
80 | IN CONST EFI_GUID *Guid,\r |
81 | IN UINTN TokenNumber,\r | |
82 | OUT EFI_PCD_INFO *PcdInfo\r | |
96d6d004 SZ |
83 | );\r |
84 | \r | |
85 | /**\r | |
86 | Retrieve the currently set SKU Id.\r | |
87 | \r | |
88 | @return The currently set SKU Id. If the platform has not set at a SKU Id, then the\r | |
89 | default SKU Id value of 0 is returned. If the platform has set a SKU Id, then the currently set SKU\r | |
90 | Id is returned.\r | |
91 | **/\r | |
92 | UINTN\r | |
93 | EFIAPI\r | |
94 | PeiGetPcdInfoGetSku (\r | |
95 | VOID\r | |
96 | );\r | |
97 | \r | |
80408db0 | 98 | //\r |
99 | // PPI Interface Implementation Declaration.\r | |
100 | //\r | |
fc547e08 | 101 | \r |
102 | /**\r | |
103 | Sets the SKU value for subsequent calls to set or get PCD token values.\r | |
104 | \r | |
d1102dba | 105 | SetSku() sets the SKU Id to be used for subsequent calls to set or get PCD values.\r |
fc547e08 | 106 | SetSku() is normally called only once by the system.\r |
107 | \r | |
d1102dba LG |
108 | For each item (token), the database can hold a single value that applies to all SKUs,\r |
109 | or multiple values, where each value is associated with a specific SKU Id. Items with multiple,\r | |
110 | SKU-specific values are called SKU enabled.\r | |
111 | \r | |
112 | The SKU Id of zero is reserved as a default. The valid SkuId range is 1 to 255.\r | |
113 | For tokens that are not SKU enabled, the system ignores any set SKU Id and works with the\r | |
114 | single value for that token. For SKU-enabled tokens, the system will use the SKU Id set by the\r | |
115 | last call to SetSku(). If no SKU Id is set or the currently set SKU Id isn't valid for the specified token,\r | |
116 | the system uses the default SKU Id. If the system attempts to use the default SKU Id and no value has been\r | |
fc547e08 | 117 | set for that Id, the results are unpredictable.\r |
118 | \r | |
d1102dba | 119 | @param[in] SkuId The SKU value that will be used when the PCD service will retrieve and\r |
fc547e08 | 120 | set values associated with a PCD token.\r |
121 | \r | |
fc547e08 | 122 | **/\r |
80408db0 | 123 | VOID\r |
124 | EFIAPI\r | |
125 | PeiPcdSetSku (\r | |
1436aea4 | 126 | IN UINTN SkuId\r |
ed66e1bc | 127 | );\r |
80408db0 | 128 | \r |
fc547e08 | 129 | /**\r |
130 | Retrieves an 8-bit value for a given PCD token.\r | |
131 | \r | |
d1102dba | 132 | Retrieves the current byte-sized value for a PCD token number.\r |
fc547e08 | 133 | If the TokenNumber is invalid, the results are unpredictable.\r |
d1102dba LG |
134 | \r |
135 | @param[in] TokenNumber The PCD token number.\r | |
80408db0 | 136 | \r |
fc547e08 | 137 | @return The UINT8 value.\r |
d1102dba | 138 | \r |
fc547e08 | 139 | **/\r |
80408db0 | 140 | UINT8\r |
141 | EFIAPI\r | |
142 | PeiPcdGet8 (\r | |
1436aea4 | 143 | IN UINTN TokenNumber\r |
ed66e1bc | 144 | );\r |
80408db0 | 145 | \r |
fc547e08 | 146 | /**\r |
147 | Retrieves an 16-bit value for a given PCD token.\r | |
148 | \r | |
d1102dba | 149 | Retrieves the current 16-bits value for a PCD token number.\r |
fc547e08 | 150 | If the TokenNumber is invalid, the results are unpredictable.\r |
d1102dba LG |
151 | \r |
152 | @param[in] TokenNumber The PCD token number.\r | |
80408db0 | 153 | \r |
fc547e08 | 154 | @return The UINT16 value.\r |
d1102dba | 155 | \r |
fc547e08 | 156 | **/\r |
80408db0 | 157 | UINT16\r |
158 | EFIAPI\r | |
159 | PeiPcdGet16 (\r | |
1436aea4 | 160 | IN UINTN TokenNumber\r |
ed66e1bc | 161 | );\r |
80408db0 | 162 | \r |
fc547e08 | 163 | /**\r |
164 | Retrieves an 32-bit value for a given PCD token.\r | |
165 | \r | |
d1102dba | 166 | Retrieves the current 32-bits value for a PCD token number.\r |
fc547e08 | 167 | If the TokenNumber is invalid, the results are unpredictable.\r |
d1102dba LG |
168 | \r |
169 | @param[in] TokenNumber The PCD token number.\r | |
80408db0 | 170 | \r |
fc547e08 | 171 | @return The UINT32 value.\r |
d1102dba | 172 | \r |
fc547e08 | 173 | **/\r |
80408db0 | 174 | UINT32\r |
175 | EFIAPI\r | |
176 | PeiPcdGet32 (\r | |
1436aea4 | 177 | IN UINTN TokenNumber\r |
ed66e1bc | 178 | );\r |
80408db0 | 179 | \r |
fc547e08 | 180 | /**\r |
181 | Retrieves an 64-bit value for a given PCD token.\r | |
182 | \r | |
d1102dba | 183 | Retrieves the current 64-bits value for a PCD token number.\r |
fc547e08 | 184 | If the TokenNumber is invalid, the results are unpredictable.\r |
d1102dba LG |
185 | \r |
186 | @param[in] TokenNumber The PCD token number.\r | |
80408db0 | 187 | \r |
fc547e08 | 188 | @return The UINT64 value.\r |
d1102dba | 189 | \r |
fc547e08 | 190 | **/\r |
80408db0 | 191 | UINT64\r |
192 | EFIAPI\r | |
193 | PeiPcdGet64 (\r | |
1436aea4 | 194 | IN UINTN TokenNumber\r |
ed66e1bc | 195 | );\r |
80408db0 | 196 | \r |
fc547e08 | 197 | /**\r |
198 | Retrieves a pointer to a value for a given PCD token.\r | |
199 | \r | |
d1102dba LG |
200 | Retrieves the current pointer to the buffer for a PCD token number.\r |
201 | Do not make any assumptions about the alignment of the pointer that\r | |
202 | is returned by this function call. If the TokenNumber is invalid,\r | |
fc547e08 | 203 | the results are unpredictable.\r |
80408db0 | 204 | \r |
d1102dba | 205 | @param[in] TokenNumber The PCD token number.\r |
fc547e08 | 206 | \r |
207 | @return The pointer to the buffer to be retrived.\r | |
d1102dba | 208 | \r |
fc547e08 | 209 | **/\r |
80408db0 | 210 | VOID *\r |
211 | EFIAPI\r | |
212 | PeiPcdGetPtr (\r | |
1436aea4 | 213 | IN UINTN TokenNumber\r |
ed66e1bc | 214 | );\r |
80408db0 | 215 | \r |
fc547e08 | 216 | /**\r |
217 | Retrieves a Boolean value for a given PCD token.\r | |
218 | \r | |
d1102dba LG |
219 | Retrieves the current boolean value for a PCD token number.\r |
220 | Do not make any assumptions about the alignment of the pointer that\r | |
221 | is returned by this function call. If the TokenNumber is invalid,\r | |
fc547e08 | 222 | the results are unpredictable.\r |
223 | \r | |
d1102dba | 224 | @param[in] TokenNumber The PCD token number.\r |
80408db0 | 225 | \r |
fc547e08 | 226 | @return The Boolean value.\r |
d1102dba | 227 | \r |
fc547e08 | 228 | **/\r |
80408db0 | 229 | BOOLEAN\r |
230 | EFIAPI\r | |
231 | PeiPcdGetBool (\r | |
1436aea4 | 232 | IN UINTN TokenNumber\r |
ed66e1bc | 233 | );\r |
80408db0 | 234 | \r |
fc547e08 | 235 | /**\r |
236 | Retrieves the size of the value for a given PCD token.\r | |
237 | \r | |
d1102dba | 238 | Retrieves the current size of a particular PCD token.\r |
fc547e08 | 239 | If the TokenNumber is invalid, the results are unpredictable.\r |
80408db0 | 240 | \r |
d1102dba | 241 | @param[in] TokenNumber The PCD token number.\r |
fc547e08 | 242 | \r |
243 | @return The size of the value for the PCD token.\r | |
d1102dba | 244 | \r |
fc547e08 | 245 | **/\r |
80408db0 | 246 | UINTN\r |
247 | EFIAPI\r | |
248 | PeiPcdGetSize (\r | |
1436aea4 | 249 | IN UINTN TokenNumber\r |
ed66e1bc | 250 | );\r |
80408db0 | 251 | \r |
fc547e08 | 252 | /**\r |
253 | Retrieves an 8-bit value for a given PCD token.\r | |
80408db0 | 254 | \r |
d1102dba | 255 | Retrieves the 8-bit value of a particular PCD token.\r |
fc547e08 | 256 | If the TokenNumber is invalid or the token space\r |
d1102dba | 257 | specified by Guid does not exist, the results are\r |
fc547e08 | 258 | unpredictable.\r |
259 | \r | |
260 | @param[in] Guid The token space for the token number.\r | |
d1102dba | 261 | @param[in] TokenNumber The PCD token number.\r |
fc547e08 | 262 | \r |
263 | @return The size 8-bit value for the PCD token.\r | |
d1102dba | 264 | \r |
fc547e08 | 265 | **/\r |
80408db0 | 266 | UINT8\r |
267 | EFIAPI\r | |
268 | PeiPcdGet8Ex (\r | |
1436aea4 MK |
269 | IN CONST EFI_GUID *Guid,\r |
270 | IN UINTN TokenNumber\r | |
ed66e1bc | 271 | );\r |
80408db0 | 272 | \r |
fc547e08 | 273 | /**\r |
274 | Retrieves an 16-bit value for a given PCD token.\r | |
275 | \r | |
d1102dba | 276 | Retrieves the 16-bit value of a particular PCD token.\r |
fc547e08 | 277 | If the TokenNumber is invalid or the token space\r |
d1102dba | 278 | specified by Guid does not exist, the results are\r |
fc547e08 | 279 | unpredictable.\r |
80408db0 | 280 | \r |
fc547e08 | 281 | @param[in] Guid The token space for the token number.\r |
d1102dba | 282 | @param[in] TokenNumber The PCD token number.\r |
fc547e08 | 283 | \r |
284 | @return The size 16-bit value for the PCD token.\r | |
d1102dba | 285 | \r |
fc547e08 | 286 | **/\r |
80408db0 | 287 | UINT16\r |
288 | EFIAPI\r | |
289 | PeiPcdGet16Ex (\r | |
1436aea4 MK |
290 | IN CONST EFI_GUID *Guid,\r |
291 | IN UINTN TokenNumber\r | |
ed66e1bc | 292 | );\r |
80408db0 | 293 | \r |
fc547e08 | 294 | /**\r |
295 | Retrieves an 32-bit value for a given PCD token.\r | |
296 | \r | |
d1102dba | 297 | Retrieves the 32-bit value of a particular PCD token.\r |
fc547e08 | 298 | If the TokenNumber is invalid or the token space\r |
d1102dba | 299 | specified by Guid does not exist, the results are\r |
fc547e08 | 300 | unpredictable.\r |
301 | \r | |
302 | @param[in] Guid The token space for the token number.\r | |
d1102dba | 303 | @param[in] TokenNumber The PCD token number.\r |
fc547e08 | 304 | \r |
305 | @return The size 32-bit value for the PCD token.\r | |
d1102dba | 306 | \r |
fc547e08 | 307 | **/\r |
80408db0 | 308 | UINT32\r |
309 | EFIAPI\r | |
310 | PeiPcdGet32Ex (\r | |
1436aea4 MK |
311 | IN CONST EFI_GUID *Guid,\r |
312 | IN UINTN TokenNumber\r | |
ed66e1bc | 313 | );\r |
80408db0 | 314 | \r |
fc547e08 | 315 | /**\r |
316 | Retrieves an 64-bit value for a given PCD token.\r | |
317 | \r | |
d1102dba | 318 | Retrieves the 64-bit value of a particular PCD token.\r |
fc547e08 | 319 | If the TokenNumber is invalid or the token space\r |
d1102dba | 320 | specified by Guid does not exist, the results are\r |
fc547e08 | 321 | unpredictable.\r |
322 | \r | |
323 | @param[in] Guid The token space for the token number.\r | |
d1102dba | 324 | @param[in] TokenNumber The PCD token number.\r |
80408db0 | 325 | \r |
fc547e08 | 326 | @return The size 64-bit value for the PCD token.\r |
d1102dba | 327 | \r |
fc547e08 | 328 | **/\r |
80408db0 | 329 | UINT64\r |
330 | EFIAPI\r | |
331 | PeiPcdGet64Ex (\r | |
1436aea4 MK |
332 | IN CONST EFI_GUID *Guid,\r |
333 | IN UINTN TokenNumber\r | |
ed66e1bc | 334 | );\r |
80408db0 | 335 | \r |
fc547e08 | 336 | /**\r |
337 | Retrieves a pointer to a value for a given PCD token.\r | |
338 | \r | |
d1102dba LG |
339 | Retrieves the current pointer to the buffer for a PCD token number.\r |
340 | Do not make any assumptions about the alignment of the pointer that\r | |
341 | is returned by this function call. If the TokenNumber is invalid,\r | |
fc547e08 | 342 | the results are unpredictable.\r |
80408db0 | 343 | \r |
fc547e08 | 344 | @param[in] Guid The token space for the token number.\r |
d1102dba | 345 | @param[in] TokenNumber The PCD token number.\r |
fc547e08 | 346 | \r |
347 | @return The pointer to the buffer to be retrived.\r | |
d1102dba | 348 | \r |
fc547e08 | 349 | **/\r |
80408db0 | 350 | VOID *\r |
351 | EFIAPI\r | |
352 | PeiPcdGetPtrEx (\r | |
1436aea4 MK |
353 | IN CONST EFI_GUID *Guid,\r |
354 | IN UINTN TokenNumber\r | |
ed66e1bc | 355 | );\r |
80408db0 | 356 | \r |
fc547e08 | 357 | /**\r |
358 | Retrieves an Boolean value for a given PCD token.\r | |
80408db0 | 359 | \r |
d1102dba | 360 | Retrieves the Boolean value of a particular PCD token.\r |
fc547e08 | 361 | If the TokenNumber is invalid or the token space\r |
d1102dba | 362 | specified by Guid does not exist, the results are\r |
fc547e08 | 363 | unpredictable.\r |
364 | \r | |
365 | @param[in] Guid The token space for the token number.\r | |
d1102dba | 366 | @param[in] TokenNumber The PCD token number.\r |
fc547e08 | 367 | \r |
368 | @return The size Boolean value for the PCD token.\r | |
d1102dba | 369 | \r |
fc547e08 | 370 | **/\r |
80408db0 | 371 | BOOLEAN\r |
372 | EFIAPI\r | |
373 | PeiPcdGetBoolEx (\r | |
1436aea4 MK |
374 | IN CONST EFI_GUID *Guid,\r |
375 | IN UINTN TokenNumber\r | |
ed66e1bc | 376 | );\r |
80408db0 | 377 | \r |
fc547e08 | 378 | /**\r |
379 | Retrieves the size of the value for a given PCD token.\r | |
380 | \r | |
d1102dba | 381 | Retrieves the current size of a particular PCD token.\r |
fc547e08 | 382 | If the TokenNumber is invalid, the results are unpredictable.\r |
80408db0 | 383 | \r |
fc547e08 | 384 | @param[in] Guid The token space for the token number.\r |
d1102dba | 385 | @param[in] TokenNumber The PCD token number.\r |
fc547e08 | 386 | \r |
387 | @return The size of the value for the PCD token.\r | |
d1102dba | 388 | \r |
fc547e08 | 389 | **/\r |
80408db0 | 390 | UINTN\r |
391 | EFIAPI\r | |
392 | PeiPcdGetSizeEx (\r | |
1436aea4 MK |
393 | IN CONST EFI_GUID *Guid,\r |
394 | IN UINTN TokenNumber\r | |
ed66e1bc | 395 | );\r |
80408db0 | 396 | \r |
fc547e08 | 397 | /**\r |
398 | Sets an 8-bit value for a given PCD token.\r | |
399 | \r | |
d1102dba LG |
400 | When the PCD service sets a value, it will check to ensure that the\r |
401 | size of the value being set is compatible with the Token's existing definition.\r | |
fc547e08 | 402 | If it is not, an error will be returned.\r |
403 | \r | |
d1102dba | 404 | @param[in] TokenNumber The PCD token number.\r |
fc547e08 | 405 | @param[in] Value The value to set for the PCD token.\r |
80408db0 | 406 | \r |
fc547e08 | 407 | @retval EFI_SUCCESS Procedure returned successfully.\r |
d1102dba LG |
408 | @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data\r |
409 | being set was incompatible with a call to this function.\r | |
fc547e08 | 410 | Use GetSize() to retrieve the size of the target data.\r |
411 | @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r | |
d1102dba | 412 | \r |
fc547e08 | 413 | **/\r |
80408db0 | 414 | EFI_STATUS\r |
415 | EFIAPI\r | |
416 | PeiPcdSet8 (\r | |
1436aea4 MK |
417 | IN UINTN TokenNumber,\r |
418 | IN UINT8 Value\r | |
ed66e1bc | 419 | );\r |
80408db0 | 420 | \r |
fc547e08 | 421 | /**\r |
422 | Sets an 16-bit value for a given PCD token.\r | |
423 | \r | |
d1102dba LG |
424 | When the PCD service sets a value, it will check to ensure that the\r |
425 | size of the value being set is compatible with the Token's existing definition.\r | |
fc547e08 | 426 | If it is not, an error will be returned.\r |
80408db0 | 427 | \r |
d1102dba | 428 | @param[in] TokenNumber The PCD token number.\r |
fc547e08 | 429 | @param[in] Value The value to set for the PCD token.\r |
430 | \r | |
431 | @retval EFI_SUCCESS Procedure returned successfully.\r | |
d1102dba LG |
432 | @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data\r |
433 | being set was incompatible with a call to this function.\r | |
fc547e08 | 434 | Use GetSize() to retrieve the size of the target data.\r |
435 | @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r | |
d1102dba | 436 | \r |
fc547e08 | 437 | **/\r |
80408db0 | 438 | EFI_STATUS\r |
439 | EFIAPI\r | |
440 | PeiPcdSet16 (\r | |
1436aea4 MK |
441 | IN UINTN TokenNumber,\r |
442 | IN UINT16 Value\r | |
ed66e1bc | 443 | );\r |
80408db0 | 444 | \r |
fc547e08 | 445 | /**\r |
446 | Sets an 32-bit value for a given PCD token.\r | |
80408db0 | 447 | \r |
d1102dba LG |
448 | When the PCD service sets a value, it will check to ensure that the\r |
449 | size of the value being set is compatible with the Token's existing definition.\r | |
fc547e08 | 450 | If it is not, an error will be returned.\r |
451 | \r | |
d1102dba | 452 | @param[in] TokenNumber The PCD token number.\r |
fc547e08 | 453 | @param[in] Value The value to set for the PCD token.\r |
454 | \r | |
455 | @retval EFI_SUCCESS Procedure returned successfully.\r | |
d1102dba LG |
456 | @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data\r |
457 | being set was incompatible with a call to this function.\r | |
fc547e08 | 458 | Use GetSize() to retrieve the size of the target data.\r |
459 | @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r | |
d1102dba | 460 | \r |
fc547e08 | 461 | **/\r |
80408db0 | 462 | EFI_STATUS\r |
463 | EFIAPI\r | |
464 | PeiPcdSet32 (\r | |
1436aea4 MK |
465 | IN UINTN TokenNumber,\r |
466 | IN UINT32 Value\r | |
ed66e1bc | 467 | );\r |
80408db0 | 468 | \r |
fc547e08 | 469 | /**\r |
470 | Sets an 64-bit value for a given PCD token.\r | |
471 | \r | |
d1102dba LG |
472 | When the PCD service sets a value, it will check to ensure that the\r |
473 | size of the value being set is compatible with the Token's existing definition.\r | |
fc547e08 | 474 | If it is not, an error will be returned.\r |
80408db0 | 475 | \r |
d1102dba | 476 | @param[in] TokenNumber The PCD token number.\r |
fc547e08 | 477 | @param[in] Value The value to set for the PCD token.\r |
478 | \r | |
479 | @retval EFI_SUCCESS Procedure returned successfully.\r | |
d1102dba LG |
480 | @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data\r |
481 | being set was incompatible with a call to this function.\r | |
fc547e08 | 482 | Use GetSize() to retrieve the size of the target data.\r |
483 | @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r | |
d1102dba | 484 | \r |
fc547e08 | 485 | **/\r |
80408db0 | 486 | EFI_STATUS\r |
487 | EFIAPI\r | |
488 | PeiPcdSet64 (\r | |
1436aea4 MK |
489 | IN UINTN TokenNumber,\r |
490 | IN UINT64 Value\r | |
ed66e1bc | 491 | );\r |
80408db0 | 492 | \r |
fc547e08 | 493 | /**\r |
494 | Sets a value of a specified size for a given PCD token.\r | |
495 | \r | |
d1102dba LG |
496 | When the PCD service sets a value, it will check to ensure that the\r |
497 | size of the value being set is compatible with the Token's existing definition.\r | |
fc547e08 | 498 | If it is not, an error will be returned.\r |
499 | \r | |
d1102dba LG |
500 | @param[in] TokenNumber The PCD token number.\r |
501 | @param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token.\r | |
502 | On input, if the SizeOfValue is greater than the maximum size supported\r | |
503 | for this TokenNumber then the output value of SizeOfValue will reflect\r | |
fc547e08 | 504 | the maximum size supported for this TokenNumber.\r |
505 | @param[in] Buffer The buffer to set for the PCD token.\r | |
506 | \r | |
507 | @retval EFI_SUCCESS Procedure returned successfully.\r | |
d1102dba LG |
508 | @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data\r |
509 | being set was incompatible with a call to this function.\r | |
fc547e08 | 510 | Use GetSize() to retrieve the size of the target data.\r |
511 | @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r | |
d1102dba | 512 | \r |
fc547e08 | 513 | **/\r |
80408db0 | 514 | EFI_STATUS\r |
515 | EFIAPI\r | |
516 | PeiPcdSetPtr (\r | |
1436aea4 MK |
517 | IN UINTN TokenNumber,\r |
518 | IN OUT UINTN *SizeOfBuffer,\r | |
519 | IN VOID *Buffer\r | |
ed66e1bc | 520 | );\r |
80408db0 | 521 | \r |
fc547e08 | 522 | /**\r |
523 | Sets an Boolean value for a given PCD token.\r | |
524 | \r | |
d1102dba LG |
525 | When the PCD service sets a value, it will check to ensure that the\r |
526 | size of the value being set is compatible with the Token's existing definition.\r | |
fc547e08 | 527 | If it is not, an error will be returned.\r |
80408db0 | 528 | \r |
d1102dba | 529 | @param[in] TokenNumber The PCD token number.\r |
fc547e08 | 530 | @param[in] Value The value to set for the PCD token.\r |
531 | \r | |
532 | @retval EFI_SUCCESS Procedure returned successfully.\r | |
d1102dba LG |
533 | @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data\r |
534 | being set was incompatible with a call to this function.\r | |
fc547e08 | 535 | Use GetSize() to retrieve the size of the target data.\r |
536 | @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r | |
d1102dba | 537 | \r |
fc547e08 | 538 | **/\r |
80408db0 | 539 | EFI_STATUS\r |
540 | EFIAPI\r | |
541 | PeiPcdSetBool (\r | |
1436aea4 MK |
542 | IN UINTN TokenNumber,\r |
543 | IN BOOLEAN Value\r | |
ed66e1bc | 544 | );\r |
80408db0 | 545 | \r |
fc547e08 | 546 | /**\r |
547 | Sets an 8-bit value for a given PCD token.\r | |
548 | \r | |
d1102dba LG |
549 | When the PCD service sets a value, it will check to ensure that the\r |
550 | size of the value being set is compatible with the Token's existing definition.\r | |
fc547e08 | 551 | If it is not, an error will be returned.\r |
552 | \r | |
553 | @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r | |
d1102dba | 554 | @param[in] TokenNumber The PCD token number.\r |
fc547e08 | 555 | @param[in] Value The value to set for the PCD token.\r |
80408db0 | 556 | \r |
fc547e08 | 557 | @retval EFI_SUCCESS Procedure returned successfully.\r |
d1102dba LG |
558 | @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data\r |
559 | being set was incompatible with a call to this function.\r | |
fc547e08 | 560 | Use GetSize() to retrieve the size of the target data.\r |
561 | @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r | |
d1102dba | 562 | \r |
fc547e08 | 563 | **/\r |
80408db0 | 564 | EFI_STATUS\r |
565 | EFIAPI\r | |
566 | PeiPcdSet8Ex (\r | |
1436aea4 MK |
567 | IN CONST EFI_GUID *Guid,\r |
568 | IN UINTN TokenNumber,\r | |
569 | IN UINT8 Value\r | |
ed66e1bc | 570 | );\r |
80408db0 | 571 | \r |
fc547e08 | 572 | /**\r |
573 | Sets an 16-bit value for a given PCD token.\r | |
574 | \r | |
d1102dba LG |
575 | When the PCD service sets a value, it will check to ensure that the\r |
576 | size of the value being set is compatible with the Token's existing definition.\r | |
fc547e08 | 577 | If it is not, an error will be returned.\r |
578 | \r | |
579 | @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r | |
d1102dba | 580 | @param[in] TokenNumber The PCD token number.\r |
fc547e08 | 581 | @param[in] Value The value to set for the PCD token.\r |
582 | \r | |
583 | @retval EFI_SUCCESS Procedure returned successfully.\r | |
d1102dba LG |
584 | @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data\r |
585 | being set was incompatible with a call to this function.\r | |
fc547e08 | 586 | Use GetSize() to retrieve the size of the target data.\r |
587 | @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r | |
d1102dba | 588 | \r |
fc547e08 | 589 | **/\r |
80408db0 | 590 | EFI_STATUS\r |
591 | EFIAPI\r | |
592 | PeiPcdSet16Ex (\r | |
1436aea4 MK |
593 | IN CONST EFI_GUID *Guid,\r |
594 | IN UINTN TokenNumber,\r | |
595 | IN UINT16 Value\r | |
ed66e1bc | 596 | );\r |
80408db0 | 597 | \r |
fc547e08 | 598 | /**\r |
599 | Sets an 32-bit value for a given PCD token.\r | |
600 | \r | |
d1102dba LG |
601 | When the PCD service sets a value, it will check to ensure that the\r |
602 | size of the value being set is compatible with the Token's existing definition.\r | |
fc547e08 | 603 | If it is not, an error will be returned.\r |
80408db0 | 604 | \r |
fc547e08 | 605 | @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r |
d1102dba | 606 | @param[in] TokenNumber The PCD token number.\r |
fc547e08 | 607 | @param[in] Value The value to set for the PCD token.\r |
608 | \r | |
609 | @retval EFI_SUCCESS Procedure returned successfully.\r | |
d1102dba LG |
610 | @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data\r |
611 | being set was incompatible with a call to this function.\r | |
fc547e08 | 612 | Use GetSize() to retrieve the size of the target data.\r |
613 | @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r | |
d1102dba | 614 | \r |
fc547e08 | 615 | **/\r |
80408db0 | 616 | EFI_STATUS\r |
617 | EFIAPI\r | |
618 | PeiPcdSet32Ex (\r | |
1436aea4 MK |
619 | IN CONST EFI_GUID *Guid,\r |
620 | IN UINTN TokenNumber,\r | |
621 | IN UINT32 Value\r | |
ed66e1bc | 622 | );\r |
80408db0 | 623 | \r |
fc547e08 | 624 | /**\r |
625 | Sets an 64-bit value for a given PCD token.\r | |
80408db0 | 626 | \r |
d1102dba LG |
627 | When the PCD service sets a value, it will check to ensure that the\r |
628 | size of the value being set is compatible with the Token's existing definition.\r | |
fc547e08 | 629 | If it is not, an error will be returned.\r |
630 | \r | |
631 | @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r | |
d1102dba | 632 | @param[in] TokenNumber The PCD token number.\r |
fc547e08 | 633 | @param[in] Value The value to set for the PCD token.\r |
634 | \r | |
635 | @retval EFI_SUCCESS Procedure returned successfully.\r | |
d1102dba LG |
636 | @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data\r |
637 | being set was incompatible with a call to this function.\r | |
fc547e08 | 638 | Use GetSize() to retrieve the size of the target data.\r |
639 | @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r | |
d1102dba | 640 | \r |
fc547e08 | 641 | **/\r |
80408db0 | 642 | EFI_STATUS\r |
643 | EFIAPI\r | |
644 | PeiPcdSet64Ex (\r | |
1436aea4 MK |
645 | IN CONST EFI_GUID *Guid,\r |
646 | IN UINTN TokenNumber,\r | |
647 | IN UINT64 Value\r | |
ed66e1bc | 648 | );\r |
80408db0 | 649 | \r |
fc547e08 | 650 | /**\r |
651 | Sets a value of a specified size for a given PCD token.\r | |
652 | \r | |
d1102dba LG |
653 | When the PCD service sets a value, it will check to ensure that the\r |
654 | size of the value being set is compatible with the Token's existing definition.\r | |
fc547e08 | 655 | If it is not, an error will be returned.\r |
656 | \r | |
657 | @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r | |
d1102dba LG |
658 | @param[in] TokenNumber The PCD token number.\r |
659 | @param[in, out] SizeOfBuffer A pointer to the length of the value being set for the PCD token.\r | |
660 | On input, if the SizeOfValue is greater than the maximum size supported\r | |
661 | for this TokenNumber then the output value of SizeOfValue will reflect\r | |
fc547e08 | 662 | the maximum size supported for this TokenNumber.\r |
663 | @param[in] Buffer The buffer to set for the PCD token.\r | |
664 | \r | |
665 | @retval EFI_SUCCESS Procedure returned successfully.\r | |
d1102dba LG |
666 | @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data\r |
667 | being set was incompatible with a call to this function.\r | |
fc547e08 | 668 | Use GetSize() to retrieve the size of the target data.\r |
669 | @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r | |
d1102dba | 670 | \r |
fc547e08 | 671 | **/\r |
80408db0 | 672 | EFI_STATUS\r |
673 | EFIAPI\r | |
674 | PeiPcdSetPtrEx (\r | |
1436aea4 MK |
675 | IN CONST EFI_GUID *Guid,\r |
676 | IN UINTN TokenNumber,\r | |
677 | IN OUT UINTN *SizeOfBuffer,\r | |
678 | IN VOID *Buffer\r | |
ed66e1bc | 679 | );\r |
80408db0 | 680 | \r |
fc547e08 | 681 | /**\r |
682 | Sets an Boolean value for a given PCD token.\r | |
683 | \r | |
d1102dba LG |
684 | When the PCD service sets a value, it will check to ensure that the\r |
685 | size of the value being set is compatible with the Token's existing definition.\r | |
fc547e08 | 686 | If it is not, an error will be returned.\r |
80408db0 | 687 | \r |
fc547e08 | 688 | @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r |
d1102dba | 689 | @param[in] TokenNumber The PCD token number.\r |
fc547e08 | 690 | @param[in] Value The value to set for the PCD token.\r |
691 | \r | |
692 | @retval EFI_SUCCESS Procedure returned successfully.\r | |
d1102dba LG |
693 | @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data\r |
694 | being set was incompatible with a call to this function.\r | |
fc547e08 | 695 | Use GetSize() to retrieve the size of the target data.\r |
696 | @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r | |
d1102dba | 697 | \r |
fc547e08 | 698 | **/\r |
80408db0 | 699 | EFI_STATUS\r |
700 | EFIAPI\r | |
701 | PeiPcdSetBoolEx (\r | |
1436aea4 MK |
702 | IN CONST EFI_GUID *Guid,\r |
703 | IN UINTN TokenNumber,\r | |
704 | IN BOOLEAN Value\r | |
ed66e1bc | 705 | );\r |
80408db0 | 706 | \r |
fc547e08 | 707 | /**\r |
708 | Specifies a function to be called anytime the value of a designated token is changed.\r | |
80408db0 | 709 | \r |
fc547e08 | 710 | @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r |
d1102dba LG |
711 | @param[in] TokenNumber The PCD token number.\r |
712 | @param[in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.\r | |
80408db0 | 713 | \r |
d1102dba | 714 | @retval EFI_SUCCESS The PCD service has successfully established a call event\r |
fc547e08 | 715 | for the CallBackToken requested.\r |
716 | @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.\r | |
717 | \r | |
718 | **/\r | |
80408db0 | 719 | EFI_STATUS\r |
720 | EFIAPI\r | |
721 | PeiRegisterCallBackOnSet (\r | |
1436aea4 MK |
722 | IN CONST EFI_GUID *Guid OPTIONAL,\r |
723 | IN UINTN TokenNumber,\r | |
724 | IN PCD_PPI_CALLBACK CallBackFunction\r | |
ed66e1bc | 725 | );\r |
80408db0 | 726 | \r |
fc547e08 | 727 | /**\r |
728 | Cancels a previously set callback function for a particular PCD token number.\r | |
729 | \r | |
730 | @param [in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r | |
d1102dba LG |
731 | @param [in] TokenNumber The PCD token number.\r |
732 | @param [in] CallBackFunction The function prototype called when the value associated with the CallBackToken is set.\r | |
fc547e08 | 733 | \r |
d1102dba | 734 | @retval EFI_SUCCESS The PCD service has successfully established a call event\r |
fc547e08 | 735 | for the CallBackToken requested.\r |
736 | @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.\r | |
80408db0 | 737 | \r |
fc547e08 | 738 | **/\r |
80408db0 | 739 | EFI_STATUS\r |
740 | EFIAPI\r | |
741 | PcdUnRegisterCallBackOnSet (\r | |
1436aea4 MK |
742 | IN CONST EFI_GUID *Guid OPTIONAL,\r |
743 | IN UINTN TokenNumber,\r | |
744 | IN PCD_PPI_CALLBACK CallBackFunction\r | |
ed66e1bc | 745 | );\r |
80408db0 | 746 | \r |
fc547e08 | 747 | /**\r |
d1102dba LG |
748 | Retrieves the next valid token number in a given namespace.\r |
749 | \r | |
750 | This is useful since the PCD infrastructure contains a sparse list of token numbers,\r | |
751 | and one cannot a priori know what token numbers are valid in the database.\r | |
752 | \r | |
753 | If TokenNumber is 0 and Guid is not NULL, then the first token from the token space specified by Guid is returned.\r | |
754 | If TokenNumber is not 0 and Guid is not NULL, then the next token in the token space specified by Guid is returned.\r | |
755 | If TokenNumber is 0 and Guid is NULL, then the first token in the default token space is returned.\r | |
756 | If TokenNumber is not 0 and Guid is NULL, then the next token in the default token space is returned.\r | |
757 | The token numbers in the default token space may not be related to token numbers in token spaces that are named by Guid.\r | |
758 | If the next token number can be retrieved, then it is returned in TokenNumber, and EFI_SUCCESS is returned.\r | |
759 | If TokenNumber represents the last token number in the token space specified by Guid, then EFI_NOT_FOUND is returned.\r | |
90e06556 | 760 | If TokenNumber is not present in the token space specified by Guid, then EFI_NOT_FOUND is returned.\r |
761 | \r | |
762 | \r | |
d1102dba LG |
763 | @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r |
764 | This is an optional parameter that may be NULL. If this parameter is NULL, then a request\r | |
90e06556 | 765 | is being made to retrieve tokens from the default token space.\r |
766 | @param[in, out] TokenNumber A pointer to the PCD token number to use to find the subsequent token number.\r | |
d1102dba LG |
767 | \r |
768 | @retval EFI_SUCCESS The PCD service has retrieved the next valid token number.\r | |
769 | Or the input token number is already the last valid token number in the PCD database.\r | |
fc547e08 | 770 | In the later case, *TokenNumber is updated with the value of 0.\r |
771 | @retval EFI_NOT_FOUND If this input token number and token namespace does not exist on the platform.\r | |
772 | \r | |
773 | **/\r | |
80408db0 | 774 | EFI_STATUS\r |
775 | EFIAPI\r | |
776 | PeiPcdGetNextToken (\r | |
1436aea4 MK |
777 | IN CONST EFI_GUID *Guid OPTIONAL,\r |
778 | IN OUT UINTN *TokenNumber\r | |
ed66e1bc | 779 | );\r |
80408db0 | 780 | \r |
fc547e08 | 781 | /**\r |
782 | Retrieves the next valid PCD token namespace for a given namespace.\r | |
783 | \r | |
d1102dba LG |
784 | @param[in, out] Guid An indirect pointer to EFI_GUID. On input it designates\r |
785 | a known token namespace from which the search will start. On output,\r | |
786 | it designates the next valid token namespace on the platform. If the input\r | |
787 | token namespace does not exist on the platform, an error is returned and\r | |
788 | the value of *Guid is undefined. If *Guid is NULL, then the GUID of the\r | |
789 | first token space of the current platform is assigned to *Guid the function\r | |
790 | return EFI_SUCCESS. If *Guid is NULL and there is no namespace exist in\r | |
791 | the platform other than the default (NULL) tokennamespace, *Guid is unchanged\r | |
792 | and the function return EFI_SUCCESS. If this input token namespace is the last\r | |
793 | namespace on the platform, *Guid will be assigned to NULL and the function return\r | |
794 | EFI_SUCCESS.\r | |
795 | \r | |
796 | @retval EFI_SUCCESS The PCD service retrieved the next valid token space Guid.\r | |
797 | Or the input token space Guid is already the last valid token space Guid\r | |
fc547e08 | 798 | in the PCD database. In the later case, *Guid is updated with the value of NULL.\r |
799 | @retval EFI_NOT_FOUND If the input token namespace does not exist on the platform.\r | |
80408db0 | 800 | \r |
fc547e08 | 801 | **/\r |
80408db0 | 802 | EFI_STATUS\r |
803 | EFIAPI\r | |
804 | PeiPcdGetNextTokenSpace (\r | |
1436aea4 | 805 | IN OUT CONST EFI_GUID **Guid\r |
ed66e1bc | 806 | );\r |
80408db0 | 807 | \r |
96d6d004 SZ |
808 | /**\r |
809 | Retrieve additional information associated with a PCD token.\r | |
810 | \r | |
811 | This includes information such as the type of value the TokenNumber is associated with as well as possible\r | |
812 | human readable name that is associated with the token.\r | |
813 | \r | |
814 | @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value.\r | |
815 | @param[in] TokenNumber The PCD token number.\r | |
816 | @param[out] PcdInfo The returned information associated with the requested TokenNumber.\r | |
d1102dba | 817 | The caller is responsible for freeing the buffer that is allocated by callee for PcdInfo->PcdName.\r |
96d6d004 SZ |
818 | \r |
819 | @retval EFI_SUCCESS The PCD information was returned successfully\r | |
820 | @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r | |
821 | **/\r | |
822 | EFI_STATUS\r | |
96d6d004 | 823 | PeiGetPcdInfo (\r |
1436aea4 MK |
824 | IN CONST EFI_GUID *Guid,\r |
825 | IN UINTN TokenNumber,\r | |
826 | OUT EFI_PCD_INFO *PcdInfo\r | |
96d6d004 | 827 | );\r |
80408db0 | 828 | \r |
829 | /* Internal Function definitions */\r | |
1436aea4 | 830 | \r |
fc547e08 | 831 | /**\r |
832 | Get PCD database from GUID HOB in PEI phase.\r | |
833 | \r | |
834 | @return Pointer to PCD database.\r | |
80408db0 | 835 | \r |
fc547e08 | 836 | **/\r |
80408db0 | 837 | PEI_PCD_DATABASE *\r |
838 | GetPcdDatabase (\r | |
839 | VOID\r | |
ed66e1bc | 840 | );\r |
80408db0 | 841 | \r |
fc547e08 | 842 | /**\r |
843 | Wrapper function for setting non-pointer type value for a PCD entry.\r | |
844 | \r | |
845 | @param TokenNumber Pcd token number autogenerated by build tools.\r | |
846 | @param Data Value want to be set for PCD entry\r | |
847 | @param Size Size of value.\r | |
80408db0 | 848 | \r |
fc547e08 | 849 | @return status of SetWorker.\r |
850 | \r | |
851 | **/\r | |
80408db0 | 852 | EFI_STATUS\r |
853 | SetValueWorker (\r | |
1436aea4 MK |
854 | IN UINTN TokenNumber,\r |
855 | IN VOID *Data,\r | |
856 | IN UINTN Size\r | |
ed66e1bc | 857 | );\r |
80408db0 | 858 | \r |
fc547e08 | 859 | /**\r |
860 | Set value for an PCD entry\r | |
80408db0 | 861 | \r |
fc547e08 | 862 | @param TokenNumber Pcd token number autogenerated by build tools.\r |
863 | @param Data Value want to be set for PCD entry\r | |
864 | @param Size Size of value.\r | |
865 | @param PtrType If TRUE, the type of PCD entry's value is Pointer.\r | |
866 | If False, the type of PCD entry's value is not Pointer.\r | |
867 | \r | |
868 | @retval EFI_INVALID_PARAMETER If this PCD type is VPD, VPD PCD can not be set.\r | |
869 | @retval EFI_INVALID_PARAMETER If Size can not be set to size table.\r | |
149fb6d6 | 870 | @retval EFI_INVALID_PARAMETER If Size of non-Ptr type PCD does not match the size information in PCD database.\r |
fc547e08 | 871 | @retval EFI_NOT_FOUND If value type of PCD entry is intergrate, but not in\r |
872 | range of UINT8, UINT16, UINT32, UINT64\r | |
d1102dba | 873 | @retval EFI_NOT_FOUND Can not find the PCD type according to token number.\r |
fc547e08 | 874 | **/\r |
80408db0 | 875 | EFI_STATUS\r |
876 | SetWorker (\r | |
1436aea4 MK |
877 | IN UINTN TokenNumber,\r |
878 | IN VOID *Data,\r | |
879 | IN OUT UINTN *Size,\r | |
880 | IN BOOLEAN PtrType\r | |
ed66e1bc | 881 | );\r |
80408db0 | 882 | \r |
fc547e08 | 883 | /**\r |
884 | Wrapper function for set PCD value for non-Pointer type dynamic-ex PCD.\r | |
80408db0 | 885 | \r |
fc547e08 | 886 | @param ExTokenNumber Token number for dynamic-ex PCD.\r |
887 | @param Guid Token space guid for dynamic-ex PCD.\r | |
888 | @param Data Value want to be set.\r | |
889 | @param SetSize The size of value.\r | |
890 | \r | |
891 | @return status of ExSetWorker().\r | |
892 | \r | |
893 | **/\r | |
80408db0 | 894 | EFI_STATUS\r |
895 | ExSetValueWorker (\r | |
1436aea4 MK |
896 | IN UINTN ExTokenNumber,\r |
897 | IN CONST EFI_GUID *Guid,\r | |
898 | IN VOID *Data,\r | |
899 | IN UINTN Size\r | |
ed66e1bc | 900 | );\r |
80408db0 | 901 | \r |
fc547e08 | 902 | /**\r |
903 | Set value for a dynamic PCD entry.\r | |
d1102dba LG |
904 | \r |
905 | This routine find the local token number according to dynamic-ex PCD's token\r | |
fc547e08 | 906 | space guid and token number firstly, and invoke callback function if this PCD\r |
907 | entry registered callback function. Finally, invoken general SetWorker to set\r | |
908 | PCD value.\r | |
d1102dba | 909 | \r |
fc547e08 | 910 | @param ExTokenNumber Dynamic-ex PCD token number.\r |
911 | @param Guid Token space guid for dynamic-ex PCD.\r | |
912 | @param Data PCD value want to be set\r | |
913 | @param SetSize Size of value.\r | |
914 | @param PtrType If TRUE, this PCD entry is pointer type.\r | |
915 | If FALSE, this PCD entry is not pointer type.\r | |
916 | \r | |
917 | @return status of SetWorker().\r | |
80408db0 | 918 | \r |
fc547e08 | 919 | **/\r |
80408db0 | 920 | EFI_STATUS\r |
921 | ExSetWorker (\r | |
1436aea4 MK |
922 | IN UINTN ExTokenNumber,\r |
923 | IN CONST EFI_GUID *Guid,\r | |
924 | IN VOID *Data,\r | |
925 | IN OUT UINTN *Size,\r | |
926 | IN BOOLEAN PtrType\r | |
ed66e1bc | 927 | );\r |
80408db0 | 928 | \r |
fc547e08 | 929 | /**\r |
930 | Get the PCD entry pointer in PCD database.\r | |
d1102dba | 931 | \r |
fc547e08 | 932 | This routine will visit PCD database to find the PCD entry according to given\r |
d1102dba LG |
933 | token number. The given token number is autogened by build tools and it will be\r |
934 | translated to local token number. Local token number contains PCD's type and\r | |
fc547e08 | 935 | offset of PCD entry in PCD database.\r |
936 | \r | |
937 | @param TokenNumber Token's number, it is autogened by build tools\r | |
938 | @param GetSize The size of token's value\r | |
80408db0 | 939 | \r |
fc547e08 | 940 | @return PCD entry pointer in PCD database\r |
80408db0 | 941 | \r |
fc547e08 | 942 | **/\r |
80408db0 | 943 | VOID *\r |
944 | GetWorker (\r | |
1436aea4 MK |
945 | IN UINTN TokenNumber,\r |
946 | IN UINTN GetSize\r | |
ed66e1bc | 947 | );\r |
80408db0 | 948 | \r |
fc547e08 | 949 | /**\r |
950 | Wrapper function for get PCD value for dynamic-ex PCD.\r | |
951 | \r | |
952 | @param Guid Token space guid for dynamic-ex PCD.\r | |
953 | @param ExTokenNumber Token number for dyanmic-ex PCD.\r | |
954 | @param GetSize The size of dynamic-ex PCD value.\r | |
80408db0 | 955 | \r |
fc547e08 | 956 | @return PCD entry in PCD database.\r |
80408db0 | 957 | \r |
fc547e08 | 958 | **/\r |
80408db0 | 959 | VOID *\r |
960 | ExGetWorker (\r | |
1436aea4 MK |
961 | IN CONST EFI_GUID *Guid,\r |
962 | IN UINTN ExTokenNumber,\r | |
963 | IN UINTN GetSize\r | |
ed66e1bc | 964 | );\r |
80408db0 | 965 | \r |
966 | typedef struct {\r | |
1436aea4 MK |
967 | UINTN TokenNumber;\r |
968 | UINTN Size;\r | |
969 | UINT32 LocalTokenNumberAlias;\r | |
80408db0 | 970 | } EX_PCD_ENTRY_ATTRIBUTE;\r |
971 | \r | |
fc547e08 | 972 | /**\r |
419db80b | 973 | Get Token Number according to dynamic-ex PCD's {token space guid:token number}\r |
fc547e08 | 974 | \r |
975 | A dynamic-ex type PCD, developer must provide pair of token space guid: token number\r | |
976 | in DEC file. PCD database maintain a mapping table that translate pair of {token\r | |
419db80b | 977 | space guid: token number} to Token Number.\r |
d1102dba | 978 | \r |
fc547e08 | 979 | @param Guid Token space guid for dynamic-ex PCD entry.\r |
a5eca427 | 980 | @param ExTokenNumber Token number for dynamic-ex PCD.\r |
80408db0 | 981 | \r |
419db80b | 982 | @return Token Number for dynamic-ex PCD.\r |
fc547e08 | 983 | \r |
984 | **/\r | |
c52fa98c | 985 | UINTN\r |
80408db0 | 986 | GetExPcdTokenNumber (\r |
1436aea4 MK |
987 | IN CONST EFI_GUID *Guid,\r |
988 | IN UINTN ExTokenNumber\r | |
ed66e1bc | 989 | );\r |
80408db0 | 990 | \r |
fc547e08 | 991 | /**\r |
992 | The function registers the CallBackOnSet fucntion\r | |
993 | according to TokenNumber and EFI_GUID space.\r | |
80408db0 | 994 | \r |
fc547e08 | 995 | @param TokenNumber The token number.\r |
996 | @param Guid The GUID space.\r | |
997 | @param CallBackFunction The Callback function to be registered.\r | |
998 | @param Register To register or unregister the callback function.\r | |
80408db0 | 999 | \r |
fc547e08 | 1000 | @retval EFI_SUCCESS If the Callback function is registered.\r |
1001 | @retval EFI_NOT_FOUND If the PCD Entry is not found according to Token Number and GUID space.\r | |
1002 | @retval EFI_OUT_OF_RESOURCES If the callback function can't be registered because there is not free\r | |
1003 | slot left in the CallbackFnTable.\r | |
1004 | **/\r | |
80408db0 | 1005 | EFI_STATUS\r |
1006 | PeiRegisterCallBackWorker (\r | |
1436aea4 MK |
1007 | IN UINTN TokenNumber,\r |
1008 | IN CONST EFI_GUID *Guid OPTIONAL,\r | |
1009 | IN PCD_PPI_CALLBACK CallBackFunction,\r | |
1010 | IN BOOLEAN Register\r | |
a3a70b6a | 1011 | );\r |
80408db0 | 1012 | \r |
fc547e08 | 1013 | /**\r |
1014 | The function builds the PCD database.\r | |
419db80b BF |
1015 | \r |
1016 | @param FileHandle Handle of the file the external PCD database binary located.\r | |
1017 | \r | |
96d6d004 SZ |
1018 | @return Pointer to PCD database.\r |
1019 | \r | |
fc547e08 | 1020 | **/\r |
96d6d004 | 1021 | PEI_PCD_DATABASE *\r |
80408db0 | 1022 | BuildPcdDatabase (\r |
1436aea4 | 1023 | IN EFI_PEI_FILE_HANDLE FileHandle\r |
ed66e1bc | 1024 | );\r |
80408db0 | 1025 | \r |
fc547e08 | 1026 | /**\r |
1027 | Get index of PCD entry in size table.\r | |
1028 | \r | |
1029 | @param LocalTokenNumberTableIdx Index of this PCD in local token number table.\r | |
1030 | @param Database Pointer to PCD database.\r | |
1031 | \r | |
1032 | @return index of PCD entry in size table.\r | |
1033 | \r | |
1034 | **/\r | |
80408db0 | 1035 | UINTN\r |
1036 | GetSizeTableIndex (\r | |
1037 | IN UINTN LocalTokenNumberTableIdx,\r | |
1038 | IN PEI_PCD_DATABASE *Database\r | |
ed66e1bc | 1039 | );\r |
80408db0 | 1040 | \r |
fc547e08 | 1041 | /**\r |
1042 | Get PCD value's size for POINTER type PCD.\r | |
d1102dba | 1043 | \r |
fc547e08 | 1044 | The POINTER type PCD's value will be stored into a buffer in specificed size.\r |
1045 | The max size of this PCD's value is described in PCD's definition in DEC file.\r | |
1046 | \r | |
1047 | @param LocalTokenNumberTableIdx Index of PCD token number in PCD token table\r | |
1048 | @param MaxSize Maxmium size of PCD's value\r | |
1049 | @param Database Pcd database in PEI phase.\r | |
1050 | \r | |
1051 | @return PCD value's size for POINTER type PCD.\r | |
1052 | \r | |
1053 | **/\r | |
80408db0 | 1054 | UINTN\r |
1055 | GetPtrTypeSize (\r | |
1056 | IN UINTN LocalTokenNumberTableIdx,\r | |
1057 | OUT UINTN *MaxSize,\r | |
1058 | IN PEI_PCD_DATABASE *Database\r | |
ed66e1bc | 1059 | );\r |
80408db0 | 1060 | \r |
fc547e08 | 1061 | /**\r |
1062 | Set PCD value's size for POINTER type PCD.\r | |
d1102dba | 1063 | \r |
fc547e08 | 1064 | The POINTER type PCD's value will be stored into a buffer in specificed size.\r |
1065 | The max size of this PCD's value is described in PCD's definition in DEC file.\r | |
80408db0 | 1066 | \r |
fc547e08 | 1067 | @param LocalTokenNumberTableIdx Index of PCD token number in PCD token table\r |
1068 | @param CurrentSize Maxmium size of PCD's value\r | |
1069 | @param Database Pcd database in PEI phase.\r | |
80408db0 | 1070 | \r |
fc547e08 | 1071 | @retval TRUE Success to set PCD's value size, which is not exceed maxmium size\r |
1072 | @retval FALSE Fail to set PCD's value size, which maybe exceed maxmium size\r | |
1073 | \r | |
1074 | **/\r | |
80408db0 | 1075 | BOOLEAN\r |
1076 | SetPtrTypeSize (\r | |
1077 | IN UINTN LocalTokenNumberTableIdx,\r | |
1078 | IN OUT UINTN *CurrentSize,\r | |
1079 | IN PEI_PCD_DATABASE *Database\r | |
ed66e1bc | 1080 | );\r |
80408db0 | 1081 | \r |
80408db0 | 1082 | #endif\r |