[edk2,1/2] ArmPlatformPkg/PL031RealTimeClockLib: don't clobber gRT table

Message ID 1460535020-3044-1-git-send-email-ard.biesheuvel@linaro.org
State Accepted
Commit 3ad72779aa97fcde5262b072edc69967da3bdc82
Headers show

Commit Message

Ard Biesheuvel April 13, 2016, 8:10 a.m.
PL031RealTimeClockLib is a base library that could potentially (although
unlikely) be incorporated into other modules than the DXE_RUNTIME_DRIVER
module that it was intended to complement.

This means the library has no business whatsoever setting the Runtime
Service table pointers directly (since we have no way of knowing which
instance will 'win', and the pointers may end up referring to a module
that is not a DXE_RUNTIME_DRIVER). So remove the assignment altogether.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

---
 ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c | 6 ------
 1 file changed, 6 deletions(-)

-- 
2.5.0

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Comments

Ard Biesheuvel May 11, 2016, 2:21 p.m. | #1
On 13 April 2016 at 10:10, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
> PL031RealTimeClockLib is a base library that could potentially (although

> unlikely) be incorporated into other modules than the DXE_RUNTIME_DRIVER

> module that it was intended to complement.

>

> This means the library has no business whatsoever setting the Runtime

> Service table pointers directly (since we have no way of knowing which

> instance will 'win', and the pointers may end up referring to a module

> that is not a DXE_RUNTIME_DRIVER). So remove the assignment altogether.

>

> Contributed-under: TianoCore Contribution Agreement 1.0

> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> ---

>  ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c | 6 ------

>  1 file changed, 6 deletions(-)

>

> diff --git a/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c b/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c

> index 52ba48992b83..516b45675c69 100644

> --- a/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c

> +++ b/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c

> @@ -650,12 +650,6 @@ LibRtcInitialize (

>      return Status;

>    }

>

> -  // Setup the setters and getters

> -  gRT->GetTime       = LibGetTime;

> -  gRT->SetTime       = LibSetTime;

> -  gRT->GetWakeupTime = LibGetWakeupTime;

> -  gRT->SetWakeupTime = LibSetWakeupTime;

> -

>    mRT = gRT;

>

>    // Install the protocol

> --

> 2.5.0

>


Ping? (also for the next one)
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Leif Lindholm May 11, 2016, 2:32 p.m. | #2
On Wed, May 11, 2016 at 04:21:35PM +0200, Ard Biesheuvel wrote:
> On 13 April 2016 at 10:10, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:

> > PL031RealTimeClockLib is a base library that could potentially (although

> > unlikely) be incorporated into other modules than the DXE_RUNTIME_DRIVER

> > module that it was intended to complement.

> >

> > This means the library has no business whatsoever setting the Runtime

> > Service table pointers directly (since we have no way of knowing which

> > instance will 'win', and the pointers may end up referring to a module

> > that is not a DXE_RUNTIME_DRIVER). So remove the assignment altogether.

> >

> > Contributed-under: TianoCore Contribution Agreement 1.0

> > Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> > ---

> >  ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c | 6 ------

> >  1 file changed, 6 deletions(-)

> >

> > diff --git a/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c b/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c

> > index 52ba48992b83..516b45675c69 100644

> > --- a/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c

> > +++ b/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c

> > @@ -650,12 +650,6 @@ LibRtcInitialize (

> >      return Status;

> >    }

> >

> > -  // Setup the setters and getters

> > -  gRT->GetTime       = LibGetTime;

> > -  gRT->SetTime       = LibSetTime;

> > -  gRT->GetWakeupTime = LibGetWakeupTime;

> > -  gRT->SetWakeupTime = LibSetWakeupTime;

> > -

> >    mRT = gRT;

> >

> >    // Install the protocol

> > --

> > 2.5.0

> >

> 

> Ping? (also for the next one)


For the series:
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Patch

diff --git a/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c b/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c
index 52ba48992b83..516b45675c69 100644
--- a/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c
+++ b/ArmPlatformPkg/Library/PL031RealTimeClockLib/PL031RealTimeClockLib.c
@@ -650,12 +650,6 @@  LibRtcInitialize (
     return Status;
   }
 
-  // Setup the setters and getters
-  gRT->GetTime       = LibGetTime;
-  gRT->SetTime       = LibSetTime;
-  gRT->GetWakeupTime = LibGetWakeupTime;
-  gRT->SetWakeupTime = LibSetWakeupTime;
-
   mRT = gRT;
 
   // Install the protocol