]> git.proxmox.com Git - mirror_edk2.git/blame - PcAtChipsetPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.c
PcAtChipsetPkg: Update BaseAcpiTimerLib
[mirror_edk2.git] / PcAtChipsetPkg / Library / AcpiTimerLib / BaseAcpiTimerLib.c
CommitLineData
83d1ffb9
LG
1/** @file\r
2 ACPI Timer implements one instance of Timer Library.\r
3\r
4 Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.<BR>\r
5 This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#include <Base.h>\r
16#include <Library/TimerLib.h>\r
17#include <Library/BaseLib.h>\r
18\r
19/**\r
20 Internal function to retrieves the 64-bit frequency in Hz.\r
21\r
22 Internal function to retrieves the 64-bit frequency in Hz.\r
23\r
24 @return The frequency in Hz.\r
25\r
26**/\r
27UINT64\r
28InternalGetPerformanceCounterFrequency (\r
29 VOID\r
30 ) \r
31{\r
32 BOOLEAN InterruptState;\r
33 UINT64 Count;\r
34 UINT64 Frequency;\r
35 \r
36 InterruptState = SaveAndDisableInterrupts ();\r
37 Count = GetPerformanceCounter ();\r
38 MicroSecondDelay (100);\r
39 Frequency = MultU64x32 (GetPerformanceCounter () - Count, 10000);\r
40 SetInterruptState (InterruptState);\r
41 return Frequency;\r
42}\r