53 Commits

Author SHA1 Message Date
Download-Fritz
c5024de443 OcCpuLib: Fix uninitialised values and and CurBusRatio for AMD 2019-11-03 16:01:01 +01:00
Download-Fritz
156cb7c586 Various type and cast fixes 2019-11-02 23:16:33 +01:00
Leoyzen
d65c11fef8 OcCpuLib: Add hypervisor CPUID support to work with virtualization (#17) 2019-10-30 11:41:40 +03:00
vit9696
24b3cdeb0d OcCpuLib: Fix analysis warning 2019-10-05 21:22:24 +03:00
Download-Fritz
4703a7f6a3 OcCpuLib: Update documentation 2019-10-05 17:08:38 +02:00
Download-Fritz
88cfc9cc8f OcCpuLib: Prevent recursion when called from OcDebugLogLib in DEBUG mode 2019-10-05 16:45:51 +02: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
mrmiller
6d104f5927 OcCpuLib: Move our read of the TSC Adjust MSR to only happen for CPUs that support the CPUID_TIME_STAMP_COUNTER leaf. (#14) 2019-09-11 19:53:25 +03:00
mrmiller
2a21f53c2d OcCpuLib: Calculate ARTFrequency based on the measured TSC frequency for CPUs that don't report it directly and are unknown models. Fixes issues with Skylake-SP chips and spread spectrum which causes the ART to deviate approximately 0.25% from its nominal 25 MHz core crystal clock frequency. (#13) 2019-09-10 11:46:49 +03:00
vit9696
1a22ae71b2 OcCpuLib: Minor debug improvements, closes #11 2019-08-31 22:43:21 +03:00
vit9696
388987169c OcCpuLib: Migrate to August edk2 stable 2019-08-31 11:36:58 +03:00
Download-Fritz
6575ee3062 OcCpuLib: Partially fix AMD BusRatio calculation 2019-08-22 21:45:33 +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
38156d60be OcCpuLib: Do not warn about CPU freq diff when TSC based freq is 0 2019-08-21 08:19:49 +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
12a3975d2e More format string fixes. 2019-08-20 14:11:48 +03:00
M. R. Miller
c0af97eb8a Change AppleProcessorMajorXeonScalable back into AppleProcessorMajorXeonW into a flag on DetectAppleMajorType. 2019-08-20 14:11:48 +03:00
M. R. Miller
87ff477f5f Small formatting cleanup and remove an unnecessary space and cast. 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
1808014e1d Revert "OcCpuLib: fix location of vendor specific *.h files"
This reverts commit f3c3dc7d5d64e97a6d5d3d766a5c2a009ae0b91d.
2019-08-10 09:56:57 +03:00
Nikolai SAOUKH
f3c3dc7d5d OcCpuLib: fix location of vendor specific *.h files 2019-08-10 09:34:33 +03:00
mrmiller
5cc416d681 OcCpuLib: Add support for the Xeon Scaleable family
These aren't available in any Macs to date but they are similar to the Xeon Ws used in the iMacPro1,1 and the upcoming MacPro7,1. (#6)
2019-08-06 09:26:04 +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
Download-Fritz
0c30803547 OcCpuLib: Fix compiler warnings 2019-06-06 09:09:01 +02:00
Download-Fritz
145ed11178 OcCpuLib: Fix usages of not yet assigned value 2019-06-06 09:09:01 +02:00
notiflux
38fd115a64 OcCpuLib: Move debug prints to OcCpuScanProcessor to get rid of duplicate code 2019-06-05 18:29:20 +03:00
notiflux
32e539bd9e OcCpuLib: Add AMD CPU support 2019-06-05 18:29:20 +03:00
PMheart
5da38ee740 OcCpuLib: Added iMac19,1 (i5 8600), thx AppleLife and @Gengik84 2019-05-21 19:58:44 +08:00
vit9696
3f9db14446 OcCpuLib: Fix model detection for certain CPUs 2019-05-13 17:34:11 +03:00
PMheart
3b7dc28ea4 added Macmini8,1 (i7 8700B), thx @Gengik84 2019-05-07 20:32:12 +08:00
vit9696
53f3acbf32 OcDevicePathLib: Fix freeing unallocated memory 2019-04-10 15:52:55 +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
Download-Fritz
b6c1d6839d Remove Macros.h 2019-03-09 17:39:48 +01:00
Download-Fritz
70cf124929 OcCpuLib: Update the legacy Core Count detection to match the SDM 2019-03-09 17:33:58 +01:00
Download-Fritz
8e335e9c88 Replace BITFIELD macro with BitFieldReadXX function usage. 2019-03-09 17:33:24 +01:00
vit9696
c6e637da83 Do not use Apple-speicific original tables, they collide with other vendors 2019-03-07 18:49:00 +03:00
vit9696
46a4377935 Accuracy and compatibility fixes for OcCpuLib 2019-03-07 17:14:11 +03:00
vit9696
377c4fa6e5 OcCpuLib improvements and compilation fixes 2019-02-28 22:43:41 +03:00
vit9696
6511ba6bc8 Fix compilation 2019-02-16 18:56:37 +03:00
vit9696
2c158e8068 Fix CpuInfo reading 2019-02-07 16:15:09 +03:00
vit9696
1672d8fbe6 Add AppleMajorType to CPU_INFO 2019-02-07 15:46:45 +03:00
vit9696
ec04c191b0 Switch to new logging scheme and fix compilation 2018-11-05 01:41:21 +03:00