]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/UefiRuntimeLib/RuntimeService.c
Code and comments have been checked with spec.
[mirror_edk2.git] / MdePkg / Library / UefiRuntimeLib / RuntimeService.c
CommitLineData
bf231ea6
A
1/** @file\r
2 UEFI Runtime Library implementation for non IPF processor types.\r
ebcc8fb7 3\r
bf231ea6
A
4 This library hides the global variable for the EFI Runtime Services so the\r
5 caller does not need to deal with the possiblitly of being called from an\r
6 OS virtual address space. All pointer values are different for a virtual \r
7 mapping than from the normal physical mapping at boot services time.\r
ebcc8fb7 8\r
60c93673 9 Copyright (c) 2006 - 2008, Intel Corporation.<BR>\r
bf231ea6
A
10 All rights reserved. This program and the accompanying materials \r
11 are licensed and made available under the terms and conditions of the BSD License \r
12 which accompanies this distribution. The full text of the license may be found at \r
13 http://opensource.org/licenses/bsd-license.php \r
ebcc8fb7 14\r
bf231ea6
A
15 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
16 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
17\r
18**/\r
ebcc8fb7 19\r
60c93673 20#include "RuntimeLibInternal.h"\r
ebcc8fb7 21\r
bf231ea6
A
22\r
23/**\r
24 Resets the entire platform.\r
25\r
26 @param ResetType The type of reset to perform.\r
1d37ab9f 27 @param ResetStatus The status code for the reset. If the system reset is part of a\r
28 normal operation, the status code would be EFI_SUCCESS. If the system\r
29 reset is due to some type of failure the most appropriate EFI Status\r
30 code would be used.\r
31 @param DataSizeThe size, in bytes, of ResetData.\r
32 @param ResetData For a ResetType of EfiResetCold, EfiResetWarm, or EfiResetShutdown\r
33 the data buffer starts with a Null-terminated Unicode string, optionally\r
34 followed by additional binary data. The string is a description that the\r
35 caller may use to further indicate the reason for the system reset. ResetData\r
36 is only valid if ResetStatus is something other then EFI_SUCCESS. This\r
37 pointer must be a physical address. For a ResetType of EfiRestUpdate the\r
38 data buffer also starts with a Null-terminated string that is followed by\r
39 a physical VOID * to an EFI_CAPSULE_HEADER.\r
bf231ea6
A
40\r
41**/\r
ebcc8fb7 42VOID\r
43EFIAPI\r
44EfiResetSystem (\r
45 IN EFI_RESET_TYPE ResetType,\r
46 IN EFI_STATUS ResetStatus,\r
47 IN UINTN DataSize,\r
48 IN CHAR16 *ResetData\r
49 )\r
bf231ea6
A
50{\r
51 mRT->ResetSystem (ResetType, ResetStatus, DataSize, ResetData);\r
52}\r
ebcc8fb7 53\r
ebcc8fb7 54\r
bf231ea6 55/**\r
1d37ab9f 56 This service is a wrapper for the UEFI Runtime Service GetTime().\r
57\r
58 The GetTime() function returns a time that was valid sometime during the call to the function.\r
59 While the returned EFI_TIME structure contains TimeZone and Daylight savings time information,\r
60 the actual clock does not maintain these values. The current time zone and daylight saving time\r
61 information returned by GetTime() are the values that were last set via SetTime().\r
62 The GetTime() function should take approximately the same amount of time to read the time each\r
63 time it is called. All reported device capabilities are to be rounded up.\r
64 During runtime, if a PC-AT CMOS device is present in the platform the caller must synchronize\r
65 access to the device before calling GetTime().\r
ebcc8fb7 66\r
bf231ea6
A
67 @param Time A pointer to storage to receive a snapshot of the current time.\r
68 @param Capabilities An optional pointer to a buffer to receive the real time clock device's\r
69 capabilities.\r
ebcc8fb7 70\r
1d37ab9f 71 @retval EFI_SUCCESS The operation completed successfully.\r
72 @retval EFI_INVALID_PARAMETER Time is NULL.\r
73 @retval EFI_DEVICE_ERROR The time could not be retrieved due to a hardware error.\r
ebcc8fb7 74\r
bf231ea6 75**/\r
ebcc8fb7 76EFI_STATUS\r
77EFIAPI\r
78EfiGetTime (\r
79 OUT EFI_TIME *Time,\r
80 OUT EFI_TIME_CAPABILITIES *Capabilities\r
81 )\r
bf231ea6
A
82{\r
83 return mRT->GetTime (Time, Capabilities);\r
84}\r
ebcc8fb7 85\r
ebcc8fb7 86\r
bf231ea6 87/**\r
1d37ab9f 88 This service is a wrapper for the UEFI Runtime Service SetTime().\r
89\r
90 The SetTime() function sets the real time clock device to the supplied time, and records the\r
91 current time zone and daylight savings time information. The SetTime() function is not allowed\r
92 to loop based on the current time. For example, if the device does not support a hardware reset\r
93 for the sub-resolution time, the code is not to implement the feature by waiting for the time to\r
94 wrap.\r
95 During runtime, if a PC-AT CMOS device is present in the platform the caller must synchronize\r
96 access to the device before calling SetTime().\r
97\r
98 @param Time A pointer to the current time. Type EFI_TIME is defined in the GetTime()\r
99 function description. Full error checking is performed on the different\r
100 fields of the EFI_TIME structure (refer to the EFI_TIME definition in the\r
101 GetTime() function description for full details), and EFI_INVALID_PARAMETER\r
102 is returned if any field is out of range.\r
103\r
104 @retval EFI_SUCCESS The operation completed successfully.\r
105 @retval EFI_INVALID_PARAMETER A time field is out of range.\r
106 @retval EFI_DEVICE_ERROR The time could not be set due to a hardware error.\r
ebcc8fb7 107\r
bf231ea6 108**/\r
ebcc8fb7 109EFI_STATUS\r
110EFIAPI\r
111EfiSetTime (\r
112 IN EFI_TIME *Time\r
113 )\r
bf231ea6
A
114{\r
115 return mRT->SetTime (Time);\r
116}\r
ebcc8fb7 117\r
ebcc8fb7 118\r
bf231ea6 119/**\r
1d37ab9f 120 Returns the current wakeup alarm clock setting.\r
ebcc8fb7 121\r
1d37ab9f 122 The alarm clock time may be rounded from the set alarm clock time to be within the resolution\r
123 of the alarm clock device. The resolution of the alarm clock device is defined to be one second.\r
124 During runtime, if a PC-AT CMOS device is present in the platform the caller must synchronize\r
125 access to the device before calling GetWakeupTime().\r
ebcc8fb7 126\r
1d37ab9f 127 @param Enabled Indicates if the alarm is currently enabled or disabled.\r
128 @param Pending Indicates if the alarm signal is pending and requires acknowledgement.\r
129 @param Time The current alarm setting. Type EFI_TIME is defined in the GetTime()\r
130 function description.\r
131\r
132 @retval EFI_SUCCESS The alarm settings were returned.\r
133 @retval EFI_INVALID_PARAMETER Enabled is NULL.\r
134 @retval EFI_INVALID_PARAMETER Pending is NULL.\r
135 @retval EFI_INVALID_PARAMETER Time is NULL.\r
136 @retval EFI_DEVICE_ERROR The wakeup time could not be retrieved due to a hardware error.\r
137 @retval EFI_UNSUPPORTED A wakeup timer is not supported on this platform.\r
ebcc8fb7 138\r
bf231ea6 139**/\r
ebcc8fb7 140EFI_STATUS\r
141EFIAPI\r
142EfiGetWakeupTime (\r
143 OUT BOOLEAN *Enabled,\r
144 OUT BOOLEAN *Pending,\r
145 OUT EFI_TIME *Time\r
146 )\r
bf231ea6
A
147{\r
148 return mRT->GetWakeupTime (Enabled, Pending, Time);\r
149}\r
ebcc8fb7 150\r
ebcc8fb7 151\r
ebcc8fb7 152\r
bf231ea6 153/**\r
1d37ab9f 154 Sets the system wakeup alarm clock time.\r
ebcc8fb7 155\r
1d37ab9f 156 @param Enable Enable or disable the wakeup alarm.\r
157 @param Time If Enable is TRUE, the time to set the wakeup alarm for. Type EFI_TIME\r
158 is defined in the GetTime() function description. If Enable is FALSE,\r
159 then this parameter is optional, and may be NULL.\r
ebcc8fb7 160\r
1d37ab9f 161 @retval EFI_SUCCESS If Enable is TRUE, then the wakeup alarm was enabled.\r
162 If Enable is FALSE, then the wakeup alarm was disabled.\r
163 @retval EFI_INVALID_PARAMETER A time field is out of range.\r
164 @retval EFI_DEVICE_ERROR The wakeup time could not be set due to a hardware error.\r
165 @retval EFI_UNSUPPORTED A wakeup timer is not supported on this platform.\r
ebcc8fb7 166\r
bf231ea6 167**/\r
ebcc8fb7 168EFI_STATUS\r
169EFIAPI\r
170EfiSetWakeupTime (\r
171 IN BOOLEAN Enable,\r
172 IN EFI_TIME *Time\r
173 )\r
ebcc8fb7 174{\r
175 return mRT->SetWakeupTime (Enable, Time);\r
176}\r
177\r
178\r
bf231ea6
A
179/**\r
180 Return value of variable.\r
181\r
182 @param VariableName the name of the vendor's variable, it's a\r
183 Null-Terminated Unicode String\r
184 @param VendorGuid Unify identifier for vendor.\r
185 @param Attributes Point to memory location to return the attributes of variable. If the point\r
186 is NULL, the parameter would be ignored.\r
187 @param DataSize As input, point to the maxinum size of return Data-Buffer.\r
188 As output, point to the actual size of the returned Data-Buffer.\r
189 @param Data Point to return Data-Buffer.\r
ebcc8fb7 190\r
1d37ab9f 191 @retval EFI_SUCCESS The function completed successfully.\r
192 @retval EFI_NOT_FOUND The variable was not found.\r
193 @retval EFI_BUFFER_TOO_SMALL The DataSize is too small for the result. DataSize has\r
194 been updated with the size needed to complete the request.\r
195 @retval EFI_INVALID_PARAMETER VariableName is NULL.\r
196 @retval EFI_INVALID_PARAMETER VendorGuid is NULL.\r
197 @retval EFI_INVALID_PARAMETER DataSize is NULL.\r
198 @retval EFI_INVALID_PARAMETER The DataSize is not too small and Data is NULL.\r
199 @retval EFI_DEVICE_ERROR The variable could not be retrieved due to a hardware error.\r
200 @retval EFI_SECURITY_VIOLATION The variable could not be retrieved due to an authentication failure.\r
bf231ea6 201**/\r
ebcc8fb7 202EFI_STATUS\r
203EFIAPI\r
204EfiGetVariable (\r
205 IN CHAR16 *VariableName,\r
206 IN EFI_GUID * VendorGuid,\r
207 OUT UINT32 *Attributes OPTIONAL,\r
208 IN OUT UINTN *DataSize,\r
209 OUT VOID *Data\r
210 )\r
bf231ea6
A
211{\r
212 return mRT->GetVariable (VariableName, VendorGuid, Attributes, DataSize, Data);\r
213}\r
ebcc8fb7 214\r
ebcc8fb7 215\r
bf231ea6
A
216/**\r
217 Enumerates variable's name.\r
ebcc8fb7 218\r
bf231ea6
A
219 @param VariableNameSize As input, point to maxinum size of variable name.\r
220 As output, point to actual size of varaible name.\r
221 @param VariableName As input, supplies the last VariableName that was returned by\r
222 GetNextVariableName().\r
223 As output, returns the name of variable. The name\r
224 string is Null-Terminated Unicode string.\r
225 @param VendorGuid As input, supplies the last VendorGuid that was returned by\r
226 GetNextVriableName().\r
227 As output, returns the VendorGuid of the current variable.\r
ebcc8fb7 228\r
1d37ab9f 229 @retval EFI_SUCCESS The function completed successfully.\r
230 @retval EFI_NOT_FOUND The next variable was not found.\r
231 @retval EFI_BUFFER_TOO_SMALL The VariableNameSize is too small for the result.\r
232 VariableNameSize has been updated with the size needed\r
233 to complete the request.\r
234 @retval EFI_INVALID_PARAMETER VariableNameSize is NULL.\r
235 @retval EFI_INVALID_PARAMETER VariableName is NULL.\r
236 @retval EFI_INVALID_PARAMETER VendorGuid is NULL.\r
237 @retval EFI_DEVICE_ERROR The variable name could not be retrieved due to a hardware error.\r
ebcc8fb7 238\r
bf231ea6 239**/\r
ebcc8fb7 240EFI_STATUS\r
241EFIAPI\r
242EfiGetNextVariableName (\r
243 IN OUT UINTN *VariableNameSize,\r
244 IN OUT CHAR16 *VariableName,\r
245 IN OUT EFI_GUID *VendorGuid\r
246 )\r
bf231ea6
A
247{\r
248 return mRT->GetNextVariableName (VariableNameSize, VariableName, VendorGuid);\r
249}\r
ebcc8fb7 250\r
ebcc8fb7 251\r
bf231ea6
A
252/**\r
253 Sets value of variable.\r
ebcc8fb7 254\r
bf231ea6
A
255 @param VariableName the name of the vendor's variable, it's a\r
256 Null-Terminated Unicode String\r
257 @param VendorGuid Unify identifier for vendor.\r
258 @param Attributes Point to memory location to return the attributes of variable. If the point\r
259 is NULL, the parameter would be ignored.\r
260 @param DataSize The size in bytes of Data-Buffer.\r
261 @param Data Point to the content of the variable.\r
ebcc8fb7 262\r
1d37ab9f 263 @retval EFI_SUCCESS The firmware has successfully stored the variable and its data as\r
264 defined by the Attributes.\r
265 @retval EFI_INVALID_PARAMETER An invalid combination of attribute bits was supplied, or the\r
266 DataSize exceeds the maximum allowed.\r
267 @retval EFI_INVALID_PARAMETER VariableName is an empty Unicode string.\r
268 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data.\r
269 @retval EFI_DEVICE_ERROR The variable could not be saved due to a hardware failure.\r
270 @retval EFI_WRITE_PROTECTED The variable in question is read-only.\r
271 @retval EFI_WRITE_PROTECTED The variable in question cannot be deleted.\r
272 @retval EFI_SECURITY_VIOLATION The variable could not be written due to EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS\r
273 set but the AuthInfo does NOT pass the validation check carried\r
274 out by the firmware.\r
275 @retval EFI_NOT_FOUND The variable trying to be updated or deleted was not found.\r
ebcc8fb7 276\r
bf231ea6 277**/\r
ebcc8fb7 278EFI_STATUS\r
279EFIAPI\r
280EfiSetVariable (\r
281 IN CHAR16 *VariableName,\r
282 IN EFI_GUID *VendorGuid,\r
283 IN UINT32 Attributes,\r
284 IN UINTN DataSize,\r
285 IN VOID *Data\r
286 )\r
bf231ea6
A
287{\r
288 return mRT->SetVariable (VariableName, VendorGuid, Attributes, DataSize, Data);\r
289}\r
ebcc8fb7 290\r
ebcc8fb7 291\r
bf231ea6
A
292/**\r
293 Returns the next high 32 bits of platform's monotonic counter.\r
ebcc8fb7 294\r
bf231ea6 295 @param HighCount Pointer to returned value.\r
ebcc8fb7 296\r
1d37ab9f 297 @retval EFI_SUCCESS The next high monotonic count was returned.\r
298 @retval EFI_DEVICE_ERROR The device is not functioning properly.\r
299 @retval EFI_INVALID_PARAMETER HighCount is NULL.\r
ebcc8fb7 300\r
bf231ea6 301**/\r
ebcc8fb7 302EFI_STATUS\r
303EFIAPI\r
304EfiGetNextHighMonotonicCount (\r
305 OUT UINT32 *HighCount\r
306 )\r
bf231ea6
A
307{\r
308 return mRT->GetNextHighMonotonicCount (HighCount);\r
309}\r
ebcc8fb7 310\r
ebcc8fb7 311\r
bf231ea6 312/**\r
1d37ab9f 313 This service converts a function pointer from physical to virtual addressing. \r
ebcc8fb7 314\r
bf231ea6
A
315 @param DebugDisposition Supplies type information for the pointer being converted.\r
316 @param Address The pointer to a pointer that is to be fixed to be the\r
317 value needed for the new virtual address mapping being\r
318 applied.\r
ebcc8fb7 319\r
1d37ab9f 320 @retval EFI_SUCCESS The pointer pointed to by Address was modified.\r
321 @retval EFI_NOT_FOUND The pointer pointed to by Address was not found to be part of\r
322 the current memory map. This is normally fatal.\r
323 @retval EFI_INVALID_PARAMETER Address is NULL.\r
324 @retval EFI_INVALID_PARAMETER *Address is NULL and DebugDispositio\r
ebcc8fb7 325\r
bf231ea6 326**/\r
ebcc8fb7 327EFI_STATUS\r
328EFIAPI\r
329EfiConvertPointer (\r
330 IN UINTN DebugDisposition,\r
331 IN OUT VOID **Address\r
332 )\r
bf231ea6 333{\r
ad9e507a 334 return gRT->ConvertPointer (DebugDisposition, Address);\r
f5b2c45b 335}\r
336\r
337\r
338/**\r
339 Determines the new virtual address that is to be used on subsequent memory accesses.\r
340\r
341 For IA32, X64, and EBC, this service is a wrapper for the UEFI Runtime Service\r
342 ConvertPointer(). See the UEFI Specification for details. \r
343 For IPF, this function interprets Address as a pointer to an EFI_PLABEL structure\r
344 and both the EntryPoint and GP fields of an EFI_PLABEL are converted from physical\r
345 to virtiual addressing. Since IPF allows the GP to point to an address outside\r
346 a PE/COFF image, the physical to virtual offset for the EntryPoint field is used\r
347 to adjust the GP field. The UEFI Runtime Service ConvertPointer() is used to convert\r
348 EntryPoint and the status code for this conversion is always returned. If the convertion\r
349 of EntryPoint fails, then neither EntryPoint nor GP are modified. See the UEFI\r
350 Specification for details on the UEFI Runtime Service ConvertPointer().\r
351\r
352 @param DebugDisposition Supplies type information for the pointer being converted.\r
353 @param Address The pointer to a pointer that is to be fixed to be the\r
354 value needed for the new virtual address mapping being\r
355 applied.\r
356\r
1d37ab9f 357 @return EFI_STATUS value from EfiConvertPointer().\r
f5b2c45b 358\r
359**/\r
360EFI_STATUS\r
361EFIAPI\r
362EfiConvertFunctionPointer (\r
363 IN UINTN DebugDisposition,\r
364 IN OUT VOID **Address\r
365 )\r
366{\r
367 return EfiConvertPointer (DebugDisposition, Address);\r
bf231ea6 368}\r
ebcc8fb7 369\r
ebcc8fb7 370\r
bf231ea6 371/**\r
1d37ab9f 372 Convert the standard Lib double linked list to a virtual mapping.\r
373\r
374 This service uses EfiConvertPointer() to walk a double linked list and convert all the link\r
375 pointers to their virtual mappings. This function is only guaranteed to work during the\r
376 EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event and calling it at other times has undefined results.\r
ebcc8fb7 377\r
bf231ea6
A
378 @param DebugDisposition Supplies type information for the pointer being converted.\r
379 @param ListHead Head of linked list to convert.\r
ebcc8fb7 380\r
bf231ea6 381 @retval EFI_SUCCESS Success to execute the function.\r
1d37ab9f 382 @retval !EFI_SUCCESS Failed to e3xecute the function.\r
ebcc8fb7 383\r
bf231ea6 384**/\r
ebcc8fb7 385EFI_STATUS\r
386EFIAPI\r
387EfiConvertList (\r
388 IN UINTN DebugDisposition,\r
389 IN OUT LIST_ENTRY *ListHead\r
390 )\r
ebcc8fb7 391{\r
392 LIST_ENTRY *Link;\r
393 LIST_ENTRY *NextLink;\r
60c93673
LG
394 \r
395 //\r
396 // For NULL List, return EFI_SUCCESS\r
397 //\r
398 if (ListHead == NULL) {\r
399 return EFI_SUCCESS;\r
400 }\r
ebcc8fb7 401\r
402 //\r
403 // Convert all the ForwardLink & BackLink pointers in the list\r
404 //\r
405 Link = ListHead;\r
406 do {\r
407 NextLink = Link->ForwardLink;\r
408\r
409 EfiConvertPointer (\r
410 Link->ForwardLink == ListHead ? DebugDisposition : 0,\r
411 (VOID **) &Link->ForwardLink\r
412 );\r
413\r
414 EfiConvertPointer (\r
415 Link->BackLink == ListHead ? DebugDisposition : 0,\r
416 (VOID **) &Link->BackLink\r
417 );\r
418\r
419 Link = NextLink;\r
420 } while (Link != ListHead);\r
421 return EFI_SUCCESS;\r
422}\r
423\r
424\r
425/**\r
426 Change the runtime addressing mode of EFI firmware from physical to virtual.\r
427\r
428 @param MemoryMapSize The size in bytes of VirtualMap.\r
429 @param DescriptorSize The size in bytes of an entry in the VirtualMap.\r
430 @param DescriptorVersion The version of the structure entries in VirtualMap.\r
431 @param VirtualMap An array of memory descriptors which contain new virtual\r
432 address mapping information for all runtime ranges. Type\r
433 EFI_MEMORY_DESCRIPTOR is defined in the\r
434 GetMemoryMap() function description.\r
435\r
436 @retval EFI_SUCCESS The virtual address map has been applied.\r
437 @retval EFI_UNSUPPORTED EFI firmware is not at runtime, or the EFI firmware is already in\r
438 virtual address mapped mode.\r
439 @retval EFI_INVALID_PARAMETER DescriptorSize or DescriptorVersion is\r
440 invalid.\r
441 @retval EFI_NO_MAPPING A virtual address was not supplied for a range in the memory\r
442 map that requires a mapping.\r
443 @retval EFI_NOT_FOUND A virtual address was supplied for an address that is not found\r
444 in the memory map.\r
445**/\r
446EFI_STATUS\r
447EFIAPI\r
448EfiSetVirtualAddressMap (\r
449 IN UINTN MemoryMapSize,\r
450 IN UINTN DescriptorSize,\r
451 IN UINT32 DescriptorVersion,\r
452 IN CONST EFI_MEMORY_DESCRIPTOR *VirtualMap\r
453 )\r
454{\r
f80b0830 455 return mRT->SetVirtualAddressMap (\r
ebcc8fb7 456 MemoryMapSize,\r
457 DescriptorSize,\r
458 DescriptorVersion,\r
459 (EFI_MEMORY_DESCRIPTOR *) VirtualMap\r
460 );\r
461}\r
462\r
463\r
bf231ea6
A
464/**\r
465 Passes capsules to the firmware with both virtual and physical mapping.\r
466 Depending on the intended consumption, the firmware may\r
467 process the capsule immediately. If the payload should persist across a\r
468 system reset, the reset value returned from EFI_QueryCapsuleCapabilities must\r
469 be passed into ResetSystem() and will cause the capsule to be processed by\r
470 the firmware as part of the reset process.\r
471\r
472 @param CapsuleHeaderArray Virtual pointer to an array of virtual pointers to the capsules\r
473 being passed into update capsule. Each capsules is assumed to\r
474 stored in contiguous virtual memory. The capsules in the\r
475 CapsuleHeaderArray must be the same capsules as the\r
476 ScatterGatherList. The CapsuleHeaderArray must\r
477 have the capsules in the same order as the ScatterGatherList.\r
478 @param CapsuleCount Number of pointers to EFI_CAPSULE_HEADER in\r
479 CaspuleHeaderArray.\r
480 @param ScatterGatherList Physical pointer to a set of\r
481 EFI_CAPSULE_BLOCK_DESCRIPTOR that describes the\r
482 location in physical memory of a set of capsules. See Related\r
483 Definitions for an explanation of how more than one capsule is\r
484 passed via this interface. The capsules in the\r
485 ScatterGatherList must be in the same order as the\r
486 CapsuleHeaderArray. This parameter is only referenced if\r
487 the capsules are defined to persist across system reset.\r
488\r
1d37ab9f 489 @retval EFI_SUCCESS Valid capsule was passed. If CAPSULE_FLAGS_PERSIT_ACROSS_RESET is not set,\r
490 the capsule has been successfully processed by the firmware.\r
491 @retval EFI_INVALID_PARAMETER CapsuleSize or HeaderSize is NULL.\r
492 @retval EFI_INVALID_PARAMETER CapsuleCount is 0\r
bf231ea6 493 @retval EFI_DEVICE_ERROR The capsule update was started, but failed due to a device error.\r
1d37ab9f 494 @retval EFI_UNSUPPORTED The capsule type is not supported on this platform.\r
495 @retval EFI_OUT_OF_RESOURCES There were insufficient resources to process the capsule.\r
bf231ea6
A
496\r
497**/\r
ebcc8fb7 498EFI_STATUS\r
499EFIAPI\r
500EfiUpdateCapsule (\r
b67d6130 501 IN EFI_CAPSULE_HEADER **CapsuleHeaderArray,\r
502 IN UINTN CapsuleCount,\r
503 IN EFI_PHYSICAL_ADDRESS ScatterGatherList OPTIONAL\r
ebcc8fb7 504 )\r
505{\r
506 return mRT->UpdateCapsule (\r
507 CapsuleHeaderArray,\r
508 CapsuleCount,\r
509 ScatterGatherList\r
510 );\r
511}\r
512\r
bf231ea6
A
513\r
514/**\r
515 The QueryCapsuleCapabilities() function allows a caller to test to see if a capsule or\r
516 capsules can be updated via UpdateCapsule(). The Flags values in the capsule header and\r
517 size of the entire capsule is checked.\r
518 If the caller needs to query for generic capsule capability a fake EFI_CAPSULE_HEADER can be\r
519 constructed where CapsuleImageSize is equal to HeaderSize that is equal to sizeof\r
520 (EFI_CAPSULE_HEADER). To determine reset requirements,\r
521 CAPSULE_FLAGS_PERSIST_ACROSS_RESET should be set in the Flags field of the\r
522 EFI_CAPSULE_HEADER.\r
523 The firmware must support any capsule that has the\r
524 CAPSULE_FLAGS_PERSIST_ACROSS_RESET flag set in EFI_CAPSULE_HEADER. The\r
525 firmware sets the policy for what capsules are supported that do not have the\r
526 CAPSULE_FLAGS_PERSIST_ACROSS_RESET flag set.\r
527\r
528 @param CapsuleHeaderArray Virtual pointer to an array of virtual pointers to the capsules\r
529 being passed into update capsule. The capsules are assumed to\r
530 stored in contiguous virtual memory.\r
531 @param CapsuleCount Number of pointers to EFI_CAPSULE_HEADER in\r
532 CaspuleHeaderArray.\r
42eedea9 533 @param MaximumCapsuleSize On output the maximum size that UpdateCapsule() can\r
bf231ea6
A
534 support as an argument to UpdateCapsule() via\r
535 CapsuleHeaderArray and ScatterGatherList.\r
536 Undefined on input.\r
537 @param ResetType Returns the type of reset required for the capsule update.\r
538\r
539 @retval EFI_SUCCESS Valid answer returned..\r
540 @retval EFI_INVALID_PARAMETER MaximumCapsuleSize is NULL.\r
541 @retval EFI_UNSUPPORTED The capsule type is not supported on this platform, and\r
542 MaximumCapsuleSize and ResetType are undefined.\r
543\r
544**/\r
ebcc8fb7 545EFI_STATUS\r
546EFIAPI\r
547EfiQueryCapsuleCapabilities (\r
b67d6130 548 IN EFI_CAPSULE_HEADER **CapsuleHeaderArray,\r
549 IN UINTN CapsuleCount,\r
550 OUT UINT64 *MaximumCapsuleSize,\r
551 OUT EFI_RESET_TYPE *ResetType\r
ebcc8fb7 552 )\r
553{\r
554 return mRT->QueryCapsuleCapabilities (\r
555 CapsuleHeaderArray,\r
556 CapsuleCount,\r
557 MaximumCapsuleSize,\r
558 ResetType\r
559 );\r
560}\r
561\r
562\r
bf231ea6 563/**\r
1d37ab9f 564 Returns information about the EFI variables.\r
565\r
bf231ea6
A
566 The QueryVariableInfo() function allows a caller to obtain the information about the\r
567 maximum size of the storage space available for the EFI variables, the remaining size of the storage\r
568 space available for the EFI variables and the maximum size of each individual EFI variable,\r
569 associated with the attributes specified.\r
570 The returned MaximumVariableStorageSize, RemainingVariableStorageSize,\r
571 MaximumVariableSize information may change immediately after the call based on other\r
572 runtime activities including asynchronous error events. Also, these values associated with different\r
573 attributes are not additive in nature.\r
574\r
575 @param Attributes Attributes bitmask to specify the type of variables on\r
576 which to return information. Refer to the\r
577 GetVariable() function description.\r
578 @param MaximumVariableStorageSize\r
579 On output the maximum size of the storage space\r
580 available for the EFI variables associated with the\r
581 attributes specified.\r
582 @param RemainingVariableStorageSize\r
583 Returns the remaining size of the storage space\r
584 available for the EFI variables associated with the\r
585 attributes specified..\r
586 @param MaximumVariableSize Returns the maximum size of the individual EFI\r
587 variables associated with the attributes specified.\r
588\r
589 @retval EFI_SUCCESS Valid answer returned.\r
590 @retval EFI_INVALID_PARAMETER An invalid combination of attribute bits was supplied.\r
591 @retval EFI_UNSUPPORTED EFI_UNSUPPORTED The attribute is not supported on this platform, and the\r
592 MaximumVariableStorageSize,\r
593 RemainingVariableStorageSize, MaximumVariableSize\r
594 are undefined.\r
595**/\r
ebcc8fb7 596EFI_STATUS\r
597EFIAPI\r
598EfiQueryVariableInfo (\r
b67d6130 599 IN UINT32 Attributes,\r
600 OUT UINT64 *MaximumVariableStorageSize,\r
601 OUT UINT64 *RemainingVariableStorageSize,\r
602 OUT UINT64 *MaximumVariableSize\r
ebcc8fb7 603 )\r
604{\r
605 return mRT->QueryVariableInfo (\r
606 Attributes,\r
607 MaximumVariableStorageSize,\r
608 RemainingVariableStorageSize,\r
609 MaximumVariableSize\r
610 );\r
611}\r