2 Library to abstract runtime services
4 Copyright (c) 2006, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #ifndef __UEFI_RUNTIME_LIB__
16 #define __UEFI_RUNTIME_LIB__
19 extern const EFI_EVENT_NOTIFY _gDriverExitBootServicesEvent
[];
21 extern const EFI_EVENT_NOTIFY _gDriverSetVirtualAddressMapEvent
[];
24 Check to see if the execute context is in Runtime phase or not.
28 @retval TRUE The driver is in SMM.
29 @retval FALSE The driver is not in SMM.
39 Check to see if the SetVirtualAddressMsp() is invoked or not.
41 @retval TRUE SetVirtualAddressMsp() has been called.
42 @retval FALSE SetVirtualAddressMsp() has not been called.
52 Return current time and date information, and time-keeping
53 capabilities of hardware platform.
55 @param Time A pointer to storage to receive a snapshot of the current time.
56 @param Capabilities An optional pointer to a buffer to receive the real time clock device's
59 @retval EFI_SUCCESS Success to execute the function.
60 @retval !EFI_SUCCESS Failed to e3xecute the function.
67 OUT EFI_TIME_CAPABILITIES
*Capabilities
71 Set current time and date information.
73 @param Time A pointer to cache of time setting.
75 @retval EFI_SUCCESS Success to execute the function.
76 @retval !EFI_SUCCESS Failed to execute the function.
86 Return current wakeup alarm clock setting.
88 @param Enabled Indicate if the alarm clock is enabled or disabled.
89 @param Pending Indicate if the alarm signal is pending and requires acknowledgement.
90 @param Time Current alarm clock setting.
92 @retval EFI_SUCCESS Success to execute the function.
93 @retval !EFI_SUCCESS Failed to e3xecute the function.
100 OUT BOOLEAN
*Pending
,
105 Set current wakeup alarm clock.
107 @param Enable Enable or disable current alarm clock..
108 @param Time Point to alarm clock setting.
110 @retval EFI_SUCCESS Success to execute the function.
111 @retval !EFI_SUCCESS Failed to e3xecute the function.
122 Return value of variable.
124 @param VariableName the name of the vendor's variable, it's a
125 Null-Terminated Unicode String
126 @param VendorGuid Unify identifier for vendor.
127 @param Attributes Point to memory location to return the attributes of variable. If the point
128 is NULL, the parameter would be ignored.
129 @param DataSize As input, point to the maxinum size of return Data-Buffer.
130 As output, point to the actual size of the returned Data-Buffer.
131 @param Data Point to return Data-Buffer.
133 @retval EFI_SUCCESS Success to execute the function.
134 @retval !EFI_SUCCESS Failed to e3xecute the function.
140 IN CHAR16
*VariableName
,
141 IN EFI_GUID
*VendorGuid
,
142 OUT UINT32
*Attributes
,
143 IN OUT UINTN
*DataSize
,
149 Enumerates variable's name.
151 @param VariableNameSize As input, point to maxinum size of variable name.
152 As output, point to actual size of varaible name.
153 @param VariableName As input, supplies the last VariableName that was returned by
154 GetNextVariableName().
155 As output, returns the name of variable. The name
156 string is Null-Terminated Unicode string.
157 @param VendorGuid As input, supplies the last VendorGuid that was returned by
158 GetNextVriableName().
159 As output, returns the VendorGuid of the current variable.
161 @retval EFI_SUCCESS Success to execute the function.
162 @retval !EFI_SUCCESS Failed to e3xecute the function.
167 EfiGetNextVariableName (
168 IN OUT UINTN
*VariableNameSize
,
169 IN OUT CHAR16
*VariableName
,
170 IN OUT EFI_GUID
*VendorGuid
174 Sets value of variable.
176 @param VariableName the name of the vendor's variable, it's a
177 Null-Terminated Unicode String
178 @param VendorGuid Unify identifier for vendor.
179 @param Attributes Point to memory location to return the attributes of variable. If the point
180 is NULL, the parameter would be ignored.
181 @param DataSize The size in bytes of Data-Buffer.
182 @param Data Point to the content of the variable.
184 @retval EFI_SUCCESS Success to execute the function.
185 @retval !EFI_SUCCESS Failed to e3xecute the function.
191 IN CHAR16
*VariableName
,
192 IN EFI_GUID
*VendorGuid
,
193 IN UINT32 Attributes
,
199 Returns the next high 32 bits of platform's monotonic counter.
201 @param HighCount Pointer to returned value.
203 @retval EFI_SUCCESS Success to execute the function.
204 @retval !EFI_SUCCESS Failed to e3xecute the function.
209 EfiGetNextHighMonotonicCount (
210 OUT UINT32
*HighCount
214 Resets the entire platform.
216 @param ResetType The type of reset to perform.
217 @param ResetStatus The status code for reset.
218 @param DataSize The size in bytes of reset data.
219 @param ResetData Pointer to data buffer that includes
220 Null-Terminated Unicode string.
225 IN EFI_RESET_TYPE ResetType
,
226 IN EFI_STATUS ResetStatus
,
232 Determines the new virtual address that is to be used on subsequent memory accesses.
234 @param DebugDisposition Supplies type information for the pointer being converted.
235 @param Address The pointer to a pointer that is to be fixed to be the
236 value needed for the new virtual address mapping being
239 @retval EFI_SUCCESS Success to execute the function.
240 @retval !EFI_SUCCESS Failed to e3xecute the function.
246 IN UINTN DebugDisposition
,
247 IN OUT VOID
**Address
252 Change the runtime addressing mode of EFI firmware from physical to virtual.
254 @param MemoryMapSize The size in bytes of VirtualMap.
255 @param DescriptorSize The size in bytes of an entry in the VirtualMap.
256 @param DescriptorVersion The version of the structure entries in VirtualMap.
257 @param VirtualMap An array of memory descriptors which contain new virtual
258 address mapping information for all runtime ranges. Type
259 EFI_MEMORY_DESCRIPTOR is defined in the
260 GetMemoryMap() function description.
262 @retval EFI_SUCCESS The virtual address map has been applied.
263 @retval EFI_UNSUPPORTED EFI firmware is not at runtime, or the EFI firmware is already in
264 virtual address mapped mode.
265 @retval EFI_INVALID_PARAMETER DescriptorSize or DescriptorVersion is
267 @retval EFI_NO_MAPPING A virtual address was not supplied for a range in the memory
268 map that requires a mapping.
269 @retval EFI_NOT_FOUND A virtual address was supplied for an address that is not found
274 EfiSetVirtualAddressMap (
275 IN UINTN MemoryMapSize
,
276 IN UINTN DescriptorSize
,
277 IN UINT32 DescriptorVersion
,
278 IN CONST EFI_MEMORY_DESCRIPTOR
*VirtualMap
283 Conver the standard Lib double linked list to a virtual mapping.
285 @param DebugDisposition Supplies type information for the pointer being converted.
286 @param ListHead Head of linked list to convert.
288 @retval EFI_SUCCESS Success to execute the function.
289 @retval !EFI_SUCCESS Failed to e3xecute the function.
295 IN UINTN DebugDisposition
,
296 IN OUT LIST_ENTRY
*ListHead
301 Passes capsules to the firmware with both virtual and physical mapping.
302 Depending on the intended consumption, the firmware may
303 process the capsule immediately. If the payload should persist across a
304 system reset, the reset value returned from EFI_QueryCapsuleCapabilities must
305 be passed into ResetSystem() and will cause the capsule to be processed by
306 the firmware as part of the reset process.
308 @param CapsuleHeaderArray Virtual pointer to an array of virtual pointers to the capsules
309 being passed into update capsule. Each capsules is assumed to
310 stored in contiguous virtual memory. The capsules in the
311 CapsuleHeaderArray must be the same capsules as the
312 ScatterGatherList. The CapsuleHeaderArray must
313 have the capsules in the same order as the ScatterGatherList.
314 @param CapsuleCount Number of pointers to EFI_CAPSULE_HEADER in
316 @param ScatterGatherList Physical pointer to a set of
317 EFI_CAPSULE_BLOCK_DESCRIPTOR that describes the
318 location in physical memory of a set of capsules. See Related
319 Definitions for an explanation of how more than one capsule is
320 passed via this interface. The capsules in the
321 ScatterGatherList must be in the same order as the
322 CapsuleHeaderArray. This parameter is only referenced if
323 the capsules are defined to persist across system reset.
325 @retval EFI_SUCCESS Valid capsule was passed. I Valid capsule was passed. If
326 CAPSULE_FLAGS_PERSIT_ACROSS_RESET is not set, the
327 capsule has been successfully processed by the firmware.
328 @retval EFI_INVALID_PARAMETER CapsuleSize is NULL or ResetTye is NULL.
329 @retval EFI_DEVICE_ERROR The capsule update was started, but failed due to a device error.
335 IN EFI_CAPSULE_HEADER
**CapsuleHeaderArray
,
336 IN UINTN CapsuleCount
,
337 IN EFI_PHYSICAL_ADDRESS ScatterGatherList
343 The QueryCapsuleCapabilities() function allows a caller to test to see if a capsule or
344 capsules can be updated via UpdateCapsule(). The Flags values in the capsule header and
345 size of the entire capsule is checked.
346 If the caller needs to query for generic capsule capability a fake EFI_CAPSULE_HEADER can be
347 constructed where CapsuleImageSize is equal to HeaderSize that is equal to sizeof
348 (EFI_CAPSULE_HEADER). To determine reset requirements,
349 CAPSULE_FLAGS_PERSIST_ACROSS_RESET should be set in the Flags field of the
351 The firmware must support any capsule that has the
352 CAPSULE_FLAGS_PERSIST_ACROSS_RESET flag set in EFI_CAPSULE_HEADER. The
353 firmware sets the policy for what capsules are supported that do not have the
354 CAPSULE_FLAGS_PERSIST_ACROSS_RESET flag set.
356 @param CapsuleHeaderArray Virtual pointer to an array of virtual pointers to the capsules
357 being passed into update capsule. The capsules are assumed to
358 stored in contiguous virtual memory.
359 @param CapsuleCount Number of pointers to EFI_CAPSULE_HEADER in
361 @param MaxiumCapsuleSize On output the maximum size that UpdateCapsule() can
362 support as an argument to UpdateCapsule() via
363 CapsuleHeaderArray and ScatterGatherList.
365 @param ResetType Returns the type of reset required for the capsule update.
367 @retval EFI_SUCCESS Valid answer returned..
368 @retval EFI_INVALID_PARAMETER MaximumCapsuleSize is NULL.
369 @retval EFI_UNSUPPORTED The capsule type is not supported on this platform, and
370 MaximumCapsuleSize and ResetType are undefined.
375 EfiQueryCapsuleCapabilities (
376 IN EFI_CAPSULE_HEADER
**CapsuleHeaderArray
,
377 IN UINTN CapsuleCount
,
378 OUT UINT64
*MaximumCapsuleSize
,
379 OUT EFI_RESET_TYPE
*ResetType
385 The QueryVariableInfo() function allows a caller to obtain the information about the
386 maximum size of the storage space available for the EFI variables, the remaining size of the storage
387 space available for the EFI variables and the maximum size of each individual EFI variable,
388 associated with the attributes specified.
389 The returned MaximumVariableStorageSize, RemainingVariableStorageSize,
390 MaximumVariableSize information may change immediately after the call based on other
391 runtime activities including asynchronous error events. Also, these values associated with different
392 attributes are not additive in nature.
394 @param Attributes Attributes bitmask to specify the type of variables on
395 which to return information. Refer to the
396 GetVariable() function description.
397 @param MaximumVariableStorageSize
398 On output the maximum size of the storage space
399 available for the EFI variables associated with the
400 attributes specified.
401 @param RemainingVariableStorageSize
402 Returns the remaining size of the storage space
403 available for the EFI variables associated with the
404 attributes specified..
405 @param MaximumVariableSize Returns the maximum size of the individual EFI
406 variables associated with the attributes specified.
408 @retval EFI_SUCCESS Valid answer returned.
409 @retval EFI_INVALID_PARAMETER An invalid combination of attribute bits was supplied.
410 @retval EFI_UNSUPPORTED EFI_UNSUPPORTED The attribute is not supported on this platform, and the
411 MaximumVariableStorageSize,
412 RemainingVariableStorageSize, MaximumVariableSize
417 EfiQueryVariableInfo (
418 IN UINT32 Attrubutes
,
419 OUT UINT64
*MaximumVariableStorageSize
,
420 OUT UINT64
*RemainingVariableStorageSize
,
421 OUT UINT64
*MaximumVariableSize