• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /** @file
2   Internal header file for TscTimerLib instances.
3 
4   Copyright (c) 2009 - 2011, 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 #ifndef _TSC_TIMER_LIB_INTERNAL_H_
16 #define _TSC_TIMER_LIB_INTERNAL_H_
17 
18 #include <Ich/GenericIch.h>
19 
20 #include <Library/TimerLib.h>
21 #include <Library/BaseLib.h>
22 #include <Library/IoLib.h>
23 #include <Library/PciLib.h>
24 #include <Library/PcdLib.h>
25 
26 /**  Get TSC frequency.
27 
28   @return The number of TSC counts per second.
29 
30 **/
31 UINT64
32 InternalGetTscFrequency (
33   VOID
34   );
35 
36 /**  Calculate TSC frequency.
37 
38   The TSC counting frequency is determined by comparing how far it counts
39   during a 1ms period as determined by the ACPI timer. The ACPI timer is
40   used because it counts at a known frequency.
41   If ACPI I/O space not enabled, this function will enable it. Then the
42   TSC is sampled, followed by waiting for 3579 clocks of the ACPI timer, or 1ms.
43   The TSC is then sampled again. The difference multiplied by 1000 is the TSC
44   frequency. There will be a small error because of the overhead of reading
45   the ACPI timer. An attempt is made to determine and compensate for this error.
46 
47   @return The number of TSC counts per second.
48 
49 **/
50 UINT64
51 InternalCalculateTscFrequency (
52   VOID
53   );
54 
55 #endif
56