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