25 Commits

Author SHA1 Message Date
Michael Belyaev
d7e47bed07
Docs: Fix Doxygen comments (#46) 2020-05-05 22:46:14 +03:00
vit9696
439688e0d4 OcCpuLib: Added privilege detection to CPU frequency detection 2020-03-07 14:52:24 +03:00
vit9696
e981bb5cee OcCpuLib: Support fallback frequency 2020-02-25 04:37:27 +03:00
Alex James
e9a34f0eb8 OcCpuLib: Introduce OcCpuGetGeneration
Add a general function for detecting the CPU's generation, replacing
OcIsSandyOrIvy.
2020-01-17 23:48:26 +03:00
vit9696
7d2f5c10aa OcSmbiosLib: Fixed SMBIOS Type4 External Clock values 2020-01-04 22:43:03 +03:00
Leoyzen
d65c11fef8 OcCpuLib: Add hypervisor CPUID support to work with virtualization (#17) 2019-10-30 11:41:40 +03:00
Download-Fritz
550c934927 OcCpuLib: Expose TSC frequency retrieval API
Fixes https://github.com/acidanthera/bugtracker/issues/476
2019-10-05 12:05:38 +02:00
vit9696
ef39b29bb8 OcTimerLib: Add PMC detection, which is absent on B360 2019-08-22 14:41:50 +03:00
vit9696
1afdc06b5b OcTimerLib: Move OcGetPmTimerAddr to OcCpuLib 2019-08-22 13:21:50 +03:00
vit9696
2657d54cb9 OcDataHubLib: Specify non 24 MHz ARTFrequency to macOS 2019-08-20 14:48:26 +03:00
M. R. Miller
5ce54f3a0f New procedure for determining the core crystal clock frequency:
1. Try obtaining crystal clock frequency from CPUID_TIME_STAMP_COUNTER (15h) leaf from ECX.
  2. On failure, take predefined values for known processor models.
  3. On failure, check for CPUID_PROCESSOR_FREQUENCY availability and divide by the TSC ratio.
  4. On failure, assume 24 MHz.

Added info about the highest supported leaf (OC_CPU_INFO::MaxId).
Fixed a few places which were incorrectly comparing standard CPUID leaves against the maximum extended function leaf (OC_CPU_INFO::MaxExtId).
Add a warning in case the TSC- and ART-derived frequency calculations are wildly different.
2019-08-20 14:11:48 +03:00
M. R. Miller
c8d396e9f8 Fix some format specifiers.
Correct CPU frequency calculation. TSC Adjust is only for converting timestamps between ART and TSC, not calculating the CPU frequency.
Only apply the 25Mhz ART fallback if the processor is a Xeon Scalable, determined via the brand string until we can find a better method.
2019-08-20 14:11:48 +03:00
M. R. Miller
dd6b0efbcb Fix support for CPUS with Always Running Timers (ART)
Previously, OcCpuLib assumed all CPUs had the same core crystal clock frequency for their ART (24 Mhz). Xeon Scalable and Intel Atoms with Goldmont architecture have different frequencies (25 Mhz and 19.2 Mhz respectively). If the CPU supports reporting its frequency, use that. Otherwise, fallback to a value based on its model and family.

Cleaned up the logic for how we compute our CPU and FSB frequencies. For CPUs that support ART, use that instead of the TSC frequency.

Added documentation and renamed `OC_CPU_INFO::TSCFrequency` to `CPUFrequencyFromTSC` and added `CPUFrequencyFromART` for clarity. These are intermediate values used to compute `CPUFrequency`. `ARTFrequency` is now correctly set to the core crystal clock frequency rather than `CPUFrequencyFromART`, which it was previously.

Lastly, adjusted the `CPUFrequencyFromART` calculation to include the TSC offset in `MSR_IA32_TSC_ADJUST` if present. I'm not aware of which CPUs have a non-zero offset but it's part of Intel's calculation for computing the CPU frequency based on the ART.
2019-08-20 14:11:48 +03:00
vit9696
40b43134e3 OcAppleBootCompatLib: Implement custom slide support 2019-08-05 23:46:28 +03:00
vit9696
98ef065309 OcAppleKernelLib: Debug kernel cpuid patches 2019-06-07 20:56:47 +03:00
vit9696
585a88eb72 OcCpuLib: Add CPUID to AppleFamily (CPUFAMILY) conversion 2019-06-07 19:46:50 +03:00
vit9696
80bfcf9ec7 OcCpuLib: Export raw CPUID info and microcode for emulated CPUID 2019-06-07 16:21:19 +03:00
vit9696
b7734fc3d5 Fix FSBFrequency and thread count detection on Penryn 2019-03-20 23:29:46 +03:00
vit9696
0aa75e80dd Implement flex ratio quirk 2019-03-13 14:20:52 +03:00
vit9696
35222181d9 Unify SMBIOS fields and fix user test compilation 2019-03-10 13:11:37 +03:00
vit9696
46a4377935 Accuracy and compatibility fixes for OcCpuLib 2019-03-07 17:14:11 +03:00
vit9696
a8d07657ab Import userspace tests 2019-03-05 17:02:05 +03:00
vit9696
377c4fa6e5 OcCpuLib improvements and compilation fixes 2019-02-28 22:43:41 +03:00
vit9696
1672d8fbe6 Add AppleMajorType to CPU_INFO 2019-02-07 15:46:45 +03:00
vit9696
e8338d8180 Import pico libs 2018-10-07 04:12:17 +03:00