Move SAL "initialization/virtual address change notification" from EdkUefiRuntimeLib to EdkDxeSalLib.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2009 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
yshang1 2006-11-24 06:02:46 +00:00
parent 9710b9a67c
commit c25aaa00aa
4 changed files with 80 additions and 50 deletions

View File

@ -25,12 +25,18 @@
<LibraryClass Usage="ALWAYS_PRODUCED"> <LibraryClass Usage="ALWAYS_PRODUCED">
<Keyword>EdkDxeSalLib</Keyword> <Keyword>EdkDxeSalLib</Keyword>
</LibraryClass> </LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>BaseLib</Keyword>
</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED"> <LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>DebugLib</Keyword> <Keyword>DebugLib</Keyword>
</LibraryClass> </LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED"> <LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>UefiBootServicesTableLib</Keyword> <Keyword>UefiBootServicesTableLib</Keyword>
</LibraryClass> </LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>UefiRuntimeLib</Keyword>
</LibraryClass>
</LibraryClassDefinitions> </LibraryClassDefinitions>
<SourceFiles> <SourceFiles>
<Filename SupArchList="IPF">Ipf/EsalServiceLib.c</Filename> <Filename SupArchList="IPF">Ipf/EsalServiceLib.c</Filename>
@ -51,5 +57,8 @@
<Extern> <Extern>
<Constructor>DxeSalLibConstruct</Constructor> <Constructor>DxeSalLibConstruct</Constructor>
</Extern> </Extern>
<Extern>
<SetVirtualAddressMapCallBack>DxeSalVirtualNotifyEvent</SetVirtualAddressMapCallBack>
</Extern>
</Externs> </Externs>
</ModuleSurfaceArea> </ModuleSurfaceArea>

View File

@ -21,6 +21,7 @@ Abstract:
STATIC EXTENDED_SAL_BOOT_SERVICE_PROTOCOL *mEsalBootService; STATIC EXTENDED_SAL_BOOT_SERVICE_PROTOCOL *mEsalBootService;
STATIC EFI_PLABEL mPlabel;
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
@ -29,14 +30,59 @@ DxeSalLibConstruct (
IN EFI_SYSTEM_TABLE *SystemTable IN EFI_SYSTEM_TABLE *SystemTable
) )
{ {
EFI_PLABEL *Plabel;
EFI_STATUS Status; 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); Status = gBS->LocateProtocol (&gEfiExtendedSalBootServiceProtocolGuid, NULL, &mEsalBootService);
ASSERT_EFI_ERROR (Status); 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; 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 EFI_STATUS
EFIAPI EFIAPI
RegisterEsalFunction ( RegisterEsalFunction (

View File

@ -24,8 +24,6 @@ Module Name:
STATIC EFI_EVENT mRuntimeNotifyEvent; STATIC EFI_EVENT mRuntimeNotifyEvent;
STATIC EFI_EVENT mEfiVirtualNotifyEvent; STATIC EFI_EVENT mEfiVirtualNotifyEvent;
STATIC EFI_PLABEL mPlabel;
STATIC EXTENDED_SAL_BOOT_SERVICE_PROTOCOL *mEsalBootService;
EFI_RUNTIME_SERVICES *mRT; EFI_RUNTIME_SERVICES *mRT;
@ -103,10 +101,10 @@ Returns:
ChildNotifyEventHandler (Event, NULL); ChildNotifyEventHandler (Event, NULL);
} }
mRT->ConvertPointer (0x0, (VOID **) &mPlabel.EntryPoint); //
mRT->ConvertPointer (EFI_IPF_GP_POINTER, (VOID **) &mPlabel.GP); // Update global for Runtime Services Table
//
SetEsalVirtualEntryPoint (mPlabel.EntryPoint, mPlabel.GP); EfiConvertPointer (0, (VOID **) &mRT);
} }
EFI_STATUS EFI_STATUS
@ -135,29 +133,10 @@ Returns:
--*/ --*/
{ {
EFI_PLABEL *Plabel;
EFI_STATUS Status; EFI_STATUS Status;
mRT = SystemTable->RuntimeServices; 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 // Register our ExitBootServices () notify function
// //

View File

@ -119,7 +119,6 @@ Returns:
--*/ --*/
{ {
SAL_RETURN_REGS ReturnReg; 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); ReturnReg = EfiCallEsalService (&Guid, SetTime, (UINT64) Time, 0, 0, 0, 0, 0, 0);
@ -152,7 +151,6 @@ Returns:
--*/ --*/
{ {
SAL_RETURN_REGS ReturnReg; 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); ReturnReg = EfiCallEsalService (&Guid, GetWakeupTime, (UINT64) Enabled, (UINT64) Pending, (UINT64) Time, 0, 0, 0, 0);
@ -184,7 +182,6 @@ Returns:
--*/ --*/
{ {
SAL_RETURN_REGS ReturnReg; 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); ReturnReg = EfiCallEsalService (&Guid, SetWakeupTime, (UINT64) Enable, (UINT64) Time, 0, 0, 0, 0, 0);
@ -356,7 +353,6 @@ Returns:
--*/ --*/
{ {
SAL_RETURN_REGS ReturnReg; 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); ReturnReg = EfiCallEsalService (&Guid, GetNextHighMonotonicCount, (UINT64) HighCount, 0, 0, 0, 0, 0, 0);