76 Commits

Author SHA1 Message Date
vit9696
f750d5b7bd OcCpuLib: Add CFG lock debugging 2020-05-13 15:31:56 +03:00
vit9696
6bfd26f381 OcCpuLib: Fixed CPU detection crash with QEMU 5.0 and KVM accelerator
closes acidanthera/bugtracker#914
2020-05-13 15:30:03 +03:00
vit9696
796765ca7c
OcBootManagementLib: Rework boot management (#42)
Co-authored-by: vit9696 <vit9696@users.noreply.github.com>
Co-authored-by: Download-Fritz <download-fritz@outlook.com>
2020-05-05 19:45:32 +03:00
vit9696
439688e0d4 OcCpuLib: Added privilege detection to CPU frequency detection 2020-03-07 14:52:24 +03:00
vit9696
97585cb6c2 Build: Remove OcSupportPkg usage 2020-02-29 17:39:41 +03:00
vit9696
e981bb5cee OcCpuLib: Support fallback frequency 2020-02-25 04:37:27 +03:00
vit9696
66979ff5c5 Build: Fix analysis warnings
closes acidanthera/bugtracker#722
2020-02-16 15:46:12 +03:00
vit9696
5da113b944 OcCpuLib: Improve ACPI PM timer CPU frequency calculation performance
closes acidanthera/bugtracker#526
2020-02-16 10:04:35 +03:00
vit9696
410ba1e7aa OcCpuLib: Fix frequency calculation on VMware 2020-02-16 05:54:24 +03:00
Alex James
6242dfe18c OcCpuLib: Fix CurBusRatio calculation for Nehalem/Westmere 2020-01-17 23:48:26 +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
Alex James
86839a8397 OcCpuLib: Add support for framework EFI MP services
Resolves acidanthera/bugtracker#663.
2020-01-17 23:48:26 +03:00
vit9696
1f047740f9 OcCpuLib: Implement package count detection with MpServices
closes acidanthera/bugtracker#363
2020-01-11 19:39:32 +03:00
vit9696
f2444a5361 OcCpuLib: Reorganise source files 2020-01-11 18:21:06 +03:00
vit9696
867000cd07 Build: Improve IA32 compat based on @nms42 patches
closes acidanthera/bugtracker#645
closes acidanthera/bugtracker#646
closes acidanthera/bugtracker#647
2020-01-11 04:51:46 +03:00
vit9696
81e33784b1 Build: Fix some warnings, thx @nms42
references acidanthera/bugtracker#640
2020-01-09 19:08:39 +03:00
vit9696
43e755c6c9 Build: Dummy fixes for IA32 compatibility 2020-01-08 14:33:54 +03:00
vit9696
abb1ac7be7 Assembly: Fix nasm section commands
closes acidanthera/bugtracker#632
2020-01-08 13:52:28 +03:00
vit9696
7d2f5c10aa OcSmbiosLib: Fixed SMBIOS Type4 External Clock values 2020-01-04 22:43:03 +03:00
vit9696
1623ddddac OcCpuLib: Fix microcode reading once again 2020-01-04 20:24:54 +03:00
vit9696
11b2648cc2 OcCpuLib: Print MicrocodeRevision in the log 2020-01-04 19:59:41 +03:00
vit9696
52a5ae916f OcCpuLib: Read microcode revision in assembly to comply with Intel SDM
closes acidanthera/bugtracker#621
2020-01-04 19:28:11 +03:00
crazyi
87b3689c5d OcCpuLib: Add Intel Xeon E5 (Broadwell-EP) support 2019-11-28 12:15:15 +03:00
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