RuntimeLib.c revision 58380e9c6174f23df78f777b4209c0fd75245cda
142eedea958591087603bbacd1c2227d2494026afyshang/** @file 260c93673b3189b7a48acdb5c300f4ee3546ffb85lgao UEFI Runtime Library implementation for non IPF processor types. 3ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang 4363bb1b56ee3f45587889b979d124aa1d03de824qhuang This library hides the global variable for the EFI Runtime Services so the 5363bb1b56ee3f45587889b979d124aa1d03de824qhuang caller does not need to deal with the possibility of being called from an 6363bb1b56ee3f45587889b979d124aa1d03de824qhuang OS virtual address space. All pointer values are different for a virtual 7363bb1b56ee3f45587889b979d124aa1d03de824qhuang mapping than from the normal physical mapping at boot services time. 8363bb1b56ee3f45587889b979d124aa1d03de824qhuang 919388d2960b2fe0347da23799e93ccc52f540214hhtianCopyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR> 1019388d2960b2fe0347da23799e93ccc52f540214hhtianThis program and the accompanying materials 11ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshangare licensed and made available under the terms and conditions of the BSD License 12ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshangwhich accompanies this distribution. The full text of the license may be found at 1358380e9c6174f23df78f777b4209c0fd75245cdamyronporterhttp://opensource.org/licenses/bsd-license.php. 14ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang 15ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshangTHE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 16ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshangWITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 17ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang 18ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang**/ 19ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang 20363bb1b56ee3f45587889b979d124aa1d03de824qhuang#include <Uefi.h> 21363bb1b56ee3f45587889b979d124aa1d03de824qhuang#include <Library/UefiRuntimeLib.h> 22363bb1b56ee3f45587889b979d124aa1d03de824qhuang#include <Library/DebugLib.h> 23363bb1b56ee3f45587889b979d124aa1d03de824qhuang#include <Library/UefiBootServicesTableLib.h> 24363bb1b56ee3f45587889b979d124aa1d03de824qhuang#include <Library/UefiRuntimeServicesTableLib.h> 25363bb1b56ee3f45587889b979d124aa1d03de824qhuang#include <Guid/EventGroup.h> 26ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang 27ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang/// 28ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang/// Driver Lib Module Globals 29ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang/// 30fe467413d2230a2170bb3ffc91e5e8c909920628jjiEFI_EVENT mEfiVirtualNotifyEvent; 31fe467413d2230a2170bb3ffc91e5e8c909920628jjiEFI_EVENT mEfiExitBootServicesEvent; 32fe467413d2230a2170bb3ffc91e5e8c909920628jjiBOOLEAN mEfiGoneVirtual = FALSE; 33fe467413d2230a2170bb3ffc91e5e8c909920628jjiBOOLEAN mEfiAtRuntime = FALSE; 34363bb1b56ee3f45587889b979d124aa1d03de824qhuangEFI_RUNTIME_SERVICES *mInternalRT; 35ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang 36ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang/** 3742eedea958591087603bbacd1c2227d2494026afyshang Set AtRuntime flag as TRUE after ExitBootServices. 38ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang 3958380e9c6174f23df78f777b4209c0fd75245cdamyronporter @param[in] Event The Event that is being processed. 4058380e9c6174f23df78f777b4209c0fd75245cdamyronporter @param[in] Context The Event Context. 41363bb1b56ee3f45587889b979d124aa1d03de824qhuang 42ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang**/ 43ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshangVOID 44ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshangEFIAPI 4521998b6778c9b77085330c4711f4cc55aa7c1e41yshangRuntimeLibExitBootServicesEvent ( 46ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang IN EFI_EVENT Event, 47ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang IN VOID *Context 48ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang ) 49ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang{ 50ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang mEfiAtRuntime = TRUE; 51ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang} 52ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang 53ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang/** 54ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang Fixup internal data so that EFI can be call in virtual mode. 55ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang Call the passed in Child Notify event and convert any pointers in 56ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang lib to virtual mode. 57ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang 5858380e9c6174f23df78f777b4209c0fd75245cdamyronporter @param[in] Event The Event that is being processed. 5958380e9c6174f23df78f777b4209c0fd75245cdamyronporter @param[in] Context The Event Context. 60ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang**/ 61ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshangVOID 62ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshangEFIAPI 63ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshangRuntimeLibVirtualNotifyEvent ( 64ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang IN EFI_EVENT Event, 65ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang IN VOID *Context 66ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang ) 67ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang{ 68ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang // 69ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang // Update global for Runtime Services Table and IO 70ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang // 71363bb1b56ee3f45587889b979d124aa1d03de824qhuang EfiConvertPointer (0, (VOID **) &mInternalRT); 72ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang 73ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang mEfiGoneVirtual = TRUE; 74ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang} 75ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang 76ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang/** 77a9b896f453c83a6f0af653c9c153014a37129453qhuang Initialize runtime Driver Lib if it has not yet been initialized. 7860c93673b3189b7a48acdb5c300f4ee3546ffb85lgao It will ASSERT() if gRT is NULL or gBS is NULL. 7960c93673b3189b7a48acdb5c300f4ee3546ffb85lgao It will ASSERT() if that operation fails. 80ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang 81ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang @param[in] ImageHandle The firmware allocated handle for the EFI image. 82ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang @param[in] SystemTable A pointer to the EFI System Table. 83ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang 84ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang @return EFI_STATUS always returns EFI_SUCCESS except EFI_ALREADY_STARTED if already started. 85ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang**/ 86ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshangEFI_STATUS 87ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshangEFIAPI 88ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshangRuntimeDriverLibConstruct ( 89ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang IN EFI_HANDLE ImageHandle, 90ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang IN EFI_SYSTEM_TABLE *SystemTable 91ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang ) 92ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang{ 93ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang EFI_STATUS Status; 94ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang 9560c93673b3189b7a48acdb5c300f4ee3546ffb85lgao ASSERT (gRT != NULL); 9660c93673b3189b7a48acdb5c300f4ee3546ffb85lgao ASSERT (gBS != NULL); 9760c93673b3189b7a48acdb5c300f4ee3546ffb85lgao 98363bb1b56ee3f45587889b979d124aa1d03de824qhuang mInternalRT = gRT; 99ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang // 100ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang // Register SetVirtualAddressMap () notify function 101ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang // 10257a31578d374da211893541d236890850529e478jji Status = gBS->CreateEventEx ( 10357a31578d374da211893541d236890850529e478jji EVT_NOTIFY_SIGNAL, 104ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang TPL_NOTIFY, 105ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang RuntimeLibVirtualNotifyEvent, 106ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang NULL, 10757a31578d374da211893541d236890850529e478jji &gEfiEventVirtualAddressChangeGuid, 108ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang &mEfiVirtualNotifyEvent 109ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang ); 110ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang 111ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang ASSERT_EFI_ERROR (Status); 112ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang 11357a31578d374da211893541d236890850529e478jji Status = gBS->CreateEventEx ( 11457a31578d374da211893541d236890850529e478jji EVT_NOTIFY_SIGNAL, 11521998b6778c9b77085330c4711f4cc55aa7c1e41yshang TPL_NOTIFY, 11621998b6778c9b77085330c4711f4cc55aa7c1e41yshang RuntimeLibExitBootServicesEvent, 11721998b6778c9b77085330c4711f4cc55aa7c1e41yshang NULL, 11857a31578d374da211893541d236890850529e478jji &gEfiEventExitBootServicesGuid, 11921998b6778c9b77085330c4711f4cc55aa7c1e41yshang &mEfiExitBootServicesEvent 12021998b6778c9b77085330c4711f4cc55aa7c1e41yshang ); 12121998b6778c9b77085330c4711f4cc55aa7c1e41yshang 12221998b6778c9b77085330c4711f4cc55aa7c1e41yshang ASSERT_EFI_ERROR (Status); 12321998b6778c9b77085330c4711f4cc55aa7c1e41yshang 124ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang return Status; 125ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang} 126ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang 127ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang/** 12860c93673b3189b7a48acdb5c300f4ee3546ffb85lgao If a runtime driver exits with an error, it must call this routine 12960c93673b3189b7a48acdb5c300f4ee3546ffb85lgao to free the allocated resource before the exiting. 13060c93673b3189b7a48acdb5c300f4ee3546ffb85lgao It will ASSERT() if gBS is NULL. 13160c93673b3189b7a48acdb5c300f4ee3546ffb85lgao It will ASSERT() if that operation fails. 132ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang 13342eedea958591087603bbacd1c2227d2494026afyshang @param[in] ImageHandle The firmware allocated handle for the EFI image. 13442eedea958591087603bbacd1c2227d2494026afyshang @param[in] SystemTable A pointer to the EFI System Table. 13542eedea958591087603bbacd1c2227d2494026afyshang 13658380e9c6174f23df78f777b4209c0fd75245cdamyronporter @retval EFI_SUCCESS The Runtime Driver Lib shutdown successfully. 13758380e9c6174f23df78f777b4209c0fd75245cdamyronporter @retval EFI_UNSUPPORTED Runtime Driver lib was not initialized. 138ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang**/ 139ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshangEFI_STATUS 140ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshangEFIAPI 141ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshangRuntimeDriverLibDeconstruct ( 142ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang IN EFI_HANDLE ImageHandle, 143ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang IN EFI_SYSTEM_TABLE *SystemTable 144ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang ) 145ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang{ 146ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang EFI_STATUS Status; 147ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang 148ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang // 149ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang // Close SetVirtualAddressMap () notify function 150ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang // 151ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang ASSERT (gBS != NULL); 152ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang Status = gBS->CloseEvent (mEfiVirtualNotifyEvent); 153ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang ASSERT_EFI_ERROR (Status); 154ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang 15521998b6778c9b77085330c4711f4cc55aa7c1e41yshang Status = gBS->CloseEvent (mEfiExitBootServicesEvent); 15621998b6778c9b77085330c4711f4cc55aa7c1e41yshang ASSERT_EFI_ERROR (Status); 15721998b6778c9b77085330c4711f4cc55aa7c1e41yshang 158ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang return Status; 159ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang} 160ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang 161ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang/** 1621d37ab9fb9714451a58023c2515d1c5f9cbf6a31jji This function allows the caller to determine if UEFI ExitBootServices() has been called. 1631d37ab9fb9714451a58023c2515d1c5f9cbf6a31jji 1641d37ab9fb9714451a58023c2515d1c5f9cbf6a31jji This function returns TRUE after all the EVT_SIGNAL_EXIT_BOOT_SERVICES functions have 1651d37ab9fb9714451a58023c2515d1c5f9cbf6a31jji executed as a result of the OS calling ExitBootServices(). Prior to this time FALSE 1661d37ab9fb9714451a58023c2515d1c5f9cbf6a31jji is returned. This function is used by runtime code to decide it is legal to access 1671d37ab9fb9714451a58023c2515d1c5f9cbf6a31jji services that go away after ExitBootServices(). 1681d37ab9fb9714451a58023c2515d1c5f9cbf6a31jji 1691d37ab9fb9714451a58023c2515d1c5f9cbf6a31jji @retval TRUE The system has finished executing the EVT_SIGNAL_EXIT_BOOT_SERVICES event. 1701d37ab9fb9714451a58023c2515d1c5f9cbf6a31jji @retval FALSE The system has not finished executing the EVT_SIGNAL_EXIT_BOOT_SERVICES event. 171ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang 172ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang**/ 173ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshangBOOLEAN 174ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshangEFIAPI 175ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshangEfiAtRuntime ( 176ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang VOID 177ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang ) 178ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang{ 179ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang return mEfiAtRuntime; 180ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang} 181ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang 182ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang/** 1831d37ab9fb9714451a58023c2515d1c5f9cbf6a31jji This function allows the caller to determine if UEFI SetVirtualAddressMap() has been called. 1841d37ab9fb9714451a58023c2515d1c5f9cbf6a31jji 1851d37ab9fb9714451a58023c2515d1c5f9cbf6a31jji This function returns TRUE after all the EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE functions have 1861d37ab9fb9714451a58023c2515d1c5f9cbf6a31jji executed as a result of the OS calling SetVirtualAddressMap(). Prior to this time FALSE 1871d37ab9fb9714451a58023c2515d1c5f9cbf6a31jji is returned. This function is used by runtime code to decide it is legal to access services 1881d37ab9fb9714451a58023c2515d1c5f9cbf6a31jji that go away after SetVirtualAddressMap(). 1891d37ab9fb9714451a58023c2515d1c5f9cbf6a31jji 1901d37ab9fb9714451a58023c2515d1c5f9cbf6a31jji @retval TRUE The system has finished executing the EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event. 1911d37ab9fb9714451a58023c2515d1c5f9cbf6a31jji @retval FALSE The system has not finished executing the EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event. 192ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang 193ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang**/ 194ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshangBOOLEAN 195ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshangEFIAPI 196ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshangEfiGoneVirtual ( 197ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang VOID 198ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang ) 199ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang{ 200ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang return mEfiGoneVirtual; 201ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang} 202ebcc8fb7ba239020d307ce113fb30ae120b6fcafyshang 203363bb1b56ee3f45587889b979d124aa1d03de824qhuang 204363bb1b56ee3f45587889b979d124aa1d03de824qhuang/** 205363bb1b56ee3f45587889b979d124aa1d03de824qhuang This service is a wrapper for the UEFI Runtime Service ResetSystem(). 206363bb1b56ee3f45587889b979d124aa1d03de824qhuang 207363bb1b56ee3f45587889b979d124aa1d03de824qhuang The ResetSystem()function resets the entire platform, including all processors and devices,and reboots the system. 208363bb1b56ee3f45587889b979d124aa1d03de824qhuang Calling this interface with ResetType of EfiResetCold causes a system-wide reset. This sets all circuitry within 209363bb1b56ee3f45587889b979d124aa1d03de824qhuang the system to its initial state. This type of reset is asynchronous to system operation and operates without regard 210363bb1b56ee3f45587889b979d124aa1d03de824qhuang to cycle boundaries. EfiResetCold is tantamount to a system power cycle. 211363bb1b56ee3f45587889b979d124aa1d03de824qhuang Calling this interface with ResetType of EfiResetWarm causes a system-wide initialization. The processors are set to 212363bb1b56ee3f45587889b979d124aa1d03de824qhuang their initial state, and pending cycles are not corrupted. If the system does not support this reset type, then an 213363bb1b56ee3f45587889b979d124aa1d03de824qhuang EfiResetCold must be performed. 214363bb1b56ee3f45587889b979d124aa1d03de824qhuang Calling this interface with ResetType of EfiResetShutdown causes the system to enter a power state equivalent to the 215363bb1b56ee3f45587889b979d124aa1d03de824qhuang ACPI G2/S5 or G3 states. If the system does not support this reset type, then when the system is rebooted, it should 216363bb1b56ee3f45587889b979d124aa1d03de824qhuang exhibit the EfiResetCold attributes. 217363bb1b56ee3f45587889b979d124aa1d03de824qhuang The platform may optionally log the parameters from any non-normal reset that occurs. 218363bb1b56ee3f45587889b979d124aa1d03de824qhuang The ResetSystem() function does not return. 219363bb1b56ee3f45587889b979d124aa1d03de824qhuang 220363bb1b56ee3f45587889b979d124aa1d03de824qhuang @param ResetType The type of reset to perform. 221363bb1b56ee3f45587889b979d124aa1d03de824qhuang @param ResetStatus The status code for the reset. If the system reset is part of a normal operation, the status code 222363bb1b56ee3f45587889b979d124aa1d03de824qhuang would be EFI_SUCCESS. If the system reset is due to some type of failure the most appropriate EFI 223363bb1b56ee3f45587889b979d124aa1d03de824qhuang Status code would be used. 224363bb1b56ee3f45587889b979d124aa1d03de824qhuang @param DataSizeThe size, in bytes, of ResetData. 225363bb1b56ee3f45587889b979d124aa1d03de824qhuang @param ResetData For a ResetType of EfiResetCold, EfiResetWarm, or EfiResetShutdown the data buffer starts with a 226363bb1b56ee3f45587889b979d124aa1d03de824qhuang Null-terminated Unicode string, optionally followed by additional binary data. The string is a 227363bb1b56ee3f45587889b979d124aa1d03de824qhuang description that the caller may use to further indicate the reason for the system reset. ResetData 228363bb1b56ee3f45587889b979d124aa1d03de824qhuang is only valid if ResetStatus is something other then EFI_SUCCESS. This pointer must be a physical 229363bb1b56ee3f45587889b979d124aa1d03de824qhuang address. For a ResetType of EfiRestUpdate the data buffer also starts with a Null-terminated string 230363bb1b56ee3f45587889b979d124aa1d03de824qhuang that is followed by a physical VOID * to an EFI_CAPSULE_HEADER. 231363bb1b56ee3f45587889b979d124aa1d03de824qhuang 232363bb1b56ee3f45587889b979d124aa1d03de824qhuang**/ 233363bb1b56ee3f45587889b979d124aa1d03de824qhuangVOID 234363bb1b56ee3f45587889b979d124aa1d03de824qhuangEFIAPI 235363bb1b56ee3f45587889b979d124aa1d03de824qhuangEfiResetSystem ( 236363bb1b56ee3f45587889b979d124aa1d03de824qhuang IN EFI_RESET_TYPE ResetType, 237363bb1b56ee3f45587889b979d124aa1d03de824qhuang IN EFI_STATUS ResetStatus, 238363bb1b56ee3f45587889b979d124aa1d03de824qhuang IN UINTN DataSize, 239363bb1b56ee3f45587889b979d124aa1d03de824qhuang IN VOID *ResetData OPTIONAL 240363bb1b56ee3f45587889b979d124aa1d03de824qhuang ) 241363bb1b56ee3f45587889b979d124aa1d03de824qhuang{ 242363bb1b56ee3f45587889b979d124aa1d03de824qhuang mInternalRT->ResetSystem (ResetType, ResetStatus, DataSize, ResetData); 243363bb1b56ee3f45587889b979d124aa1d03de824qhuang} 244363bb1b56ee3f45587889b979d124aa1d03de824qhuang 245363bb1b56ee3f45587889b979d124aa1d03de824qhuang 246363bb1b56ee3f45587889b979d124aa1d03de824qhuang/** 247363bb1b56ee3f45587889b979d124aa1d03de824qhuang This service is a wrapper for the UEFI Runtime Service GetTime(). 248363bb1b56ee3f45587889b979d124aa1d03de824qhuang 249363bb1b56ee3f45587889b979d124aa1d03de824qhuang The GetTime() function returns a time that was valid sometime during the call to the function. 250363bb1b56ee3f45587889b979d124aa1d03de824qhuang While the returned EFI_TIME structure contains TimeZone and Daylight savings time information, 251363bb1b56ee3f45587889b979d124aa1d03de824qhuang the actual clock does not maintain these values. The current time zone and daylight saving time 252363bb1b56ee3f45587889b979d124aa1d03de824qhuang information returned by GetTime() are the values that were last set via SetTime(). 253363bb1b56ee3f45587889b979d124aa1d03de824qhuang The GetTime() function should take approximately the same amount of time to read the time each 254363bb1b56ee3f45587889b979d124aa1d03de824qhuang time it is called. All reported device capabilities are to be rounded up. 255363bb1b56ee3f45587889b979d124aa1d03de824qhuang During runtime, if a PC-AT CMOS device is present in the platform the caller must synchronize 256363bb1b56ee3f45587889b979d124aa1d03de824qhuang access to the device before calling GetTime(). 257363bb1b56ee3f45587889b979d124aa1d03de824qhuang 258363bb1b56ee3f45587889b979d124aa1d03de824qhuang @param Time A pointer to storage to receive a snapshot of the current time. 259363bb1b56ee3f45587889b979d124aa1d03de824qhuang @param Capabilities An optional pointer to a buffer to receive the real time clock device's 260363bb1b56ee3f45587889b979d124aa1d03de824qhuang capabilities. 261363bb1b56ee3f45587889b979d124aa1d03de824qhuang 262363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_SUCCESS The operation completed successfully. 263363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_INVALID_PARAMETER Time is NULL. 264363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_DEVICE_ERROR The time could not be retrieved due to a hardware error. 265363bb1b56ee3f45587889b979d124aa1d03de824qhuang 266363bb1b56ee3f45587889b979d124aa1d03de824qhuang**/ 267363bb1b56ee3f45587889b979d124aa1d03de824qhuangEFI_STATUS 268363bb1b56ee3f45587889b979d124aa1d03de824qhuangEFIAPI 269363bb1b56ee3f45587889b979d124aa1d03de824qhuangEfiGetTime ( 270363bb1b56ee3f45587889b979d124aa1d03de824qhuang OUT EFI_TIME *Time, 271363bb1b56ee3f45587889b979d124aa1d03de824qhuang OUT EFI_TIME_CAPABILITIES *Capabilities OPTIONAL 272363bb1b56ee3f45587889b979d124aa1d03de824qhuang ) 273363bb1b56ee3f45587889b979d124aa1d03de824qhuang{ 274363bb1b56ee3f45587889b979d124aa1d03de824qhuang return mInternalRT->GetTime (Time, Capabilities); 275363bb1b56ee3f45587889b979d124aa1d03de824qhuang} 276363bb1b56ee3f45587889b979d124aa1d03de824qhuang 277363bb1b56ee3f45587889b979d124aa1d03de824qhuang 278363bb1b56ee3f45587889b979d124aa1d03de824qhuang/** 279363bb1b56ee3f45587889b979d124aa1d03de824qhuang This service is a wrapper for the UEFI Runtime Service SetTime(). 280363bb1b56ee3f45587889b979d124aa1d03de824qhuang 281363bb1b56ee3f45587889b979d124aa1d03de824qhuang The SetTime() function sets the real time clock device to the supplied time, and records the 282363bb1b56ee3f45587889b979d124aa1d03de824qhuang current time zone and daylight savings time information. The SetTime() function is not allowed 283363bb1b56ee3f45587889b979d124aa1d03de824qhuang to loop based on the current time. For example, if the device does not support a hardware reset 284363bb1b56ee3f45587889b979d124aa1d03de824qhuang for the sub-resolution time, the code is not to implement the feature by waiting for the time to 285363bb1b56ee3f45587889b979d124aa1d03de824qhuang wrap. 286363bb1b56ee3f45587889b979d124aa1d03de824qhuang During runtime, if a PC-AT CMOS device is present in the platform the caller must synchronize 287363bb1b56ee3f45587889b979d124aa1d03de824qhuang access to the device before calling SetTime(). 288363bb1b56ee3f45587889b979d124aa1d03de824qhuang 289363bb1b56ee3f45587889b979d124aa1d03de824qhuang @param Time A pointer to the current time. Type EFI_TIME is defined in the GetTime() 290363bb1b56ee3f45587889b979d124aa1d03de824qhuang function description. Full error checking is performed on the different 291363bb1b56ee3f45587889b979d124aa1d03de824qhuang fields of the EFI_TIME structure (refer to the EFI_TIME definition in the 292363bb1b56ee3f45587889b979d124aa1d03de824qhuang GetTime() function description for full details), and EFI_INVALID_PARAMETER 293363bb1b56ee3f45587889b979d124aa1d03de824qhuang is returned if any field is out of range. 294363bb1b56ee3f45587889b979d124aa1d03de824qhuang 295363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_SUCCESS The operation completed successfully. 296363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_INVALID_PARAMETER A time field is out of range. 297363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_DEVICE_ERROR The time could not be set due to a hardware error. 298363bb1b56ee3f45587889b979d124aa1d03de824qhuang 299363bb1b56ee3f45587889b979d124aa1d03de824qhuang**/ 300363bb1b56ee3f45587889b979d124aa1d03de824qhuangEFI_STATUS 301363bb1b56ee3f45587889b979d124aa1d03de824qhuangEFIAPI 302363bb1b56ee3f45587889b979d124aa1d03de824qhuangEfiSetTime ( 303363bb1b56ee3f45587889b979d124aa1d03de824qhuang IN EFI_TIME *Time 304363bb1b56ee3f45587889b979d124aa1d03de824qhuang ) 305363bb1b56ee3f45587889b979d124aa1d03de824qhuang{ 306363bb1b56ee3f45587889b979d124aa1d03de824qhuang return mInternalRT->SetTime (Time); 307363bb1b56ee3f45587889b979d124aa1d03de824qhuang} 308363bb1b56ee3f45587889b979d124aa1d03de824qhuang 309363bb1b56ee3f45587889b979d124aa1d03de824qhuang 310363bb1b56ee3f45587889b979d124aa1d03de824qhuang/** 311363bb1b56ee3f45587889b979d124aa1d03de824qhuang This service is a wrapper for the UEFI Runtime Service GetWakeupTime(). 312363bb1b56ee3f45587889b979d124aa1d03de824qhuang 313363bb1b56ee3f45587889b979d124aa1d03de824qhuang The alarm clock time may be rounded from the set alarm clock time to be within the resolution 314363bb1b56ee3f45587889b979d124aa1d03de824qhuang of the alarm clock device. The resolution of the alarm clock device is defined to be one second. 315363bb1b56ee3f45587889b979d124aa1d03de824qhuang During runtime, if a PC-AT CMOS device is present in the platform the caller must synchronize 316363bb1b56ee3f45587889b979d124aa1d03de824qhuang access to the device before calling GetWakeupTime(). 317363bb1b56ee3f45587889b979d124aa1d03de824qhuang 318363bb1b56ee3f45587889b979d124aa1d03de824qhuang @param Enabled Indicates if the alarm is currently enabled or disabled. 319363bb1b56ee3f45587889b979d124aa1d03de824qhuang @param Pending Indicates if the alarm signal is pending and requires acknowledgement. 320363bb1b56ee3f45587889b979d124aa1d03de824qhuang @param Time The current alarm setting. Type EFI_TIME is defined in the GetTime() 321363bb1b56ee3f45587889b979d124aa1d03de824qhuang function description. 322363bb1b56ee3f45587889b979d124aa1d03de824qhuang 32358380e9c6174f23df78f777b4209c0fd75245cdamyronporter @retval EFI_SUCCESS The alarm settings were returned. 324363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_INVALID_PARAMETER Enabled is NULL. 325363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_INVALID_PARAMETER Pending is NULL. 326363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_INVALID_PARAMETER Time is NULL. 327363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_DEVICE_ERROR The wakeup time could not be retrieved due to a hardware error. 328363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_UNSUPPORTED A wakeup timer is not supported on this platform. 329363bb1b56ee3f45587889b979d124aa1d03de824qhuang 330363bb1b56ee3f45587889b979d124aa1d03de824qhuang**/ 331363bb1b56ee3f45587889b979d124aa1d03de824qhuangEFI_STATUS 332363bb1b56ee3f45587889b979d124aa1d03de824qhuangEFIAPI 333363bb1b56ee3f45587889b979d124aa1d03de824qhuangEfiGetWakeupTime ( 334363bb1b56ee3f45587889b979d124aa1d03de824qhuang OUT BOOLEAN *Enabled, 335363bb1b56ee3f45587889b979d124aa1d03de824qhuang OUT BOOLEAN *Pending, 336363bb1b56ee3f45587889b979d124aa1d03de824qhuang OUT EFI_TIME *Time 337363bb1b56ee3f45587889b979d124aa1d03de824qhuang ) 338363bb1b56ee3f45587889b979d124aa1d03de824qhuang{ 339363bb1b56ee3f45587889b979d124aa1d03de824qhuang return mInternalRT->GetWakeupTime (Enabled, Pending, Time); 340363bb1b56ee3f45587889b979d124aa1d03de824qhuang} 341363bb1b56ee3f45587889b979d124aa1d03de824qhuang 342363bb1b56ee3f45587889b979d124aa1d03de824qhuang 343363bb1b56ee3f45587889b979d124aa1d03de824qhuang 344363bb1b56ee3f45587889b979d124aa1d03de824qhuang/** 345363bb1b56ee3f45587889b979d124aa1d03de824qhuang This service is a wrapper for the UEFI Runtime Service SetWakeupTime() 346363bb1b56ee3f45587889b979d124aa1d03de824qhuang 347363bb1b56ee3f45587889b979d124aa1d03de824qhuang Setting a system wakeup alarm causes the system to wake up or power on at the set time. 348363bb1b56ee3f45587889b979d124aa1d03de824qhuang When the alarm fires, the alarm signal is latched until it is acknowledged by calling SetWakeupTime() 349363bb1b56ee3f45587889b979d124aa1d03de824qhuang to disable the alarm. If the alarm fires before the system is put into a sleeping or off state, 350363bb1b56ee3f45587889b979d124aa1d03de824qhuang since the alarm signal is latched the system will immediately wake up. If the alarm fires while 351363bb1b56ee3f45587889b979d124aa1d03de824qhuang the system is off and there is insufficient power to power on the system, the system is powered 352363bb1b56ee3f45587889b979d124aa1d03de824qhuang on when power is restored. 353363bb1b56ee3f45587889b979d124aa1d03de824qhuang 354363bb1b56ee3f45587889b979d124aa1d03de824qhuang @param Enable Enable or disable the wakeup alarm. 355363bb1b56ee3f45587889b979d124aa1d03de824qhuang @param Time If Enable is TRUE, the time to set the wakeup alarm for. Type EFI_TIME 356363bb1b56ee3f45587889b979d124aa1d03de824qhuang is defined in the GetTime() function description. If Enable is FALSE, 357363bb1b56ee3f45587889b979d124aa1d03de824qhuang then this parameter is optional, and may be NULL. 358363bb1b56ee3f45587889b979d124aa1d03de824qhuang 359363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_SUCCESS If Enable is TRUE, then the wakeup alarm was enabled. 360363bb1b56ee3f45587889b979d124aa1d03de824qhuang If Enable is FALSE, then the wakeup alarm was disabled. 361363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_INVALID_PARAMETER A time field is out of range. 362363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_DEVICE_ERROR The wakeup time could not be set due to a hardware error. 363363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_UNSUPPORTED A wakeup timer is not supported on this platform. 364363bb1b56ee3f45587889b979d124aa1d03de824qhuang 365363bb1b56ee3f45587889b979d124aa1d03de824qhuang**/ 366363bb1b56ee3f45587889b979d124aa1d03de824qhuangEFI_STATUS 367363bb1b56ee3f45587889b979d124aa1d03de824qhuangEFIAPI 368363bb1b56ee3f45587889b979d124aa1d03de824qhuangEfiSetWakeupTime ( 369363bb1b56ee3f45587889b979d124aa1d03de824qhuang IN BOOLEAN Enable, 370363bb1b56ee3f45587889b979d124aa1d03de824qhuang IN EFI_TIME *Time OPTIONAL 371363bb1b56ee3f45587889b979d124aa1d03de824qhuang ) 372363bb1b56ee3f45587889b979d124aa1d03de824qhuang{ 373363bb1b56ee3f45587889b979d124aa1d03de824qhuang return mInternalRT->SetWakeupTime (Enable, Time); 374363bb1b56ee3f45587889b979d124aa1d03de824qhuang} 375363bb1b56ee3f45587889b979d124aa1d03de824qhuang 376363bb1b56ee3f45587889b979d124aa1d03de824qhuang 377363bb1b56ee3f45587889b979d124aa1d03de824qhuang/** 378363bb1b56ee3f45587889b979d124aa1d03de824qhuang This service is a wrapper for the UEFI Runtime Service GetVariable(). 379363bb1b56ee3f45587889b979d124aa1d03de824qhuang 380363bb1b56ee3f45587889b979d124aa1d03de824qhuang Each vendor may create and manage its own variables without the risk of name conflicts by 381363bb1b56ee3f45587889b979d124aa1d03de824qhuang using a unique VendorGuid. When a variable is set its Attributes are supplied to indicate 382363bb1b56ee3f45587889b979d124aa1d03de824qhuang how the data variable should be stored and maintained by the system. The attributes affect 383363bb1b56ee3f45587889b979d124aa1d03de824qhuang when the variable may be accessed and volatility of the data. Any attempts to access a variable 384363bb1b56ee3f45587889b979d124aa1d03de824qhuang that does not have the attribute set for runtime access will yield the EFI_NOT_FOUND error. 385363bb1b56ee3f45587889b979d124aa1d03de824qhuang If the Data buffer is too small to hold the contents of the variable, the error EFI_BUFFER_TOO_SMALL 386363bb1b56ee3f45587889b979d124aa1d03de824qhuang is returned and DataSize is set to the required buffer size to obtain the data. 387363bb1b56ee3f45587889b979d124aa1d03de824qhuang 388363bb1b56ee3f45587889b979d124aa1d03de824qhuang @param VariableName the name of the vendor's variable, it's a Null-Terminated Unicode String 389363bb1b56ee3f45587889b979d124aa1d03de824qhuang @param VendorGuid Unify identifier for vendor. 390363bb1b56ee3f45587889b979d124aa1d03de824qhuang @param Attributes Point to memory location to return the attributes of variable. If the point 391363bb1b56ee3f45587889b979d124aa1d03de824qhuang is NULL, the parameter would be ignored. 392363bb1b56ee3f45587889b979d124aa1d03de824qhuang @param DataSize As input, point to the maximum size of return Data-Buffer. 393363bb1b56ee3f45587889b979d124aa1d03de824qhuang As output, point to the actual size of the returned Data-Buffer. 394363bb1b56ee3f45587889b979d124aa1d03de824qhuang @param Data Point to return Data-Buffer. 395363bb1b56ee3f45587889b979d124aa1d03de824qhuang 396363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_SUCCESS The function completed successfully. 397363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_NOT_FOUND The variable was not found. 398363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_BUFFER_TOO_SMALL The DataSize is too small for the result. DataSize has 399363bb1b56ee3f45587889b979d124aa1d03de824qhuang been updated with the size needed to complete the request. 400363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_INVALID_PARAMETER VariableName is NULL. 401363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_INVALID_PARAMETER VendorGuid is NULL. 402363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_INVALID_PARAMETER DataSize is NULL. 403363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_INVALID_PARAMETER The DataSize is not too small and Data is NULL. 404363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_DEVICE_ERROR The variable could not be retrieved due to a hardware error. 405363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_SECURITY_VIOLATION The variable could not be retrieved due to an authentication failure. 406363bb1b56ee3f45587889b979d124aa1d03de824qhuang**/ 407363bb1b56ee3f45587889b979d124aa1d03de824qhuangEFI_STATUS 408363bb1b56ee3f45587889b979d124aa1d03de824qhuangEFIAPI 409363bb1b56ee3f45587889b979d124aa1d03de824qhuangEfiGetVariable ( 410363bb1b56ee3f45587889b979d124aa1d03de824qhuang IN CHAR16 *VariableName, 411363bb1b56ee3f45587889b979d124aa1d03de824qhuang IN EFI_GUID *VendorGuid, 412363bb1b56ee3f45587889b979d124aa1d03de824qhuang OUT UINT32 *Attributes OPTIONAL, 413363bb1b56ee3f45587889b979d124aa1d03de824qhuang IN OUT UINTN *DataSize, 414363bb1b56ee3f45587889b979d124aa1d03de824qhuang OUT VOID *Data 415363bb1b56ee3f45587889b979d124aa1d03de824qhuang ) 416363bb1b56ee3f45587889b979d124aa1d03de824qhuang{ 417363bb1b56ee3f45587889b979d124aa1d03de824qhuang return mInternalRT->GetVariable (VariableName, VendorGuid, Attributes, DataSize, Data); 418363bb1b56ee3f45587889b979d124aa1d03de824qhuang} 419363bb1b56ee3f45587889b979d124aa1d03de824qhuang 420363bb1b56ee3f45587889b979d124aa1d03de824qhuang 421363bb1b56ee3f45587889b979d124aa1d03de824qhuang/** 422363bb1b56ee3f45587889b979d124aa1d03de824qhuang This service is a wrapper for the UEFI Runtime Service GetNextVariableName(). 423363bb1b56ee3f45587889b979d124aa1d03de824qhuang 424363bb1b56ee3f45587889b979d124aa1d03de824qhuang GetNextVariableName() is called multiple times to retrieve the VariableName and VendorGuid of 425363bb1b56ee3f45587889b979d124aa1d03de824qhuang all variables currently available in the system. On each call to GetNextVariableName() the 426363bb1b56ee3f45587889b979d124aa1d03de824qhuang previous results are passed into the interface, and on output the interface returns the next 427363bb1b56ee3f45587889b979d124aa1d03de824qhuang variable name data. When the entire variable list has been returned, the error EFI_NOT_FOUND 428363bb1b56ee3f45587889b979d124aa1d03de824qhuang is returned. 429363bb1b56ee3f45587889b979d124aa1d03de824qhuang 430363bb1b56ee3f45587889b979d124aa1d03de824qhuang @param VariableNameSize As input, point to maximum size of variable name. 431363bb1b56ee3f45587889b979d124aa1d03de824qhuang As output, point to actual size of variable name. 432363bb1b56ee3f45587889b979d124aa1d03de824qhuang @param VariableName As input, supplies the last VariableName that was returned by 433363bb1b56ee3f45587889b979d124aa1d03de824qhuang GetNextVariableName(). 434363bb1b56ee3f45587889b979d124aa1d03de824qhuang As output, returns the name of variable. The name 435363bb1b56ee3f45587889b979d124aa1d03de824qhuang string is Null-Terminated Unicode string. 436363bb1b56ee3f45587889b979d124aa1d03de824qhuang @param VendorGuid As input, supplies the last VendorGuid that was returned by 437363bb1b56ee3f45587889b979d124aa1d03de824qhuang GetNextVriableName(). 438363bb1b56ee3f45587889b979d124aa1d03de824qhuang As output, returns the VendorGuid of the current variable. 439363bb1b56ee3f45587889b979d124aa1d03de824qhuang 440363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_SUCCESS The function completed successfully. 441363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_NOT_FOUND The next variable was not found. 442363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_BUFFER_TOO_SMALL The VariableNameSize is too small for the result. 443363bb1b56ee3f45587889b979d124aa1d03de824qhuang VariableNameSize has been updated with the size needed 444363bb1b56ee3f45587889b979d124aa1d03de824qhuang to complete the request. 445363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_INVALID_PARAMETER VariableNameSize is NULL. 446363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_INVALID_PARAMETER VariableName is NULL. 447363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_INVALID_PARAMETER VendorGuid is NULL. 448363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_DEVICE_ERROR The variable name could not be retrieved due to a hardware error. 449363bb1b56ee3f45587889b979d124aa1d03de824qhuang 450363bb1b56ee3f45587889b979d124aa1d03de824qhuang**/ 451363bb1b56ee3f45587889b979d124aa1d03de824qhuangEFI_STATUS 452363bb1b56ee3f45587889b979d124aa1d03de824qhuangEFIAPI 453363bb1b56ee3f45587889b979d124aa1d03de824qhuangEfiGetNextVariableName ( 454363bb1b56ee3f45587889b979d124aa1d03de824qhuang IN OUT UINTN *VariableNameSize, 455363bb1b56ee3f45587889b979d124aa1d03de824qhuang IN OUT CHAR16 *VariableName, 456363bb1b56ee3f45587889b979d124aa1d03de824qhuang IN OUT EFI_GUID *VendorGuid 457363bb1b56ee3f45587889b979d124aa1d03de824qhuang ) 458363bb1b56ee3f45587889b979d124aa1d03de824qhuang{ 459363bb1b56ee3f45587889b979d124aa1d03de824qhuang return mInternalRT->GetNextVariableName (VariableNameSize, VariableName, VendorGuid); 460363bb1b56ee3f45587889b979d124aa1d03de824qhuang} 461363bb1b56ee3f45587889b979d124aa1d03de824qhuang 462363bb1b56ee3f45587889b979d124aa1d03de824qhuang 463363bb1b56ee3f45587889b979d124aa1d03de824qhuang/** 464363bb1b56ee3f45587889b979d124aa1d03de824qhuang This service is a wrapper for the UEFI Runtime Service GetNextVariableName() 465363bb1b56ee3f45587889b979d124aa1d03de824qhuang 466363bb1b56ee3f45587889b979d124aa1d03de824qhuang Variables are stored by the firmware and may maintain their values across power cycles. Each vendor 467363bb1b56ee3f45587889b979d124aa1d03de824qhuang may create and manage its own variables without the risk of name conflicts by using a unique VendorGuid. 468363bb1b56ee3f45587889b979d124aa1d03de824qhuang 46958380e9c6174f23df78f777b4209c0fd75245cdamyronporter @param VariableName The name of the vendor's variable; it's a Null-Terminated 47058380e9c6174f23df78f777b4209c0fd75245cdamyronporter Unicode String 471363bb1b56ee3f45587889b979d124aa1d03de824qhuang @param VendorGuid Unify identifier for vendor. 47258380e9c6174f23df78f777b4209c0fd75245cdamyronporter @param Attributes Points to a memory location to return the attributes of variable. If the point 473363bb1b56ee3f45587889b979d124aa1d03de824qhuang is NULL, the parameter would be ignored. 474363bb1b56ee3f45587889b979d124aa1d03de824qhuang @param DataSize The size in bytes of Data-Buffer. 47558380e9c6174f23df78f777b4209c0fd75245cdamyronporter @param Data Points to the content of the variable. 476363bb1b56ee3f45587889b979d124aa1d03de824qhuang 477363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_SUCCESS The firmware has successfully stored the variable and its data as 478363bb1b56ee3f45587889b979d124aa1d03de824qhuang defined by the Attributes. 479363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_INVALID_PARAMETER An invalid combination of attribute bits was supplied, or the 480363bb1b56ee3f45587889b979d124aa1d03de824qhuang DataSize exceeds the maximum allowed. 481363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_INVALID_PARAMETER VariableName is an empty Unicode string. 482363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data. 483363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_DEVICE_ERROR The variable could not be saved due to a hardware failure. 484363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_WRITE_PROTECTED The variable in question is read-only. 485363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_WRITE_PROTECTED The variable in question cannot be deleted. 486363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_SECURITY_VIOLATION The variable could not be written due to EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS 487363bb1b56ee3f45587889b979d124aa1d03de824qhuang set but the AuthInfo does NOT pass the validation check carried 488363bb1b56ee3f45587889b979d124aa1d03de824qhuang out by the firmware. 489363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_NOT_FOUND The variable trying to be updated or deleted was not found. 490363bb1b56ee3f45587889b979d124aa1d03de824qhuang 491363bb1b56ee3f45587889b979d124aa1d03de824qhuang**/ 492363bb1b56ee3f45587889b979d124aa1d03de824qhuangEFI_STATUS 493363bb1b56ee3f45587889b979d124aa1d03de824qhuangEFIAPI 494363bb1b56ee3f45587889b979d124aa1d03de824qhuangEfiSetVariable ( 495363bb1b56ee3f45587889b979d124aa1d03de824qhuang IN CHAR16 *VariableName, 496363bb1b56ee3f45587889b979d124aa1d03de824qhuang IN EFI_GUID *VendorGuid, 497363bb1b56ee3f45587889b979d124aa1d03de824qhuang IN UINT32 Attributes, 498363bb1b56ee3f45587889b979d124aa1d03de824qhuang IN UINTN DataSize, 499363bb1b56ee3f45587889b979d124aa1d03de824qhuang IN VOID *Data 500363bb1b56ee3f45587889b979d124aa1d03de824qhuang ) 501363bb1b56ee3f45587889b979d124aa1d03de824qhuang{ 502363bb1b56ee3f45587889b979d124aa1d03de824qhuang return mInternalRT->SetVariable (VariableName, VendorGuid, Attributes, DataSize, Data); 503363bb1b56ee3f45587889b979d124aa1d03de824qhuang} 504363bb1b56ee3f45587889b979d124aa1d03de824qhuang 505363bb1b56ee3f45587889b979d124aa1d03de824qhuang 506363bb1b56ee3f45587889b979d124aa1d03de824qhuang/** 507363bb1b56ee3f45587889b979d124aa1d03de824qhuang This service is a wrapper for the UEFI Runtime Service GetNextHighMonotonicCount(). 508363bb1b56ee3f45587889b979d124aa1d03de824qhuang 509363bb1b56ee3f45587889b979d124aa1d03de824qhuang The platform's monotonic counter is comprised of two 32-bit quantities: the high 32 bits and 510363bb1b56ee3f45587889b979d124aa1d03de824qhuang the low 32 bits. During boot service time the low 32-bit value is volatile: it is reset to zero 511363bb1b56ee3f45587889b979d124aa1d03de824qhuang on every system reset and is increased by 1 on every call to GetNextMonotonicCount(). The high 512363bb1b56ee3f45587889b979d124aa1d03de824qhuang 32-bit value is nonvolatile and is increased by 1 whenever the system resets or whenever the low 513363bb1b56ee3f45587889b979d124aa1d03de824qhuang 32-bit count (returned by GetNextMonoticCount()) overflows. 514363bb1b56ee3f45587889b979d124aa1d03de824qhuang 5152fc59a003ed9104f9feebe0e418f2a04a50f3284myronporter @param HighCount The pointer to returned value. 516363bb1b56ee3f45587889b979d124aa1d03de824qhuang 517363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_SUCCESS The next high monotonic count was returned. 518363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_DEVICE_ERROR The device is not functioning properly. 519363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_INVALID_PARAMETER HighCount is NULL. 520363bb1b56ee3f45587889b979d124aa1d03de824qhuang 521363bb1b56ee3f45587889b979d124aa1d03de824qhuang**/ 522363bb1b56ee3f45587889b979d124aa1d03de824qhuangEFI_STATUS 523363bb1b56ee3f45587889b979d124aa1d03de824qhuangEFIAPI 524363bb1b56ee3f45587889b979d124aa1d03de824qhuangEfiGetNextHighMonotonicCount ( 525363bb1b56ee3f45587889b979d124aa1d03de824qhuang OUT UINT32 *HighCount 526363bb1b56ee3f45587889b979d124aa1d03de824qhuang ) 527363bb1b56ee3f45587889b979d124aa1d03de824qhuang{ 528363bb1b56ee3f45587889b979d124aa1d03de824qhuang return mInternalRT->GetNextHighMonotonicCount (HighCount); 529363bb1b56ee3f45587889b979d124aa1d03de824qhuang} 530363bb1b56ee3f45587889b979d124aa1d03de824qhuang 531363bb1b56ee3f45587889b979d124aa1d03de824qhuang 532363bb1b56ee3f45587889b979d124aa1d03de824qhuang/** 533363bb1b56ee3f45587889b979d124aa1d03de824qhuang This service is a wrapper for the UEFI Runtime Service ConvertPointer(). 534363bb1b56ee3f45587889b979d124aa1d03de824qhuang 535363bb1b56ee3f45587889b979d124aa1d03de824qhuang The ConvertPointer() function is used by an EFI component during the SetVirtualAddressMap() operation. 536363bb1b56ee3f45587889b979d124aa1d03de824qhuang ConvertPointer()must be called using physical address pointers during the execution of SetVirtualAddressMap(). 537363bb1b56ee3f45587889b979d124aa1d03de824qhuang 538363bb1b56ee3f45587889b979d124aa1d03de824qhuang @param DebugDisposition Supplies type information for the pointer being converted. 539363bb1b56ee3f45587889b979d124aa1d03de824qhuang @param Address The pointer to a pointer that is to be fixed to be the 540363bb1b56ee3f45587889b979d124aa1d03de824qhuang value needed for the new virtual address mapping being 541363bb1b56ee3f45587889b979d124aa1d03de824qhuang applied. 542363bb1b56ee3f45587889b979d124aa1d03de824qhuang 543363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_SUCCESS The pointer pointed to by Address was modified. 544363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_NOT_FOUND The pointer pointed to by Address was not found to be part of 545363bb1b56ee3f45587889b979d124aa1d03de824qhuang the current memory map. This is normally fatal. 546363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_INVALID_PARAMETER Address is NULL. 547363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_INVALID_PARAMETER *Address is NULL and DebugDispositio 548363bb1b56ee3f45587889b979d124aa1d03de824qhuang 549363bb1b56ee3f45587889b979d124aa1d03de824qhuang**/ 550363bb1b56ee3f45587889b979d124aa1d03de824qhuangEFI_STATUS 551363bb1b56ee3f45587889b979d124aa1d03de824qhuangEFIAPI 552363bb1b56ee3f45587889b979d124aa1d03de824qhuangEfiConvertPointer ( 553363bb1b56ee3f45587889b979d124aa1d03de824qhuang IN UINTN DebugDisposition, 554363bb1b56ee3f45587889b979d124aa1d03de824qhuang IN OUT VOID **Address 555363bb1b56ee3f45587889b979d124aa1d03de824qhuang ) 556363bb1b56ee3f45587889b979d124aa1d03de824qhuang{ 557363bb1b56ee3f45587889b979d124aa1d03de824qhuang return gRT->ConvertPointer (DebugDisposition, Address); 558363bb1b56ee3f45587889b979d124aa1d03de824qhuang} 559363bb1b56ee3f45587889b979d124aa1d03de824qhuang 560363bb1b56ee3f45587889b979d124aa1d03de824qhuang 561363bb1b56ee3f45587889b979d124aa1d03de824qhuang/** 562363bb1b56ee3f45587889b979d124aa1d03de824qhuang Determines the new virtual address that is to be used on subsequent memory accesses. 563363bb1b56ee3f45587889b979d124aa1d03de824qhuang 564363bb1b56ee3f45587889b979d124aa1d03de824qhuang For IA32, x64, and EBC, this service is a wrapper for the UEFI Runtime Service 565363bb1b56ee3f45587889b979d124aa1d03de824qhuang ConvertPointer(). See the UEFI Specification for details. 566363bb1b56ee3f45587889b979d124aa1d03de824qhuang For IPF, this function interprets Address as a pointer to an EFI_PLABEL structure 567363bb1b56ee3f45587889b979d124aa1d03de824qhuang and both the EntryPoint and GP fields of an EFI_PLABEL are converted from physical 568363bb1b56ee3f45587889b979d124aa1d03de824qhuang to virtiual addressing. Since IPF allows the GP to point to an address outside 569363bb1b56ee3f45587889b979d124aa1d03de824qhuang a PE/COFF image, the physical to virtual offset for the EntryPoint field is used 570363bb1b56ee3f45587889b979d124aa1d03de824qhuang to adjust the GP field. The UEFI Runtime Service ConvertPointer() is used to convert 571363bb1b56ee3f45587889b979d124aa1d03de824qhuang EntryPoint and the status code for this conversion is always returned. If the convertion 572363bb1b56ee3f45587889b979d124aa1d03de824qhuang of EntryPoint fails, then neither EntryPoint nor GP are modified. See the UEFI 573363bb1b56ee3f45587889b979d124aa1d03de824qhuang Specification for details on the UEFI Runtime Service ConvertPointer(). 574363bb1b56ee3f45587889b979d124aa1d03de824qhuang 575363bb1b56ee3f45587889b979d124aa1d03de824qhuang @param DebugDisposition Supplies type information for the pointer being converted. 576363bb1b56ee3f45587889b979d124aa1d03de824qhuang @param Address The pointer to a pointer that is to be fixed to be the 577363bb1b56ee3f45587889b979d124aa1d03de824qhuang value needed for the new virtual address mapping being 578363bb1b56ee3f45587889b979d124aa1d03de824qhuang applied. 579363bb1b56ee3f45587889b979d124aa1d03de824qhuang 580363bb1b56ee3f45587889b979d124aa1d03de824qhuang @return EFI_STATUS value from EfiConvertPointer(). 581363bb1b56ee3f45587889b979d124aa1d03de824qhuang 582363bb1b56ee3f45587889b979d124aa1d03de824qhuang**/ 583363bb1b56ee3f45587889b979d124aa1d03de824qhuangEFI_STATUS 584363bb1b56ee3f45587889b979d124aa1d03de824qhuangEFIAPI 585363bb1b56ee3f45587889b979d124aa1d03de824qhuangEfiConvertFunctionPointer ( 586363bb1b56ee3f45587889b979d124aa1d03de824qhuang IN UINTN DebugDisposition, 587363bb1b56ee3f45587889b979d124aa1d03de824qhuang IN OUT VOID **Address 588363bb1b56ee3f45587889b979d124aa1d03de824qhuang ) 589363bb1b56ee3f45587889b979d124aa1d03de824qhuang{ 590363bb1b56ee3f45587889b979d124aa1d03de824qhuang return EfiConvertPointer (DebugDisposition, Address); 591363bb1b56ee3f45587889b979d124aa1d03de824qhuang} 592363bb1b56ee3f45587889b979d124aa1d03de824qhuang 593363bb1b56ee3f45587889b979d124aa1d03de824qhuang 594363bb1b56ee3f45587889b979d124aa1d03de824qhuang/** 595363bb1b56ee3f45587889b979d124aa1d03de824qhuang Convert the standard Lib double linked list to a virtual mapping. 596363bb1b56ee3f45587889b979d124aa1d03de824qhuang 597363bb1b56ee3f45587889b979d124aa1d03de824qhuang This service uses EfiConvertPointer() to walk a double linked list and convert all the link 598363bb1b56ee3f45587889b979d124aa1d03de824qhuang pointers to their virtual mappings. This function is only guaranteed to work during the 599363bb1b56ee3f45587889b979d124aa1d03de824qhuang EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event and calling it at other times has undefined results. 600363bb1b56ee3f45587889b979d124aa1d03de824qhuang 601363bb1b56ee3f45587889b979d124aa1d03de824qhuang @param DebugDisposition Supplies type information for the pointer being converted. 602363bb1b56ee3f45587889b979d124aa1d03de824qhuang @param ListHead Head of linked list to convert. 603363bb1b56ee3f45587889b979d124aa1d03de824qhuang 604363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_SUCCESS Success to execute the function. 605363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval !EFI_SUCCESS Failed to e3xecute the function. 606363bb1b56ee3f45587889b979d124aa1d03de824qhuang 607363bb1b56ee3f45587889b979d124aa1d03de824qhuang**/ 608363bb1b56ee3f45587889b979d124aa1d03de824qhuangEFI_STATUS 609363bb1b56ee3f45587889b979d124aa1d03de824qhuangEFIAPI 610363bb1b56ee3f45587889b979d124aa1d03de824qhuangEfiConvertList ( 611363bb1b56ee3f45587889b979d124aa1d03de824qhuang IN UINTN DebugDisposition, 612363bb1b56ee3f45587889b979d124aa1d03de824qhuang IN OUT LIST_ENTRY *ListHead 613363bb1b56ee3f45587889b979d124aa1d03de824qhuang ) 614363bb1b56ee3f45587889b979d124aa1d03de824qhuang{ 615363bb1b56ee3f45587889b979d124aa1d03de824qhuang LIST_ENTRY *Link; 616363bb1b56ee3f45587889b979d124aa1d03de824qhuang LIST_ENTRY *NextLink; 617363bb1b56ee3f45587889b979d124aa1d03de824qhuang 618363bb1b56ee3f45587889b979d124aa1d03de824qhuang // 619363bb1b56ee3f45587889b979d124aa1d03de824qhuang // For NULL List, return EFI_SUCCESS 620363bb1b56ee3f45587889b979d124aa1d03de824qhuang // 621363bb1b56ee3f45587889b979d124aa1d03de824qhuang if (ListHead == NULL) { 622363bb1b56ee3f45587889b979d124aa1d03de824qhuang return EFI_SUCCESS; 623363bb1b56ee3f45587889b979d124aa1d03de824qhuang } 624363bb1b56ee3f45587889b979d124aa1d03de824qhuang 625363bb1b56ee3f45587889b979d124aa1d03de824qhuang // 626363bb1b56ee3f45587889b979d124aa1d03de824qhuang // Convert all the ForwardLink & BackLink pointers in the list 627363bb1b56ee3f45587889b979d124aa1d03de824qhuang // 628363bb1b56ee3f45587889b979d124aa1d03de824qhuang Link = ListHead; 629363bb1b56ee3f45587889b979d124aa1d03de824qhuang do { 630363bb1b56ee3f45587889b979d124aa1d03de824qhuang NextLink = Link->ForwardLink; 631363bb1b56ee3f45587889b979d124aa1d03de824qhuang 632363bb1b56ee3f45587889b979d124aa1d03de824qhuang EfiConvertPointer ( 633363bb1b56ee3f45587889b979d124aa1d03de824qhuang Link->ForwardLink == ListHead ? DebugDisposition : 0, 634363bb1b56ee3f45587889b979d124aa1d03de824qhuang (VOID **) &Link->ForwardLink 635363bb1b56ee3f45587889b979d124aa1d03de824qhuang ); 636363bb1b56ee3f45587889b979d124aa1d03de824qhuang 637363bb1b56ee3f45587889b979d124aa1d03de824qhuang EfiConvertPointer ( 638363bb1b56ee3f45587889b979d124aa1d03de824qhuang Link->BackLink == ListHead ? DebugDisposition : 0, 639363bb1b56ee3f45587889b979d124aa1d03de824qhuang (VOID **) &Link->BackLink 640363bb1b56ee3f45587889b979d124aa1d03de824qhuang ); 641363bb1b56ee3f45587889b979d124aa1d03de824qhuang 642363bb1b56ee3f45587889b979d124aa1d03de824qhuang Link = NextLink; 643363bb1b56ee3f45587889b979d124aa1d03de824qhuang } while (Link != ListHead); 644363bb1b56ee3f45587889b979d124aa1d03de824qhuang return EFI_SUCCESS; 645363bb1b56ee3f45587889b979d124aa1d03de824qhuang} 646363bb1b56ee3f45587889b979d124aa1d03de824qhuang 647363bb1b56ee3f45587889b979d124aa1d03de824qhuang 648363bb1b56ee3f45587889b979d124aa1d03de824qhuang/** 649363bb1b56ee3f45587889b979d124aa1d03de824qhuang This service is a wrapper for the UEFI Runtime Service SetVirtualAddressMap(). 650363bb1b56ee3f45587889b979d124aa1d03de824qhuang 651363bb1b56ee3f45587889b979d124aa1d03de824qhuang The SetVirtualAddressMap() function is used by the OS loader. The function can only be called 652363bb1b56ee3f45587889b979d124aa1d03de824qhuang at runtime, and is called by the owner of the system's memory map. I.e., the component which 653363bb1b56ee3f45587889b979d124aa1d03de824qhuang called ExitBootServices(). All events of type EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE must be signaled 654363bb1b56ee3f45587889b979d124aa1d03de824qhuang before SetVirtualAddressMap() returns. 655363bb1b56ee3f45587889b979d124aa1d03de824qhuang 656363bb1b56ee3f45587889b979d124aa1d03de824qhuang @param MemoryMapSize The size in bytes of VirtualMap. 657363bb1b56ee3f45587889b979d124aa1d03de824qhuang @param DescriptorSize The size in bytes of an entry in the VirtualMap. 658363bb1b56ee3f45587889b979d124aa1d03de824qhuang @param DescriptorVersion The version of the structure entries in VirtualMap. 659363bb1b56ee3f45587889b979d124aa1d03de824qhuang @param VirtualMap An array of memory descriptors which contain new virtual 660363bb1b56ee3f45587889b979d124aa1d03de824qhuang address mapping information for all runtime ranges. Type 661363bb1b56ee3f45587889b979d124aa1d03de824qhuang EFI_MEMORY_DESCRIPTOR is defined in the 662363bb1b56ee3f45587889b979d124aa1d03de824qhuang GetMemoryMap() function description. 663363bb1b56ee3f45587889b979d124aa1d03de824qhuang 664363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_SUCCESS The virtual address map has been applied. 665363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_UNSUPPORTED EFI firmware is not at runtime, or the EFI firmware is already in 666363bb1b56ee3f45587889b979d124aa1d03de824qhuang virtual address mapped mode. 667363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_INVALID_PARAMETER DescriptorSize or DescriptorVersion is 668363bb1b56ee3f45587889b979d124aa1d03de824qhuang invalid. 669363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_NO_MAPPING A virtual address was not supplied for a range in the memory 670363bb1b56ee3f45587889b979d124aa1d03de824qhuang map that requires a mapping. 671363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_NOT_FOUND A virtual address was supplied for an address that is not found 672363bb1b56ee3f45587889b979d124aa1d03de824qhuang in the memory map. 673363bb1b56ee3f45587889b979d124aa1d03de824qhuang**/ 674363bb1b56ee3f45587889b979d124aa1d03de824qhuangEFI_STATUS 675363bb1b56ee3f45587889b979d124aa1d03de824qhuangEFIAPI 676363bb1b56ee3f45587889b979d124aa1d03de824qhuangEfiSetVirtualAddressMap ( 677363bb1b56ee3f45587889b979d124aa1d03de824qhuang IN UINTN MemoryMapSize, 678363bb1b56ee3f45587889b979d124aa1d03de824qhuang IN UINTN DescriptorSize, 679363bb1b56ee3f45587889b979d124aa1d03de824qhuang IN UINT32 DescriptorVersion, 680363bb1b56ee3f45587889b979d124aa1d03de824qhuang IN CONST EFI_MEMORY_DESCRIPTOR *VirtualMap 681363bb1b56ee3f45587889b979d124aa1d03de824qhuang ) 682363bb1b56ee3f45587889b979d124aa1d03de824qhuang{ 683363bb1b56ee3f45587889b979d124aa1d03de824qhuang return mInternalRT->SetVirtualAddressMap ( 684363bb1b56ee3f45587889b979d124aa1d03de824qhuang MemoryMapSize, 685363bb1b56ee3f45587889b979d124aa1d03de824qhuang DescriptorSize, 686363bb1b56ee3f45587889b979d124aa1d03de824qhuang DescriptorVersion, 687363bb1b56ee3f45587889b979d124aa1d03de824qhuang (EFI_MEMORY_DESCRIPTOR *) VirtualMap 688363bb1b56ee3f45587889b979d124aa1d03de824qhuang ); 689363bb1b56ee3f45587889b979d124aa1d03de824qhuang} 690363bb1b56ee3f45587889b979d124aa1d03de824qhuang 691363bb1b56ee3f45587889b979d124aa1d03de824qhuang 692363bb1b56ee3f45587889b979d124aa1d03de824qhuang/** 693363bb1b56ee3f45587889b979d124aa1d03de824qhuang This service is a wrapper for the UEFI Runtime Service UpdateCapsule(). 694363bb1b56ee3f45587889b979d124aa1d03de824qhuang 695363bb1b56ee3f45587889b979d124aa1d03de824qhuang Passes capsules to the firmware with both virtual and physical mapping. Depending on the intended 696363bb1b56ee3f45587889b979d124aa1d03de824qhuang consumption, the firmware may process the capsule immediately. If the payload should persist across a 697363bb1b56ee3f45587889b979d124aa1d03de824qhuang system reset, the reset value returned from EFI_QueryCapsuleCapabilities must be passed into ResetSystem() 698363bb1b56ee3f45587889b979d124aa1d03de824qhuang and will cause the capsule to be processed by the firmware as part of the reset process. 699363bb1b56ee3f45587889b979d124aa1d03de824qhuang 700363bb1b56ee3f45587889b979d124aa1d03de824qhuang @param CapsuleHeaderArray Virtual pointer to an array of virtual pointers to the capsules 701363bb1b56ee3f45587889b979d124aa1d03de824qhuang being passed into update capsule. Each capsules is assumed to 702363bb1b56ee3f45587889b979d124aa1d03de824qhuang stored in contiguous virtual memory. The capsules in the 703363bb1b56ee3f45587889b979d124aa1d03de824qhuang CapsuleHeaderArray must be the same capsules as the 704363bb1b56ee3f45587889b979d124aa1d03de824qhuang ScatterGatherList. The CapsuleHeaderArray must 705363bb1b56ee3f45587889b979d124aa1d03de824qhuang have the capsules in the same order as the ScatterGatherList. 7062fc59a003ed9104f9feebe0e418f2a04a50f3284myronporter @param CapsuleCount The number of pointers to EFI_CAPSULE_HEADER in 707363bb1b56ee3f45587889b979d124aa1d03de824qhuang CaspuleHeaderArray. 708363bb1b56ee3f45587889b979d124aa1d03de824qhuang @param ScatterGatherList Physical pointer to a set of 709363bb1b56ee3f45587889b979d124aa1d03de824qhuang EFI_CAPSULE_BLOCK_DESCRIPTOR that describes the 710363bb1b56ee3f45587889b979d124aa1d03de824qhuang location in physical memory of a set of capsules. See Related 711363bb1b56ee3f45587889b979d124aa1d03de824qhuang Definitions for an explanation of how more than one capsule is 712363bb1b56ee3f45587889b979d124aa1d03de824qhuang passed via this interface. The capsules in the 713363bb1b56ee3f45587889b979d124aa1d03de824qhuang ScatterGatherList must be in the same order as the 714363bb1b56ee3f45587889b979d124aa1d03de824qhuang CapsuleHeaderArray. This parameter is only referenced if 715363bb1b56ee3f45587889b979d124aa1d03de824qhuang the capsules are defined to persist across system reset. 716363bb1b56ee3f45587889b979d124aa1d03de824qhuang 717363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_SUCCESS Valid capsule was passed. If CAPSULE_FLAGS_PERSIT_ACROSS_RESET is not set, 718363bb1b56ee3f45587889b979d124aa1d03de824qhuang the capsule has been successfully processed by the firmware. 719363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_INVALID_PARAMETER CapsuleSize or HeaderSize is NULL. 720363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_INVALID_PARAMETER CapsuleCount is 0 721363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_DEVICE_ERROR The capsule update was started, but failed due to a device error. 722363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_UNSUPPORTED The capsule type is not supported on this platform. 723363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_OUT_OF_RESOURCES There were insufficient resources to process the capsule. 724363bb1b56ee3f45587889b979d124aa1d03de824qhuang 725363bb1b56ee3f45587889b979d124aa1d03de824qhuang**/ 726363bb1b56ee3f45587889b979d124aa1d03de824qhuangEFI_STATUS 727363bb1b56ee3f45587889b979d124aa1d03de824qhuangEFIAPI 728363bb1b56ee3f45587889b979d124aa1d03de824qhuangEfiUpdateCapsule ( 729363bb1b56ee3f45587889b979d124aa1d03de824qhuang IN EFI_CAPSULE_HEADER **CapsuleHeaderArray, 730363bb1b56ee3f45587889b979d124aa1d03de824qhuang IN UINTN CapsuleCount, 731363bb1b56ee3f45587889b979d124aa1d03de824qhuang IN EFI_PHYSICAL_ADDRESS ScatterGatherList OPTIONAL 732363bb1b56ee3f45587889b979d124aa1d03de824qhuang ) 733363bb1b56ee3f45587889b979d124aa1d03de824qhuang{ 734363bb1b56ee3f45587889b979d124aa1d03de824qhuang return mInternalRT->UpdateCapsule ( 735363bb1b56ee3f45587889b979d124aa1d03de824qhuang CapsuleHeaderArray, 736363bb1b56ee3f45587889b979d124aa1d03de824qhuang CapsuleCount, 737363bb1b56ee3f45587889b979d124aa1d03de824qhuang ScatterGatherList 738363bb1b56ee3f45587889b979d124aa1d03de824qhuang ); 739363bb1b56ee3f45587889b979d124aa1d03de824qhuang} 740363bb1b56ee3f45587889b979d124aa1d03de824qhuang 741363bb1b56ee3f45587889b979d124aa1d03de824qhuang 742363bb1b56ee3f45587889b979d124aa1d03de824qhuang/** 743363bb1b56ee3f45587889b979d124aa1d03de824qhuang This service is a wrapper for the UEFI Runtime Service QueryCapsuleCapabilities(). 744363bb1b56ee3f45587889b979d124aa1d03de824qhuang 745363bb1b56ee3f45587889b979d124aa1d03de824qhuang The QueryCapsuleCapabilities() function allows a caller to test to see if a capsule or 746363bb1b56ee3f45587889b979d124aa1d03de824qhuang capsules can be updated via UpdateCapsule(). The Flags values in the capsule header and 747363bb1b56ee3f45587889b979d124aa1d03de824qhuang size of the entire capsule is checked. 748363bb1b56ee3f45587889b979d124aa1d03de824qhuang If the caller needs to query for generic capsule capability a fake EFI_CAPSULE_HEADER can be 749363bb1b56ee3f45587889b979d124aa1d03de824qhuang constructed where CapsuleImageSize is equal to HeaderSize that is equal to sizeof 750363bb1b56ee3f45587889b979d124aa1d03de824qhuang (EFI_CAPSULE_HEADER). To determine reset requirements, 751363bb1b56ee3f45587889b979d124aa1d03de824qhuang CAPSULE_FLAGS_PERSIST_ACROSS_RESET should be set in the Flags field of the 752363bb1b56ee3f45587889b979d124aa1d03de824qhuang EFI_CAPSULE_HEADER. 753363bb1b56ee3f45587889b979d124aa1d03de824qhuang The firmware must support any capsule that has the 754363bb1b56ee3f45587889b979d124aa1d03de824qhuang CAPSULE_FLAGS_PERSIST_ACROSS_RESET flag set in EFI_CAPSULE_HEADER. The 755363bb1b56ee3f45587889b979d124aa1d03de824qhuang firmware sets the policy for what capsules are supported that do not have the 756363bb1b56ee3f45587889b979d124aa1d03de824qhuang CAPSULE_FLAGS_PERSIST_ACROSS_RESET flag set. 757363bb1b56ee3f45587889b979d124aa1d03de824qhuang 758363bb1b56ee3f45587889b979d124aa1d03de824qhuang @param CapsuleHeaderArray Virtual pointer to an array of virtual pointers to the capsules 759363bb1b56ee3f45587889b979d124aa1d03de824qhuang being passed into update capsule. The capsules are assumed to 760363bb1b56ee3f45587889b979d124aa1d03de824qhuang stored in contiguous virtual memory. 7612fc59a003ed9104f9feebe0e418f2a04a50f3284myronporter @param CapsuleCount The number of pointers to EFI_CAPSULE_HEADER in 762363bb1b56ee3f45587889b979d124aa1d03de824qhuang CaspuleHeaderArray. 763363bb1b56ee3f45587889b979d124aa1d03de824qhuang @param MaximumCapsuleSize On output the maximum size that UpdateCapsule() can 764363bb1b56ee3f45587889b979d124aa1d03de824qhuang support as an argument to UpdateCapsule() via 765363bb1b56ee3f45587889b979d124aa1d03de824qhuang CapsuleHeaderArray and ScatterGatherList. 766363bb1b56ee3f45587889b979d124aa1d03de824qhuang Undefined on input. 767363bb1b56ee3f45587889b979d124aa1d03de824qhuang @param ResetType Returns the type of reset required for the capsule update. 768363bb1b56ee3f45587889b979d124aa1d03de824qhuang 76958380e9c6174f23df78f777b4209c0fd75245cdamyronporter @retval EFI_SUCCESS A valid answer was returned. 770363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_INVALID_PARAMETER MaximumCapsuleSize is NULL. 771363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_UNSUPPORTED The capsule type is not supported on this platform, and 772363bb1b56ee3f45587889b979d124aa1d03de824qhuang MaximumCapsuleSize and ResetType are undefined. 773363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_OUT_OF_RESOURCES There were insufficient resources to process the query request. 774363bb1b56ee3f45587889b979d124aa1d03de824qhuang 775363bb1b56ee3f45587889b979d124aa1d03de824qhuang**/ 776363bb1b56ee3f45587889b979d124aa1d03de824qhuangEFI_STATUS 777363bb1b56ee3f45587889b979d124aa1d03de824qhuangEFIAPI 778363bb1b56ee3f45587889b979d124aa1d03de824qhuangEfiQueryCapsuleCapabilities ( 779363bb1b56ee3f45587889b979d124aa1d03de824qhuang IN EFI_CAPSULE_HEADER **CapsuleHeaderArray, 780363bb1b56ee3f45587889b979d124aa1d03de824qhuang IN UINTN CapsuleCount, 781363bb1b56ee3f45587889b979d124aa1d03de824qhuang OUT UINT64 *MaximumCapsuleSize, 782363bb1b56ee3f45587889b979d124aa1d03de824qhuang OUT EFI_RESET_TYPE *ResetType 783363bb1b56ee3f45587889b979d124aa1d03de824qhuang ) 784363bb1b56ee3f45587889b979d124aa1d03de824qhuang{ 785363bb1b56ee3f45587889b979d124aa1d03de824qhuang return mInternalRT->QueryCapsuleCapabilities ( 786363bb1b56ee3f45587889b979d124aa1d03de824qhuang CapsuleHeaderArray, 787363bb1b56ee3f45587889b979d124aa1d03de824qhuang CapsuleCount, 788363bb1b56ee3f45587889b979d124aa1d03de824qhuang MaximumCapsuleSize, 789363bb1b56ee3f45587889b979d124aa1d03de824qhuang ResetType 790363bb1b56ee3f45587889b979d124aa1d03de824qhuang ); 791363bb1b56ee3f45587889b979d124aa1d03de824qhuang} 792363bb1b56ee3f45587889b979d124aa1d03de824qhuang 793363bb1b56ee3f45587889b979d124aa1d03de824qhuang 794363bb1b56ee3f45587889b979d124aa1d03de824qhuang/** 795363bb1b56ee3f45587889b979d124aa1d03de824qhuang This service is a wrapper for the UEFI Runtime Service QueryVariableInfo(). 796363bb1b56ee3f45587889b979d124aa1d03de824qhuang 797363bb1b56ee3f45587889b979d124aa1d03de824qhuang The QueryVariableInfo() function allows a caller to obtain the information about the 798363bb1b56ee3f45587889b979d124aa1d03de824qhuang maximum size of the storage space available for the EFI variables, the remaining size of the storage 799363bb1b56ee3f45587889b979d124aa1d03de824qhuang space available for the EFI variables and the maximum size of each individual EFI variable, 800363bb1b56ee3f45587889b979d124aa1d03de824qhuang associated with the attributes specified. 801363bb1b56ee3f45587889b979d124aa1d03de824qhuang The returned MaximumVariableStorageSize, RemainingVariableStorageSize, 802363bb1b56ee3f45587889b979d124aa1d03de824qhuang MaximumVariableSize information may change immediately after the call based on other 803363bb1b56ee3f45587889b979d124aa1d03de824qhuang runtime activities including asynchronous error events. Also, these values associated with different 804363bb1b56ee3f45587889b979d124aa1d03de824qhuang attributes are not additive in nature. 805363bb1b56ee3f45587889b979d124aa1d03de824qhuang 806363bb1b56ee3f45587889b979d124aa1d03de824qhuang @param Attributes Attributes bitmask to specify the type of variables on 807363bb1b56ee3f45587889b979d124aa1d03de824qhuang which to return information. Refer to the 808363bb1b56ee3f45587889b979d124aa1d03de824qhuang GetVariable() function description. 809363bb1b56ee3f45587889b979d124aa1d03de824qhuang @param MaximumVariableStorageSize 810363bb1b56ee3f45587889b979d124aa1d03de824qhuang On output the maximum size of the storage space 811363bb1b56ee3f45587889b979d124aa1d03de824qhuang available for the EFI variables associated with the 812363bb1b56ee3f45587889b979d124aa1d03de824qhuang attributes specified. 813363bb1b56ee3f45587889b979d124aa1d03de824qhuang @param RemainingVariableStorageSize 814363bb1b56ee3f45587889b979d124aa1d03de824qhuang Returns the remaining size of the storage space 815363bb1b56ee3f45587889b979d124aa1d03de824qhuang available for the EFI variables associated with the 816363bb1b56ee3f45587889b979d124aa1d03de824qhuang attributes specified.. 817363bb1b56ee3f45587889b979d124aa1d03de824qhuang @param MaximumVariableSize Returns the maximum size of the individual EFI 818363bb1b56ee3f45587889b979d124aa1d03de824qhuang variables associated with the attributes specified. 819363bb1b56ee3f45587889b979d124aa1d03de824qhuang 82058380e9c6174f23df78f777b4209c0fd75245cdamyronporter @retval EFI_SUCCESS A valid answer was returned. 821363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_INVALID_PARAMETER An invalid combination of attribute bits was supplied. 822363bb1b56ee3f45587889b979d124aa1d03de824qhuang @retval EFI_UNSUPPORTED EFI_UNSUPPORTED The attribute is not supported on this platform, and the 823363bb1b56ee3f45587889b979d124aa1d03de824qhuang MaximumVariableStorageSize, 824363bb1b56ee3f45587889b979d124aa1d03de824qhuang RemainingVariableStorageSize, MaximumVariableSize 825363bb1b56ee3f45587889b979d124aa1d03de824qhuang are undefined. 826363bb1b56ee3f45587889b979d124aa1d03de824qhuang 827363bb1b56ee3f45587889b979d124aa1d03de824qhuang**/ 828363bb1b56ee3f45587889b979d124aa1d03de824qhuangEFI_STATUS 829363bb1b56ee3f45587889b979d124aa1d03de824qhuangEFIAPI 830363bb1b56ee3f45587889b979d124aa1d03de824qhuangEfiQueryVariableInfo ( 831363bb1b56ee3f45587889b979d124aa1d03de824qhuang IN UINT32 Attributes, 832363bb1b56ee3f45587889b979d124aa1d03de824qhuang OUT UINT64 *MaximumVariableStorageSize, 833363bb1b56ee3f45587889b979d124aa1d03de824qhuang OUT UINT64 *RemainingVariableStorageSize, 834363bb1b56ee3f45587889b979d124aa1d03de824qhuang OUT UINT64 *MaximumVariableSize 835363bb1b56ee3f45587889b979d124aa1d03de824qhuang ) 836363bb1b56ee3f45587889b979d124aa1d03de824qhuang{ 837363bb1b56ee3f45587889b979d124aa1d03de824qhuang return mInternalRT->QueryVariableInfo ( 838363bb1b56ee3f45587889b979d124aa1d03de824qhuang Attributes, 839363bb1b56ee3f45587889b979d124aa1d03de824qhuang MaximumVariableStorageSize, 840363bb1b56ee3f45587889b979d124aa1d03de824qhuang RemainingVariableStorageSize, 841363bb1b56ee3f45587889b979d124aa1d03de824qhuang MaximumVariableSize 842363bb1b56ee3f45587889b979d124aa1d03de824qhuang ); 843363bb1b56ee3f45587889b979d124aa1d03de824qhuang} 844