<Keyword>BaseLib</Keyword>\r
</LibraryClass>\r
<LibraryClass Usage="ALWAYS_CONSUMED">\r
- <Keyword>DxeRuntimeDriverLib</Keyword>\r
+ <Keyword>UefiRuntimeLib</Keyword>\r
</LibraryClass>\r
<LibraryClass Usage="ALWAYS_CONSUMED">\r
<Keyword>DebugLib</Keyword>\r
<Filename>Library/EdkDxePeCoffLoaderFromHobLib/EdkDxePeCoffLoaderFromHobLib.msa</Filename>\r
<Filename>Library/DxePerformanceLib/DxePerformanceLib.msa</Filename>\r
<Filename>Library/EdkDxePrintLib/EdkDxePrintLib.msa</Filename>\r
- <Filename>Library/EdkDxeRuntimeDriverLib/EdkDxeRuntimeDriverLib.msa</Filename>\r
+ <Filename>Library/EdkUefiRuntimeLib/EdkUefiRuntimeLib.msa</Filename>\r
<Filename>Library/EdkDxeSalLib/EdkDxeSalLib.msa</Filename>\r
<Filename>Library/EdkFvbServiceLib/EdkFvbServiceLib.msa</Filename>\r
<Filename>Library/EdkGraphicsLib/EdkGraphicsLib.msa</Filename>\r
+++ /dev/null
-/*++\r
-\r
-Copyright (c) 2006, Intel Corporation \r
-All rights reserved. This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php \r
- \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
-\r
-Module Name:\r
-\r
- RuntimeLib.c\r
-\r
-Abstract:\r
-\r
- Light weight lib to support Tiano drivers.\r
-\r
---*/\r
-\r
-#include <RuntimeLibInternal.h>\r
-\r
-//\r
-// Driver Lib Module Globals\r
-//\r
-STATIC EFI_EVENT mRuntimeNotifyEvent;\r
-STATIC EFI_EVENT mEfiVirtualNotifyEvent;\r
-STATIC BOOLEAN mEfiGoneVirtual = FALSE;\r
-STATIC BOOLEAN mEfiAtRuntime = FALSE;\r
-\r
-EFI_RUNTIME_SERVICES *mRT = NULL;\r
-\r
-VOID\r
-EFIAPI\r
-RuntimeDriverExitBootServices (\r
- IN EFI_EVENT Event,\r
- IN VOID *Context\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Set AtRuntime flag as TRUE after ExitBootServices\r
-\r
-Arguments:\r
-\r
- Event - The Event that is being processed\r
- \r
- Context - Event Context\r
-\r
-Returns: \r
-\r
- None\r
-\r
---*/\r
-{\r
- EFI_EVENT_NOTIFY ChildNotifyEventHandler;\r
- UINTN Index;\r
-\r
- for (Index = 0; \r
- _gDriverExitBootServicesEvent[Index] != NULL;\r
- Index++) {\r
- ChildNotifyEventHandler = _gDriverExitBootServicesEvent[Index];\r
- ChildNotifyEventHandler (Event, NULL);\r
- }\r
-\r
- mEfiAtRuntime = TRUE;\r
-}\r
-\r
-STATIC\r
-VOID\r
-EFIAPI\r
-RuntimeLibVirtualNotifyEvent (\r
- IN EFI_EVENT Event,\r
- IN VOID *Context\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Fixup internal data so that EFI can be call in virtual mode.\r
- Call the passed in Child Notify event and convert any pointers in \r
- lib to virtual mode.\r
-\r
-Arguments:\r
-\r
- Event - The Event that is being processed\r
- \r
- Context - Event Context\r
-\r
-Returns: \r
-\r
- None\r
-\r
---*/\r
-{\r
- UINTN Index;\r
- EFI_EVENT_NOTIFY ChildNotifyEventHandler;\r
-\r
- for (Index = 0; \r
- _gDriverSetVirtualAddressMapEvent[Index] != NULL;\r
- Index++) {\r
- ChildNotifyEventHandler = _gDriverSetVirtualAddressMapEvent[Index];\r
- ChildNotifyEventHandler (Event, NULL);\r
- }\r
-\r
- //\r
- // Update global for Runtime Services Table and IO\r
- //\r
- EfiConvertInternalPointer ((VOID **) &mRT);\r
-\r
- //\r
- // Clear out BootService globals\r
- //\r
- gBS = NULL;\r
- gST = NULL;\r
- mEfiGoneVirtual = TRUE;\r
-}\r
-\r
-EFI_STATUS\r
-RuntimeDriverLibConstruct (\r
- IN EFI_HANDLE ImageHandle,\r
- IN EFI_SYSTEM_TABLE *SystemTable\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Intialize runtime Driver Lib if it has not yet been initialized. \r
-\r
-Arguments:\r
-\r
- ImageHandle - The firmware allocated handle for the EFI image.\r
- \r
- SystemTable - A pointer to the EFI System Table.\r
-\r
- GoVirtualChildEvent - Caller can register a virtual notification event.\r
-\r
-Returns: \r
-\r
- EFI_STATUS always returns EFI_SUCCESS except EFI_ALREADY_STARTED if already started.\r
-\r
---*/\r
-{\r
- EFI_STATUS Status;\r
-\r
- mRT = SystemTable->RuntimeServices;\r
-\r
- //\r
- // Register our ExitBootServices () notify function\r
- //\r
- Status = gBS->CreateEvent (\r
- EFI_EVENT_SIGNAL_EXIT_BOOT_SERVICES,\r
- EFI_TPL_NOTIFY,\r
- RuntimeDriverExitBootServices,\r
- NULL,\r
- &mRuntimeNotifyEvent\r
- );\r
-\r
- ASSERT_EFI_ERROR (Status);\r
-\r
- //\r
- // Register SetVirtualAddressMap () notify function\r
- // \r
- Status = gBS->CreateEvent (\r
- EFI_EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE,\r
- EFI_TPL_NOTIFY,\r
- RuntimeLibVirtualNotifyEvent,\r
- NULL,\r
- &mEfiVirtualNotifyEvent\r
- );\r
-\r
- ASSERT_EFI_ERROR (Status);\r
-\r
- return EFI_SUCCESS;\r
-}\r
-\r
-EFI_STATUS\r
-RuntimeDriverLibDeconstruct (\r
- VOID\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- This routine will free some resources which have been allocated in\r
- EfiInitializeRuntimeDriverLib(). If a runtime driver exits with an error, \r
- it must call this routine to free the allocated resource before the exiting.\r
-\r
-Arguments:\r
-\r
- None\r
-\r
-Returns: \r
-\r
- EFI_SUCCESS - Shotdown the Runtime Driver Lib successfully\r
- EFI_UNSUPPORTED - Runtime Driver lib was not initialized at all\r
-\r
---*/\r
-{\r
- EFI_STATUS Status;\r
-\r
- //\r
- // Close our ExitBootServices () notify function\r
- //\r
- Status = gBS->CloseEvent (mRuntimeNotifyEvent);\r
- ASSERT_EFI_ERROR (Status);\r
-\r
- //\r
- // Close SetVirtualAddressMap () notify function\r
- //\r
- Status = gBS->CloseEvent (mEfiVirtualNotifyEvent);\r
- ASSERT_EFI_ERROR (Status);\r
-\r
- return EFI_SUCCESS;\r
-}\r
-\r
-BOOLEAN\r
-EfiAtRuntime (\r
- VOID\r
- )\r
-/*++\r
-\r
-Routine Description:\r
- Return TRUE if ExitBootServices () has been called\r
-\r
-Arguments:\r
- NONE\r
-\r
-Returns: \r
- TRUE - If ExitBootServices () has been called\r
-\r
---*/\r
-{\r
- return mEfiAtRuntime;\r
-}\r
-\r
-BOOLEAN\r
-EfiGoneVirtual (\r
- VOID\r
- )\r
-/*++\r
-\r
-Routine Description:\r
- Return TRUE if SetVirtualAddressMap () has been called\r
-\r
-Arguments:\r
- NONE\r
-\r
-Returns: \r
- TRUE - If SetVirtualAddressMap () has been called\r
-\r
---*/\r
-{\r
- return mEfiGoneVirtual;\r
-}\r
-\r
+++ /dev/null
-/*++\r
-\r
-Copyright (c) 2006, Intel Corporation \r
-All rights reserved. This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php \r
- \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
-\r
-Module Name:\r
-\r
- RuntimeService.c\r
-\r
-Abstract:\r
-\r
- Light weight lib to support Tiano drivers.\r
-\r
---*/\r
-\r
-#include <RuntimeLibInternal.h>\r
-\r
-VOID\r
-EfiResetSystem (\r
- IN EFI_RESET_TYPE ResetType,\r
- IN EFI_STATUS ResetStatus,\r
- IN UINTN DataSize,\r
- IN CHAR16 *ResetData\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Resets the entire platform.\r
-\r
-Arguments:\r
-\r
- ResetType - The type of reset to perform.\r
- ResetStatus - The status code for the reset.\r
- DataSize - The size, in bytes, of ResetData.\r
- ResetData - A data buffer that includes a Null-terminated Unicode string, optionally\r
- followed by additional binary data.\r
-\r
-Returns:\r
-\r
- None\r
-\r
---*/\r
-{\r
- mRT->ResetSystem (ResetType, ResetStatus, DataSize, ResetData);\r
-}\r
-\r
-//\r
-// The following functions hide the mRT local global from the call to\r
-// runtime service in the EFI system table.\r
-//\r
-EFI_STATUS\r
-EfiGetTime (\r
- OUT EFI_TIME *Time,\r
- OUT EFI_TIME_CAPABILITIES *Capabilities\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Returns the current time and date information, and the time-keeping \r
- capabilities of the hardware platform.\r
-\r
-Arguments:\r
-\r
- Time - A pointer to storage to receive a snapshot of the current time.\r
- Capabilities - An optional pointer to a buffer to receive the real time clock device¡¯s\r
- capabilities.\r
-\r
-Returns:\r
-\r
- Status code\r
-\r
---*/\r
-{\r
- return mRT->GetTime (Time, Capabilities);\r
-}\r
-\r
-EFI_STATUS\r
-EfiSetTime (\r
- IN EFI_TIME *Time\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Sets the current local time and date information.\r
-\r
-Arguments:\r
-\r
- Time - A pointer to the current time.\r
-\r
-Returns:\r
-\r
- Status code\r
-\r
---*/\r
-{\r
- return mRT->SetTime (Time);\r
-}\r
-\r
-EFI_STATUS\r
-EfiGetWakeupTime (\r
- OUT BOOLEAN *Enabled,\r
- OUT BOOLEAN *Pending,\r
- OUT EFI_TIME *Time\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Returns the current wakeup alarm clock setting.\r
-\r
-Arguments:\r
-\r
- Enabled - Indicates if the alarm is currently enabled or disabled.\r
- Pending - Indicates if the alarm signal is pending and requires acknowledgement.\r
- Time - The current alarm setting.\r
-\r
-Returns:\r
-\r
- Status code\r
-\r
---*/\r
-{\r
- return mRT->GetWakeupTime (Enabled, Pending, Time);\r
-}\r
-\r
-EFI_STATUS\r
-EfiSetWakeupTime (\r
- IN BOOLEAN Enable,\r
- IN EFI_TIME *Time\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Sets the system wakeup alarm clock time.\r
-\r
-Arguments:\r
-\r
- Enable - Enable or disable the wakeup alarm.\r
- Time - If Enable is TRUE, the time to set the wakeup alarm for.\r
- If Enable is FALSE, then this parameter is optional, and may be NULL.\r
-\r
-Returns:\r
-\r
- Status code\r
-\r
---*/\r
-{\r
- return mRT->SetWakeupTime (Enable, Time);\r
-}\r
-\r
-\r
-\r
-\r
-EFI_STATUS\r
-EfiGetVariable (\r
- IN CHAR16 *VariableName,\r
- IN EFI_GUID * VendorGuid,\r
- OUT UINT32 *Attributes OPTIONAL,\r
- IN OUT UINTN *DataSize,\r
- OUT VOID *Data\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Returns the value of a variable.\r
-\r
-Arguments:\r
-\r
- VariableName - A Null-terminated Unicode string that is the name of the\r
- vendor¡¯s variable.\r
- VendorGuid - A unique identifier for the vendor.\r
- Attributes - If not NULL, a pointer to the memory location to return the\r
- attributes bitmask for the variable.\r
- DataSize - On input, the size in bytes of the return Data buffer.\r
- On output the size of data returned in Data.\r
- Data - The buffer to return the contents of the variable.\r
-\r
-Returns:\r
-\r
- Status code\r
-\r
---*/\r
-{\r
- return mRT->GetVariable (VariableName, VendorGuid, Attributes, DataSize, Data);\r
-}\r
-\r
-EFI_STATUS\r
-EfiGetNextVariableName (\r
- IN OUT UINTN *VariableNameSize,\r
- IN OUT CHAR16 *VariableName,\r
- IN OUT EFI_GUID *VendorGuid\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Enumerates the current variable names.\r
-\r
-Arguments:\r
-\r
- VariableNameSize - The size of the VariableName buffer.\r
- VariableName - On input, supplies the last VariableName that was returned\r
- by GetNextVariableName(). \r
- On output, returns the Nullterminated Unicode string of the\r
- current variable.\r
- VendorGuid - On input, supplies the last VendorGuid that was returned by\r
- GetNextVariableName(). \r
- On output, returns the VendorGuid of the current variable.\r
-\r
-Returns:\r
-\r
- Status code\r
-\r
---*/\r
-{\r
- return mRT->GetNextVariableName (VariableNameSize, VariableName, VendorGuid);\r
-}\r
-\r
-EFI_STATUS\r
-EfiSetVariable (\r
- IN CHAR16 *VariableName,\r
- IN EFI_GUID *VendorGuid,\r
- IN UINT32 Attributes,\r
- IN UINTN DataSize,\r
- IN VOID *Data\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Sets the value of a variable.\r
-\r
-Arguments:\r
-\r
- VariableName - A Null-terminated Unicode string that is the name of the\r
- vendor¡¯s variable.\r
- VendorGuid - A unique identifier for the vendor.\r
- Attributes - Attributes bitmask to set for the variable.\r
- DataSize - The size in bytes of the Data buffer.\r
- Data - The contents for the variable.\r
-\r
-Returns:\r
-\r
- Status code\r
-\r
---*/\r
-{\r
- return mRT->SetVariable (VariableName, VendorGuid, Attributes, DataSize, Data);\r
-}\r
-\r
-EFI_STATUS\r
-EfiGetNextHighMonotonicCount (\r
- OUT UINT32 *HighCount\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Returns the next high 32 bits of the platform¡¯s monotonic counter.\r
-\r
-Arguments:\r
-\r
- HighCount - Pointer to returned value.\r
-\r
-Returns:\r
-\r
- Status code\r
-\r
---*/\r
-{\r
- return mRT->GetNextHighMonotonicCount (HighCount);\r
-}\r
-\r
-EFI_STATUS\r
-EfiConvertPointer (\r
- IN UINTN DebugDisposition,\r
- IN OUT VOID *Address\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Determines the new virtual address that is to be used on subsequent memory accesses.\r
-\r
-Arguments:\r
-\r
- DebugDisposition - Supplies type information for the pointer being converted.\r
- Address - A pointer to a pointer that is to be fixed to be the value needed\r
- for the new virtual address mappings being applied.\r
-\r
-Returns:\r
-\r
- Status code\r
-\r
---*/\r
-{\r
- return mRT->ConvertPointer (DebugDisposition, Address);\r
-}\r
-\r
-EFI_STATUS\r
-EfiConvertInternalPointer (\r
- IN OUT VOID *Address\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Call EfiConvertPointer() to convert internal pointer.\r
-\r
-Arguments:\r
-\r
- Address - A pointer to a pointer that is to be fixed to be the value needed\r
- for the new virtual address mappings being applied.\r
-\r
-Returns:\r
-\r
- Status code\r
-\r
---*/\r
-{\r
- return EfiConvertPointer (0x0, Address);\r
-}\r
-\r
-EFI_STATUS\r
-EfiConvertList (\r
- IN UINTN DebugDisposition,\r
- IN OUT LIST_ENTRY *ListHead\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Conver the standard Lib double linked list to a virtual mapping.\r
-\r
-Arguments:\r
-\r
- DebugDisposition - Argument to EfiConvertPointer (EFI 1.0 API)\r
-\r
- ListHead - Head of linked list to convert\r
-\r
-Returns: \r
-\r
- EFI_SUCCESS\r
-\r
---*/\r
-{\r
- LIST_ENTRY *Link;\r
- LIST_ENTRY *NextLink;\r
-\r
- //\r
- // Convert all the ForwardLink & BackLink pointers in the list\r
- //\r
- Link = ListHead;\r
- do {\r
- NextLink = Link->ForwardLink;\r
-\r
- EfiConvertPointer (\r
- Link->ForwardLink == ListHead ? DebugDisposition : 0,\r
- (VOID **) &Link->ForwardLink\r
- );\r
-\r
- EfiConvertPointer (\r
- Link->BackLink == ListHead ? DebugDisposition : 0,\r
- (VOID **) &Link->BackLink\r
- );\r
-\r
- Link = NextLink;\r
- } while (Link != ListHead);\r
- return EFI_SUCCESS;\r
-}\r
-\r
-\r
-/**\r
- Change the runtime addressing mode of EFI firmware from physical to virtual.\r
-\r
- @param MemoryMapSize The size in bytes of VirtualMap.\r
- @param DescriptorSize The size in bytes of an entry in the VirtualMap.\r
- @param DescriptorVersion The version of the structure entries in VirtualMap.\r
- @param VirtualMap An array of memory descriptors which contain new virtual\r
- address mapping information for all runtime ranges. Type\r
- EFI_MEMORY_DESCRIPTOR is defined in the\r
- GetMemoryMap() function description.\r
-\r
- @retval EFI_SUCCESS The virtual address map has been applied.\r
- @retval EFI_UNSUPPORTED EFI firmware is not at runtime, or the EFI firmware is already in\r
- virtual address mapped mode.\r
- @retval EFI_INVALID_PARAMETER DescriptorSize or DescriptorVersion is\r
- invalid.\r
- @retval EFI_NO_MAPPING A virtual address was not supplied for a range in the memory\r
- map that requires a mapping.\r
- @retval EFI_NOT_FOUND A virtual address was supplied for an address that is not found\r
- in the memory map.\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-EfiSetVirtualAddressMap (\r
- IN UINTN MemoryMapSize,\r
- IN UINTN DescriptorSize,\r
- IN UINT32 DescriptorVersion,\r
- IN CONST EFI_MEMORY_DESCRIPTOR *VirtualMap\r
- )\r
-{\r
- return mRT->SetVirtualAddressMap (\r
- MemoryMapSize,\r
- DescriptorSize,\r
- DescriptorVersion,\r
- (EFI_MEMORY_DESCRIPTOR *) VirtualMap\r
- );\r
-}\r
-\r
-\r
-EFI_STATUS\r
-EfiUpdateCapsule (\r
- IN UEFI_CAPSULE_HEADER **CapsuleHeaderArray,\r
- IN UINTN CapsuleCount,\r
- IN EFI_PHYSICAL_ADDRESS ScatterGatherList OPTIONAL\r
- )\r
-{\r
-#if (EFI_SPECIFICATION_VERSION >= 0x00020000)\r
- return mRT->UpdateCapsule (\r
- CapsuleHeaderArray,\r
- CapsuleCount,\r
- ScatterGatherList\r
- );\r
-#else\r
- return EFI_UNSUPPORTED;\r
-#endif\r
-}\r
-\r
-EFI_STATUS\r
-EfiQueryCapsuleCapabilities (\r
- IN UEFI_CAPSULE_HEADER **CapsuleHeaderArray,\r
- IN UINTN CapsuleCount,\r
- OUT UINT64 *MaximumCapsuleSize,\r
- OUT EFI_RESET_TYPE *ResetType\r
- )\r
-{\r
-#if (EFI_SPECIFICATION_VERSION >= 0x00020000)\r
- return mRT->QueryCapsuleCapabilities (\r
- CapsuleHeaderArray,\r
- CapsuleCount,\r
- MaximumCapsuleSize,\r
- ResetType\r
- );\r
-#else\r
- return EFI_UNSUPPORTED;\r
-#endif\r
-}\r
-\r
-\r
-EFI_STATUS\r
-EfiQueryVariableInfo (\r
- IN UINT32 Attributes,\r
- OUT UINT64 *MaximumVariableStorageSize,\r
- OUT UINT64 *RemainingVariableStorageSize,\r
- OUT UINT64 *MaximumVariableSize\r
- )\r
-{\r
-#if (EFI_SPECIFICATION_VERSION >= 0x00020000)\r
- return mRT->QueryVariableInfo (\r
- Attributes,\r
- MaximumVariableStorageSize,\r
- RemainingVariableStorageSize,\r
- MaximumVariableSize\r
- );\r
-#else \r
- return EFI_UNSUPPORTED;\r
-#endif\r
-}\r
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>\r
-<!--\r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
--->\r
-<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">\r
- <MsaHeader>\r
- <ModuleName>EdkDxeRuntimeDriverLib</ModuleName>\r
- <ModuleType>DXE_DRIVER</ModuleType>\r
- <GuidValue>b1ee6c28-54aa-4d17-b705-3e28ccb27b2e</GuidValue>\r
- <Version>1.0</Version>\r
- <Abstract>Runtime driver library</Abstract>\r
- <Description>\r
- Instance of runtime driver library, Hook VitualAddressChange and \r
- BooterviceExit event and provide runtime service.\r
- </Description>\r
- <Copyright>Copyright (c) 2006, Intel Corporation.</Copyright>\r
- <License>All rights reserved. This program and the accompanying materials
- are licensed and made available under the terms and conditions of the BSD License
- which accompanies this distribution. The full text of the license may be found at
- http://opensource.org/licenses/bsd-license.php
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>\r
- <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>\r
- </MsaHeader>\r
- <ModuleDefinitions>\r
- <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>\r
- <BinaryModule>false</BinaryModule>\r
- <OutputFileBasename>EdkDxeRuntimeDriverLib</OutputFileBasename>\r
- </ModuleDefinitions>\r
- <LibraryClassDefinitions>\r
- <LibraryClass Usage="ALWAYS_PRODUCED">\r
- <Keyword>DxeRuntimeDriverLib</Keyword>\r
- </LibraryClass>\r
- <LibraryClass Usage="ALWAYS_CONSUMED">\r
- <Keyword>UefiLib</Keyword>\r
- </LibraryClass>\r
- <LibraryClass Usage="ALWAYS_CONSUMED">\r
- <Keyword>BaseLib</Keyword>\r
- </LibraryClass>\r
- <LibraryClass Usage="ALWAYS_CONSUMED">\r
- <Keyword>DebugLib</Keyword>\r
- </LibraryClass>\r
- <LibraryClass Usage="ALWAYS_CONSUMED">\r
- <Keyword>UefiBootServicesTableLib</Keyword>\r
- </LibraryClass>\r
- <LibraryClass Usage="ALWAYS_CONSUMED">\r
- <Keyword>EdkDxeSalLib</Keyword>\r
- </LibraryClass>\r
- </LibraryClassDefinitions>\r
- <SourceFiles>\r
- <Filename>RuntimeLibInternal.h</Filename>\r
- <Filename SupArchList="IA32">Common/RuntimeLib.c</Filename>\r
- <Filename SupArchList="IA32">Common/RuntimeService.c</Filename>\r
- <Filename SupArchList="X64">Common/RuntimeLib.c</Filename>\r
- <Filename SupArchList="X64">Common/RuntimeService.c</Filename>\r
- <Filename SupArchList="IPF">Ipf/RuntimeLib.c</Filename>\r
- <Filename SupArchList="IPF">Ipf/RuntimeService.c</Filename>\r
- </SourceFiles>\r
- <PackageDependencies>\r
- <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
- <Package PackageGuid="B6EC423C-21D2-490D-85C6-DD5864EAA674"/>\r
- </PackageDependencies>\r
- <Protocols>\r
- <Protocol Usage="ALWAYS_CONSUMED">\r
- <ProtocolCName>gEfiExtendedSalBootServiceProtocolGuid</ProtocolCName>\r
- </Protocol>\r
- </Protocols>\r
- <Externs>\r
- <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>\r
- <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>\r
- <Extern>\r
- <Constructor>RuntimeDriverLibConstruct</Constructor>\r
- <Destructor>RuntimeDriverLibDeconstruct</Destructor>\r
- </Extern>\r
- <Extern>\r
- <Constructor>RuntimeDriverLibConstruct</Constructor>\r
- <Destructor>RuntimeDriverLibDeconstruct</Destructor>\r
- </Extern>\r
- </Externs>\r
-</ModuleSurfaceArea>
\ No newline at end of file
+++ /dev/null
-/*++\r
-\r
-Copyright (c) 2006, Intel Corporation \r
-All rights reserved. This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php \r
- \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
-\r
-Module Name:\r
-\r
- RuntimeLib.c\r
-\r
-Abstract:\r
-\r
- Light weight lib to support Tiano drivers.\r
-\r
---*/\r
-\r
-#include <SalApi.h>\r
-#include <RuntimeLibInternal.h>\r
-\r
-//\r
-// Driver Lib Module Globals\r
-//\r
-\r
-STATIC EFI_EVENT mRuntimeNotifyEvent;\r
-STATIC EFI_EVENT mEfiVirtualNotifyEvent;\r
-\r
-STATIC EFI_PLABEL mPlabel;\r
-STATIC EXTENDED_SAL_BOOT_SERVICE_PROTOCOL *mEsalBootService;\r
-\r
-EFI_RUNTIME_SERVICES *mRT = NULL;\r
-\r
-STATIC\r
-VOID\r
-EFIAPI\r
-RuntimeDriverExitBootServices (\r
- IN EFI_EVENT Event,\r
- IN VOID *Context\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Set AtRuntime flag as TRUE after ExitBootServices\r
-\r
-Arguments:\r
-\r
- Event - The Event that is being processed\r
- \r
- Context - Event Context\r
-\r
-Returns: \r
-\r
- None\r
-\r
---*/\r
-{\r
- EFI_EVENT_NOTIFY ChildNotifyEventHandler;\r
- UINTN Index;\r
-\r
- for (Index = 0; _gDriverExitBootServicesEvent[Index] != NULL; Index++) {\r
- ChildNotifyEventHandler = _gDriverExitBootServicesEvent[Index];\r
- ChildNotifyEventHandler (Event, NULL);\r
- }\r
-}\r
-\r
-STATIC\r
-VOID\r
-EFIAPI\r
-RuntimeLibVirtualNotifyEvent (\r
- IN EFI_EVENT Event,\r
- IN VOID *Context\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Fixup internal data so that EFI can be call in virtual mode.\r
- Call the passed in Child Notify event and convert any pointers in \r
- lib to virtual mode.\r
-\r
-Arguments:\r
-\r
- Event - The Event that is being processed\r
- \r
- Context - Event Context\r
-\r
-Returns: \r
-\r
- None\r
-\r
---*/\r
-{\r
- UINTN Index;\r
- EFI_EVENT_NOTIFY ChildNotifyEventHandler;\r
-\r
- for (Index = 0; _gDriverSetVirtualAddressMapEvent[Index] != NULL; Index++) {\r
- ChildNotifyEventHandler = _gDriverSetVirtualAddressMapEvent[Index];\r
- ChildNotifyEventHandler (Event, NULL);\r
- }\r
-\r
- mRT->ConvertPointer (0x0, (VOID **) &mPlabel.EntryPoint);\r
- mRT->ConvertPointer (EFI_IPF_GP_POINTER, (VOID **) &mPlabel.GP);\r
-\r
- SetEsalVirtualEntryPoint (mPlabel.EntryPoint, mPlabel.GP);\r
-\r
- //\r
- // Clear out BootService globals\r
- //\r
- gBS = NULL;\r
- gST = NULL;\r
- mRT = NULL;\r
-}\r
-\r
-EFI_STATUS\r
-RuntimeDriverLibConstruct (\r
- IN EFI_HANDLE ImageHandle,\r
- IN EFI_SYSTEM_TABLE *SystemTable\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Intialize runtime Driver Lib if it has not yet been initialized. \r
-\r
-Arguments:\r
-\r
- ImageHandle - The firmware allocated handle for the EFI image.\r
- \r
- SystemTable - A pointer to the EFI System Table.\r
-\r
- GoVirtualChildEvent - Caller can register a virtual notification event.\r
-\r
-Returns: \r
-\r
- EFI_STATUS always returns EFI_SUCCESS except EFI_ALREADY_STARTED if already started.\r
-\r
---*/\r
-{\r
- EFI_PLABEL *Plabel;\r
- EFI_STATUS Status;\r
-\r
- mRT = SystemTable->RuntimeServices;\r
-\r
- //\r
- // The protocol contains a function pointer, which is an indirect procedure call.\r
- // An indirect procedure call goes through a plabel, and pointer to a function is\r
- // a pointer to a plabel. To implement indirect procedure calls that can work in\r
- // both physical and virtual mode, two plabels are required (one physical and one\r
- // virtual). So lets grap the physical PLABEL for the EsalEntryPoint and store it\r
- // away. We cache it in a module global, so we can register the vitrual version.\r
- //\r
- Status = gBS->LocateProtocol (&gEfiExtendedSalBootServiceProtocolGuid, NULL, &mEsalBootService);\r
- ASSERT_EFI_ERROR (Status);\r
-\r
- Plabel = (EFI_PLABEL *) (UINTN) mEsalBootService->ExtendedSalProc;\r
-\r
- mPlabel.EntryPoint = Plabel->EntryPoint;\r
- mPlabel.GP = Plabel->GP;\r
-\r
- SetEsalPhysicalEntryPoint (mPlabel.EntryPoint, mPlabel.GP);\r
-\r
- //\r
- // Register our ExitBootServices () notify function\r
- //\r
-\r
- Status = gBS->CreateEvent (\r
- EFI_EVENT_SIGNAL_EXIT_BOOT_SERVICES,\r
- EFI_TPL_NOTIFY,\r
- RuntimeDriverExitBootServices,\r
- NULL,\r
- &mRuntimeNotifyEvent\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
-\r
- //\r
- // Register SetVirtualAddressMap () notify function\r
- //\r
- \r
- Status = gBS->CreateEvent (\r
- EFI_EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE,\r
- EFI_TPL_NOTIFY,\r
- RuntimeLibVirtualNotifyEvent,\r
- NULL,\r
- mEfiVirtualNotifyEvent\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
-\r
- return EFI_SUCCESS;\r
-}\r
-\r
-EFI_STATUS\r
-RuntimeDriverLibDeconstruct (\r
- VOID\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- This routine will free some resources which have been allocated in\r
- EfiInitializeRuntimeDriverLib(). If a runtime driver exits with an error, \r
- it must call this routine to free the allocated resource before the exiting.\r
-\r
-Arguments:\r
-\r
- None\r
-\r
-Returns: \r
-\r
- EFI_SUCCESS - Shotdown the Runtime Driver Lib successfully\r
- EFI_UNSUPPORTED - Runtime Driver lib was not initialized at all\r
-\r
---*/\r
-{\r
- EFI_STATUS Status;\r
-\r
- //\r
- // Close our ExitBootServices () notify function\r
- //\r
- Status = gBS->CloseEvent (mRuntimeNotifyEvent);\r
- ASSERT_EFI_ERROR (Status);\r
-\r
- //\r
- // Close SetVirtualAddressMap () notify function\r
- //\r
- Status = gBS->CloseEvent (mEfiVirtualNotifyEvent);\r
- ASSERT_EFI_ERROR (Status);\r
-\r
- return EFI_SUCCESS;\r
-}\r
-\r
-BOOLEAN\r
-EfiAtRuntime (\r
- VOID\r
- )\r
-/*++\r
-\r
-Routine Description:\r
- Return TRUE if ExitBootService () has been called\r
-\r
-Arguments:\r
- NONE\r
-\r
-Returns: \r
- TRUE - If ExitBootService () has been called\r
-\r
---*/\r
-{\r
- EFI_GUID Guid = EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID;\r
- SAL_RETURN_REGS ReturnReg;\r
-\r
- ReturnReg = EfiCallEsalService (&Guid, IsEfiRuntime, 0, 0, 0, 0, 0, 0, 0);\r
-\r
- return (BOOLEAN) (ReturnReg.r9 == 1);\r
-}\r
-\r
-BOOLEAN\r
-EfiGoneVirtual (\r
- VOID\r
- )\r
-/*++\r
-\r
-Routine Description:\r
- Return TRUE if SetVirtualAddressMap () has been called\r
-\r
-Arguments:\r
- NONE\r
-\r
-Returns: \r
- TRUE - If SetVirtualAddressMap () has been called\r
-\r
---*/\r
-{\r
- EFI_GUID Guid = EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID;\r
- SAL_RETURN_REGS ReturnReg;\r
-\r
- ReturnReg = EfiCallEsalService (&Guid, IsVirtual, 0, 0, 0, 0, 0, 0, 0);\r
-\r
- return (BOOLEAN) (ReturnReg.r9 == 1);\r
-}\r
+++ /dev/null
-/*++\r
-\r
-Copyright (c) 2006, Intel Corporation \r
-All rights reserved. This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php \r
- \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
-\r
-Module Name:\r
-\r
- RuntimeService.c\r
-\r
-Abstract:\r
-\r
- Light weight lib to support Tiano drivers.\r
-\r
---*/\r
-\r
-#include <RuntimeLibInternal.h>\r
-\r
-VOID\r
-EfiResetSystem (\r
- IN EFI_RESET_TYPE ResetType,\r
- IN EFI_STATUS ResetStatus,\r
- IN UINTN DataSize,\r
- IN CHAR16 *ResetData\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Resets the entire platform.\r
-\r
-Arguments:\r
-\r
- ResetType - The type of reset to perform.\r
- ResetStatus - The status code for the reset.\r
- DataSize - The size, in bytes, of ResetData.\r
- ResetData - A data buffer that includes a Null-terminated Unicode string, optionally\r
- followed by additional binary data.\r
-\r
-Returns:\r
-\r
- None\r
-\r
---*/\r
-{\r
- EFI_GUID Guid = EFI_EXTENDED_SAL_RESET_SERVICES_PROTOCOL_GUID;\r
-\r
- EfiCallEsalService (\r
- &Guid,\r
- ResetSystem,\r
- (UINT64) ResetType,\r
- (UINT64) ResetStatus,\r
- (UINT64) DataSize,\r
- (UINT64) ResetData,\r
- 0,\r
- 0,\r
- 0\r
- );\r
-}\r
-\r
-\r
-//\r
-// The following functions hide the mRT local global from the call to\r
-// runtime service in the EFI system table.\r
-//\r
-EFI_STATUS\r
-EfiGetTime (\r
- OUT EFI_TIME *Time,\r
- OUT EFI_TIME_CAPABILITIES *Capabilities\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Returns the current time and date information, and the time-keeping \r
- capabilities of the hardware platform.\r
-\r
-Arguments:\r
-\r
- Time - A pointer to storage to receive a snapshot of the current time.\r
- Capabilities - An optional pointer to a buffer to receive the real time clock device¡¯s\r
- capabilities.\r
-\r
-Returns:\r
-\r
- Status code\r
-\r
---*/\r
-{\r
- SAL_RETURN_REGS ReturnReg;\r
- EFI_GUID Guid = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID;\r
-\r
- ReturnReg = EfiCallEsalService (&Guid, GetTime, (UINT64) Time, (UINT64) Capabilities, 0, 0, 0, 0, 0);\r
- return ReturnReg.Status;\r
-}\r
-\r
-EFI_STATUS\r
-EfiSetTime (\r
- IN EFI_TIME *Time\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Sets the current local time and date information.\r
-\r
-Arguments:\r
-\r
- Time - A pointer to the current time.\r
-\r
-Returns:\r
-\r
- Status code\r
-\r
---*/\r
-{\r
- SAL_RETURN_REGS ReturnReg;\r
-\r
- EFI_GUID Guid = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID;\r
-\r
- ReturnReg = EfiCallEsalService (&Guid, SetTime, (UINT64) Time, 0, 0, 0, 0, 0, 0);\r
- return ReturnReg.Status;\r
-}\r
-\r
-EFI_STATUS\r
-EfiGetWakeupTime (\r
- OUT BOOLEAN *Enabled,\r
- OUT BOOLEAN *Pending,\r
- OUT EFI_TIME *Time\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Returns the current wakeup alarm clock setting.\r
-\r
-Arguments:\r
-\r
- Enabled - Indicates if the alarm is currently enabled or disabled.\r
- Pending - Indicates if the alarm signal is pending and requires acknowledgement.\r
- Time - The current alarm setting.\r
-\r
-Returns:\r
-\r
- Status code\r
-\r
---*/\r
-{\r
- SAL_RETURN_REGS ReturnReg;\r
-\r
- EFI_GUID Guid = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID;\r
-\r
- ReturnReg = EfiCallEsalService (&Guid, GetWakeupTime, (UINT64) Enabled, (UINT64) Pending, (UINT64) Time, 0, 0, 0, 0);\r
- return ReturnReg.Status;\r
-}\r
-\r
-EFI_STATUS\r
-EfiSetWakeupTime (\r
- IN BOOLEAN Enable,\r
- IN EFI_TIME *Time\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Sets the system wakeup alarm clock time.\r
-\r
-Arguments:\r
-\r
- Enable - Enable or disable the wakeup alarm.\r
- Time - If Enable is TRUE, the time to set the wakeup alarm for.\r
- If Enable is FALSE, then this parameter is optional, and may be NULL.\r
-\r
-Returns:\r
-\r
- Status code\r
-\r
---*/\r
-{\r
- SAL_RETURN_REGS ReturnReg;\r
-\r
- EFI_GUID Guid = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID;\r
-\r
- ReturnReg = EfiCallEsalService (&Guid, SetWakeupTime, (UINT64) Enable, (UINT64) Time, 0, 0, 0, 0, 0);\r
- return ReturnReg.Status;\r
-}\r
-\r
-EFI_STATUS\r
-EfiGetVariable (\r
- IN CHAR16 *VariableName,\r
- IN EFI_GUID * VendorGuid,\r
- OUT UINT32 *Attributes OPTIONAL,\r
- IN OUT UINTN *DataSize,\r
- OUT VOID *Data\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Returns the value of a variable.\r
-\r
-Arguments:\r
-\r
- VariableName - A Null-terminated Unicode string that is the name of the\r
- vendor¡¯s variable.\r
- VendorGuid - A unique identifier for the vendor.\r
- Attributes - If not NULL, a pointer to the memory location to return the\r
- attributes bitmask for the variable.\r
- DataSize - On input, the size in bytes of the return Data buffer.\r
- On output the size of data returned in Data.\r
- Data - The buffer to return the contents of the variable.\r
-\r
-Returns:\r
-\r
- Status code\r
-\r
---*/\r
-{\r
- SAL_RETURN_REGS ReturnReg;\r
- EFI_GUID Guid = EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID;\r
-\r
- ReturnReg = EfiCallEsalService (\r
- &Guid,\r
- EsalGetVariable,\r
- (UINT64) VariableName,\r
- (UINT64) VendorGuid,\r
- (UINT64) Attributes,\r
- (UINT64) DataSize,\r
- (UINT64) Data,\r
- 0,\r
- 0\r
- );\r
- return (EFI_STATUS) ReturnReg.Status;\r
-}\r
-\r
-EFI_STATUS\r
-EfiGetNextVariableName (\r
- IN OUT UINTN *VariableNameSize,\r
- IN OUT CHAR16 *VariableName,\r
- IN OUT EFI_GUID *VendorGuid\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Enumerates the current variable names.\r
-\r
-Arguments:\r
-\r
- VariableNameSize - The size of the VariableName buffer.\r
- VariableName - On input, supplies the last VariableName that was returned\r
- by GetNextVariableName(). \r
- On output, returns the Nullterminated Unicode string of the\r
- current variable.\r
- VendorGuid - On input, supplies the last VendorGuid that was returned by\r
- GetNextVariableName(). \r
- On output, returns the VendorGuid of the current variable.\r
-\r
-Returns:\r
-\r
- Status code\r
-\r
---*/\r
-{\r
- SAL_RETURN_REGS ReturnReg;\r
- EFI_GUID Guid = EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID;\r
-\r
- ReturnReg = EfiCallEsalService (\r
- &Guid,\r
- EsalGetNextVariableName,\r
- (UINT64) VariableNameSize,\r
- (UINT64) VariableName,\r
- (UINT64) VendorGuid,\r
- 0,\r
- 0,\r
- 0,\r
- 0\r
- );\r
- return (EFI_STATUS) ReturnReg.Status;\r
-}\r
-\r
-EFI_STATUS\r
-EfiSetVariable (\r
- IN CHAR16 *VariableName,\r
- IN EFI_GUID *VendorGuid,\r
- IN UINT32 Attributes,\r
- IN UINTN DataSize,\r
- IN VOID *Data\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Sets the value of a variable.\r
-\r
-Arguments:\r
-\r
- VariableName - A Null-terminated Unicode string that is the name of the\r
- vendor¡¯s variable.\r
- VendorGuid - A unique identifier for the vendor.\r
- Attributes - Attributes bitmask to set for the variable.\r
- DataSize - The size in bytes of the Data buffer.\r
- Data - The contents for the variable.\r
-\r
-Returns:\r
-\r
- Status code\r
-\r
---*/\r
-{\r
- SAL_RETURN_REGS ReturnReg;\r
- EFI_GUID Guid = EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID;\r
-\r
- ReturnReg = EfiCallEsalService (\r
- &Guid,\r
- EsalSetVariable,\r
- (UINT64) VariableName,\r
- (UINT64) VendorGuid,\r
- (UINT64) Attributes,\r
- (UINT64) DataSize,\r
- (UINT64) Data,\r
- 0,\r
- 0\r
- );\r
- return (EFI_STATUS) ReturnReg.Status;\r
-}\r
-\r
-EFI_STATUS\r
-EfiGetNextHighMonotonicCount (\r
- OUT UINT32 *HighCount\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Returns the next high 32 bits of the platform¡¯s monotonic counter.\r
-\r
-Arguments:\r
-\r
- HighCount - Pointer to returned value.\r
-\r
-Returns:\r
-\r
- Status code\r
-\r
---*/\r
-{\r
- SAL_RETURN_REGS ReturnReg;\r
-\r
- EFI_GUID Guid = EFI_EXTENDED_SAL_MTC_SERVICES_PROTOCOL_GUID;\r
-\r
- ReturnReg = EfiCallEsalService (&Guid, GetNextHighMonotonicCount, (UINT64) HighCount, 0, 0, 0, 0, 0, 0);\r
- return (EFI_STATUS) ReturnReg.Status;\r
-}\r
-\r
-EFI_STATUS\r
-EfiConvertPointer (\r
- IN UINTN DebugDisposition,\r
- IN OUT VOID *Address\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Determines the new virtual address that is to be used on subsequent memory accesses.\r
-\r
-Arguments:\r
-\r
- DebugDisposition - Supplies type information for the pointer being converted.\r
- Address - A pointer to a pointer that is to be fixed to be the value needed\r
- for the new virtual address mappings being applied.\r
-\r
-Returns:\r
-\r
- Status code\r
-\r
---*/\r
-{\r
- return mRT->ConvertPointer (DebugDisposition, Address);\r
-}\r
-\r
-EFI_STATUS\r
-EfiConvertList (\r
- IN UINTN DebugDisposition,\r
- IN OUT LIST_ENTRY *ListHead\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Conver the standard Lib double linked list to a virtual mapping.\r
-\r
-Arguments:\r
-\r
- DebugDisposition - Argument to EfiConvertPointer (EFI 1.0 API)\r
-\r
- ListHead - Head of linked list to convert\r
-\r
-Returns: \r
-\r
- EFI_SUCCESS\r
-\r
---*/\r
-{\r
- LIST_ENTRY *Link;\r
- LIST_ENTRY *NextLink;\r
-\r
- //\r
- // Convert all the ForwardLink & BackLink pointers in the list\r
- //\r
- Link = ListHead;\r
- do {\r
- NextLink = Link->ForwardLink;\r
-\r
- EfiConvertPointer (\r
- Link->ForwardLink == ListHead ? DebugDisposition : 0,\r
- (VOID **) &Link->ForwardLink\r
- );\r
-\r
- EfiConvertPointer (\r
- Link->BackLink == ListHead ? DebugDisposition : 0,\r
- (VOID **) &Link->BackLink\r
- );\r
-\r
- Link = NextLink;\r
- } while (Link != ListHead);\r
- return EFI_SUCCESS;\r
-}\r
-\r
-\r
-/**\r
- Change the runtime addressing mode of EFI firmware from physical to virtual.\r
-\r
- @param MemoryMapSize The size in bytes of VirtualMap.\r
- @param DescriptorSize The size in bytes of an entry in the VirtualMap.\r
- @param DescriptorVersion The version of the structure entries in VirtualMap.\r
- @param VirtualMap An array of memory descriptors which contain new virtual\r
- address mapping information for all runtime ranges. Type\r
- EFI_MEMORY_DESCRIPTOR is defined in the\r
- GetMemoryMap() function description.\r
-\r
- @retval EFI_SUCCESS The virtual address map has been applied.\r
- @retval EFI_UNSUPPORTED EFI firmware is not at runtime, or the EFI firmware is already in\r
- virtual address mapped mode.\r
- @retval EFI_INVALID_PARAMETER DescriptorSize or DescriptorVersion is\r
- invalid.\r
- @retval EFI_NO_MAPPING A virtual address was not supplied for a range in the memory\r
- map that requires a mapping.\r
- @retval EFI_NOT_FOUND A virtual address was supplied for an address that is not found\r
- in the memory map.\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-EfiSetVirtualAddressMap (\r
- IN UINTN MemoryMapSize,\r
- IN UINTN DescriptorSize,\r
- IN UINT32 DescriptorVersion,\r
- IN CONST EFI_MEMORY_DESCRIPTOR *VirtualMap\r
- )\r
-{\r
- SAL_RETURN_REGS ReturnReg;\r
- EFI_GUID Guid = EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID;\r
-\r
- ReturnReg = EfiCallEsalService (\r
- &Guid,\r
- SetVirtualAddress,\r
- (UINT64) MemoryMapSize,\r
- (UINT64) DescriptorSize,\r
- (UINT64) DescriptorVersion,\r
- (UINT64) VirtualMap,\r
- 0,\r
- 0,\r
- 0\r
- );\r
-\r
- return ReturnReg.Status;\r
-}\r
-\r
-\r
-EFI_STATUS\r
-EfiUpdateCapsule (\r
- IN UEFI_CAPSULE_HEADER **CapsuleHeaderArray,\r
- IN UINTN CapsuleCount,\r
- IN EFI_PHYSICAL_ADDRESS ScatterGatherList OPTIONAL\r
- )\r
-{\r
- return EFI_UNSUPPORTED;\r
-}\r
-\r
-EFI_STATUS\r
-EfiQueryCapsuleCapabilities (\r
- IN UEFI_CAPSULE_HEADER **CapsuleHeaderArray,\r
- IN UINTN CapsuleCount,\r
- OUT UINT64 *MaximumCapsuleSize,\r
- OUT EFI_RESET_TYPE *ResetType\r
- )\r
-{\r
- return EFI_UNSUPPORTED;\r
-}\r
-\r
-\r
-EFI_STATUS\r
-EfiQueryVariableInfo (\r
- IN UINT32 Attributes,\r
- OUT UINT64 *MaximumVariableStorageSize,\r
- OUT UINT64 *RemainingVariableStorageSize,\r
- OUT UINT64 *MaximumVariableSize\r
- )\r
-{\r
- return EFI_UNSUPPORTED;\r
-}\r
+++ /dev/null
-/*++\r
-\r
-Copyright (c) 2006, Intel Corporation \r
-All rights reserved. This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php \r
- \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
-\r
-Module Name:\r
-\r
- RuntimeLibInternal.h\r
-\r
-Abstract:\r
-\r
---*/\r
-\r
-#ifndef __RUNTIMELIBINTERNAL_H__\r
-#define __RUNTIMELIBINTERNAL_H__\r
-\r
-EFI_STATUS\r
-EfiConvertInternalPointer (\r
- IN OUT VOID *Address\r
- );\r
-\r
-extern EFI_RUNTIME_SERVICES *mRT;\r
-\r
-#endif //__RUNTIMELIBINTERNAL_H__\r
<Keyword>BaseMemoryLib</Keyword>\r
</LibraryClass>\r
<LibraryClass Usage="ALWAYS_CONSUMED">\r
- <Keyword>DxeRuntimeDriverLib</Keyword>\r
+ <Keyword>UefiRuntimeLib</Keyword>\r
</LibraryClass>\r
<LibraryClass Usage="ALWAYS_CONSUMED">\r
<Keyword>UefiBootServicesTableLib</Keyword>\r
<Keyword>BaseMemoryLib</Keyword>\r
</LibraryClass>\r
<LibraryClass Usage="ALWAYS_CONSUMED">\r
- <Keyword>DxeRuntimeDriverLib</Keyword>\r
+ <Keyword>UefiRuntimeLib</Keyword>\r
</LibraryClass>\r
<LibraryClass Usage="ALWAYS_CONSUMED">\r
<Keyword>ReportStatusCodeLib</Keyword>\r
<Keyword>BaseLib</Keyword>\r
</LibraryClass>\r
<LibraryClass Usage="ALWAYS_CONSUMED">\r
- <Keyword>DxeRuntimeDriverLib</Keyword>\r
+ <Keyword>UefiRuntimeLib</Keyword>\r
</LibraryClass>\r
<LibraryClass Usage="ALWAYS_CONSUMED">\r
<Keyword>ReportStatusCodeLib</Keyword>\r
<Keyword>BaseLib</Keyword>\r
</LibraryClass>\r
<LibraryClass Usage="ALWAYS_CONSUMED">\r
- <Keyword>DxeRuntimeDriverLib</Keyword>\r
+ <Keyword>UefiRuntimeLib</Keyword>\r
</LibraryClass>\r
<LibraryClass Usage="ALWAYS_CONSUMED">\r
<Keyword>ReportStatusCodeLib</Keyword>\r
--- /dev/null
+/*++\r
+\r
+Copyright (c) 2006, Intel Corporation \r
+All rights reserved. This program and the accompanying materials \r
+are licensed and made available under the terms and conditions of the BSD License \r
+which accompanies this distribution. The full text of the license may be found at \r
+http://opensource.org/licenses/bsd-license.php \r
+ \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+\r
+Module Name:\r
+\r
+ RuntimeLib.c\r
+\r
+Abstract:\r
+\r
+ Light weight lib to support Tiano drivers.\r
+\r
+--*/\r
+\r
+#include <RuntimeLibInternal.h>\r
+\r
+//\r
+// Driver Lib Module Globals\r
+//\r
+STATIC EFI_EVENT mRuntimeNotifyEvent;\r
+STATIC EFI_EVENT mEfiVirtualNotifyEvent;\r
+STATIC BOOLEAN mEfiGoneVirtual = FALSE;\r
+STATIC BOOLEAN mEfiAtRuntime = FALSE;\r
+\r
+EFI_RUNTIME_SERVICES *mRT = NULL;\r
+\r
+VOID\r
+EFIAPI\r
+RuntimeDriverExitBootServices (\r
+ IN EFI_EVENT Event,\r
+ IN VOID *Context\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Set AtRuntime flag as TRUE after ExitBootServices\r
+\r
+Arguments:\r
+\r
+ Event - The Event that is being processed\r
+ \r
+ Context - Event Context\r
+\r
+Returns: \r
+\r
+ None\r
+\r
+--*/\r
+{\r
+ EFI_EVENT_NOTIFY ChildNotifyEventHandler;\r
+ UINTN Index;\r
+\r
+ for (Index = 0; \r
+ _gDriverExitBootServicesEvent[Index] != NULL;\r
+ Index++) {\r
+ ChildNotifyEventHandler = _gDriverExitBootServicesEvent[Index];\r
+ ChildNotifyEventHandler (Event, NULL);\r
+ }\r
+\r
+ mEfiAtRuntime = TRUE;\r
+}\r
+\r
+STATIC\r
+VOID\r
+EFIAPI\r
+RuntimeLibVirtualNotifyEvent (\r
+ IN EFI_EVENT Event,\r
+ IN VOID *Context\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Fixup internal data so that EFI can be call in virtual mode.\r
+ Call the passed in Child Notify event and convert any pointers in \r
+ lib to virtual mode.\r
+\r
+Arguments:\r
+\r
+ Event - The Event that is being processed\r
+ \r
+ Context - Event Context\r
+\r
+Returns: \r
+\r
+ None\r
+\r
+--*/\r
+{\r
+ UINTN Index;\r
+ EFI_EVENT_NOTIFY ChildNotifyEventHandler;\r
+\r
+ for (Index = 0; \r
+ _gDriverSetVirtualAddressMapEvent[Index] != NULL;\r
+ Index++) {\r
+ ChildNotifyEventHandler = _gDriverSetVirtualAddressMapEvent[Index];\r
+ ChildNotifyEventHandler (Event, NULL);\r
+ }\r
+\r
+ //\r
+ // Update global for Runtime Services Table and IO\r
+ //\r
+ EfiConvertInternalPointer ((VOID **) &mRT);\r
+\r
+ //\r
+ // Clear out BootService globals\r
+ //\r
+ gBS = NULL;\r
+ gST = NULL;\r
+ mEfiGoneVirtual = TRUE;\r
+}\r
+\r
+EFI_STATUS\r
+RuntimeDriverLibConstruct (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Intialize runtime Driver Lib if it has not yet been initialized. \r
+\r
+Arguments:\r
+\r
+ ImageHandle - The firmware allocated handle for the EFI image.\r
+ \r
+ SystemTable - A pointer to the EFI System Table.\r
+\r
+ GoVirtualChildEvent - Caller can register a virtual notification event.\r
+\r
+Returns: \r
+\r
+ EFI_STATUS always returns EFI_SUCCESS except EFI_ALREADY_STARTED if already started.\r
+\r
+--*/\r
+{\r
+ EFI_STATUS Status;\r
+\r
+ mRT = SystemTable->RuntimeServices;\r
+\r
+ //\r
+ // Register our ExitBootServices () notify function\r
+ //\r
+ Status = gBS->CreateEvent (\r
+ EFI_EVENT_SIGNAL_EXIT_BOOT_SERVICES,\r
+ EFI_TPL_NOTIFY,\r
+ RuntimeDriverExitBootServices,\r
+ NULL,\r
+ &mRuntimeNotifyEvent\r
+ );\r
+\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ //\r
+ // Register SetVirtualAddressMap () notify function\r
+ // \r
+ Status = gBS->CreateEvent (\r
+ EFI_EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE,\r
+ EFI_TPL_NOTIFY,\r
+ RuntimeLibVirtualNotifyEvent,\r
+ NULL,\r
+ &mEfiVirtualNotifyEvent\r
+ );\r
+\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+RuntimeDriverLibDeconstruct (\r
+ VOID\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ This routine will free some resources which have been allocated in\r
+ EfiInitializeRuntimeDriverLib(). If a runtime driver exits with an error, \r
+ it must call this routine to free the allocated resource before the exiting.\r
+\r
+Arguments:\r
+\r
+ None\r
+\r
+Returns: \r
+\r
+ EFI_SUCCESS - Shotdown the Runtime Driver Lib successfully\r
+ EFI_UNSUPPORTED - Runtime Driver lib was not initialized at all\r
+\r
+--*/\r
+{\r
+ EFI_STATUS Status;\r
+\r
+ //\r
+ // Close our ExitBootServices () notify function\r
+ //\r
+ Status = gBS->CloseEvent (mRuntimeNotifyEvent);\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ //\r
+ // Close SetVirtualAddressMap () notify function\r
+ //\r
+ Status = gBS->CloseEvent (mEfiVirtualNotifyEvent);\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+BOOLEAN\r
+EfiAtRuntime (\r
+ VOID\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+ Return TRUE if ExitBootServices () has been called\r
+\r
+Arguments:\r
+ NONE\r
+\r
+Returns: \r
+ TRUE - If ExitBootServices () has been called\r
+\r
+--*/\r
+{\r
+ return mEfiAtRuntime;\r
+}\r
+\r
+BOOLEAN\r
+EfiGoneVirtual (\r
+ VOID\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+ Return TRUE if SetVirtualAddressMap () has been called\r
+\r
+Arguments:\r
+ NONE\r
+\r
+Returns: \r
+ TRUE - If SetVirtualAddressMap () has been called\r
+\r
+--*/\r
+{\r
+ return mEfiGoneVirtual;\r
+}\r
+\r
--- /dev/null
+/*++\r
+\r
+Copyright (c) 2006, Intel Corporation \r
+All rights reserved. This program and the accompanying materials \r
+are licensed and made available under the terms and conditions of the BSD License \r
+which accompanies this distribution. The full text of the license may be found at \r
+http://opensource.org/licenses/bsd-license.php \r
+ \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+\r
+Module Name:\r
+\r
+ RuntimeService.c\r
+\r
+Abstract:\r
+\r
+ Light weight lib to support Tiano drivers.\r
+\r
+--*/\r
+\r
+#include <RuntimeLibInternal.h>\r
+\r
+VOID\r
+EfiResetSystem (\r
+ IN EFI_RESET_TYPE ResetType,\r
+ IN EFI_STATUS ResetStatus,\r
+ IN UINTN DataSize,\r
+ IN CHAR16 *ResetData\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Resets the entire platform.\r
+\r
+Arguments:\r
+\r
+ ResetType - The type of reset to perform.\r
+ ResetStatus - The status code for the reset.\r
+ DataSize - The size, in bytes, of ResetData.\r
+ ResetData - A data buffer that includes a Null-terminated Unicode string, optionally\r
+ followed by additional binary data.\r
+\r
+Returns:\r
+\r
+ None\r
+\r
+--*/\r
+{\r
+ mRT->ResetSystem (ResetType, ResetStatus, DataSize, ResetData);\r
+}\r
+\r
+//\r
+// The following functions hide the mRT local global from the call to\r
+// runtime service in the EFI system table.\r
+//\r
+EFI_STATUS\r
+EfiGetTime (\r
+ OUT EFI_TIME *Time,\r
+ OUT EFI_TIME_CAPABILITIES *Capabilities\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Returns the current time and date information, and the time-keeping \r
+ capabilities of the hardware platform.\r
+\r
+Arguments:\r
+\r
+ Time - A pointer to storage to receive a snapshot of the current time.\r
+ Capabilities - An optional pointer to a buffer to receive the real time clock device¡¯s\r
+ capabilities.\r
+\r
+Returns:\r
+\r
+ Status code\r
+\r
+--*/\r
+{\r
+ return mRT->GetTime (Time, Capabilities);\r
+}\r
+\r
+EFI_STATUS\r
+EfiSetTime (\r
+ IN EFI_TIME *Time\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Sets the current local time and date information.\r
+\r
+Arguments:\r
+\r
+ Time - A pointer to the current time.\r
+\r
+Returns:\r
+\r
+ Status code\r
+\r
+--*/\r
+{\r
+ return mRT->SetTime (Time);\r
+}\r
+\r
+EFI_STATUS\r
+EfiGetWakeupTime (\r
+ OUT BOOLEAN *Enabled,\r
+ OUT BOOLEAN *Pending,\r
+ OUT EFI_TIME *Time\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Returns the current wakeup alarm clock setting.\r
+\r
+Arguments:\r
+\r
+ Enabled - Indicates if the alarm is currently enabled or disabled.\r
+ Pending - Indicates if the alarm signal is pending and requires acknowledgement.\r
+ Time - The current alarm setting.\r
+\r
+Returns:\r
+\r
+ Status code\r
+\r
+--*/\r
+{\r
+ return mRT->GetWakeupTime (Enabled, Pending, Time);\r
+}\r
+\r
+EFI_STATUS\r
+EfiSetWakeupTime (\r
+ IN BOOLEAN Enable,\r
+ IN EFI_TIME *Time\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Sets the system wakeup alarm clock time.\r
+\r
+Arguments:\r
+\r
+ Enable - Enable or disable the wakeup alarm.\r
+ Time - If Enable is TRUE, the time to set the wakeup alarm for.\r
+ If Enable is FALSE, then this parameter is optional, and may be NULL.\r
+\r
+Returns:\r
+\r
+ Status code\r
+\r
+--*/\r
+{\r
+ return mRT->SetWakeupTime (Enable, Time);\r
+}\r
+\r
+\r
+\r
+\r
+EFI_STATUS\r
+EfiGetVariable (\r
+ IN CHAR16 *VariableName,\r
+ IN EFI_GUID * VendorGuid,\r
+ OUT UINT32 *Attributes OPTIONAL,\r
+ IN OUT UINTN *DataSize,\r
+ OUT VOID *Data\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Returns the value of a variable.\r
+\r
+Arguments:\r
+\r
+ VariableName - A Null-terminated Unicode string that is the name of the\r
+ vendor¡¯s variable.\r
+ VendorGuid - A unique identifier for the vendor.\r
+ Attributes - If not NULL, a pointer to the memory location to return the\r
+ attributes bitmask for the variable.\r
+ DataSize - On input, the size in bytes of the return Data buffer.\r
+ On output the size of data returned in Data.\r
+ Data - The buffer to return the contents of the variable.\r
+\r
+Returns:\r
+\r
+ Status code\r
+\r
+--*/\r
+{\r
+ return mRT->GetVariable (VariableName, VendorGuid, Attributes, DataSize, Data);\r
+}\r
+\r
+EFI_STATUS\r
+EfiGetNextVariableName (\r
+ IN OUT UINTN *VariableNameSize,\r
+ IN OUT CHAR16 *VariableName,\r
+ IN OUT EFI_GUID *VendorGuid\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Enumerates the current variable names.\r
+\r
+Arguments:\r
+\r
+ VariableNameSize - The size of the VariableName buffer.\r
+ VariableName - On input, supplies the last VariableName that was returned\r
+ by GetNextVariableName(). \r
+ On output, returns the Nullterminated Unicode string of the\r
+ current variable.\r
+ VendorGuid - On input, supplies the last VendorGuid that was returned by\r
+ GetNextVariableName(). \r
+ On output, returns the VendorGuid of the current variable.\r
+\r
+Returns:\r
+\r
+ Status code\r
+\r
+--*/\r
+{\r
+ return mRT->GetNextVariableName (VariableNameSize, VariableName, VendorGuid);\r
+}\r
+\r
+EFI_STATUS\r
+EfiSetVariable (\r
+ IN CHAR16 *VariableName,\r
+ IN EFI_GUID *VendorGuid,\r
+ IN UINT32 Attributes,\r
+ IN UINTN DataSize,\r
+ IN VOID *Data\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Sets the value of a variable.\r
+\r
+Arguments:\r
+\r
+ VariableName - A Null-terminated Unicode string that is the name of the\r
+ vendor¡¯s variable.\r
+ VendorGuid - A unique identifier for the vendor.\r
+ Attributes - Attributes bitmask to set for the variable.\r
+ DataSize - The size in bytes of the Data buffer.\r
+ Data - The contents for the variable.\r
+\r
+Returns:\r
+\r
+ Status code\r
+\r
+--*/\r
+{\r
+ return mRT->SetVariable (VariableName, VendorGuid, Attributes, DataSize, Data);\r
+}\r
+\r
+EFI_STATUS\r
+EfiGetNextHighMonotonicCount (\r
+ OUT UINT32 *HighCount\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Returns the next high 32 bits of the platform¡¯s monotonic counter.\r
+\r
+Arguments:\r
+\r
+ HighCount - Pointer to returned value.\r
+\r
+Returns:\r
+\r
+ Status code\r
+\r
+--*/\r
+{\r
+ return mRT->GetNextHighMonotonicCount (HighCount);\r
+}\r
+\r
+EFI_STATUS\r
+EfiConvertPointer (\r
+ IN UINTN DebugDisposition,\r
+ IN OUT VOID *Address\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Determines the new virtual address that is to be used on subsequent memory accesses.\r
+\r
+Arguments:\r
+\r
+ DebugDisposition - Supplies type information for the pointer being converted.\r
+ Address - A pointer to a pointer that is to be fixed to be the value needed\r
+ for the new virtual address mappings being applied.\r
+\r
+Returns:\r
+\r
+ Status code\r
+\r
+--*/\r
+{\r
+ return mRT->ConvertPointer (DebugDisposition, Address);\r
+}\r
+\r
+EFI_STATUS\r
+EfiConvertInternalPointer (\r
+ IN OUT VOID *Address\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Call EfiConvertPointer() to convert internal pointer.\r
+\r
+Arguments:\r
+\r
+ Address - A pointer to a pointer that is to be fixed to be the value needed\r
+ for the new virtual address mappings being applied.\r
+\r
+Returns:\r
+\r
+ Status code\r
+\r
+--*/\r
+{\r
+ return EfiConvertPointer (0x0, Address);\r
+}\r
+\r
+EFI_STATUS\r
+EfiConvertList (\r
+ IN UINTN DebugDisposition,\r
+ IN OUT LIST_ENTRY *ListHead\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Conver the standard Lib double linked list to a virtual mapping.\r
+\r
+Arguments:\r
+\r
+ DebugDisposition - Argument to EfiConvertPointer (EFI 1.0 API)\r
+\r
+ ListHead - Head of linked list to convert\r
+\r
+Returns: \r
+\r
+ EFI_SUCCESS\r
+\r
+--*/\r
+{\r
+ LIST_ENTRY *Link;\r
+ LIST_ENTRY *NextLink;\r
+\r
+ //\r
+ // Convert all the ForwardLink & BackLink pointers in the list\r
+ //\r
+ Link = ListHead;\r
+ do {\r
+ NextLink = Link->ForwardLink;\r
+\r
+ EfiConvertPointer (\r
+ Link->ForwardLink == ListHead ? DebugDisposition : 0,\r
+ (VOID **) &Link->ForwardLink\r
+ );\r
+\r
+ EfiConvertPointer (\r
+ Link->BackLink == ListHead ? DebugDisposition : 0,\r
+ (VOID **) &Link->BackLink\r
+ );\r
+\r
+ Link = NextLink;\r
+ } while (Link != ListHead);\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+\r
+/**\r
+ Change the runtime addressing mode of EFI firmware from physical to virtual.\r
+\r
+ @param MemoryMapSize The size in bytes of VirtualMap.\r
+ @param DescriptorSize The size in bytes of an entry in the VirtualMap.\r
+ @param DescriptorVersion The version of the structure entries in VirtualMap.\r
+ @param VirtualMap An array of memory descriptors which contain new virtual\r
+ address mapping information for all runtime ranges. Type\r
+ EFI_MEMORY_DESCRIPTOR is defined in the\r
+ GetMemoryMap() function description.\r
+\r
+ @retval EFI_SUCCESS The virtual address map has been applied.\r
+ @retval EFI_UNSUPPORTED EFI firmware is not at runtime, or the EFI firmware is already in\r
+ virtual address mapped mode.\r
+ @retval EFI_INVALID_PARAMETER DescriptorSize or DescriptorVersion is\r
+ invalid.\r
+ @retval EFI_NO_MAPPING A virtual address was not supplied for a range in the memory\r
+ map that requires a mapping.\r
+ @retval EFI_NOT_FOUND A virtual address was supplied for an address that is not found\r
+ in the memory map.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+EfiSetVirtualAddressMap (\r
+ IN UINTN MemoryMapSize,\r
+ IN UINTN DescriptorSize,\r
+ IN UINT32 DescriptorVersion,\r
+ IN CONST EFI_MEMORY_DESCRIPTOR *VirtualMap\r
+ )\r
+{\r
+ return mRT->SetVirtualAddressMap (\r
+ MemoryMapSize,\r
+ DescriptorSize,\r
+ DescriptorVersion,\r
+ (EFI_MEMORY_DESCRIPTOR *) VirtualMap\r
+ );\r
+}\r
+\r
+\r
+EFI_STATUS\r
+EfiUpdateCapsule (\r
+ IN UEFI_CAPSULE_HEADER **CapsuleHeaderArray,\r
+ IN UINTN CapsuleCount,\r
+ IN EFI_PHYSICAL_ADDRESS ScatterGatherList OPTIONAL\r
+ )\r
+{\r
+#if (EFI_SPECIFICATION_VERSION >= 0x00020000)\r
+ return mRT->UpdateCapsule (\r
+ CapsuleHeaderArray,\r
+ CapsuleCount,\r
+ ScatterGatherList\r
+ );\r
+#else\r
+ return EFI_UNSUPPORTED;\r
+#endif\r
+}\r
+\r
+EFI_STATUS\r
+EfiQueryCapsuleCapabilities (\r
+ IN UEFI_CAPSULE_HEADER **CapsuleHeaderArray,\r
+ IN UINTN CapsuleCount,\r
+ OUT UINT64 *MaximumCapsuleSize,\r
+ OUT EFI_RESET_TYPE *ResetType\r
+ )\r
+{\r
+#if (EFI_SPECIFICATION_VERSION >= 0x00020000)\r
+ return mRT->QueryCapsuleCapabilities (\r
+ CapsuleHeaderArray,\r
+ CapsuleCount,\r
+ MaximumCapsuleSize,\r
+ ResetType\r
+ );\r
+#else\r
+ return EFI_UNSUPPORTED;\r
+#endif\r
+}\r
+\r
+\r
+EFI_STATUS\r
+EfiQueryVariableInfo (\r
+ IN UINT32 Attributes,\r
+ OUT UINT64 *MaximumVariableStorageSize,\r
+ OUT UINT64 *RemainingVariableStorageSize,\r
+ OUT UINT64 *MaximumVariableSize\r
+ )\r
+{\r
+#if (EFI_SPECIFICATION_VERSION >= 0x00020000)\r
+ return mRT->QueryVariableInfo (\r
+ Attributes,\r
+ MaximumVariableStorageSize,\r
+ RemainingVariableStorageSize,\r
+ MaximumVariableSize\r
+ );\r
+#else \r
+ return EFI_UNSUPPORTED;\r
+#endif\r
+}\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<!--\r
+Copyright (c) 2006, Intel Corporation\r
+All rights reserved. This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution. The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+-->\r
+<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">\r
+ <MsaHeader>\r
+ <ModuleName>EdkUefiRuntimeLib</ModuleName>\r
+ <ModuleType>DXE_DRIVER</ModuleType>\r
+ <GuidValue>b1ee6c28-54aa-4d17-b705-3e28ccb27b2e</GuidValue>\r
+ <Version>1.0</Version>\r
+ <Abstract>Runtime driver library</Abstract>\r
+ <Description>\r
+ Instance of runtime driver library, Hook VitualAddressChange and \r
+ BooterviceExit event and provide runtime service.\r
+ </Description>\r
+ <Copyright>Copyright (c) 2006, Intel Corporation.</Copyright>\r
+ <License>All rights reserved. This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>\r
+ <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>\r
+ </MsaHeader>\r
+ <ModuleDefinitions>\r
+ <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>\r
+ <BinaryModule>false</BinaryModule>\r
+ <OutputFileBasename>EdkUefiRuntimeLib</OutputFileBasename>\r
+ </ModuleDefinitions>\r
+ <LibraryClassDefinitions>\r
+ <LibraryClass Usage="ALWAYS_PRODUCED">\r
+ <Keyword>UefiRuntimeLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>UefiLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>BaseLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>DebugLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>UefiBootServicesTableLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>EdkDxeSalLib</Keyword>\r
+ </LibraryClass>\r
+ </LibraryClassDefinitions>\r
+ <SourceFiles>\r
+ <Filename>RuntimeLibInternal.h</Filename>\r
+ <Filename SupArchList="IA32">Common/RuntimeLib.c</Filename>\r
+ <Filename SupArchList="IA32">Common/RuntimeService.c</Filename>\r
+ <Filename SupArchList="X64">Common/RuntimeLib.c</Filename>\r
+ <Filename SupArchList="X64">Common/RuntimeService.c</Filename>\r
+ <Filename SupArchList="IPF">Ipf/RuntimeLib.c</Filename>\r
+ <Filename SupArchList="IPF">Ipf/RuntimeService.c</Filename>\r
+ </SourceFiles>\r
+ <PackageDependencies>\r
+ <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
+ <Package PackageGuid="B6EC423C-21D2-490D-85C6-DD5864EAA674"/>\r
+ </PackageDependencies>\r
+ <Protocols>\r
+ <Protocol Usage="ALWAYS_CONSUMED">\r
+ <ProtocolCName>gEfiExtendedSalBootServiceProtocolGuid</ProtocolCName>\r
+ </Protocol>\r
+ </Protocols>\r
+ <Externs>\r
+ <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>\r
+ <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>\r
+ <Extern>\r
+ <Constructor>RuntimeDriverLibConstruct</Constructor>\r
+ <Destructor>RuntimeDriverLibDeconstruct</Destructor>\r
+ </Extern>\r
+ <Extern>\r
+ <Constructor>RuntimeDriverLibConstruct</Constructor>\r
+ <Destructor>RuntimeDriverLibDeconstruct</Destructor>\r
+ </Extern>\r
+ </Externs>\r
+</ModuleSurfaceArea>
\ No newline at end of file
--- /dev/null
+/*++\r
+\r
+Copyright (c) 2006, Intel Corporation \r
+All rights reserved. This program and the accompanying materials \r
+are licensed and made available under the terms and conditions of the BSD License \r
+which accompanies this distribution. The full text of the license may be found at \r
+http://opensource.org/licenses/bsd-license.php \r
+ \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+\r
+Module Name:\r
+\r
+ RuntimeLib.c\r
+\r
+Abstract:\r
+\r
+ Light weight lib to support Tiano drivers.\r
+\r
+--*/\r
+\r
+#include <SalApi.h>\r
+#include <RuntimeLibInternal.h>\r
+\r
+//\r
+// Driver Lib Module Globals\r
+//\r
+\r
+STATIC EFI_EVENT mRuntimeNotifyEvent;\r
+STATIC EFI_EVENT mEfiVirtualNotifyEvent;\r
+\r
+STATIC EFI_PLABEL mPlabel;\r
+STATIC EXTENDED_SAL_BOOT_SERVICE_PROTOCOL *mEsalBootService;\r
+\r
+EFI_RUNTIME_SERVICES *mRT = NULL;\r
+\r
+STATIC\r
+VOID\r
+EFIAPI\r
+RuntimeDriverExitBootServices (\r
+ IN EFI_EVENT Event,\r
+ IN VOID *Context\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Set AtRuntime flag as TRUE after ExitBootServices\r
+\r
+Arguments:\r
+\r
+ Event - The Event that is being processed\r
+ \r
+ Context - Event Context\r
+\r
+Returns: \r
+\r
+ None\r
+\r
+--*/\r
+{\r
+ EFI_EVENT_NOTIFY ChildNotifyEventHandler;\r
+ UINTN Index;\r
+\r
+ for (Index = 0; _gDriverExitBootServicesEvent[Index] != NULL; Index++) {\r
+ ChildNotifyEventHandler = _gDriverExitBootServicesEvent[Index];\r
+ ChildNotifyEventHandler (Event, NULL);\r
+ }\r
+}\r
+\r
+STATIC\r
+VOID\r
+EFIAPI\r
+RuntimeLibVirtualNotifyEvent (\r
+ IN EFI_EVENT Event,\r
+ IN VOID *Context\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Fixup internal data so that EFI can be call in virtual mode.\r
+ Call the passed in Child Notify event and convert any pointers in \r
+ lib to virtual mode.\r
+\r
+Arguments:\r
+\r
+ Event - The Event that is being processed\r
+ \r
+ Context - Event Context\r
+\r
+Returns: \r
+\r
+ None\r
+\r
+--*/\r
+{\r
+ UINTN Index;\r
+ EFI_EVENT_NOTIFY ChildNotifyEventHandler;\r
+\r
+ for (Index = 0; _gDriverSetVirtualAddressMapEvent[Index] != NULL; Index++) {\r
+ ChildNotifyEventHandler = _gDriverSetVirtualAddressMapEvent[Index];\r
+ ChildNotifyEventHandler (Event, NULL);\r
+ }\r
+\r
+ mRT->ConvertPointer (0x0, (VOID **) &mPlabel.EntryPoint);\r
+ mRT->ConvertPointer (EFI_IPF_GP_POINTER, (VOID **) &mPlabel.GP);\r
+\r
+ SetEsalVirtualEntryPoint (mPlabel.EntryPoint, mPlabel.GP);\r
+\r
+ //\r
+ // Clear out BootService globals\r
+ //\r
+ gBS = NULL;\r
+ gST = NULL;\r
+ mRT = NULL;\r
+}\r
+\r
+EFI_STATUS\r
+RuntimeDriverLibConstruct (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Intialize runtime Driver Lib if it has not yet been initialized. \r
+\r
+Arguments:\r
+\r
+ ImageHandle - The firmware allocated handle for the EFI image.\r
+ \r
+ SystemTable - A pointer to the EFI System Table.\r
+\r
+ GoVirtualChildEvent - Caller can register a virtual notification event.\r
+\r
+Returns: \r
+\r
+ EFI_STATUS always returns EFI_SUCCESS except EFI_ALREADY_STARTED if already started.\r
+\r
+--*/\r
+{\r
+ EFI_PLABEL *Plabel;\r
+ EFI_STATUS Status;\r
+\r
+ mRT = SystemTable->RuntimeServices;\r
+\r
+ //\r
+ // The protocol contains a function pointer, which is an indirect procedure call.\r
+ // An indirect procedure call goes through a plabel, and pointer to a function is\r
+ // a pointer to a plabel. To implement indirect procedure calls that can work in\r
+ // both physical and virtual mode, two plabels are required (one physical and one\r
+ // virtual). So lets grap the physical PLABEL for the EsalEntryPoint and store it\r
+ // away. We cache it in a module global, so we can register the vitrual version.\r
+ //\r
+ Status = gBS->LocateProtocol (&gEfiExtendedSalBootServiceProtocolGuid, NULL, &mEsalBootService);\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ Plabel = (EFI_PLABEL *) (UINTN) mEsalBootService->ExtendedSalProc;\r
+\r
+ mPlabel.EntryPoint = Plabel->EntryPoint;\r
+ mPlabel.GP = Plabel->GP;\r
+\r
+ SetEsalPhysicalEntryPoint (mPlabel.EntryPoint, mPlabel.GP);\r
+\r
+ //\r
+ // Register our ExitBootServices () notify function\r
+ //\r
+\r
+ Status = gBS->CreateEvent (\r
+ EFI_EVENT_SIGNAL_EXIT_BOOT_SERVICES,\r
+ EFI_TPL_NOTIFY,\r
+ RuntimeDriverExitBootServices,\r
+ NULL,\r
+ &mRuntimeNotifyEvent\r
+ );\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ //\r
+ // Register SetVirtualAddressMap () notify function\r
+ //\r
+ \r
+ Status = gBS->CreateEvent (\r
+ EFI_EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE,\r
+ EFI_TPL_NOTIFY,\r
+ RuntimeLibVirtualNotifyEvent,\r
+ NULL,\r
+ mEfiVirtualNotifyEvent\r
+ );\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+RuntimeDriverLibDeconstruct (\r
+ VOID\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ This routine will free some resources which have been allocated in\r
+ EfiInitializeRuntimeDriverLib(). If a runtime driver exits with an error, \r
+ it must call this routine to free the allocated resource before the exiting.\r
+\r
+Arguments:\r
+\r
+ None\r
+\r
+Returns: \r
+\r
+ EFI_SUCCESS - Shotdown the Runtime Driver Lib successfully\r
+ EFI_UNSUPPORTED - Runtime Driver lib was not initialized at all\r
+\r
+--*/\r
+{\r
+ EFI_STATUS Status;\r
+\r
+ //\r
+ // Close our ExitBootServices () notify function\r
+ //\r
+ Status = gBS->CloseEvent (mRuntimeNotifyEvent);\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ //\r
+ // Close SetVirtualAddressMap () notify function\r
+ //\r
+ Status = gBS->CloseEvent (mEfiVirtualNotifyEvent);\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+BOOLEAN\r
+EfiAtRuntime (\r
+ VOID\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+ Return TRUE if ExitBootService () has been called\r
+\r
+Arguments:\r
+ NONE\r
+\r
+Returns: \r
+ TRUE - If ExitBootService () has been called\r
+\r
+--*/\r
+{\r
+ EFI_GUID Guid = EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID;\r
+ SAL_RETURN_REGS ReturnReg;\r
+\r
+ ReturnReg = EfiCallEsalService (&Guid, IsEfiRuntime, 0, 0, 0, 0, 0, 0, 0);\r
+\r
+ return (BOOLEAN) (ReturnReg.r9 == 1);\r
+}\r
+\r
+BOOLEAN\r
+EfiGoneVirtual (\r
+ VOID\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+ Return TRUE if SetVirtualAddressMap () has been called\r
+\r
+Arguments:\r
+ NONE\r
+\r
+Returns: \r
+ TRUE - If SetVirtualAddressMap () has been called\r
+\r
+--*/\r
+{\r
+ EFI_GUID Guid = EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID;\r
+ SAL_RETURN_REGS ReturnReg;\r
+\r
+ ReturnReg = EfiCallEsalService (&Guid, IsVirtual, 0, 0, 0, 0, 0, 0, 0);\r
+\r
+ return (BOOLEAN) (ReturnReg.r9 == 1);\r
+}\r
--- /dev/null
+/*++\r
+\r
+Copyright (c) 2006, Intel Corporation \r
+All rights reserved. This program and the accompanying materials \r
+are licensed and made available under the terms and conditions of the BSD License \r
+which accompanies this distribution. The full text of the license may be found at \r
+http://opensource.org/licenses/bsd-license.php \r
+ \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+\r
+Module Name:\r
+\r
+ RuntimeService.c\r
+\r
+Abstract:\r
+\r
+ Light weight lib to support Tiano drivers.\r
+\r
+--*/\r
+\r
+#include <RuntimeLibInternal.h>\r
+\r
+VOID\r
+EfiResetSystem (\r
+ IN EFI_RESET_TYPE ResetType,\r
+ IN EFI_STATUS ResetStatus,\r
+ IN UINTN DataSize,\r
+ IN CHAR16 *ResetData\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Resets the entire platform.\r
+\r
+Arguments:\r
+\r
+ ResetType - The type of reset to perform.\r
+ ResetStatus - The status code for the reset.\r
+ DataSize - The size, in bytes, of ResetData.\r
+ ResetData - A data buffer that includes a Null-terminated Unicode string, optionally\r
+ followed by additional binary data.\r
+\r
+Returns:\r
+\r
+ None\r
+\r
+--*/\r
+{\r
+ EFI_GUID Guid = EFI_EXTENDED_SAL_RESET_SERVICES_PROTOCOL_GUID;\r
+\r
+ EfiCallEsalService (\r
+ &Guid,\r
+ ResetSystem,\r
+ (UINT64) ResetType,\r
+ (UINT64) ResetStatus,\r
+ (UINT64) DataSize,\r
+ (UINT64) ResetData,\r
+ 0,\r
+ 0,\r
+ 0\r
+ );\r
+}\r
+\r
+\r
+//\r
+// The following functions hide the mRT local global from the call to\r
+// runtime service in the EFI system table.\r
+//\r
+EFI_STATUS\r
+EfiGetTime (\r
+ OUT EFI_TIME *Time,\r
+ OUT EFI_TIME_CAPABILITIES *Capabilities\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Returns the current time and date information, and the time-keeping \r
+ capabilities of the hardware platform.\r
+\r
+Arguments:\r
+\r
+ Time - A pointer to storage to receive a snapshot of the current time.\r
+ Capabilities - An optional pointer to a buffer to receive the real time clock device¡¯s\r
+ capabilities.\r
+\r
+Returns:\r
+\r
+ Status code\r
+\r
+--*/\r
+{\r
+ SAL_RETURN_REGS ReturnReg;\r
+ EFI_GUID Guid = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID;\r
+\r
+ ReturnReg = EfiCallEsalService (&Guid, GetTime, (UINT64) Time, (UINT64) Capabilities, 0, 0, 0, 0, 0);\r
+ return ReturnReg.Status;\r
+}\r
+\r
+EFI_STATUS\r
+EfiSetTime (\r
+ IN EFI_TIME *Time\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Sets the current local time and date information.\r
+\r
+Arguments:\r
+\r
+ Time - A pointer to the current time.\r
+\r
+Returns:\r
+\r
+ Status code\r
+\r
+--*/\r
+{\r
+ SAL_RETURN_REGS ReturnReg;\r
+\r
+ EFI_GUID Guid = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID;\r
+\r
+ ReturnReg = EfiCallEsalService (&Guid, SetTime, (UINT64) Time, 0, 0, 0, 0, 0, 0);\r
+ return ReturnReg.Status;\r
+}\r
+\r
+EFI_STATUS\r
+EfiGetWakeupTime (\r
+ OUT BOOLEAN *Enabled,\r
+ OUT BOOLEAN *Pending,\r
+ OUT EFI_TIME *Time\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Returns the current wakeup alarm clock setting.\r
+\r
+Arguments:\r
+\r
+ Enabled - Indicates if the alarm is currently enabled or disabled.\r
+ Pending - Indicates if the alarm signal is pending and requires acknowledgement.\r
+ Time - The current alarm setting.\r
+\r
+Returns:\r
+\r
+ Status code\r
+\r
+--*/\r
+{\r
+ SAL_RETURN_REGS ReturnReg;\r
+\r
+ EFI_GUID Guid = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID;\r
+\r
+ ReturnReg = EfiCallEsalService (&Guid, GetWakeupTime, (UINT64) Enabled, (UINT64) Pending, (UINT64) Time, 0, 0, 0, 0);\r
+ return ReturnReg.Status;\r
+}\r
+\r
+EFI_STATUS\r
+EfiSetWakeupTime (\r
+ IN BOOLEAN Enable,\r
+ IN EFI_TIME *Time\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Sets the system wakeup alarm clock time.\r
+\r
+Arguments:\r
+\r
+ Enable - Enable or disable the wakeup alarm.\r
+ Time - If Enable is TRUE, the time to set the wakeup alarm for.\r
+ If Enable is FALSE, then this parameter is optional, and may be NULL.\r
+\r
+Returns:\r
+\r
+ Status code\r
+\r
+--*/\r
+{\r
+ SAL_RETURN_REGS ReturnReg;\r
+\r
+ EFI_GUID Guid = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID;\r
+\r
+ ReturnReg = EfiCallEsalService (&Guid, SetWakeupTime, (UINT64) Enable, (UINT64) Time, 0, 0, 0, 0, 0);\r
+ return ReturnReg.Status;\r
+}\r
+\r
+EFI_STATUS\r
+EfiGetVariable (\r
+ IN CHAR16 *VariableName,\r
+ IN EFI_GUID * VendorGuid,\r
+ OUT UINT32 *Attributes OPTIONAL,\r
+ IN OUT UINTN *DataSize,\r
+ OUT VOID *Data\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Returns the value of a variable.\r
+\r
+Arguments:\r
+\r
+ VariableName - A Null-terminated Unicode string that is the name of the\r
+ vendor¡¯s variable.\r
+ VendorGuid - A unique identifier for the vendor.\r
+ Attributes - If not NULL, a pointer to the memory location to return the\r
+ attributes bitmask for the variable.\r
+ DataSize - On input, the size in bytes of the return Data buffer.\r
+ On output the size of data returned in Data.\r
+ Data - The buffer to return the contents of the variable.\r
+\r
+Returns:\r
+\r
+ Status code\r
+\r
+--*/\r
+{\r
+ SAL_RETURN_REGS ReturnReg;\r
+ EFI_GUID Guid = EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID;\r
+\r
+ ReturnReg = EfiCallEsalService (\r
+ &Guid,\r
+ EsalGetVariable,\r
+ (UINT64) VariableName,\r
+ (UINT64) VendorGuid,\r
+ (UINT64) Attributes,\r
+ (UINT64) DataSize,\r
+ (UINT64) Data,\r
+ 0,\r
+ 0\r
+ );\r
+ return (EFI_STATUS) ReturnReg.Status;\r
+}\r
+\r
+EFI_STATUS\r
+EfiGetNextVariableName (\r
+ IN OUT UINTN *VariableNameSize,\r
+ IN OUT CHAR16 *VariableName,\r
+ IN OUT EFI_GUID *VendorGuid\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Enumerates the current variable names.\r
+\r
+Arguments:\r
+\r
+ VariableNameSize - The size of the VariableName buffer.\r
+ VariableName - On input, supplies the last VariableName that was returned\r
+ by GetNextVariableName(). \r
+ On output, returns the Nullterminated Unicode string of the\r
+ current variable.\r
+ VendorGuid - On input, supplies the last VendorGuid that was returned by\r
+ GetNextVariableName(). \r
+ On output, returns the VendorGuid of the current variable.\r
+\r
+Returns:\r
+\r
+ Status code\r
+\r
+--*/\r
+{\r
+ SAL_RETURN_REGS ReturnReg;\r
+ EFI_GUID Guid = EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID;\r
+\r
+ ReturnReg = EfiCallEsalService (\r
+ &Guid,\r
+ EsalGetNextVariableName,\r
+ (UINT64) VariableNameSize,\r
+ (UINT64) VariableName,\r
+ (UINT64) VendorGuid,\r
+ 0,\r
+ 0,\r
+ 0,\r
+ 0\r
+ );\r
+ return (EFI_STATUS) ReturnReg.Status;\r
+}\r
+\r
+EFI_STATUS\r
+EfiSetVariable (\r
+ IN CHAR16 *VariableName,\r
+ IN EFI_GUID *VendorGuid,\r
+ IN UINT32 Attributes,\r
+ IN UINTN DataSize,\r
+ IN VOID *Data\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Sets the value of a variable.\r
+\r
+Arguments:\r
+\r
+ VariableName - A Null-terminated Unicode string that is the name of the\r
+ vendor¡¯s variable.\r
+ VendorGuid - A unique identifier for the vendor.\r
+ Attributes - Attributes bitmask to set for the variable.\r
+ DataSize - The size in bytes of the Data buffer.\r
+ Data - The contents for the variable.\r
+\r
+Returns:\r
+\r
+ Status code\r
+\r
+--*/\r
+{\r
+ SAL_RETURN_REGS ReturnReg;\r
+ EFI_GUID Guid = EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID;\r
+\r
+ ReturnReg = EfiCallEsalService (\r
+ &Guid,\r
+ EsalSetVariable,\r
+ (UINT64) VariableName,\r
+ (UINT64) VendorGuid,\r
+ (UINT64) Attributes,\r
+ (UINT64) DataSize,\r
+ (UINT64) Data,\r
+ 0,\r
+ 0\r
+ );\r
+ return (EFI_STATUS) ReturnReg.Status;\r
+}\r
+\r
+EFI_STATUS\r
+EfiGetNextHighMonotonicCount (\r
+ OUT UINT32 *HighCount\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Returns the next high 32 bits of the platform¡¯s monotonic counter.\r
+\r
+Arguments:\r
+\r
+ HighCount - Pointer to returned value.\r
+\r
+Returns:\r
+\r
+ Status code\r
+\r
+--*/\r
+{\r
+ SAL_RETURN_REGS ReturnReg;\r
+\r
+ EFI_GUID Guid = EFI_EXTENDED_SAL_MTC_SERVICES_PROTOCOL_GUID;\r
+\r
+ ReturnReg = EfiCallEsalService (&Guid, GetNextHighMonotonicCount, (UINT64) HighCount, 0, 0, 0, 0, 0, 0);\r
+ return (EFI_STATUS) ReturnReg.Status;\r
+}\r
+\r
+EFI_STATUS\r
+EfiConvertPointer (\r
+ IN UINTN DebugDisposition,\r
+ IN OUT VOID *Address\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Determines the new virtual address that is to be used on subsequent memory accesses.\r
+\r
+Arguments:\r
+\r
+ DebugDisposition - Supplies type information for the pointer being converted.\r
+ Address - A pointer to a pointer that is to be fixed to be the value needed\r
+ for the new virtual address mappings being applied.\r
+\r
+Returns:\r
+\r
+ Status code\r
+\r
+--*/\r
+{\r
+ return mRT->ConvertPointer (DebugDisposition, Address);\r
+}\r
+\r
+EFI_STATUS\r
+EfiConvertList (\r
+ IN UINTN DebugDisposition,\r
+ IN OUT LIST_ENTRY *ListHead\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Conver the standard Lib double linked list to a virtual mapping.\r
+\r
+Arguments:\r
+\r
+ DebugDisposition - Argument to EfiConvertPointer (EFI 1.0 API)\r
+\r
+ ListHead - Head of linked list to convert\r
+\r
+Returns: \r
+\r
+ EFI_SUCCESS\r
+\r
+--*/\r
+{\r
+ LIST_ENTRY *Link;\r
+ LIST_ENTRY *NextLink;\r
+\r
+ //\r
+ // Convert all the ForwardLink & BackLink pointers in the list\r
+ //\r
+ Link = ListHead;\r
+ do {\r
+ NextLink = Link->ForwardLink;\r
+\r
+ EfiConvertPointer (\r
+ Link->ForwardLink == ListHead ? DebugDisposition : 0,\r
+ (VOID **) &Link->ForwardLink\r
+ );\r
+\r
+ EfiConvertPointer (\r
+ Link->BackLink == ListHead ? DebugDisposition : 0,\r
+ (VOID **) &Link->BackLink\r
+ );\r
+\r
+ Link = NextLink;\r
+ } while (Link != ListHead);\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+\r
+/**\r
+ Change the runtime addressing mode of EFI firmware from physical to virtual.\r
+\r
+ @param MemoryMapSize The size in bytes of VirtualMap.\r
+ @param DescriptorSize The size in bytes of an entry in the VirtualMap.\r
+ @param DescriptorVersion The version of the structure entries in VirtualMap.\r
+ @param VirtualMap An array of memory descriptors which contain new virtual\r
+ address mapping information for all runtime ranges. Type\r
+ EFI_MEMORY_DESCRIPTOR is defined in the\r
+ GetMemoryMap() function description.\r
+\r
+ @retval EFI_SUCCESS The virtual address map has been applied.\r
+ @retval EFI_UNSUPPORTED EFI firmware is not at runtime, or the EFI firmware is already in\r
+ virtual address mapped mode.\r
+ @retval EFI_INVALID_PARAMETER DescriptorSize or DescriptorVersion is\r
+ invalid.\r
+ @retval EFI_NO_MAPPING A virtual address was not supplied for a range in the memory\r
+ map that requires a mapping.\r
+ @retval EFI_NOT_FOUND A virtual address was supplied for an address that is not found\r
+ in the memory map.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+EfiSetVirtualAddressMap (\r
+ IN UINTN MemoryMapSize,\r
+ IN UINTN DescriptorSize,\r
+ IN UINT32 DescriptorVersion,\r
+ IN CONST EFI_MEMORY_DESCRIPTOR *VirtualMap\r
+ )\r
+{\r
+ SAL_RETURN_REGS ReturnReg;\r
+ EFI_GUID Guid = EFI_EXTENDED_SAL_VIRTUAL_SERVICES_PROTOCOL_GUID;\r
+\r
+ ReturnReg = EfiCallEsalService (\r
+ &Guid,\r
+ SetVirtualAddress,\r
+ (UINT64) MemoryMapSize,\r
+ (UINT64) DescriptorSize,\r
+ (UINT64) DescriptorVersion,\r
+ (UINT64) VirtualMap,\r
+ 0,\r
+ 0,\r
+ 0\r
+ );\r
+\r
+ return ReturnReg.Status;\r
+}\r
+\r
+\r
+EFI_STATUS\r
+EfiUpdateCapsule (\r
+ IN UEFI_CAPSULE_HEADER **CapsuleHeaderArray,\r
+ IN UINTN CapsuleCount,\r
+ IN EFI_PHYSICAL_ADDRESS ScatterGatherList OPTIONAL\r
+ )\r
+{\r
+ return EFI_UNSUPPORTED;\r
+}\r
+\r
+EFI_STATUS\r
+EfiQueryCapsuleCapabilities (\r
+ IN UEFI_CAPSULE_HEADER **CapsuleHeaderArray,\r
+ IN UINTN CapsuleCount,\r
+ OUT UINT64 *MaximumCapsuleSize,\r
+ OUT EFI_RESET_TYPE *ResetType\r
+ )\r
+{\r
+ return EFI_UNSUPPORTED;\r
+}\r
+\r
+\r
+EFI_STATUS\r
+EfiQueryVariableInfo (\r
+ IN UINT32 Attributes,\r
+ OUT UINT64 *MaximumVariableStorageSize,\r
+ OUT UINT64 *RemainingVariableStorageSize,\r
+ OUT UINT64 *MaximumVariableSize\r
+ )\r
+{\r
+ return EFI_UNSUPPORTED;\r
+}\r
--- /dev/null
+/*++\r
+\r
+Copyright (c) 2006, Intel Corporation \r
+All rights reserved. This program and the accompanying materials \r
+are licensed and made available under the terms and conditions of the BSD License \r
+which accompanies this distribution. The full text of the license may be found at \r
+http://opensource.org/licenses/bsd-license.php \r
+ \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+\r
+Module Name:\r
+\r
+ RuntimeLibInternal.h\r
+\r
+Abstract:\r
+\r
+--*/\r
+\r
+#ifndef __RUNTIMELIBINTERNAL_H__\r
+#define __RUNTIMELIBINTERNAL_H__\r
+\r
+EFI_STATUS\r
+EfiConvertInternalPointer (\r
+ IN OUT VOID *Address\r
+ );\r
+\r
+extern EFI_RUNTIME_SERVICES *mRT;\r
+\r
+#endif //__RUNTIMELIBINTERNAL_H__\r
<Keyword>DxeServicesTableLib</Keyword>\r
</LibraryClass>\r
<LibraryClass Usage="ALWAYS_CONSUMED">\r
- <Keyword>DxeRuntimeDriverLib</Keyword>\r
+ <Keyword>UefiRuntimeLib</Keyword>\r
</LibraryClass>\r
<LibraryClass Usage="ALWAYS_CONSUMED">\r
<Keyword>DebugLib</Keyword>\r
<Keyword>DebugLib</Keyword>\r
</LibraryClass>\r
<LibraryClass Usage="ALWAYS_CONSUMED">\r
- <Keyword>DxeRuntimeDriverLib</Keyword>\r
+ <Keyword>UefiRuntimeLib</Keyword>\r
</LibraryClass>\r
<LibraryClass Usage="ALWAYS_CONSUMED">\r
<Keyword>UefiDriverEntryPoint</Keyword>\r
<Keyword>UefiDriverEntryPoint</Keyword>\r
</LibraryClass>\r
<LibraryClass Usage="ALWAYS_CONSUMED">\r
- <Keyword>DxeRuntimeDriverLib</Keyword>\r
+ <Keyword>UefiRuntimeLib</Keyword>\r
</LibraryClass>\r
<LibraryClass Usage="ALWAYS_CONSUMED">\r
<Keyword>DebugLib</Keyword>\r
<Keyword>BaseLib</Keyword>\r
</LibraryClass>\r
<LibraryClass Usage="ALWAYS_CONSUMED">\r
- <Keyword>DxeRuntimeDriverLib</Keyword>\r
+ <Keyword>UefiRuntimeLib</Keyword>\r
</LibraryClass>\r
<LibraryClass Usage="ALWAYS_CONSUMED">\r
<Keyword>UefiDriverEntryPoint</Keyword>\r
<Keyword>BaseLib</Keyword>\r
</LibraryClass>\r
<LibraryClass Usage="ALWAYS_CONSUMED">\r
- <Keyword>DxeRuntimeDriverLib</Keyword>\r
+ <Keyword>UefiRuntimeLib</Keyword>\r
</LibraryClass>\r
<LibraryClass Usage="ALWAYS_CONSUMED">\r
<Keyword>UefiDriverEntryPoint</Keyword>\r
<Keyword>DxeServicesTableLib</Keyword>\r
</LibraryClass>\r
<LibraryClass Usage="ALWAYS_CONSUMED">\r
- <Keyword>DxeRuntimeDriverLib</Keyword>\r
+ <Keyword>UefiRuntimeLib</Keyword>\r
</LibraryClass>\r
<LibraryClass Usage="ALWAYS_CONSUMED">\r
<Keyword>DebugLib</Keyword>\r