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 |
21 | extern const EFI_EVENT_NOTIFY _gDriverExitBootServicesEvent[];\r |
22 | \r |
23 | extern 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 |
34 | BOOLEAN\r |
35 | EFIAPI\r |
36 | EfiAtRuntime (\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 |
47 | BOOLEAN\r |
48 | EFIAPI\r |
49 | EfiGoneVirtual (\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 |
65 | EFI_STATUS\r |
66 | EFIAPI\r |
67 | EfiGetTime (\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 |
81 | EFI_STATUS\r |
82 | EFIAPI\r |
83 | EfiSetTime (\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 |
98 | EFI_STATUS\r |
99 | EFIAPI\r |
100 | EfiGetWakeupTime (\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 |
116 | EFI_STATUS\r |
117 | EFIAPI\r |
118 | EfiSetWakeupTime (\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 |
139 | EFI_STATUS\r |
140 | EFIAPI\r |
141 | EfiGetVariable (\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 |
167 | EFI_STATUS\r |
168 | EFIAPI\r |
169 | EfiGetNextVariableName (\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 |
190 | EFI_STATUS\r |
191 | EFIAPI\r |
192 | EfiSetVariable (\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 |
209 | EFI_STATUS\r |
210 | EFIAPI\r |
211 | EfiGetNextHighMonotonicCount (\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 |
fb3df220 |
224 | **/\r |
225 | VOID\r |
226 | EfiResetSystem (\r |
227 | IN EFI_RESET_TYPE ResetType,\r |
228 | IN EFI_STATUS ResetStatus,\r |
229 | IN UINTN DataSize,\r |
230 | IN CHAR16 *ResetData\r |
231 | );\r |
232 | \r |
233 | /**\r |
234 | Determines the new virtual address that is to be used on subsequent memory accesses.\r |
235 | \r |
236 | @param DebugDisposition Supplies type information for the pointer being converted.\r |
237 | @param Address The pointer to a pointer that is to be fixed to be the \r |
238 | value needed for the new virtual address mapping being \r |
239 | applied.\r |
240 | \r |
241 | @retval EFI_SUCCESS Success to execute the function.\r |
242 | @retval !EFI_SUCCESS Failed to e3xecute the function.\r |
243 | \r |
244 | **/\r |
245 | EFI_STATUS\r |
246 | EFIAPI\r |
247 | EfiConvertPointer (\r |
248 | IN UINTN DebugDisposition,\r |
249 | IN OUT VOID **Address\r |
250 | );\r |
251 | \r |
252 | \r |
253 | /**\r |
254 | Change the runtime addressing mode of EFI firmware from physical to virtual.\r |
255 | \r |
256 | @param MemoryMapSize The size in bytes of VirtualMap.\r |
257 | @param DescriptorSize The size in bytes of an entry in the VirtualMap.\r |
258 | @param DescriptorVersion The version of the structure entries in VirtualMap.\r |
259 | @param VirtualMap An array of memory descriptors which contain new virtual\r |
260 | address mapping information for all runtime ranges. Type\r |
261 | EFI_MEMORY_DESCRIPTOR is defined in the\r |
262 | GetMemoryMap() function description.\r |
263 | \r |
264 | @retval EFI_SUCCESS The virtual address map has been applied.\r |
265 | @retval EFI_UNSUPPORTED EFI firmware is not at runtime, or the EFI firmware is already in\r |
266 | virtual address mapped mode.\r |
267 | @retval EFI_INVALID_PARAMETER DescriptorSize or DescriptorVersion is\r |
268 | invalid.\r |
269 | @retval EFI_NO_MAPPING A virtual address was not supplied for a range in the memory\r |
270 | map that requires a mapping.\r |
271 | @retval EFI_NOT_FOUND A virtual address was supplied for an address that is not found\r |
272 | in the memory map.\r |
273 | **/\r |
274 | EFI_STATUS\r |
275 | EFIAPI\r |
276 | EfiSetVirtualAddressMap (\r |
277 | IN UINTN MemoryMapSize,\r |
278 | IN UINTN DescriptorSize,\r |
279 | IN UINT32 DescriptorVersion,\r |
280 | IN CONST EFI_MEMORY_DESCRIPTOR *VirtualMap\r |
281 | );\r |
282 | \r |
283 | \r |
284 | /**\r |
285 | Conver the standard Lib double linked list to a virtual mapping.\r |
286 | \r |
287 | @param DebugDisposition Supplies type information for the pointer being converted.\r |
288 | @param ListHead Head of linked list to convert.\r |
289 | \r |
290 | @retval EFI_SUCCESS Success to execute the function.\r |
291 | @retval !EFI_SUCCESS Failed to e3xecute the function.\r |
292 | \r |
293 | **/\r |
294 | EFI_STATUS\r |
295 | EFIAPI\r |
296 | EfiConvertList (\r |
297 | IN UINTN DebugDisposition,\r |
298 | IN OUT LIST_ENTRY *ListHead\r |
299 | );\r |
300 | \r |
301 | /**\r |
302 | \r |
303 | Passes capsules to the firmware with both virtual and physical mapping. \r |
304 | Depending on the intended consumption, the firmware may\r |
305 | process the capsule immediately. If the payload should persist across a\r |
306 | system reset, the reset value returned from EFI_QueryCapsuleCapabilities must\r |
307 | be passed into ResetSystem() and will cause the capsule to be processed by \r |
308 | the firmware as part of the reset process.\r |
309 | \r |
310 | @param CapsuleHeaderArray Virtual pointer to an array of virtual pointers to the capsules\r |
311 | being passed into update capsule. Each capsules is assumed to\r |
312 | stored in contiguous virtual memory. The capsules in the\r |
313 | CapsuleHeaderArray must be the same capsules as the\r |
314 | ScatterGatherList. The CapsuleHeaderArray must\r |
315 | have the capsules in the same order as the ScatterGatherList.\r |
316 | @param CapsuleCount Number of pointers to EFI_CAPSULE_HEADER in\r |
317 | CaspuleHeaderArray.\r |
318 | @param ScatterGatherList Physical pointer to a set of\r |
319 | EFI_CAPSULE_BLOCK_DESCRIPTOR that describes the\r |
320 | location in physical memory of a set of capsules. See Related\r |
321 | Definitions for an explanation of how more than one capsule is\r |
322 | passed via this interface. The capsules in the\r |
323 | ScatterGatherList must be in the same order as the\r |
324 | CapsuleHeaderArray. This parameter is only referenced if\r |
325 | the capsules are defined to persist across system reset.\r |
326 | \r |
327 | @retval EFI_SUCCESS Valid capsule was passed. I Valid capsule was passed. If\r |
328 | CAPSULE_FLAGS_PERSIT_ACROSS_RESET is not set, the\r |
329 | capsule has been successfully processed by the firmware.\r |
330 | @retval EFI_INVALID_PARAMETER CapsuleSize is NULL or ResetTye is NULL.\r |
331 | @retval EFI_DEVICE_ERROR The capsule update was started, but failed due to a device error.\r |
332 | \r |
333 | **/\r |
334 | EFI_STATUS\r |
335 | EFIAPI\r |
336 | EfiUpdateCapsule (\r |
337 | IN UEFI_CAPSULE_HEADER **CapsuleHeaderArray,\r |
338 | IN UINTN CapsuleCount,\r |
339 | IN EFI_PHYSICAL_ADDRESS ScatterGatherList\r |
340 | );\r |
341 | \r |
342 | \r |
343 | /**\r |
344 | \r |
345 | The QueryCapsuleCapabilities() function allows a caller to test to see if a capsule or\r |
346 | capsules can be updated via UpdateCapsule(). The Flags values in the capsule header and\r |
347 | size of the entire capsule is checked.\r |
348 | If the caller needs to query for generic capsule capability a fake EFI_CAPSULE_HEADER can be\r |
349 | constructed where CapsuleImageSize is equal to HeaderSize that is equal to sizeof\r |
350 | (EFI_CAPSULE_HEADER). To determine reset requirements,\r |
351 | CAPSULE_FLAGS_PERSIST_ACROSS_RESET should be set in the Flags field of the\r |
352 | EFI_CAPSULE_HEADER.\r |
353 | The firmware must support any capsule that has the\r |
354 | CAPSULE_FLAGS_PERSIST_ACROSS_RESET flag set in EFI_CAPSULE_HEADER. The\r |
355 | firmware sets the policy for what capsules are supported that do not have the\r |
356 | CAPSULE_FLAGS_PERSIST_ACROSS_RESET flag set.\r |
357 | \r |
358 | @param CapsuleHeaderArray Virtual pointer to an array of virtual pointers to the capsules\r |
359 | being passed into update capsule. The capsules are assumed to\r |
360 | stored in contiguous virtual memory.\r |
361 | @param CapsuleCount Number of pointers to EFI_CAPSULE_HEADER in\r |
362 | CaspuleHeaderArray.\r |
363 | @param MaxiumCapsuleSize On output the maximum size that UpdateCapsule() can\r |
364 | support as an argument to UpdateCapsule() via\r |
365 | CapsuleHeaderArray and ScatterGatherList.\r |
366 | Undefined on input.\r |
367 | @param ResetType Returns the type of reset required for the capsule update.\r |
368 | \r |
369 | @retval EFI_SUCCESS Valid answer returned..\r |
370 | @retval EFI_INVALID_PARAMETER MaximumCapsuleSize is NULL.\r |
371 | @retval EFI_UNSUPPORTED The capsule type is not supported on this platform, and\r |
372 | MaximumCapsuleSize and ResetType are undefined.\r |
373 | \r |
374 | **/\r |
375 | EFI_STATUS\r |
376 | EFIAPI\r |
377 | EfiQueryCapsuleCapabilities (\r |
378 | IN UEFI_CAPSULE_HEADER **CapsuleHeaderArray,\r |
379 | IN UINTN CapsuleCount,\r |
380 | OUT UINT64 *MaximumCapsuleSize,\r |
381 | OUT EFI_RESET_TYPE *ResetType\r |
382 | );\r |
383 | \r |
384 | \r |
385 | /**\r |
386 | \r |
387 | The QueryVariableInfo() function allows a caller to obtain the information about the\r |
388 | maximum size of the storage space available for the EFI variables, the remaining size of the storage\r |
389 | space available for the EFI variables and the maximum size of each individual EFI variable,\r |
390 | associated with the attributes specified.\r |
391 | The returned MaximumVariableStorageSize, RemainingVariableStorageSize,\r |
392 | MaximumVariableSize information may change immediately after the call based on other\r |
393 | runtime activities including asynchronous error events. Also, these values associated with different\r |
394 | attributes are not additive in nature.\r |
395 | \r |
396 | @param Attributes Attributes bitmask to specify the type of variables on\r |
397 | which to return information. Refer to the\r |
398 | GetVariable() function description.\r |
399 | @param MaximumVariableStorageSize \r |
400 | On output the maximum size of the storage space\r |
401 | available for the EFI variables associated with the\r |
402 | attributes specified.\r |
403 | @param RemainingVariableStorageSize \r |
404 | Returns the remaining size of the storage space\r |
405 | available for the EFI variables associated with the\r |
406 | attributes specified..\r |
407 | @param MaximumVariableSize Returns the maximum size of the individual EFI\r |
408 | variables associated with the attributes specified.\r |
409 | \r |
410 | @retval EFI_SUCCESS Valid answer returned.\r |
411 | @retval EFI_INVALID_PARAMETER An invalid combination of attribute bits was supplied.\r |
412 | @retval EFI_UNSUPPORTED EFI_UNSUPPORTED The attribute is not supported on this platform, and the\r |
413 | MaximumVariableStorageSize,\r |
414 | RemainingVariableStorageSize, MaximumVariableSize\r |
415 | are undefined.\r |
416 | **/\r |
417 | EFI_STATUS\r |
418 | EFIAPI\r |
419 | EfiQueryVariableInfo (\r |
420 | IN UINT32 Attrubutes,\r |
421 | OUT UINT64 *MaximumVariableStorageSize,\r |
422 | OUT UINT64 *RemainingVariableStorageSize,\r |
423 | OUT UINT64 *MaximumVariableSize\r |
424 | );\r |
425 | \r |
426 | #endif\r |
427 | \r |