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