]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Library/UefiRuntimeLib.h
Fixed comments to follow coding standard.
[mirror_edk2.git] / MdePkg / Include / Library / UefiRuntimeLib.h
CommitLineData
fb3df220 1/** @file\r
2 Library to abstract runtime services\r
3\r
3b89de63 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
fb3df220 9\r
3b89de63 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
fb3df220 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
3b89de63 35 VOID\r
fb3df220 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
3b89de63 48 VOID\r
fb3df220 49 );\r
50\r
51/**\r
3b89de63 52 Return current time and date information, and time-keeping\r
fb3df220 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
3b89de63 58\r
fb3df220 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
3b89de63 74\r
fb3df220 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
3b89de63 91\r
fb3df220 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
3b89de63 109\r
fb3df220 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
3b89de63 124 @param VariableName the name of the vendor's variable, it's a\r
fb3df220 125 Null-Terminated Unicode String\r
126 @param VendorGuid Unify identifier for vendor.\r
3b89de63 127 @param Attributes Point to memory location to return the attributes of variable. If the point\r
fb3df220 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
3b89de63 132\r
fb3df220 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
bf231ea6 145 );\r
fb3df220 146\r
147/**\r
148 Enumerates variable's name.\r
149\r
150 @param VariableNameSize As input, point to maxinum size of variable name.\r
151 As output, point to actual size of varaible name.\r
3b89de63 152 @param VariableName As input, supplies the last VariableName that was returned by\r
fb3df220 153 GetNextVariableName().\r
3b89de63 154 As output, returns the name of variable. The name\r
fb3df220 155 string is Null-Terminated Unicode string.\r
3b89de63 156 @param VendorGuid As input, supplies the last VendorGuid that was returned by\r
fb3df220 157 GetNextVriableName().\r
158 As output, returns the VendorGuid of the current variable.\r
3b89de63 159\r
fb3df220 160 @retval EFI_SUCCESS Success to execute the function.\r
161 @retval !EFI_SUCCESS Failed to e3xecute the function.\r
162\r
163**/\r
164EFI_STATUS\r
165EFIAPI\r
166EfiGetNextVariableName (\r
167 IN OUT UINTN *VariableNameSize,\r
168 IN OUT CHAR16 *VariableName,\r
169 IN OUT EFI_GUID *VendorGuid\r
170 );\r
171\r
172/**\r
173 Sets value of variable.\r
174\r
3b89de63 175 @param VariableName the name of the vendor's variable, it's a\r
fb3df220 176 Null-Terminated Unicode String\r
177 @param VendorGuid Unify identifier for vendor.\r
3b89de63 178 @param Attributes Point to memory location to return the attributes of variable. If the point\r
fb3df220 179 is NULL, the parameter would be ignored.\r
180 @param DataSize The size in bytes of Data-Buffer.\r
181 @param Data Point to the content of the variable.\r
182\r
183 @retval EFI_SUCCESS Success to execute the function.\r
184 @retval !EFI_SUCCESS Failed to e3xecute the function.\r
185\r
186**/\r
187EFI_STATUS\r
188EFIAPI\r
189EfiSetVariable (\r
190 IN CHAR16 *VariableName,\r
191 IN EFI_GUID *VendorGuid,\r
192 IN UINT32 Attributes,\r
193 IN UINTN DataSize,\r
194 IN VOID *Data\r
195 );\r
196\r
197/**\r
198 Returns the next high 32 bits of platform's monotonic counter.\r
199\r
200 @param HighCount Pointer to returned value.\r
201\r
202 @retval EFI_SUCCESS Success to execute the function.\r
203 @retval !EFI_SUCCESS Failed to e3xecute the function.\r
204\r
205**/\r
206EFI_STATUS\r
207EFIAPI\r
208EfiGetNextHighMonotonicCount (\r
209 OUT UINT32 *HighCount\r
210 );\r
211\r
212/**\r
213 Resets the entire platform.\r
214\r
215 @param ResetType The type of reset to perform.\r
216 @param ResetStatus The status code for reset.\r
217 @param DataSize The size in bytes of reset data.\r
3b89de63 218 @param ResetData Pointer to data buffer that includes\r
fb3df220 219 Null-Terminated Unicode string.\r
220\r
fb3df220 221**/\r
222VOID\r
223EfiResetSystem (\r
224 IN EFI_RESET_TYPE ResetType,\r
225 IN EFI_STATUS ResetStatus,\r
226 IN UINTN DataSize,\r
227 IN CHAR16 *ResetData\r
228 );\r
229\r
230/**\r
231 Determines the new virtual address that is to be used on subsequent memory accesses.\r
232\r
233 @param DebugDisposition Supplies type information for the pointer being converted.\r
3b89de63 234 @param Address The pointer to a pointer that is to be fixed to be the\r
235 value needed for the new virtual address mapping being\r
fb3df220 236 applied.\r
237\r
238 @retval EFI_SUCCESS Success to execute the function.\r
239 @retval !EFI_SUCCESS Failed to e3xecute the function.\r
240\r
241**/\r
242EFI_STATUS\r
243EFIAPI\r
244EfiConvertPointer (\r
245 IN UINTN DebugDisposition,\r
246 IN OUT VOID **Address\r
247 );\r
248\r
249\r
250/**\r
251 Change the runtime addressing mode of EFI firmware from physical to virtual.\r
252\r
253 @param MemoryMapSize The size in bytes of VirtualMap.\r
254 @param DescriptorSize The size in bytes of an entry in the VirtualMap.\r
255 @param DescriptorVersion The version of the structure entries in VirtualMap.\r
256 @param VirtualMap An array of memory descriptors which contain new virtual\r
257 address mapping information for all runtime ranges. Type\r
258 EFI_MEMORY_DESCRIPTOR is defined in the\r
259 GetMemoryMap() function description.\r
260\r
261 @retval EFI_SUCCESS The virtual address map has been applied.\r
262 @retval EFI_UNSUPPORTED EFI firmware is not at runtime, or the EFI firmware is already in\r
263 virtual address mapped mode.\r
264 @retval EFI_INVALID_PARAMETER DescriptorSize or DescriptorVersion is\r
265 invalid.\r
266 @retval EFI_NO_MAPPING A virtual address was not supplied for a range in the memory\r
267 map that requires a mapping.\r
268 @retval EFI_NOT_FOUND A virtual address was supplied for an address that is not found\r
269 in the memory map.\r
270**/\r
271EFI_STATUS\r
272EFIAPI\r
273EfiSetVirtualAddressMap (\r
274 IN UINTN MemoryMapSize,\r
275 IN UINTN DescriptorSize,\r
276 IN UINT32 DescriptorVersion,\r
277 IN CONST EFI_MEMORY_DESCRIPTOR *VirtualMap\r
278 );\r
279\r
280\r
281/**\r
bf231ea6 282 Convert the standard Lib double linked list to a virtual mapping.\r
fb3df220 283\r
284 @param DebugDisposition Supplies type information for the pointer being converted.\r
285 @param ListHead Head of linked list to convert.\r
286\r
287 @retval EFI_SUCCESS Success to execute the function.\r
288 @retval !EFI_SUCCESS Failed to e3xecute the function.\r
289\r
290**/\r
291EFI_STATUS\r
292EFIAPI\r
293EfiConvertList (\r
294 IN UINTN DebugDisposition,\r
295 IN OUT LIST_ENTRY *ListHead\r
296 );\r
297\r
298/**\r
3b89de63 299 Passes capsules to the firmware with both virtual and physical mapping.\r
fb3df220 300 Depending on the intended consumption, the firmware may\r
301 process the capsule immediately. If the payload should persist across a\r
302 system reset, the reset value returned from EFI_QueryCapsuleCapabilities must\r
3b89de63 303 be passed into ResetSystem() and will cause the capsule to be processed by\r
fb3df220 304 the firmware as part of the reset process.\r
3b89de63 305\r
fb3df220 306 @param CapsuleHeaderArray Virtual pointer to an array of virtual pointers to the capsules\r
307 being passed into update capsule. Each capsules is assumed to\r
308 stored in contiguous virtual memory. The capsules in the\r
309 CapsuleHeaderArray must be the same capsules as the\r
310 ScatterGatherList. The CapsuleHeaderArray must\r
311 have the capsules in the same order as the ScatterGatherList.\r
312 @param CapsuleCount Number of pointers to EFI_CAPSULE_HEADER in\r
313 CaspuleHeaderArray.\r
314 @param ScatterGatherList Physical pointer to a set of\r
315 EFI_CAPSULE_BLOCK_DESCRIPTOR that describes the\r
316 location in physical memory of a set of capsules. See Related\r
317 Definitions for an explanation of how more than one capsule is\r
318 passed via this interface. The capsules in the\r
319 ScatterGatherList must be in the same order as the\r
320 CapsuleHeaderArray. This parameter is only referenced if\r
321 the capsules are defined to persist across system reset.\r
322\r
323 @retval EFI_SUCCESS Valid capsule was passed. I Valid capsule was passed. If\r
324 CAPSULE_FLAGS_PERSIT_ACROSS_RESET is not set, the\r
325 capsule has been successfully processed by the firmware.\r
326 @retval EFI_INVALID_PARAMETER CapsuleSize is NULL or ResetTye is NULL.\r
327 @retval EFI_DEVICE_ERROR The capsule update was started, but failed due to a device error.\r
328\r
329**/\r
330EFI_STATUS\r
331EFIAPI\r
332EfiUpdateCapsule (\r
3b89de63 333 IN EFI_CAPSULE_HEADER **CapsuleHeaderArray,\r
fb3df220 334 IN UINTN CapsuleCount,\r
335 IN EFI_PHYSICAL_ADDRESS ScatterGatherList\r
336 );\r
337\r
338\r
339/**\r
fb3df220 340 The QueryCapsuleCapabilities() function allows a caller to test to see if a capsule or\r
341 capsules can be updated via UpdateCapsule(). The Flags values in the capsule header and\r
342 size of the entire capsule is checked.\r
343 If the caller needs to query for generic capsule capability a fake EFI_CAPSULE_HEADER can be\r
344 constructed where CapsuleImageSize is equal to HeaderSize that is equal to sizeof\r
345 (EFI_CAPSULE_HEADER). To determine reset requirements,\r
346 CAPSULE_FLAGS_PERSIST_ACROSS_RESET should be set in the Flags field of the\r
347 EFI_CAPSULE_HEADER.\r
348 The firmware must support any capsule that has the\r
349 CAPSULE_FLAGS_PERSIST_ACROSS_RESET flag set in EFI_CAPSULE_HEADER. The\r
350 firmware sets the policy for what capsules are supported that do not have the\r
351 CAPSULE_FLAGS_PERSIST_ACROSS_RESET flag set.\r
3b89de63 352\r
fb3df220 353 @param CapsuleHeaderArray Virtual pointer to an array of virtual pointers to the capsules\r
354 being passed into update capsule. The capsules are assumed to\r
355 stored in contiguous virtual memory.\r
356 @param CapsuleCount Number of pointers to EFI_CAPSULE_HEADER in\r
357 CaspuleHeaderArray.\r
358 @param MaxiumCapsuleSize On output the maximum size that UpdateCapsule() can\r
359 support as an argument to UpdateCapsule() via\r
360 CapsuleHeaderArray and ScatterGatherList.\r
361 Undefined on input.\r
362 @param ResetType Returns the type of reset required for the capsule update.\r
363\r
364 @retval EFI_SUCCESS Valid answer returned..\r
365 @retval EFI_INVALID_PARAMETER MaximumCapsuleSize is NULL.\r
366 @retval EFI_UNSUPPORTED The capsule type is not supported on this platform, and\r
367 MaximumCapsuleSize and ResetType are undefined.\r
368\r
369**/\r
370EFI_STATUS\r
371EFIAPI\r
372EfiQueryCapsuleCapabilities (\r
3b89de63 373 IN EFI_CAPSULE_HEADER **CapsuleHeaderArray,\r
374 IN UINTN CapsuleCount,\r
fb3df220 375 OUT UINT64 *MaximumCapsuleSize,\r
376 OUT EFI_RESET_TYPE *ResetType\r
377 );\r
378\r
379\r
380/**\r
fb3df220 381 The QueryVariableInfo() function allows a caller to obtain the information about the\r
382 maximum size of the storage space available for the EFI variables, the remaining size of the storage\r
383 space available for the EFI variables and the maximum size of each individual EFI variable,\r
384 associated with the attributes specified.\r
385 The returned MaximumVariableStorageSize, RemainingVariableStorageSize,\r
386 MaximumVariableSize information may change immediately after the call based on other\r
387 runtime activities including asynchronous error events. Also, these values associated with different\r
388 attributes are not additive in nature.\r
3b89de63 389\r
fb3df220 390 @param Attributes Attributes bitmask to specify the type of variables on\r
391 which to return information. Refer to the\r
392 GetVariable() function description.\r
3b89de63 393 @param MaximumVariableStorageSize\r
fb3df220 394 On output the maximum size of the storage space\r
395 available for the EFI variables associated with the\r
396 attributes specified.\r
3b89de63 397 @param RemainingVariableStorageSize\r
fb3df220 398 Returns the remaining size of the storage space\r
399 available for the EFI variables associated with the\r
400 attributes specified..\r
401 @param MaximumVariableSize Returns the maximum size of the individual EFI\r
402 variables associated with the attributes specified.\r
403\r
404 @retval EFI_SUCCESS Valid answer returned.\r
405 @retval EFI_INVALID_PARAMETER An invalid combination of attribute bits was supplied.\r
406 @retval EFI_UNSUPPORTED EFI_UNSUPPORTED The attribute is not supported on this platform, and the\r
407 MaximumVariableStorageSize,\r
408 RemainingVariableStorageSize, MaximumVariableSize\r
409 are undefined.\r
410**/\r
411EFI_STATUS\r
412EFIAPI\r
413EfiQueryVariableInfo (\r
414 IN UINT32 Attrubutes,\r
415 OUT UINT64 *MaximumVariableStorageSize,\r
416 OUT UINT64 *RemainingVariableStorageSize,\r
417 OUT UINT64 *MaximumVariableSize\r
418 );\r
419\r
420#endif\r
421\r