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