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