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