Last change
on this file since 107064 was 80721, checked in by vboxsync, 5 years ago |
Devices/EFI/FirmwareNew: Start upgrade process to edk2-stable201908 (compiles on Windows and works to some extent), bugref:4643
|
-
Property svn:eol-style
set to
native
|
File size:
1.2 KB
|
Line | |
---|
1 | /** @file
|
---|
2 | ACPI Timer implements one instance of Timer Library.
|
---|
3 |
|
---|
4 | Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.<BR>
|
---|
5 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
6 |
|
---|
7 | **/
|
---|
8 |
|
---|
9 | #include <Base.h>
|
---|
10 | #include <Library/TimerLib.h>
|
---|
11 | #include <Library/BaseLib.h>
|
---|
12 |
|
---|
13 | /**
|
---|
14 | Calculate TSC frequency.
|
---|
15 |
|
---|
16 | The TSC counting frequency is determined by comparing how far it counts
|
---|
17 | during a 101.4 us period as determined by the ACPI timer.
|
---|
18 | The ACPI timer is used because it counts at a known frequency.
|
---|
19 | The TSC is sampled, followed by waiting 363 counts of the ACPI timer,
|
---|
20 | or 101.4 us. The TSC is then sampled again. The difference multiplied by
|
---|
21 | 9861 is the TSC frequency. There will be a small error because of the
|
---|
22 | overhead of reading the ACPI timer. An attempt is made to determine and
|
---|
23 | compensate for this error.
|
---|
24 |
|
---|
25 | @return The number of TSC counts per second.
|
---|
26 |
|
---|
27 | **/
|
---|
28 | UINT64
|
---|
29 | InternalCalculateTscFrequency (
|
---|
30 | VOID
|
---|
31 | );
|
---|
32 |
|
---|
33 | /**
|
---|
34 | Internal function to retrieves the 64-bit frequency in Hz.
|
---|
35 |
|
---|
36 | Internal function to retrieves the 64-bit frequency in Hz.
|
---|
37 |
|
---|
38 | @return The frequency in Hz.
|
---|
39 |
|
---|
40 | **/
|
---|
41 | UINT64
|
---|
42 | InternalGetPerformanceCounterFrequency (
|
---|
43 | VOID
|
---|
44 | )
|
---|
45 | {
|
---|
46 | return InternalCalculateTscFrequency ();
|
---|
47 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.