]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Library/UefiRuntimeLib.h
refine the comments
[mirror_edk2.git] / MdePkg / Include / Library / UefiRuntimeLib.h
CommitLineData
fb3df220 1/** @file\r
50a64e5b 2 Provides library functions for each of the UEFI Runtime Services.\r
3 Only available to DXE and UEFI module types.\r
fb3df220 4\r
50a64e5b 5Copyright (c) 2006 - 2008, Intel Corporation\r
6All rights reserved. This program and the accompanying materials\r
7are licensed and made available under the terms and conditions of the BSD License\r
8which accompanies this distribution. The full text of the license may be found at\r
9http://opensource.org/licenses/bsd-license.php\r
fb3df220 10\r
50a64e5b 11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\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
201c7668 142 OUT UINT32 *Attributes OPTIONAL,\r
fb3df220 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
201c7668 223EFIAPI\r
fb3df220 224EfiResetSystem (\r
225 IN EFI_RESET_TYPE ResetType,\r
226 IN EFI_STATUS ResetStatus,\r
227 IN UINTN DataSize,\r
228 IN CHAR16 *ResetData\r
229 );\r
230\r
231/**\r
20742255 232 This service converts a function pointer from physical to virtual addressing. \r
fb3df220 233\r
234 @param DebugDisposition Supplies type information for the pointer being converted.\r
3b89de63 235 @param Address The pointer to a pointer that is to be fixed to be the\r
236 value needed for the new virtual address mapping being\r
fb3df220 237 applied.\r
238\r
239 @retval EFI_SUCCESS Success to execute the function.\r
20742255 240 @retval !EFI_SUCCESS Failed to execute the function.\r
fb3df220 241\r
242**/\r
243EFI_STATUS\r
244EFIAPI\r
245EfiConvertPointer (\r
246 IN UINTN DebugDisposition,\r
247 IN OUT VOID **Address\r
248 );\r
249\r
20742255 250/**\r
251 Determines the new virtual address that is to be used on subsequent memory accesses.\r
252\r
253 For IA32, X64, and EBC, this service is a wrapper for the UEFI Runtime Service\r
254 ConvertPointer(). See the UEFI Specification for details. \r
255 For IPF, this function interprets Address as a pointer to an EFI_PLABEL structure\r
256 and both the EntryPoint and GP fields of an EFI_PLABEL are converted from physical\r
257 to virtiual addressing. Since IPF allows the GP to point to an address outside\r
258 a PE/COFF image, the physical to virtual offset for the EntryPoint field is used\r
259 to adjust the GP field. The UEFI Runtime Service ConvertPointer() is used to convert\r
260 EntryPoint and the status code for this conversion is always returned. If the convertion\r
261 of EntryPoint fails, then neither EntryPoint nor GP are modified. See the UEFI\r
262 Specification for details on the UEFI Runtime Service ConvertPointer().\r
263\r
264 @param DebugDisposition Supplies type information for the pointer being converted.\r
265 @param Address The pointer to a pointer that is to be fixed to be the\r
266 value needed for the new virtual address mapping being\r
267 applied.\r
268\r
269 @retval EFI_SUCCESS Success to execute the function.\r
270 @retval !EFI_SUCCESS Failed to execute the function.\r
271\r
272**/\r
273EFI_STATUS\r
274EFIAPI\r
275EfiConvertFunctionPointer (\r
276 IN UINTN DebugDisposition,\r
277 IN OUT VOID **Address\r
278 );\r
fb3df220 279\r
280/**\r
281 Change the runtime addressing mode of EFI firmware from physical to virtual.\r
282\r
283 @param MemoryMapSize The size in bytes of VirtualMap.\r
284 @param DescriptorSize The size in bytes of an entry in the VirtualMap.\r
285 @param DescriptorVersion The version of the structure entries in VirtualMap.\r
286 @param VirtualMap An array of memory descriptors which contain new virtual\r
287 address mapping information for all runtime ranges. Type\r
288 EFI_MEMORY_DESCRIPTOR is defined in the\r
289 GetMemoryMap() function description.\r
290\r
291 @retval EFI_SUCCESS The virtual address map has been applied.\r
292 @retval EFI_UNSUPPORTED EFI firmware is not at runtime, or the EFI firmware is already in\r
293 virtual address mapped mode.\r
294 @retval EFI_INVALID_PARAMETER DescriptorSize or DescriptorVersion is\r
295 invalid.\r
296 @retval EFI_NO_MAPPING A virtual address was not supplied for a range in the memory\r
297 map that requires a mapping.\r
298 @retval EFI_NOT_FOUND A virtual address was supplied for an address that is not found\r
299 in the memory map.\r
300**/\r
301EFI_STATUS\r
302EFIAPI\r
303EfiSetVirtualAddressMap (\r
304 IN UINTN MemoryMapSize,\r
305 IN UINTN DescriptorSize,\r
306 IN UINT32 DescriptorVersion,\r
307 IN CONST EFI_MEMORY_DESCRIPTOR *VirtualMap\r
308 );\r
309\r
310\r
311/**\r
bf231ea6 312 Convert the standard Lib double linked list to a virtual mapping.\r
fb3df220 313\r
314 @param DebugDisposition Supplies type information for the pointer being converted.\r
315 @param ListHead Head of linked list to convert.\r
316\r
317 @retval EFI_SUCCESS Success to execute the function.\r
318 @retval !EFI_SUCCESS Failed to e3xecute the function.\r
319\r
320**/\r
321EFI_STATUS\r
322EFIAPI\r
323EfiConvertList (\r
324 IN UINTN DebugDisposition,\r
325 IN OUT LIST_ENTRY *ListHead\r
326 );\r
327\r
328/**\r
3b89de63 329 Passes capsules to the firmware with both virtual and physical mapping.\r
fb3df220 330 Depending on the intended consumption, the firmware may\r
331 process the capsule immediately. If the payload should persist across a\r
332 system reset, the reset value returned from EFI_QueryCapsuleCapabilities must\r
3b89de63 333 be passed into ResetSystem() and will cause the capsule to be processed by\r
fb3df220 334 the firmware as part of the reset process.\r
3b89de63 335\r
fb3df220 336 @param CapsuleHeaderArray Virtual pointer to an array of virtual pointers to the capsules\r
337 being passed into update capsule. Each capsules is assumed to\r
338 stored in contiguous virtual memory. The capsules in the\r
339 CapsuleHeaderArray must be the same capsules as the\r
340 ScatterGatherList. The CapsuleHeaderArray must\r
341 have the capsules in the same order as the ScatterGatherList.\r
342 @param CapsuleCount Number of pointers to EFI_CAPSULE_HEADER in\r
343 CaspuleHeaderArray.\r
344 @param ScatterGatherList Physical pointer to a set of\r
345 EFI_CAPSULE_BLOCK_DESCRIPTOR that describes the\r
346 location in physical memory of a set of capsules. See Related\r
347 Definitions for an explanation of how more than one capsule is\r
348 passed via this interface. The capsules in the\r
349 ScatterGatherList must be in the same order as the\r
350 CapsuleHeaderArray. This parameter is only referenced if\r
351 the capsules are defined to persist across system reset.\r
352\r
353 @retval EFI_SUCCESS Valid capsule was passed. I Valid capsule was passed. If\r
354 CAPSULE_FLAGS_PERSIT_ACROSS_RESET is not set, the\r
355 capsule has been successfully processed by the firmware.\r
356 @retval EFI_INVALID_PARAMETER CapsuleSize is NULL or ResetTye is NULL.\r
357 @retval EFI_DEVICE_ERROR The capsule update was started, but failed due to a device error.\r
358\r
359**/\r
360EFI_STATUS\r
361EFIAPI\r
362EfiUpdateCapsule (\r
3b89de63 363 IN EFI_CAPSULE_HEADER **CapsuleHeaderArray,\r
fb3df220 364 IN UINTN CapsuleCount,\r
d27e363b 365 IN EFI_PHYSICAL_ADDRESS ScatterGatherList OPTIONAL\r
fb3df220 366 );\r
367\r
368\r
369/**\r
fb3df220 370 The QueryCapsuleCapabilities() function allows a caller to test to see if a capsule or\r
371 capsules can be updated via UpdateCapsule(). The Flags values in the capsule header and\r
372 size of the entire capsule is checked.\r
373 If the caller needs to query for generic capsule capability a fake EFI_CAPSULE_HEADER can be\r
374 constructed where CapsuleImageSize is equal to HeaderSize that is equal to sizeof\r
375 (EFI_CAPSULE_HEADER). To determine reset requirements,\r
376 CAPSULE_FLAGS_PERSIST_ACROSS_RESET should be set in the Flags field of the\r
377 EFI_CAPSULE_HEADER.\r
378 The firmware must support any capsule that has the\r
379 CAPSULE_FLAGS_PERSIST_ACROSS_RESET flag set in EFI_CAPSULE_HEADER. The\r
380 firmware sets the policy for what capsules are supported that do not have the\r
381 CAPSULE_FLAGS_PERSIST_ACROSS_RESET flag set.\r
3b89de63 382\r
fb3df220 383 @param CapsuleHeaderArray Virtual pointer to an array of virtual pointers to the capsules\r
384 being passed into update capsule. The capsules are assumed to\r
385 stored in contiguous virtual memory.\r
386 @param CapsuleCount Number of pointers to EFI_CAPSULE_HEADER in\r
387 CaspuleHeaderArray.\r
42eedea9 388 @param MaximumCapsuleSize On output the maximum size that UpdateCapsule() can\r
fb3df220 389 support as an argument to UpdateCapsule() via\r
390 CapsuleHeaderArray and ScatterGatherList.\r
391 Undefined on input.\r
392 @param ResetType Returns the type of reset required for the capsule update.\r
393\r
394 @retval EFI_SUCCESS Valid answer returned..\r
395 @retval EFI_INVALID_PARAMETER MaximumCapsuleSize is NULL.\r
396 @retval EFI_UNSUPPORTED The capsule type is not supported on this platform, and\r
397 MaximumCapsuleSize and ResetType are undefined.\r
398\r
399**/\r
400EFI_STATUS\r
401EFIAPI\r
402EfiQueryCapsuleCapabilities (\r
3b89de63 403 IN EFI_CAPSULE_HEADER **CapsuleHeaderArray,\r
404 IN UINTN CapsuleCount,\r
fb3df220 405 OUT UINT64 *MaximumCapsuleSize,\r
406 OUT EFI_RESET_TYPE *ResetType\r
407 );\r
408\r
409\r
410/**\r
fb3df220 411 The QueryVariableInfo() function allows a caller to obtain the information about the\r
412 maximum size of the storage space available for the EFI variables, the remaining size of the storage\r
413 space available for the EFI variables and the maximum size of each individual EFI variable,\r
414 associated with the attributes specified.\r
415 The returned MaximumVariableStorageSize, RemainingVariableStorageSize,\r
416 MaximumVariableSize information may change immediately after the call based on other\r
417 runtime activities including asynchronous error events. Also, these values associated with different\r
418 attributes are not additive in nature.\r
3b89de63 419\r
fb3df220 420 @param Attributes Attributes bitmask to specify the type of variables on\r
421 which to return information. Refer to the\r
422 GetVariable() function description.\r
3b89de63 423 @param MaximumVariableStorageSize\r
fb3df220 424 On output the maximum size of the storage space\r
425 available for the EFI variables associated with the\r
426 attributes specified.\r
3b89de63 427 @param RemainingVariableStorageSize\r
fb3df220 428 Returns the remaining size of the storage space\r
429 available for the EFI variables associated with the\r
430 attributes specified..\r
431 @param MaximumVariableSize Returns the maximum size of the individual EFI\r
432 variables associated with the attributes specified.\r
433\r
434 @retval EFI_SUCCESS Valid answer returned.\r
435 @retval EFI_INVALID_PARAMETER An invalid combination of attribute bits was supplied.\r
436 @retval EFI_UNSUPPORTED EFI_UNSUPPORTED The attribute is not supported on this platform, and the\r
437 MaximumVariableStorageSize,\r
438 RemainingVariableStorageSize, MaximumVariableSize\r
439 are undefined.\r
440**/\r
441EFI_STATUS\r
442EFIAPI\r
443EfiQueryVariableInfo (\r
42eedea9 444 IN UINT32 Attributes,\r
fb3df220 445 OUT UINT64 *MaximumVariableStorageSize,\r
446 OUT UINT64 *RemainingVariableStorageSize,\r
447 OUT UINT64 *MaximumVariableSize\r
448 );\r
449\r
450#endif\r
451\r