diff options
Diffstat (limited to 'EdkModulePkg')
4 files changed, 81 insertions, 51 deletions
diff --git a/EdkModulePkg/Library/EdkDxeSalLib/EdkDxeSalLib.msa b/EdkModulePkg/Library/EdkDxeSalLib/EdkDxeSalLib.msa index a2e51f0..42a846d 100644 --- a/EdkModulePkg/Library/EdkDxeSalLib/EdkDxeSalLib.msa +++ b/EdkModulePkg/Library/EdkDxeSalLib/EdkDxeSalLib.msa @@ -26,11 +26,17 @@ <Keyword>EdkDxeSalLib</Keyword>
</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>BaseLib</Keyword>
+ </LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>DebugLib</Keyword>
</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>UefiBootServicesTableLib</Keyword>
</LibraryClass>
+ <LibraryClass Usage="ALWAYS_CONSUMED">
+ <Keyword>UefiRuntimeLib</Keyword>
+ </LibraryClass>
</LibraryClassDefinitions>
<SourceFiles>
<Filename SupArchList="IPF">Ipf/EsalServiceLib.c</Filename>
@@ -51,5 +57,8 @@ <Extern>
<Constructor>DxeSalLibConstruct</Constructor>
</Extern>
+ <Extern>
+ <SetVirtualAddressMapCallBack>DxeSalVirtualNotifyEvent</SetVirtualAddressMapCallBack>
+ </Extern>
</Externs>
</ModuleSurfaceArea>
\ No newline at end of file diff --git a/EdkModulePkg/Library/EdkDxeSalLib/Ipf/EsalServiceLib.c b/EdkModulePkg/Library/EdkDxeSalLib/Ipf/EsalServiceLib.c index 83b6aa2..2e0daeb 100644 --- a/EdkModulePkg/Library/EdkDxeSalLib/Ipf/EsalServiceLib.c +++ b/EdkModulePkg/Library/EdkDxeSalLib/Ipf/EsalServiceLib.c @@ -21,6 +21,7 @@ Abstract: STATIC EXTENDED_SAL_BOOT_SERVICE_PROTOCOL *mEsalBootService;
+STATIC EFI_PLABEL mPlabel;
EFI_STATUS
EFIAPI
@@ -29,14 +30,59 @@ DxeSalLibConstruct ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
-
- Status = gBS->LocateProtocol (&gEfiExtendedSalBootServiceProtocolGuid, NULL, &mEsalBootService);
+ EFI_PLABEL *Plabel;
+ EFI_STATUS Status;
+
+ //
+ // The protocol contains a function pointer, which is an indirect procedure call.
+ // An indirect procedure call goes through a plabel, and pointer to a function is
+ // a pointer to a plabel. To implement indirect procedure calls that can work in
+ // both physical and virtual mode, two plabels are required (one physical and one
+ // virtual). So lets grap the physical PLABEL for the EsalEntryPoint and store it
+ // away. We cache it in a module global, so we can register the vitrual version.
+ //
+ Status = gBS->LocateProtocol (&gEfiExtendedSalBootServiceProtocolGuid, NULL, &mEsalBootService);
ASSERT_EFI_ERROR (Status);
+ Plabel = (EFI_PLABEL *) (UINTN) mEsalBootService->ExtendedSalProc;
+
+ mPlabel.EntryPoint = Plabel->EntryPoint;
+ mPlabel.GP = Plabel->GP;
+ SetEsalPhysicalEntryPoint (mPlabel.EntryPoint, mPlabel.GP);
+
return Status;
}
+VOID
+EFIAPI
+DxeSalVirtualNotifyEvent (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+/*++
+
+Routine Description:
+
+ Fixup virtual address pointer of label.
+
+Arguments:
+
+ Event - The Event that is being processed
+
+ Context - Event Context
+
+Returns:
+
+ None
+
+--*/
+{
+ EfiConvertPointer (0x0, (VOID **) &mPlabel.EntryPoint);
+ EfiConvertPointer (EFI_IPF_GP_POINTER, (VOID **) &mPlabel.GP);
+
+ SetEsalVirtualEntryPoint (mPlabel.EntryPoint, mPlabel.GP);
+}
+
EFI_STATUS
EFIAPI
RegisterEsalFunction (
diff --git a/EdkModulePkg/Library/EdkUefiRuntimeLib/Ipf/RuntimeLib.c b/EdkModulePkg/Library/EdkUefiRuntimeLib/Ipf/RuntimeLib.c index 6399f67..3e95547 100644 --- a/EdkModulePkg/Library/EdkUefiRuntimeLib/Ipf/RuntimeLib.c +++ b/EdkModulePkg/Library/EdkUefiRuntimeLib/Ipf/RuntimeLib.c @@ -24,8 +24,6 @@ Module Name: STATIC EFI_EVENT mRuntimeNotifyEvent;
STATIC EFI_EVENT mEfiVirtualNotifyEvent;
-STATIC EFI_PLABEL mPlabel;
-STATIC EXTENDED_SAL_BOOT_SERVICE_PROTOCOL *mEsalBootService;
EFI_RUNTIME_SERVICES *mRT;
@@ -103,10 +101,10 @@ Returns: ChildNotifyEventHandler (Event, NULL);
}
- mRT->ConvertPointer (0x0, (VOID **) &mPlabel.EntryPoint);
- mRT->ConvertPointer (EFI_IPF_GP_POINTER, (VOID **) &mPlabel.GP);
-
- SetEsalVirtualEntryPoint (mPlabel.EntryPoint, mPlabel.GP);
+ //
+ // Update global for Runtime Services Table
+ //
+ EfiConvertPointer (0, (VOID **) &mRT);
}
EFI_STATUS
@@ -135,30 +133,11 @@ Returns: --*/
{
- EFI_PLABEL *Plabel;
EFI_STATUS Status;
mRT = SystemTable->RuntimeServices;
//
- // The protocol contains a function pointer, which is an indirect procedure call.
- // An indirect procedure call goes through a plabel, and pointer to a function is
- // a pointer to a plabel. To implement indirect procedure calls that can work in
- // both physical and virtual mode, two plabels are required (one physical and one
- // virtual). So lets grap the physical PLABEL for the EsalEntryPoint and store it
- // away. We cache it in a module global, so we can register the vitrual version.
- //
- Status = gBS->LocateProtocol (&gEfiExtendedSalBootServiceProtocolGuid, NULL, &mEsalBootService);
- ASSERT_EFI_ERROR (Status);
-
- Plabel = (EFI_PLABEL *) (UINTN) mEsalBootService->ExtendedSalProc;
-
- mPlabel.EntryPoint = Plabel->EntryPoint;
- mPlabel.GP = Plabel->GP;
-
- SetEsalPhysicalEntryPoint (mPlabel.EntryPoint, mPlabel.GP);
-
- //
// Register our ExitBootServices () notify function
//
diff --git a/EdkModulePkg/Library/EdkUefiRuntimeLib/Ipf/RuntimeService.c b/EdkModulePkg/Library/EdkUefiRuntimeLib/Ipf/RuntimeService.c index 159a53f..b4a56a2 100644 --- a/EdkModulePkg/Library/EdkUefiRuntimeLib/Ipf/RuntimeService.c +++ b/EdkModulePkg/Library/EdkUefiRuntimeLib/Ipf/RuntimeService.c @@ -91,7 +91,7 @@ Returns: --*/
{
SAL_RETURN_REGS ReturnReg;
- EFI_GUID Guid = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID;
+ EFI_GUID Guid = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID;
ReturnReg = EfiCallEsalService (&Guid, GetTime, (UINT64) Time, (UINT64) Capabilities, 0, 0, 0, 0, 0);
return ReturnReg.Status;
@@ -119,8 +119,7 @@ Returns: --*/
{
SAL_RETURN_REGS ReturnReg;
-
- EFI_GUID Guid = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID;
+ EFI_GUID Guid = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID;
ReturnReg = EfiCallEsalService (&Guid, SetTime, (UINT64) Time, 0, 0, 0, 0, 0, 0);
return ReturnReg.Status;
@@ -152,8 +151,7 @@ Returns: --*/
{
SAL_RETURN_REGS ReturnReg;
-
- EFI_GUID Guid = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID;
+ EFI_GUID Guid = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID;
ReturnReg = EfiCallEsalService (&Guid, GetWakeupTime, (UINT64) Enabled, (UINT64) Pending, (UINT64) Time, 0, 0, 0, 0);
return ReturnReg.Status;
@@ -184,8 +182,7 @@ Returns: --*/
{
SAL_RETURN_REGS ReturnReg;
-
- EFI_GUID Guid = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID;
+ EFI_GUID Guid = EFI_EXTENDED_SAL_RTC_SERVICES_PROTOCOL_GUID;
ReturnReg = EfiCallEsalService (&Guid, SetWakeupTime, (UINT64) Enable, (UINT64) Time, 0, 0, 0, 0, 0);
return ReturnReg.Status;
@@ -224,7 +221,7 @@ Returns: --*/
{
SAL_RETURN_REGS ReturnReg;
- EFI_GUID Guid = EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID;
+ EFI_GUID Guid = EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID;
ReturnReg = EfiCallEsalService (
&Guid,
@@ -271,7 +268,7 @@ Returns: --*/
{
SAL_RETURN_REGS ReturnReg;
- EFI_GUID Guid = EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID;
+ EFI_GUID Guid = EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID;
ReturnReg = EfiCallEsalService (
&Guid,
@@ -318,7 +315,7 @@ Returns: --*/
{
SAL_RETURN_REGS ReturnReg;
- EFI_GUID Guid = EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID;
+ EFI_GUID Guid = EFI_EXTENDED_SAL_VARIABLE_SERVICES_PROTOCOL_GUID;
ReturnReg = EfiCallEsalService (
&Guid,
@@ -356,8 +353,7 @@ Returns: --*/
{
SAL_RETURN_REGS ReturnReg;
-
- EFI_GUID Guid = EFI_EXTENDED_SAL_MTC_SERVICES_PROTOCOL_GUID;
+ EFI_GUID Guid = EFI_EXTENDED_SAL_MTC_SERVICES_PROTOCOL_GUID;
ReturnReg = EfiCallEsalService (&Guid, GetNextHighMonotonicCount, (UINT64) HighCount, 0, 0, 0, 0, 0, 0);
return (EFI_STATUS) ReturnReg.Status;
@@ -492,9 +488,9 @@ EfiSetVirtualAddressMap ( EFI_STATUS
EFIAPI
EfiUpdateCapsule (
- IN UEFI_CAPSULE_HEADER **CapsuleHeaderArray,
- IN UINTN CapsuleCount,
- IN EFI_PHYSICAL_ADDRESS ScatterGatherList OPTIONAL
+ IN UEFI_CAPSULE_HEADER **CapsuleHeaderArray,
+ IN UINTN CapsuleCount,
+ IN EFI_PHYSICAL_ADDRESS ScatterGatherList OPTIONAL
)
{
return EFI_UNSUPPORTED;
@@ -503,10 +499,10 @@ EfiUpdateCapsule ( EFI_STATUS
EFIAPI
EfiQueryCapsuleCapabilities (
- IN UEFI_CAPSULE_HEADER **CapsuleHeaderArray,
- IN UINTN CapsuleCount,
- OUT UINT64 *MaximumCapsuleSize,
- OUT EFI_RESET_TYPE *ResetType
+ IN UEFI_CAPSULE_HEADER **CapsuleHeaderArray,
+ IN UINTN CapsuleCount,
+ OUT UINT64 *MaximumCapsuleSize,
+ OUT EFI_RESET_TYPE *ResetType
)
{
return EFI_UNSUPPORTED;
@@ -516,10 +512,10 @@ EfiQueryCapsuleCapabilities ( EFI_STATUS
EFIAPI
EfiQueryVariableInfo (
- IN UINT32 Attributes,
- OUT UINT64 *MaximumVariableStorageSize,
- OUT UINT64 *RemainingVariableStorageSize,
- OUT UINT64 *MaximumVariableSize
+ IN UINT32 Attributes,
+ OUT UINT64 *MaximumVariableStorageSize,
+ OUT UINT64 *RemainingVariableStorageSize,
+ OUT UINT64 *MaximumVariableSize
)
{
return EFI_UNSUPPORTED;
|