]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdePkg/Include/Ppi/PiPcd.h
Update the copyright notice format
[mirror_edk2.git] / MdePkg / Include / Ppi / PiPcd.h
... / ...
CommitLineData
1/** @file\r
2 Platform Configuration Database (PCD) Protocol defined in PI 1.2 Vol3\r
3\r
4 A platform database that contains a variety of current platform settings or\r
5 directives that can be accessed by a driver or application.\r
6 PI PCD protocol only provide the accessing interfaces for Dynamic-Ex type PCD.\r
7\r
8 Callers to this protocol must be at a TPL_APPLICATION task priority level.\r
9 This is the base PCD service API that provides an abstraction for accessing configuration content in\r
10 the platform. It a seamless mechanism for extracting information regardless of where the\r
11 information is stored (such as in Read-only data, or an EFI Variable).\r
12 This protocol allows access to data through size-granular APIs and provides a mechanism for a\r
13 firmware component to monitor specific settings and be alerted when a setting is changed.\r
14\r
15 Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
16 This program and the accompanying materials\r
17 are licensed and made available under the terms and conditions of the BSD License\r
18 which accompanies this distribution. The full text of the license may be found at\r
19 http://opensource.org/licenses/bsd-license.php\r
20\r
21 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
22 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
23\r
24 @par Revision Reference:\r
25 PI Version 1.2 Vol 3.\r
26**/\r
27\r
28#ifndef __PI_PCD_PPI_H__\r
29#define __PI_PCD_PPI_H__\r
30\r
31extern EFI_GUID gEfiPeiPcdPpiGuid;\r
32\r
33#define EFI_PEI_PCD_PPI_GUID \\r
34 { 0x1f34d25, 0x4de2, 0x23ad, { 0x3f, 0xf3, 0x36, 0x35, 0x3f, 0xf3, 0x23, 0xf1 } }\r
35\r
36#define EFI_PCD_INVALID_TOKEN_NUMBER ((UINTN) 0)\r
37\r
38/**\r
39 SetSku() sets the SKU Id to be used for subsequent calls to set or get PCD values. SetSku() is\r
40 normally called only once by the system.\r
41 For each item (token), the database can hold a single value that applies to all SKUs, or multiple\r
42 values, where each value is associated with a specific SKU Id. Items with multiple, SKU-specific\r
43 values are called SKU enabled.\r
44 The SKU Id of zero is reserved as a default. The valid SkuId range is 1 to 255. For tokens that are\r
45 not SKU enabled, the system ignores any set SKU Id and works with the single value for that token.\r
46 For SKU-enabled tokens, the system will use the SKU Id set by the last call to SetSku(). If no\r
47 SKU Id is set or the currently set SKU Id isn't valid for the specified token, the system uses the\r
48 default SKU Id. If the system attempts to use the default SKU Id and no value has been set for that\r
49 Id, the results are unpredictable.\r
50\r
51 @param[in] SkuId The SKU value to set.\r
52**/\r
53typedef\r
54VOID\r
55(EFIAPI *EFI_PEI_PCD_PPI_SET_SKU)(\r
56 IN UINTN SkuId\r
57);\r
58\r
59/**\r
60 Retrieves the current byte-sized value for a PCD token number. If the TokenNumber is invalid,\r
61 the results are unpredictable.\r
62\r
63 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.\r
64 @param[in] TokenNumber The PCD token number.\r
65\r
66 @return 8-bit value for a given PCD token.\r
67**/\r
68typedef\r
69UINT8\r
70(EFIAPI *EFI_PEI_PCD_PPI_GET_8)(\r
71 IN CONST EFI_GUID *Guid,\r
72 IN UINTN TokenNumber\r
73);\r
74\r
75/**\r
76 Retrieves the current byte-sized value for a PCD token number. If the TokenNumber is invalid,\r
77 the results are unpredictable.\r
78\r
79 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.\r
80 @param[in] TokenNumber The PCD token number.\r
81\r
82 @return 16-bit value for a given PCD token.\r
83**/\r
84typedef\r
85UINT16\r
86(EFIAPI *EFI_PEI_PCD_PPI_GET_16)(\r
87 IN CONST EFI_GUID *Guid,\r
88 IN UINTN TokenNumber\r
89);\r
90\r
91/**\r
92 Retrieves the current 32-bit value for a PCD token number. If the TokenNumber is invalid, the\r
93 results are unpredictable.\r
94\r
95 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.\r
96 @param[in] TokenNumber The PCD token number.\r
97\r
98 @return 32-bit value for a given PCD token.\r
99**/\r
100typedef\r
101UINT32\r
102(EFIAPI *EFI_PEI_PCD_PPI_GET_32)(\r
103 IN CONST EFI_GUID *Guid,\r
104 IN UINTN TokenNumber\r
105);\r
106\r
107/**\r
108 Retrieves the current 64-bit value for a PCD token number. If the TokenNumber is invalid, the\r
109 results are unpredictable.\r
110\r
111 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.\r
112 @param[in] TokenNumber The PCD token number.\r
113\r
114 @return 64-bit value for a given PCD token.\r
115**/\r
116typedef\r
117UINT64\r
118(EFIAPI *EFI_PEI_PCD_PPI_GET_64)(\r
119 IN CONST EFI_GUID *Guid,\r
120 IN UINTN TokenNumber\r
121);\r
122\r
123/**\r
124 Retrieves the current pointer to the value for a PCD token number. There should not be any\r
125 alignment assumptions about the pointer that is returned by this function call. If the TokenNumber\r
126 is invalid, the results are unpredictable.\r
127\r
128 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.\r
129 @param[in] TokenNumber The PCD token number.\r
130**/\r
131typedef\r
132VOID *\r
133(EFIAPI *EFI_PEI_PCD_PPI_GET_POINTER)(\r
134 IN CONST EFI_GUID *Guid,\r
135 IN UINTN TokenNumber\r
136);\r
137\r
138/**\r
139 Retrieves the current Boolean-sized value for a PCD token number. If the TokenNumber is\r
140 invalid, the results are unpredictable.\r
141\r
142 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.\r
143 @param[in] TokenNumber The PCD token number.\r
144\r
145 @return Boolean value for a given PCD token.\r
146**/\r
147typedef\r
148BOOLEAN\r
149(EFIAPI *EFI_PEI_PCD_PPI_GET_BOOLEAN)(\r
150 IN CONST EFI_GUID *Guid,\r
151 IN UINTN TokenNumber\r
152);\r
153\r
154/**\r
155 Retrieves the current size of a particular PCD token. If the TokenNumber is invalid, the results are\r
156 unpredictable.\r
157\r
158 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.\r
159 @param[in] TokenNumber The PCD token number.\r
160\r
161 @return the size of the value for a given PCD token.\r
162**/\r
163typedef\r
164UINTN\r
165(EFIAPI *EFI_PEI_PCD_PPI_GET_SIZE)(\r
166 IN CONST EFI_GUID *Guid,\r
167 IN UINTN TokenNumber\r
168);\r
169\r
170/**\r
171 Sets an 8-bit value for a given PCD token.\r
172\r
173 When the PCD service sets a value, it will check to ensure that the size of the value being set is\r
174 compatible with the Token's existing definition. If it is not, an error will be returned.\r
175\r
176 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.\r
177 @param[in] TokenNumber The PCD token number.\r
178 @param[in] Value The value to set for the PCD token.\r
179\r
180 @retval EFI_SUCCESS The PCD service has set the value requested\r
181 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was\r
182 incompatible with a call to this function. Use GetSizeEx() to\r
183 retrieve the size of the target data.\r
184 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
185**/\r
186typedef\r
187EFI_STATUS\r
188(EFIAPI *EFI_PEI_PCD_PPI_SET_8)(\r
189 IN CONST EFI_GUID *Guid,\r
190 IN UINTN TokenNumber,\r
191 IN UINT8 Value\r
192);\r
193\r
194/**\r
195 Sets an 16-bit value for a given PCD token.\r
196\r
197 When the PCD service sets a value, it will check to ensure that the size of the value being set is\r
198 compatible with the Token's existing definition. If it is not, an error will be returned.\r
199\r
200 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.\r
201 @param[in] TokenNumber The PCD token number.\r
202 @param[in] Value The value to set for the PCD token.\r
203\r
204 @retval EFI_SUCCESS The PCD service has set the value requested\r
205 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was\r
206 incompatible with a call to this function. Use GetSizeEx() to\r
207 retrieve the size of the target data.\r
208 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
209**/\r
210typedef\r
211EFI_STATUS\r
212(EFIAPI *EFI_PEI_PCD_PPI_SET_16)(\r
213 IN CONST EFI_GUID *Guid,\r
214 IN UINTN TokenNumber,\r
215 IN UINT16 Value\r
216);\r
217\r
218/**\r
219 Sets an 32-bit value for a given PCD token.\r
220\r
221 When the PCD service sets a value, it will check to ensure that the size of the value being set is\r
222 compatible with the Token's existing definition. If it is not, an error will be returned.\r
223\r
224 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.\r
225 @param[in] TokenNumber The PCD token number.\r
226 @param[in] Value The value to set for the PCD token.\r
227\r
228 @retval EFI_SUCCESS The PCD service has set the value requested\r
229 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was\r
230 incompatible with a call to this function. Use GetSizeEx() to\r
231 retrieve the size of the target data.\r
232 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
233**/\r
234typedef\r
235EFI_STATUS\r
236(EFIAPI *EFI_PEI_PCD_PPI_SET_32)(\r
237 IN CONST EFI_GUID *Guid,\r
238 IN UINTN TokenNumber,\r
239 IN UINT32 Value\r
240);\r
241\r
242/**\r
243 Sets an 64-bit value for a given PCD token.\r
244\r
245 When the PCD service sets a value, it will check to ensure that the size of the value being set is\r
246 compatible with the Token's existing definition. If it is not, an error will be returned.\r
247\r
248 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.\r
249 @param[in] TokenNumber The PCD token number.\r
250 @param[in] Value The value to set for the PCD token.\r
251\r
252 @retval EFI_SUCCESS The PCD service has set the value requested\r
253 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was\r
254 incompatible with a call to this function. Use GetSizeEx() to\r
255 retrieve the size of the target data.\r
256 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
257**/\r
258typedef\r
259EFI_STATUS\r
260(EFIAPI *EFI_PEI_PCD_PPI_SET_64)(\r
261 IN CONST EFI_GUID *Guid,\r
262 IN UINTN TokenNumber,\r
263 IN UINT64 Value\r
264);\r
265\r
266/**\r
267 Sets a value of the specified size for a given PCD token.\r
268\r
269 When the PCD service sets a value, it will check to ensure that the size of the value being set is\r
270 compatible with the Token's existing definition. If it is not, an error will be returned.\r
271\r
272 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.\r
273 @param[in] TokenNumber The PCD token number.\r
274 @param[in] SizeOfValue The length of the value being set for the PCD token. If too large of a length is\r
275 specified, upon return from this function the value of SizeOfValue will reflect the\r
276 maximum size for the PCD token.\r
277 @param[in] Buffer A pointer to the buffer containing the value to set for the PCD token.\r
278\r
279 @retval EFI_SUCCESS The PCD service has set the value requested\r
280 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was\r
281 incompatible with a call to this function. Use GetSizeEx() to\r
282 retrieve the size of the target data.\r
283 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
284**/\r
285typedef\r
286EFI_STATUS\r
287(EFIAPI *EFI_PEI_PCD_PPI_SET_POINTER)(\r
288 IN CONST EFI_GUID *Guid,\r
289 IN UINTN TokenNumber,\r
290 IN OUT UINTN *SizeOfValue,\r
291 IN VOID *Buffer\r
292);\r
293\r
294/**\r
295 Sets a Boolean value for a given PCD token.\r
296\r
297 When the PCD service sets a value, it will check to ensure that the size of the value being set is\r
298 compatible with the Token's existing definition. If it is not, an error will be returned.\r
299\r
300 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.\r
301 @param[in] TokenNumber The PCD token number.\r
302 @param[in] Value The value to set for the PCD token.\r
303\r
304 @retval EFI_SUCCESS The PCD service has set the value requested\r
305 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was\r
306 incompatible with a call to this function. Use GetSizeEx() to\r
307 retrieve the size of the target data.\r
308 @retval EFI_NOT_FOUND The PCD service could not find the requested token number.\r
309**/\r
310typedef\r
311EFI_STATUS\r
312(EFIAPI *EFI_PEI_PCD_PPI_SET_BOOLEAN)(\r
313 IN CONST EFI_GUID *Guid,\r
314 IN UINTN TokenNumber,\r
315 IN BOOLEAN Value\r
316);\r
317\r
318typedef\r
319VOID\r
320(EFIAPI *EFI_PEI_PCD_PPI_CALLBACK)(\r
321 IN EFI_GUID *Guid OPTIONAL,\r
322 IN UINTN CallBackToken,\r
323 IN OUT VOID *TokenData,\r
324 IN UINTN TokenDatSize\r
325);\r
326\r
327/**\r
328 Specifies a function to be called anytime the value of a designated token is changed.\r
329\r
330 @param[in] Guid The 128-bit unique value that designates which namespace to monitor. If NULL, use\r
331 the standard platform namespace.\r
332 @param[in] CallBackToken The PCD token number to monitor.\r
333 @param[in] CallBackFunction The function prototype that will be called when the value associated with the\r
334 CallBackToken is set.\r
335\r
336 @retval EFI_SUCCESS The PCD service has successfully established a call event for the\r
337 CallBackToken requested.\r
338 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number.\r
339**/\r
340typedef\r
341EFI_STATUS\r
342(EFIAPI *EFI_PEI_PCD_PPI_CALLBACK_ON_SET)(\r
343 IN CONST EFI_GUID *Guid OPTIONAL,\r
344 IN UINTN CallBackToken,\r
345 IN EFI_PEI_PCD_PPI_CALLBACK CallBackFunction\r
346);\r
347\r
348/**\r
349 Cancels a previously set callback function for a particular PCD token number.\r
350\r
351 @param[in] Guid The 128-bit unique value that designates which namespace to monitor. If NULL, use\r
352 the standard platform namespace.\r
353 @param[in] CallBackToken The PCD token number to cancel monitoring.\r
354 @param[in] CallBackFunction The function prototype that was originally passed to the CallBackOnSet function.\r
355\r
356 @retval EFI_SUCCESS The PCD service has cancelled the call event associated with the\r
357 CallBackToken.\r
358 @retval EFI_INVALID_PARAMETER The PCD service did not match the CallBackFunction to one\r
359 that is currently being monitored.\r
360 @retval EFI_NOT_FOUND The PCD service could not find data the requested token number.\r
361**/\r
362typedef\r
363EFI_STATUS\r
364(EFIAPI *EFI_PEI_PCD_PPI_CANCEL_CALLBACK)(\r
365 IN CONST EFI_GUID *Guid OPTIONAL,\r
366 IN UINTN CallBackToken,\r
367 IN EFI_PEI_PCD_PPI_CALLBACK CallBackFunction\r
368);\r
369\r
370/**\r
371 Retrieves the next valid PCD token for a given namespace.\r
372\r
373 This provides a means by which to get the next valid token number in a given namespace. This is\r
374 useful since the PCD infrastructure has a sparse list of token numbers in it, and one cannot a priori\r
375 know what token numbers are valid in the database.\r
376\r
377 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.\r
378 @param[in] TokenNumber The PCD token number.\r
379\r
380 @retval EFI_SUCCESS The PCD service has retrieved the value requested.\r
381 @retval EFI_NOT_FOUND The PCD service could not find data from the requested token number.\r
382**/\r
383typedef\r
384EFI_STATUS\r
385(EFIAPI *EFI_PEI_PCD_PPI_GET_NEXT_TOKEN)(\r
386 IN CONST EFI_GUID *Guid OPTIONAL,\r
387 IN UINTN *TokenNumber\r
388);\r
389\r
390/**\r
391 Retrieves the next valid PCD token namespace for a given namespace.\r
392\r
393 Gets the next valid token namespace for a given namespace. This is useful to traverse the valid\r
394 token namespaces on a platform.\r
395\r
396 @param[in, out] Guid An indirect pointer to EFI_GUID. On input it designates a known token\r
397 namespace from which the search will start. On output, it designates the next valid\r
398 token namespace on the platform. If *Guid is NULL, then the GUID of the first token\r
399 space of the current platform is returned. If the search cannot locate the next valid\r
400 token namespace, an error is returned and the value of *Guid is undefined.\r
401\r
402 @retval EFI_SUCCESS The PCD service retrieved the value requested.\r
403 @retval EFI_NOT_FOUND The PCD service could not find the next valid token namespace.\r
404**/\r
405typedef\r
406EFI_STATUS\r
407(EFIAPI *EFI_PEI_PCD_PPI_GET_NEXT_TOKEN_SPACE)(\r
408 IN OUT CONST EFI_GUID **Guid\r
409);\r
410\r
411typedef struct {\r
412 EFI_PEI_PCD_PPI_SET_SKU SetSku;\r
413 EFI_PEI_PCD_PPI_GET_8 Get8;\r
414 EFI_PEI_PCD_PPI_GET_16 Get16;\r
415 EFI_PEI_PCD_PPI_GET_32 Get32;\r
416 EFI_PEI_PCD_PPI_GET_64 Get64;\r
417 EFI_PEI_PCD_PPI_GET_POINTER GetPtr;\r
418 EFI_PEI_PCD_PPI_GET_BOOLEAN GetBool;\r
419 EFI_PEI_PCD_PPI_GET_SIZE GetSize;\r
420 EFI_PEI_PCD_PPI_SET_8 Set8;\r
421 EFI_PEI_PCD_PPI_SET_16 Set16;\r
422 EFI_PEI_PCD_PPI_SET_32 Set32;\r
423 EFI_PEI_PCD_PPI_SET_64 Set64;\r
424 EFI_PEI_PCD_PPI_SET_POINTER SetPtr;\r
425 EFI_PEI_PCD_PPI_SET_BOOLEAN SetBool;\r
426 EFI_PEI_PCD_PPI_CALLBACK_ON_SET CallbackOnSet;\r
427 EFI_PEI_PCD_PPI_CANCEL_CALLBACK CancelCallback;\r
428 EFI_PEI_PCD_PPI_GET_NEXT_TOKEN GetNextToken;\r
429 EFI_PEI_PCD_PPI_GET_NEXT_TOKEN_SPACE GetNextTokenSpace;\r
430} EFI_PEI_PCD_PPI;\r
431\r
432#endif\r