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