X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdePkg%2FLibrary%2FSecPeiDxeTimerLibCpu%2FIpfTimerLib.c;h=d61956433e923c8a0c808e7a67378c8377415ed1;hp=2e511704d88ca0f794b63c821f2a34af5957c0f2;hb=19388d2960b2fe0347da23799e93ccc52f540214;hpb=ceffbc1900072d6def2324d558cf4ef2813ceb8c diff --git a/MdePkg/Library/SecPeiDxeTimerLibCpu/IpfTimerLib.c b/MdePkg/Library/SecPeiDxeTimerLibCpu/IpfTimerLib.c index 2e511704d8..d61956433e 100644 --- a/MdePkg/Library/SecPeiDxeTimerLibCpu/IpfTimerLib.c +++ b/MdePkg/Library/SecPeiDxeTimerLibCpu/IpfTimerLib.c @@ -1,8 +1,8 @@ /** @file Timer Library functions built upon ITC on IPF. - Copyright (c) 2006 - 2007, Intel Corporation
- All rights reserved. This program and the accompanying materials + Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.
+ This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php @@ -10,11 +10,12 @@ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - Module Name: IpfTimerLib.c - **/ - +#include +#include +#include +#include /** @@ -26,8 +27,8 @@ @param Delay Number of ticks to delay. **/ -STATIC VOID +EFIAPI InternalIpfDelay ( IN INT64 Delay ) @@ -54,7 +55,7 @@ InternalIpfDelay ( @param MicroSeconds The minimum number of microseconds to delay. - @return MicroSeconds + @return The value of MicroSeconds inputted. **/ UINTN @@ -78,7 +79,7 @@ MicroSecondDelay ( @param NanoSeconds The minimum number of nanoseconds to delay. - @return NanoSeconds + @return The value of NanoSeconds inputted. **/ UINTN @@ -98,8 +99,7 @@ NanoSecondDelay ( /** Retrieves the current value of a 64-bit free running performance counter. - Retrieves the current value of a 64-bit free running performance counter. The - counter can either count up by 1 or count down by 1. If the physical + The counter can either count up by 1 or count down by 1. If the physical performance counter counts by a larger increment, then the counter values must be translated. The properties of the counter can be retrieved from GetPerformanceCounterProperties(). @@ -149,13 +149,6 @@ GetPerformanceCounterProperties ( PAL_CALL_RETURN PalRet; UINT64 BaseFrequence; - PalRet = PalCallStatic (NULL, 13, 0, 0, 0); - ASSERT (PalRet.Status == 0); - BaseFrequence = PalRet.r9; - - PalRet = PalCallStatic (NULL, 14, 0, 0, 0); - ASSERT (PalRet.Status == 0); - if (StartValue != NULL) { *StartValue = 0; } @@ -164,5 +157,16 @@ GetPerformanceCounterProperties ( *EndValue = (UINT64)(-1); } + PalRet = PalCall (PAL_FREQ_BASE, 0, 0, 0); + if (PalRet.Status != 0) { + return 1000000; + } + BaseFrequence = PalRet.r9; + + PalRet = PalCall (PAL_FREQ_RATIOS, 0, 0, 0); + if (PalRet.Status != 0) { + return 1000000; + } + return BaseFrequence * (PalRet.r11 >> 32) / (UINT32)PalRet.r11; }