Update EFI_CAPSULE_HEADER definition.
[mirror_edk2.git] / MdePkg / Include / Library / UefiRuntimeLib.h
CommitLineData
fb3df220 1/** @file\r
2 Library to abstract runtime services\r
3\r
4 Copyright (c) 2006, Intel Corporation \r
5 All rights reserved. This program and the accompanying materials \r
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
12\r
fb3df220 13**/\r
14\r
15#ifndef __UEFI_RUNTIME_LIB__\r
16#define __UEFI_RUNTIME_LIB__\r
17\r
18\r
19extern const EFI_EVENT_NOTIFY _gDriverExitBootServicesEvent[];\r
20\r
21extern const EFI_EVENT_NOTIFY _gDriverSetVirtualAddressMapEvent[];\r
22\r
23/**\r
24 Check to see if the execute context is in Runtime phase or not.\r
25\r
26 @param None.\r
27\r
28 @retval TRUE The driver is in SMM.\r
29 @retval FALSE The driver is not in SMM.\r
30\r
31**/\r
32BOOLEAN\r
33EFIAPI\r
34EfiAtRuntime (\r
35 VOID \r
36 );\r
37\r
38/**\r
39 Check to see if the SetVirtualAddressMsp() is invoked or not.\r
40\r
41 @retval TRUE SetVirtualAddressMsp() has been called.\r
42 @retval FALSE SetVirtualAddressMsp() has not been called.\r
43\r
44**/\r
45BOOLEAN\r
46EFIAPI\r
47EfiGoneVirtual (\r
48 VOID \r
49 );\r
50\r
51/**\r
52 Return current time and date information, and time-keeping \r
53 capabilities of hardware platform.\r
54\r
55 @param Time A pointer to storage to receive a snapshot of the current time.\r
56 @param Capabilities An optional pointer to a buffer to receive the real time clock device's\r
57 capabilities.\r
58 \r
59 @retval EFI_SUCCESS Success to execute the function.\r
60 @retval !EFI_SUCCESS Failed to e3xecute the function.\r
61\r
62**/\r
63EFI_STATUS\r
64EFIAPI\r
65EfiGetTime (\r
66 OUT EFI_TIME *Time,\r
67 OUT EFI_TIME_CAPABILITIES *Capabilities\r
68 );\r
69\r
70/**\r
71 Set current time and date information.\r
72\r
73 @param Time A pointer to cache of time setting.\r
74 \r
75 @retval EFI_SUCCESS Success to execute the function.\r
76 @retval !EFI_SUCCESS Failed to execute the function.\r
77\r
78**/\r
79EFI_STATUS\r
80EFIAPI\r
81EfiSetTime (\r
82 IN EFI_TIME *Time\r
83 );\r
84\r
85/**\r
86 Return current wakeup alarm clock setting.\r
87\r
88 @param Enabled Indicate if the alarm clock is enabled or disabled.\r
89 @param Pending Indicate if the alarm signal is pending and requires acknowledgement.\r
90 @param Time Current alarm clock setting.\r
91 \r
92 @retval EFI_SUCCESS Success to execute the function.\r
93 @retval !EFI_SUCCESS Failed to e3xecute the function.\r
94\r
95**/\r
96EFI_STATUS\r
97EFIAPI\r
98EfiGetWakeupTime (\r
99 OUT BOOLEAN *Enabled,\r
100 OUT BOOLEAN *Pending,\r
101 OUT EFI_TIME *Time\r
102 );\r
103\r
104/**\r
105 Set current wakeup alarm clock.\r
106\r
107 @param Enable Enable or disable current alarm clock..\r
108 @param Time Point to alarm clock setting.\r
109 \r
110 @retval EFI_SUCCESS Success to execute the function.\r
111 @retval !EFI_SUCCESS Failed to e3xecute the function.\r
112\r
113**/\r
114EFI_STATUS\r
115EFIAPI\r
116EfiSetWakeupTime (\r
117 IN BOOLEAN Enable,\r
118 IN EFI_TIME *Time\r
119 );\r
120\r
121/**\r
122 Return value of variable.\r
123\r
124 @param VariableName the name of the vendor's variable, it's a \r
125 Null-Terminated Unicode String\r
126 @param VendorGuid Unify identifier for vendor.\r
127 @param Attributes Point to memory location to return the attributes of variable. If the point \r
128 is NULL, the parameter would be ignored.\r
129 @param DataSize As input, point to the maxinum size of return Data-Buffer.\r
130 As output, point to the actual size of the returned Data-Buffer.\r
131 @param Data Point to return Data-Buffer.\r
132 \r
133 @retval EFI_SUCCESS Success to execute the function.\r
134 @retval !EFI_SUCCESS Failed to e3xecute the function.\r
135\r
136**/\r
137EFI_STATUS\r
138EFIAPI\r
139EfiGetVariable (\r
140 IN CHAR16 *VariableName,\r
141 IN EFI_GUID *VendorGuid,\r
142 OUT UINT32 *Attributes,\r
143 IN OUT UINTN *DataSize,\r
144 OUT VOID *Data\r
145 )\r
146;\r
147\r
148/**\r
149 Enumerates variable's name.\r
150\r
151 @param VariableNameSize As input, point to maxinum size of variable name.\r
152 As output, point to actual size of varaible name.\r
153 @param VariableName As input, supplies the last VariableName that was returned by \r
154 GetNextVariableName().\r
155 As output, returns the name of variable. The name \r
156 string is Null-Terminated Unicode string.\r
157 @param VendorGuid As input, supplies the last VendorGuid that was returned by \r
158 GetNextVriableName().\r
159 As output, returns the VendorGuid of the current variable.\r
160 \r
161 @retval EFI_SUCCESS Success to execute the function.\r
162 @retval !EFI_SUCCESS Failed to e3xecute the function.\r
163\r
164**/\r
165EFI_STATUS\r
166EFIAPI\r
167EfiGetNextVariableName (\r
168 IN OUT UINTN *VariableNameSize,\r
169 IN OUT CHAR16 *VariableName,\r
170 IN OUT EFI_GUID *VendorGuid\r
171 );\r
172\r
173/**\r
174 Sets value of variable.\r
175\r
176 @param VariableName the name of the vendor's variable, it's a \r
177 Null-Terminated Unicode String\r
178 @param VendorGuid Unify identifier for vendor.\r
179 @param Attributes Point to memory location to return the attributes of variable. If the point \r
180 is NULL, the parameter would be ignored.\r
181 @param DataSize The size in bytes of Data-Buffer.\r
182 @param Data Point to the content of the variable.\r
183\r
184 @retval EFI_SUCCESS Success to execute the function.\r
185 @retval !EFI_SUCCESS Failed to e3xecute the function.\r
186\r
187**/\r
188EFI_STATUS\r
189EFIAPI\r
190EfiSetVariable (\r
191 IN CHAR16 *VariableName,\r
192 IN EFI_GUID *VendorGuid,\r
193 IN UINT32 Attributes,\r
194 IN UINTN DataSize,\r
195 IN VOID *Data\r
196 );\r
197\r
198/**\r
199 Returns the next high 32 bits of platform's monotonic counter.\r
200\r
201 @param HighCount Pointer to returned value.\r
202\r
203 @retval EFI_SUCCESS Success to execute the function.\r
204 @retval !EFI_SUCCESS Failed to e3xecute the function.\r
205\r
206**/\r
207EFI_STATUS\r
208EFIAPI\r
209EfiGetNextHighMonotonicCount (\r
210 OUT UINT32 *HighCount\r
211 );\r
212\r
213/**\r
214 Resets the entire platform.\r
215\r
216 @param ResetType The type of reset to perform.\r
217 @param ResetStatus The status code for reset.\r
218 @param DataSize The size in bytes of reset data.\r
219 @param ResetData Pointer to data buffer that includes \r
220 Null-Terminated Unicode string.\r
221\r
fb3df220 222**/\r
223VOID\r
224EfiResetSystem (\r
225 IN EFI_RESET_TYPE ResetType,\r
226 IN EFI_STATUS ResetStatus,\r
227 IN UINTN DataSize,\r
228 IN CHAR16 *ResetData\r
229 );\r
230\r
231/**\r
232 Determines the new virtual address that is to be used on subsequent memory accesses.\r
233\r
234 @param DebugDisposition Supplies type information for the pointer being converted.\r
235 @param Address The pointer to a pointer that is to be fixed to be the \r
236 value needed for the new virtual address mapping being \r
237 applied.\r
238\r
239 @retval EFI_SUCCESS Success to execute the function.\r
240 @retval !EFI_SUCCESS Failed to e3xecute the function.\r
241\r
242**/\r
243EFI_STATUS\r
244EFIAPI\r
245EfiConvertPointer (\r
246 IN UINTN DebugDisposition,\r
247 IN OUT VOID **Address\r
248 );\r
249\r
250\r
251/**\r
252 Change the runtime addressing mode of EFI firmware from physical to virtual.\r
253\r
254 @param MemoryMapSize The size in bytes of VirtualMap.\r
255 @param DescriptorSize The size in bytes of an entry in the VirtualMap.\r
256 @param DescriptorVersion The version of the structure entries in VirtualMap.\r
257 @param VirtualMap An array of memory descriptors which contain new virtual\r
258 address mapping information for all runtime ranges. Type\r
259 EFI_MEMORY_DESCRIPTOR is defined in the\r
260 GetMemoryMap() function description.\r
261\r
262 @retval EFI_SUCCESS The virtual address map has been applied.\r
263 @retval EFI_UNSUPPORTED EFI firmware is not at runtime, or the EFI firmware is already in\r
264 virtual address mapped mode.\r
265 @retval EFI_INVALID_PARAMETER DescriptorSize or DescriptorVersion is\r
266 invalid.\r
267 @retval EFI_NO_MAPPING A virtual address was not supplied for a range in the memory\r
268 map that requires a mapping.\r
269 @retval EFI_NOT_FOUND A virtual address was supplied for an address that is not found\r
270 in the memory map.\r
271**/\r
272EFI_STATUS\r
273EFIAPI\r
274EfiSetVirtualAddressMap (\r
275 IN UINTN MemoryMapSize,\r
276 IN UINTN DescriptorSize,\r
277 IN UINT32 DescriptorVersion,\r
278 IN CONST EFI_MEMORY_DESCRIPTOR *VirtualMap\r
279 );\r
280\r
281\r
282/**\r
283 Conver the standard Lib double linked list to a virtual mapping.\r
284\r
285 @param DebugDisposition Supplies type information for the pointer being converted.\r
286 @param ListHead Head of linked list to convert.\r
287\r
288 @retval EFI_SUCCESS Success to execute the function.\r
289 @retval !EFI_SUCCESS Failed to e3xecute the function.\r
290\r
291**/\r
292EFI_STATUS\r
293EFIAPI\r
294EfiConvertList (\r
295 IN UINTN DebugDisposition,\r
296 IN OUT LIST_ENTRY *ListHead\r
297 );\r
298\r
299/**\r
300 \r
301 Passes capsules to the firmware with both virtual and physical mapping. \r
302 Depending on the intended consumption, the firmware may\r
303 process the capsule immediately. If the payload should persist across a\r
304 system reset, the reset value returned from EFI_QueryCapsuleCapabilities must\r
305 be passed into ResetSystem() and will cause the capsule to be processed by \r
306 the firmware as part of the reset process.\r
307 \r
308 @param CapsuleHeaderArray Virtual pointer to an array of virtual pointers to the capsules\r
309 being passed into update capsule. Each capsules is assumed to\r
310 stored in contiguous virtual memory. The capsules in the\r
311 CapsuleHeaderArray must be the same capsules as the\r
312 ScatterGatherList. The CapsuleHeaderArray must\r
313 have the capsules in the same order as the ScatterGatherList.\r
314 @param CapsuleCount Number of pointers to EFI_CAPSULE_HEADER in\r
315 CaspuleHeaderArray.\r
316 @param ScatterGatherList Physical pointer to a set of\r
317 EFI_CAPSULE_BLOCK_DESCRIPTOR that describes the\r
318 location in physical memory of a set of capsules. See Related\r
319 Definitions for an explanation of how more than one capsule is\r
320 passed via this interface. The capsules in the\r
321 ScatterGatherList must be in the same order as the\r
322 CapsuleHeaderArray. This parameter is only referenced if\r
323 the capsules are defined to persist across system reset.\r
324\r
325 @retval EFI_SUCCESS Valid capsule was passed. I Valid capsule was passed. If\r
326 CAPSULE_FLAGS_PERSIT_ACROSS_RESET is not set, the\r
327 capsule has been successfully processed by the firmware.\r
328 @retval EFI_INVALID_PARAMETER CapsuleSize is NULL or ResetTye is NULL.\r
329 @retval EFI_DEVICE_ERROR The capsule update was started, but failed due to a device error.\r
330\r
331**/\r
332EFI_STATUS\r
333EFIAPI\r
334EfiUpdateCapsule (\r
335 IN UEFI_CAPSULE_HEADER **CapsuleHeaderArray,\r
336 IN UINTN CapsuleCount,\r
337 IN EFI_PHYSICAL_ADDRESS ScatterGatherList\r
338 );\r
339\r
340\r
341/**\r
342 \r
343 The QueryCapsuleCapabilities() function allows a caller to test to see if a capsule or\r
344 capsules can be updated via UpdateCapsule(). The Flags values in the capsule header and\r
345 size of the entire capsule is checked.\r
346 If the caller needs to query for generic capsule capability a fake EFI_CAPSULE_HEADER can be\r
347 constructed where CapsuleImageSize is equal to HeaderSize that is equal to sizeof\r
348 (EFI_CAPSULE_HEADER). To determine reset requirements,\r
349 CAPSULE_FLAGS_PERSIST_ACROSS_RESET should be set in the Flags field of the\r
350 EFI_CAPSULE_HEADER.\r
351 The firmware must support any capsule that has the\r
352 CAPSULE_FLAGS_PERSIST_ACROSS_RESET flag set in EFI_CAPSULE_HEADER. The\r
353 firmware sets the policy for what capsules are supported that do not have the\r
354 CAPSULE_FLAGS_PERSIST_ACROSS_RESET flag set.\r
355 \r
356 @param CapsuleHeaderArray Virtual pointer to an array of virtual pointers to the capsules\r
357 being passed into update capsule. The capsules are assumed to\r
358 stored in contiguous virtual memory.\r
359 @param CapsuleCount Number of pointers to EFI_CAPSULE_HEADER in\r
360 CaspuleHeaderArray.\r
361 @param MaxiumCapsuleSize On output the maximum size that UpdateCapsule() can\r
362 support as an argument to UpdateCapsule() via\r
363 CapsuleHeaderArray and ScatterGatherList.\r
364 Undefined on input.\r
365 @param ResetType Returns the type of reset required for the capsule update.\r
366\r
367 @retval EFI_SUCCESS Valid answer returned..\r
368 @retval EFI_INVALID_PARAMETER MaximumCapsuleSize is NULL.\r
369 @retval EFI_UNSUPPORTED The capsule type is not supported on this platform, and\r
370 MaximumCapsuleSize and ResetType are undefined.\r
371\r
372**/\r
373EFI_STATUS\r
374EFIAPI\r
375EfiQueryCapsuleCapabilities (\r
376 IN UEFI_CAPSULE_HEADER **CapsuleHeaderArray,\r
377 IN UINTN CapsuleCount,\r
378 OUT UINT64 *MaximumCapsuleSize,\r
379 OUT EFI_RESET_TYPE *ResetType\r
380 );\r
381\r
382\r
383/**\r
384 \r
385 The QueryVariableInfo() function allows a caller to obtain the information about the\r
386 maximum size of the storage space available for the EFI variables, the remaining size of the storage\r
387 space available for the EFI variables and the maximum size of each individual EFI variable,\r
388 associated with the attributes specified.\r
389 The returned MaximumVariableStorageSize, RemainingVariableStorageSize,\r
390 MaximumVariableSize information may change immediately after the call based on other\r
391 runtime activities including asynchronous error events. Also, these values associated with different\r
392 attributes are not additive in nature.\r
393 \r
394 @param Attributes Attributes bitmask to specify the type of variables on\r
395 which to return information. Refer to the\r
396 GetVariable() function description.\r
397 @param MaximumVariableStorageSize \r
398 On output the maximum size of the storage space\r
399 available for the EFI variables associated with the\r
400 attributes specified.\r
401 @param RemainingVariableStorageSize \r
402 Returns the remaining size of the storage space\r
403 available for the EFI variables associated with the\r
404 attributes specified..\r
405 @param MaximumVariableSize Returns the maximum size of the individual EFI\r
406 variables associated with the attributes specified.\r
407\r
408 @retval EFI_SUCCESS Valid answer returned.\r
409 @retval EFI_INVALID_PARAMETER An invalid combination of attribute bits was supplied.\r
410 @retval EFI_UNSUPPORTED EFI_UNSUPPORTED The attribute is not supported on this platform, and the\r
411 MaximumVariableStorageSize,\r
412 RemainingVariableStorageSize, MaximumVariableSize\r
413 are undefined.\r
414**/\r
415EFI_STATUS\r
416EFIAPI\r
417EfiQueryVariableInfo (\r
418 IN UINT32 Attrubutes,\r
419 OUT UINT64 *MaximumVariableStorageSize,\r
420 OUT UINT64 *RemainingVariableStorageSize,\r
421 OUT UINT64 *MaximumVariableSize\r
422 );\r
423\r
424#endif\r
425\r