diff mbox series

[edk2,v2] Omap35xxPkg: add GetTimeInNanoSecond implementation

Message ID 20171130142257.28140-1-leif.lindholm@linaro.org
State New
Headers show
Series [edk2,v2] Omap35xxPkg: add GetTimeInNanoSecond implementation | expand

Commit Message

Leif Lindholm Nov. 30, 2017, 2:22 p.m. UTC
Commit a63be426f8e3 ("ArmPlatformPkg: Store initial timer value") caused
BeagleBoard to stop building, due to Omap35xxTimerLib lacking an
implementation of GetTimeInNanoSecond (). So add one.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>

---
 Omap35xxPkg/Library/Omap35xxTimerLib/TimerLib.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

-- 
2.11.0

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

Comments

Ard Biesheuvel Nov. 30, 2017, 2:24 p.m. UTC | #1
On 30 November 2017 at 14:22, Leif Lindholm <leif.lindholm@linaro.org> wrote:
> Commit a63be426f8e3 ("ArmPlatformPkg: Store initial timer value") caused

> BeagleBoard to stop building, due to Omap35xxTimerLib lacking an

> implementation of GetTimeInNanoSecond (). So add one.

>

> Contributed-under: TianoCore Contribution Agreement 1.1

> Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>

> ---

>  Omap35xxPkg/Library/Omap35xxTimerLib/TimerLib.c | 24 ++++++++++++++++++++++++

>  1 file changed, 24 insertions(+)

>

> diff --git a/Omap35xxPkg/Library/Omap35xxTimerLib/TimerLib.c b/Omap35xxPkg/Library/Omap35xxTimerLib/TimerLib.c

> index 652c47b6f6..a6f79ddd57 100644

> --- a/Omap35xxPkg/Library/Omap35xxTimerLib/TimerLib.c

> +++ b/Omap35xxPkg/Library/Omap35xxTimerLib/TimerLib.c

> @@ -131,3 +131,27 @@ GetPerformanceCounterProperties (

>

>    return PcdGet64(PcdEmbeddedPerformanceCounterFrequencyInHz);

>  }

> +

> +/**

> +  Converts elapsed ticks of performance counter to time in nanoseconds.

> +

> +  This function converts the elapsed ticks of running performance counter to

> +  time value in unit of nanoseconds.

> +

> +  @param  Ticks     The number of elapsed ticks of running performance counter.

> +

> +  @return The elapsed time in nanoseconds.

> +

> +**/

> +UINT64

> +EFIAPI

> +GetTimeInNanoSecond (

> +  IN      UINT64                     Ticks

> +  )

> +{

> +  UINT32 Period;

> +

> +  Period = PcdGet32 (PcdEmbeddedPerformanceCounterPeriodInNanoseconds);

> +

> +  return (Ticks * Period);

> +}

> --

> 2.11.0

>


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

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Leif Lindholm Nov. 30, 2017, 2:34 p.m. UTC | #2
On Thu, Nov 30, 2017 at 02:24:24PM +0000, Ard Biesheuvel wrote:
> On 30 November 2017 at 14:22, Leif Lindholm <leif.lindholm@linaro.org> wrote:

> > Commit a63be426f8e3 ("ArmPlatformPkg: Store initial timer value") caused

> > BeagleBoard to stop building, due to Omap35xxTimerLib lacking an

> > implementation of GetTimeInNanoSecond (). So add one.

> >

> > Contributed-under: TianoCore Contribution Agreement 1.1

> > Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>

> > ---

> >  Omap35xxPkg/Library/Omap35xxTimerLib/TimerLib.c | 24 ++++++++++++++++++++++++

> >  1 file changed, 24 insertions(+)

> >

> > diff --git a/Omap35xxPkg/Library/Omap35xxTimerLib/TimerLib.c b/Omap35xxPkg/Library/Omap35xxTimerLib/TimerLib.c

> > index 652c47b6f6..a6f79ddd57 100644

> > --- a/Omap35xxPkg/Library/Omap35xxTimerLib/TimerLib.c

> > +++ b/Omap35xxPkg/Library/Omap35xxTimerLib/TimerLib.c

> > @@ -131,3 +131,27 @@ GetPerformanceCounterProperties (

> >

> >    return PcdGet64(PcdEmbeddedPerformanceCounterFrequencyInHz);

> >  }

> > +

> > +/**

> > +  Converts elapsed ticks of performance counter to time in nanoseconds.

> > +

> > +  This function converts the elapsed ticks of running performance counter to

> > +  time value in unit of nanoseconds.

> > +

> > +  @param  Ticks     The number of elapsed ticks of running performance counter.

> > +

> > +  @return The elapsed time in nanoseconds.

> > +

> > +**/

> > +UINT64

> > +EFIAPI

> > +GetTimeInNanoSecond (

> > +  IN      UINT64                     Ticks

> > +  )

> > +{

> > +  UINT32 Period;

> > +

> > +  Period = PcdGet32 (PcdEmbeddedPerformanceCounterPeriodInNanoseconds);

> > +

> > +  return (Ticks * Period);

> > +}

> > --

> > 2.11.0

> >

> 

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


Thanks. These two BeagleBoard/Omap fixes pushed as
ef1b70ff08..f0d9d2b617.
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
diff mbox series

Patch

diff --git a/Omap35xxPkg/Library/Omap35xxTimerLib/TimerLib.c b/Omap35xxPkg/Library/Omap35xxTimerLib/TimerLib.c
index 652c47b6f6..a6f79ddd57 100644
--- a/Omap35xxPkg/Library/Omap35xxTimerLib/TimerLib.c
+++ b/Omap35xxPkg/Library/Omap35xxTimerLib/TimerLib.c
@@ -131,3 +131,27 @@  GetPerformanceCounterProperties (
 
   return PcdGet64(PcdEmbeddedPerformanceCounterFrequencyInHz);
 }
+
+/**
+  Converts elapsed ticks of performance counter to time in nanoseconds.
+
+  This function converts the elapsed ticks of running performance counter to
+  time value in unit of nanoseconds.
+
+  @param  Ticks     The number of elapsed ticks of running performance counter.
+
+  @return The elapsed time in nanoseconds.
+
+**/
+UINT64
+EFIAPI
+GetTimeInNanoSecond (
+  IN      UINT64                     Ticks
+  )
+{
+  UINT32 Period;
+
+  Period = PcdGet32 (PcdEmbeddedPerformanceCounterPeriodInNanoseconds);
+
+  return (Ticks * Period);
+}