mirror of https://github.com/acidanthera/audk.git
ArmPlatformPkg/PL031RealTimeClockLib: use virtual address of runtime services
This library accesses SystemTable->RuntimeServices at runtime, which means it should take care to use its updated value after SetVirtualAddressMap () is called. Replace references to gRT with mRT, which we initialize to gRT and update to its virtual value on a virtual address change event. Contributed-under: TianoCore Contribution Agreement 1.0 Reviewed-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Olivier Martin <olivier.martin@arm.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16091 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
7a1e861e29
commit
259ea52b19
|
@ -1,8 +1,6 @@
|
||||||
/** @file
|
/** @file
|
||||||
Implement EFI RealTimeClock runtime services via RTC Lib.
|
Implement EFI RealTimeClock runtime services via RTC Lib.
|
||||||
|
|
||||||
Currently this driver does not support runtime virtual calling.
|
|
||||||
|
|
||||||
Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
|
Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
|
||||||
Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.<BR>
|
Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.<BR>
|
||||||
|
|
||||||
|
@ -40,11 +38,12 @@
|
||||||
|
|
||||||
#include <ArmPlatform.h>
|
#include <ArmPlatform.h>
|
||||||
|
|
||||||
STATIC CONST CHAR16 mTimeZoneVariableName[] = L"PL031RtcTimeZone";
|
STATIC CONST CHAR16 mTimeZoneVariableName[] = L"PL031RtcTimeZone";
|
||||||
STATIC CONST CHAR16 mDaylightVariableName[] = L"PL031RtcDaylight";
|
STATIC CONST CHAR16 mDaylightVariableName[] = L"PL031RtcDaylight";
|
||||||
STATIC BOOLEAN mPL031Initialized = FALSE;
|
STATIC BOOLEAN mPL031Initialized = FALSE;
|
||||||
STATIC EFI_EVENT mRtcVirtualAddrChangeEvent;
|
STATIC EFI_EVENT mRtcVirtualAddrChangeEvent;
|
||||||
STATIC UINTN mPL031RtcBase;
|
STATIC UINTN mPL031RtcBase;
|
||||||
|
STATIC EFI_RUNTIME_SERVICES *mRT;
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
IdentifyPL031 (
|
IdentifyPL031 (
|
||||||
|
@ -294,7 +293,7 @@ LibGetTime (
|
||||||
|
|
||||||
// Get the current time zone information from non-volatile storage
|
// Get the current time zone information from non-volatile storage
|
||||||
Size = sizeof (TimeZone);
|
Size = sizeof (TimeZone);
|
||||||
Status = gRT->GetVariable (
|
Status = mRT->GetVariable (
|
||||||
(CHAR16 *)mTimeZoneVariableName,
|
(CHAR16 *)mTimeZoneVariableName,
|
||||||
&gEfiCallerIdGuid,
|
&gEfiCallerIdGuid,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -312,7 +311,7 @@ LibGetTime (
|
||||||
// The time zone variable does not exist in non-volatile storage, so create it.
|
// The time zone variable does not exist in non-volatile storage, so create it.
|
||||||
Time->TimeZone = EFI_UNSPECIFIED_TIMEZONE;
|
Time->TimeZone = EFI_UNSPECIFIED_TIMEZONE;
|
||||||
// Store it
|
// Store it
|
||||||
Status = gRT->SetVariable (
|
Status = mRT->SetVariable (
|
||||||
(CHAR16 *)mTimeZoneVariableName,
|
(CHAR16 *)mTimeZoneVariableName,
|
||||||
&gEfiCallerIdGuid,
|
&gEfiCallerIdGuid,
|
||||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
||||||
|
@ -346,7 +345,7 @@ LibGetTime (
|
||||||
|
|
||||||
// Get the current daylight information from non-volatile storage
|
// Get the current daylight information from non-volatile storage
|
||||||
Size = sizeof (Daylight);
|
Size = sizeof (Daylight);
|
||||||
Status = gRT->GetVariable (
|
Status = mRT->GetVariable (
|
||||||
(CHAR16 *)mDaylightVariableName,
|
(CHAR16 *)mDaylightVariableName,
|
||||||
&gEfiCallerIdGuid,
|
&gEfiCallerIdGuid,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -364,7 +363,7 @@ LibGetTime (
|
||||||
// The daylight variable does not exist in non-volatile storage, so create it.
|
// The daylight variable does not exist in non-volatile storage, so create it.
|
||||||
Time->Daylight = 0;
|
Time->Daylight = 0;
|
||||||
// Store it
|
// Store it
|
||||||
Status = gRT->SetVariable (
|
Status = mRT->SetVariable (
|
||||||
(CHAR16 *)mDaylightVariableName,
|
(CHAR16 *)mDaylightVariableName,
|
||||||
&gEfiCallerIdGuid,
|
&gEfiCallerIdGuid,
|
||||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
||||||
|
@ -498,7 +497,7 @@ LibSetTime (
|
||||||
// Do this after having set the RTC.
|
// Do this after having set the RTC.
|
||||||
|
|
||||||
// Save the current time zone information into non-volatile storage
|
// Save the current time zone information into non-volatile storage
|
||||||
Status = gRT->SetVariable (
|
Status = mRT->SetVariable (
|
||||||
(CHAR16 *)mTimeZoneVariableName,
|
(CHAR16 *)mTimeZoneVariableName,
|
||||||
&gEfiCallerIdGuid,
|
&gEfiCallerIdGuid,
|
||||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
||||||
|
@ -516,7 +515,7 @@ LibSetTime (
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save the current daylight information into non-volatile storage
|
// Save the current daylight information into non-volatile storage
|
||||||
Status = gRT->SetVariable (
|
Status = mRT->SetVariable (
|
||||||
(CHAR16 *)mDaylightVariableName,
|
(CHAR16 *)mDaylightVariableName,
|
||||||
&gEfiCallerIdGuid,
|
&gEfiCallerIdGuid,
|
||||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
||||||
|
@ -609,6 +608,7 @@ LibRtcVirtualNotifyEvent (
|
||||||
// runtime calls will be made in virtual mode.
|
// runtime calls will be made in virtual mode.
|
||||||
//
|
//
|
||||||
EfiConvertPointer (0x0, (VOID**)&mPL031RtcBase);
|
EfiConvertPointer (0x0, (VOID**)&mPL031RtcBase);
|
||||||
|
EfiConvertPointer (0x0, (VOID**)&mRT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -656,6 +656,8 @@ LibRtcInitialize (
|
||||||
gRT->GetWakeupTime = LibGetWakeupTime;
|
gRT->GetWakeupTime = LibGetWakeupTime;
|
||||||
gRT->SetWakeupTime = LibSetWakeupTime;
|
gRT->SetWakeupTime = LibSetWakeupTime;
|
||||||
|
|
||||||
|
mRT = gRT;
|
||||||
|
|
||||||
// Install the protocol
|
// Install the protocol
|
||||||
Handle = NULL;
|
Handle = NULL;
|
||||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||||
|
|
Loading…
Reference in New Issue