]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Ppi/PiPcd.h
Rename one field in "EFI_ATA_STATUS_BLOCK" to make it a legal C structure.
[mirror_edk2.git] / MdePkg / Include / Ppi / PiPcd.h
CommitLineData
be35570d 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, Intel Corporation \r
16 All rights reserved. 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
fa3e7746 47 SKU Id is set or the currently set SKU Id isn't valid for the specified token, the system uses the\r
be35570d 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_EX_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_EX_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_EX_32)(\r
103 IN CONST EFI_GUID *Guid,\r
104 IN UINTN TokenNumber\r
105);\r
106\r
107/**\r
108 Retrieves the current pointer to the value for a PCD token number. There should not be any\r
109 alignment assumptions about the pointer that is returned by this function call. If the TokenNumber\r
110 is invalid, the results are unpredictable.\r
111 \r
112 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.\r
113 @param[in] TokenNumber The PCD token number.\r
114**/\r
115typedef\r
116VOID *\r
117(EFIAPI *EFI_PEI_PCD_PPI_GET_EX_POINTER)(\r
118 IN CONST EFI_GUID *Guid,\r
119 IN UINTN TokenNumber\r
120);\r
121\r
122/**\r
123 Retrieves the current Boolean-sized value for a PCD token number. If the TokenNumber is\r
124 invalid, the results are unpredictable.\r
125\r
126 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.\r
127 @param[in] TokenNumber The PCD token number.\r
128 \r
129 @return Boolean value for a given PCD token.\r
130**/\r
131typedef\r
132BOOLEAN\r
133(EFIAPI *EFI_PEI_PCD_PPI_GET_EX_BOOLEAN)(\r
134 IN CONST EFI_GUID *Guid,\r
135 IN UINTN TokenNumber\r
136);\r
137\r
138/**\r
139 Retrieves the current size of a particular PCD token. If the TokenNumber is invalid, the results are\r
140 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 the size of the value for a given PCD token.\r
146**/\r
147typedef\r
148UINTN\r
149(EFIAPI *EFI_PEI_PCD_PPI_GET_EX_SIZE)(\r
150 IN CONST EFI_GUID *Guid,\r
151 IN UINTN TokenNumber\r
152);\r
153\r
154/**\r
155 Sets an 8-bit value for a given PCD token.\r
156 \r
157 When the PCD service sets a value, it will check to ensure that the size of the value being set is\r
fa3e7746 158 compatible with the Token's existing definition. If it is not, an error will be returned.\r
be35570d 159 \r
160 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.\r
161 @param[in] TokenNumber The PCD token number. \r
162 @param[in] Value The value to set for the PCD token.\r
163 \r
164 @retval EFI_SUCCESS The PCD service has set the value requested\r
165 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was\r
166 incompatible with a call to this function. Use GetSizeEx() to\r
167 retrieve the size of the target data.\r
168 @retval EFI_NOT_FOUND The PCD service could not find the requested token number. \r
169**/\r
170typedef\r
171EFI_STATUS\r
172(EFIAPI *EFI_PEI_PCD_PPI_SET_EX_8)(\r
173 IN CONST EFI_GUID *Guid,\r
174 IN UINTN TokenNumber,\r
175 IN UINT8 Value\r
176);\r
177\r
178/**\r
179 Sets an 16-bit value for a given PCD token.\r
180 \r
181 When the PCD service sets a value, it will check to ensure that the size of the value being set is\r
fa3e7746 182 compatible with the Token's existing definition. If it is not, an error will be returned.\r
be35570d 183 \r
184 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.\r
185 @param[in] TokenNumber The PCD token number. \r
186 @param[in] Value The value to set for the PCD token.\r
187 \r
188 @retval EFI_SUCCESS The PCD service has set the value requested\r
189 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was\r
190 incompatible with a call to this function. Use GetSizeEx() to\r
191 retrieve the size of the target data.\r
192 @retval EFI_NOT_FOUND The PCD service could not find the requested token number. \r
193**/\r
194typedef\r
195EFI_STATUS\r
196(EFIAPI *EFI_PEI_PCD_PPI_SET_EX_16)(\r
197 IN CONST EFI_GUID *Guid,\r
198 IN UINTN TokenNumber,\r
199 IN UINT16 Value\r
200);\r
201\r
202/**\r
203 Sets an 32-bit value for a given PCD token.\r
204 \r
205 When the PCD service sets a value, it will check to ensure that the size of the value being set is\r
fa3e7746 206 compatible with the Token's existing definition. If it is not, an error will be returned.\r
be35570d 207 \r
208 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.\r
209 @param[in] TokenNumber The PCD token number. \r
210 @param[in] Value The value to set for the PCD token.\r
211 \r
212 @retval EFI_SUCCESS The PCD service has set the value requested\r
213 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was\r
214 incompatible with a call to this function. Use GetSizeEx() to\r
215 retrieve the size of the target data.\r
216 @retval EFI_NOT_FOUND The PCD service could not find the requested token number. \r
217**/\r
218typedef\r
219EFI_STATUS\r
220(EFIAPI *EFI_PEI_PCD_PPI_SET_EX_32)(\r
221 IN CONST EFI_GUID *Guid,\r
222 IN UINTN TokenNumber,\r
223 IN UINT32 Value\r
224);\r
225\r
226/**\r
227 Sets an 64-bit value for a given PCD token.\r
228 \r
229 When the PCD service sets a value, it will check to ensure that the size of the value being set is\r
fa3e7746 230 compatible with the Token's existing definition. If it is not, an error will be returned.\r
be35570d 231 \r
232 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.\r
233 @param[in] TokenNumber The PCD token number. \r
234 @param[in] Value The value to set for the PCD token.\r
235 \r
236 @retval EFI_SUCCESS The PCD service has set the value requested\r
237 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was\r
238 incompatible with a call to this function. Use GetSizeEx() to\r
239 retrieve the size of the target data.\r
240 @retval EFI_NOT_FOUND The PCD service could not find the requested token number. \r
241**/\r
242typedef\r
243EFI_STATUS\r
244(EFIAPI *EFI_PEI_PCD_PPI_SET_EX_64)(\r
245 IN CONST EFI_GUID *Guid,\r
246 IN UINTN TokenNumber,\r
247 IN UINT64 Value\r
248);\r
249\r
250/**\r
251 Sets a value of the specified size for a given PCD token.\r
252 \r
253 When the PCD service sets a value, it will check to ensure that the size of the value being set is\r
fa3e7746 254 compatible with the Token's existing definition. If it is not, an error will be returned.\r
be35570d 255 \r
256 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.\r
257 @param[in] TokenNumber The PCD token number. \r
258 @param[in] SizeOfValue The length of the Value being set for the PCD token.\r
259 @param[in] Buffer A pointer to the buffer containing the value to set for the PCD token.\r
260 \r
261 @retval EFI_SUCCESS The PCD service has set the value requested\r
262 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was\r
263 incompatible with a call to this function. Use GetSizeEx() to\r
264 retrieve the size of the target data.\r
265 @retval EFI_NOT_FOUND The PCD service could not find the requested token number. \r
266**/\r
267typedef\r
268EFI_STATUS\r
269(EFIAPI *EFI_PEI_PCD_PPI_SET_EX_POINTER)(\r
270 IN CONST EFI_GUID *Guid,\r
271 IN UINTN TokenNumber,\r
272 IN UINTN SizeOfValue,\r
273 IN VOID *Buffer\r
274);\r
275\r
276/**\r
277 Sets a Boolean value for a given PCD token.\r
278 \r
279 When the PCD service sets a value, it will check to ensure that the size of the value being set is\r
fa3e7746 280 compatible with the Token's existing definition. If it is not, an error will be returned.\r
be35570d 281 \r
282 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.\r
283 @param[in] TokenNumber The PCD token number. \r
284 @param[in] Value The value to set for the PCD token.\r
285 \r
286 @retval EFI_SUCCESS The PCD service has set the value requested\r
287 @retval EFI_INVALID_PARAMETER The PCD service determined that the size of the data being set was\r
288 incompatible with a call to this function. Use GetSizeEx() to\r
289 retrieve the size of the target data.\r
290 @retval EFI_NOT_FOUND The PCD service could not find the requested token number. \r
291**/\r
292typedef\r
293EFI_STATUS\r
294(EFIAPI *EFI_PEI_PCD_PPI_SET_EX_BOOLEAN)(\r
295 IN CONST EFI_GUID *Guid,\r
296 IN UINTN TokenNumber,\r
297 IN BOOLEAN Value\r
298);\r
299\r
300typedef\r
301VOID\r
302(EFIAPI *PCD_PPI_CALLBACK)(\r
303 IN EFI_GUID *Guid OPTIONAL,\r
304 IN UINTN CallBackToken,\r
305 IN VOID *TokenData,\r
306 IN UINTN TokenDatSize\r
307);\r
308\r
309/**\r
310 Specifies a function to be called anytime the value of a designated token is changed.\r
311 \r
312 @param[in] Guid The 128-bit unique value that designates which namespace to monitor. If NULL, use\r
313 the standard platform namespace.\r
314 @param[in] CallBackToken The PCD token number to monitor.\r
315 @param[in] CallBackFunction The function prototype that will be called when the value associated with the\r
316 CallBackToken is set.\r
317\r
318 @retval EFI_SUCCESS The PCD service has successfully established a call event for the\r
319 CallBackToken requested.\r
320 @retval EFI_NOT_FOUND The PCD service could not find the referenced token number. \r
321**/\r
322typedef\r
323EFI_STATUS\r
324(EFIAPI *EFI_PEI_PCD_PPI_CALL_BACK_ON_SET)(\r
325 IN CONST EFI_GUID *Guid OPTIONAL,\r
326 IN UINTN CallBackToken,\r
327 IN PCD_PPI_CALLBACK CallBackFunction\r
328);\r
329\r
330/**\r
331 Cancels a previously set callback function for a particular PCD token number.\r
332 \r
333 @param[in] Guid The 128-bit unique value that designates which namespace to monitor. If NULL, use\r
334 the standard platform namespace.\r
335 @param[in] CallBackToken The PCD token number to cancel monitoring.\r
336 @param[in] CallBackFunction The function prototype that was originally passed to the CallBackOnSet function.\r
337 \r
338 @retval EFI_SUCCESS The PCD service has cancelled the call event associated with the\r
339 CallBackToken.\r
340 @retval EFI_INVALID_PARAMETER The PCD service did not match the CallBackFunction to one\r
341 that is currently being monitored.\r
342 @retval EFI_NOT_FOUND The PCD service could not find data the requested token number. \r
343**/\r
344typedef\r
345EFI_STATUS\r
346(EFIAPI *EFI_PEI_PCD_PPI_CANCEL_CALL_BACK)(\r
347 IN CONST EFI_GUID *Guid OPTIONAL,\r
348 IN UINTN CallBackToken,\r
349 IN PCD_PPI_CALLBACK CallBackFunction\r
350);\r
351\r
352/**\r
353 Retrieves the next valid PCD token for a given namespace.\r
354 \r
355 This provides a means by which to get the next valid token number in a given namespace. This is\r
356 useful since the PCD infrastructure has a sparse list of token numbers in it, and one cannot a priori\r
357 know what token numbers are valid in the database.\r
358 \r
359 @param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.\r
360 @param[in] TokenNumber The PCD token number. \r
361 \r
362 @retval EFI_SUCCESS The PCD service has retrieved the value requested.\r
363 @retval EFI_NOT_FOUND The PCD service could not find data from the requested token number.\r
364**/\r
365typedef\r
366EFI_STATUS\r
367(EFIAPI *EFI_PEI_PCD_PPI_GET_NEXT_TOKEN)(\r
368 IN CONST EFI_GUID *Guid OPTIONAL,\r
369 IN UINTN *TokenNumber\r
370);\r
371\r
372/**\r
373 Retrieves the next valid PCD token namespace for a given namespace.\r
374 \r
375 Gets the next valid token namespace for a given namespace. This is useful to traverse the valid\r
376 token namespaces on a platform.\r
377 \r
378 @param[in, out] Guid An indirect pointer to EFI_GUID. On input it designates a known token\r
379 namespace from which the search will start. On output, it designates the next valid\r
380 token namespace on the platform. If *Guid is NULL, then the GUID of the first token\r
381 space of the current platform is returned. If the search cannot locate the next valid\r
382 token namespace, an error is returned and the value of *Guid is undefined.\r
383 \r
384 @retval EFI_SUCCESS The PCD service retrieved the value requested.\r
385 @retval EFI_NOT_FOUND The PCD service could not find the next valid token namespace. \r
386**/\r
387typedef\r
388EFI_STATUS\r
389(EFIAPI *EFI_PEI_PCD_PPI_GET_NEXT_TOKEN_SPACE)(\r
390 IN OUT CONST EFI_GUID **Guid\r
391);\r
392\r
393typedef struct {\r
394 EFI_PEI_PCD_PPI_SET_SKU SetSku;\r
395 EFI_PEI_PCD_PPI_GET_EX_8 GetEx8;\r
396 EFI_PEI_PCD_PPI_GET_EX_16 GetEx16;\r
397 EFI_PEI_PCD_PPI_GET_EX_32 GetEx32;\r
398 EFI_PEI_PCD_PPI_GET_EX_64 GetEx64;\r
399 EFI_PEI_PCD_PPI_GET_EX_POINTER GetExPtr;\r
400 EFI_PEI_PCD_PPI_GET_EX_BOOLEAN GetExBool;\r
401 EFI_PEI_PCD_PPI_GET_EX_SIZE GetExSize;\r
402 EFI_PEI_PCD_PPI_SET_EX_8 SetEx8;\r
403 EFI_PEI_PCD_PPI_SET_EX_16 SetEx16;\r
404 EFI_PEI_PCD_PPI_SET_EX_32 SetEx32;\r
405 EFI_PEI_PCD_PPI_SET_EX_64 SetEx64;\r
406 EFI_PEI_PCD_PPI_SET_EX_POINTER SetExPtr;\r
407 EFI_PEI_PCD_PPI_SET_EX_BOOLEAN SetExBool;\r
408 EFI_PEI_PCD_PPI_CALLBACK_ON_SET CallbackOnSet;\r
409 EFI_PEI_PCD_PPI_CANCEL_CALLBACK CancelCallback;\r
410 EFI_PEI_PCD_PPI_GET_NEXT_TOKEN GetNextToken;\r
411 EFI_PEI_PCD_PPI_GET_NEXT_TOKEN_SPACE GetNextTokenSpace;\r
412} EFI_PEI_PCD_PPI;\r
413\r
414#endif\r