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