OpenCore
1.0.4
OpenCore Bootloader
|
#include <Uefi.h>
#include <IndustryStandard/CpuId.h>
#include <IndustryStandard/AppleIntelCpuInfo.h>
#include <Protocol/FrameworkMpService.h>
#include <Protocol/MpService.h>
Go to the source code of this file.
Data Structures | |
struct | OC_CPU_INFO |
struct | OC_CPU_MSR_REPORT |
struct | OC_CPU_MSR_REPORT_PROCEDURE_ARGUMENT |
Macros | |
#define | OC_FALLBACK_CPU_FREQUENCY 1000000000 |
Functions | |
VOID | OcCpuScanProcessor (IN OUT OC_CPU_INFO *Cpu) |
VOID | OcCpuGetMsrReport (IN OC_CPU_INFO *CpuInfo, OUT OC_CPU_MSR_REPORT *Report) |
VOID EFIAPI | OcCpuGetMsrReportPerCore (IN OUT VOID *Buffer) |
OC_CPU_MSR_REPORT * | OcCpuGetMsrReports (IN OC_CPU_INFO *CpuInfo, OUT UINTN *EntryCount) |
VOID | OcCpuCorrectFlexRatio (IN OC_CPU_INFO *Cpu) |
EFI_STATUS | OcCpuEnableVmx (VOID) |
EFI_STATUS | OcCpuCorrectTscSync (IN OC_CPU_INFO *Cpu, IN UINTN Timeout) |
UINT32 | OcCpuModelToAppleFamily (IN CPUID_VERSION_INFO_EAX VersionEax) |
UINT16 | OcCpuFrequencyToDisplayFrequency (IN UINT64 Frequency) |
UINT64 | OcGetTSCFrequency (VOID) |
Copyright (C) 2016 - 2017, The HermitCrabs Lab. All rights reserved.
All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Definition in file OcCpuLib.h.
#define OC_FALLBACK_CPU_FREQUENCY 1000000000 |
Assumed CPU frequency when it cannot be detected. Can be overridden by e.g. emulator.
Definition at line 29 of file OcCpuLib.h.
enum OC_CPU_GENERATION |
Sorted Intel CPU generations.
Definition at line 35 of file OcCpuLib.h.
VOID OcCpuCorrectFlexRatio | ( | IN OC_CPU_INFO * | Cpu | ) |
Disable flex ratio if it has invalid value. Commonly fixes early reboot on APTIO IV (Ivy/Haswell).
[in] | Cpu | A pointer to the cpu info. |
Definition at line 1231 of file OcCpuLib.c.
EFI_STATUS OcCpuCorrectTscSync | ( | IN OC_CPU_INFO * | Cpu, |
IN UINTN | Timeout ) |
Synchronise TSC on all cores (needed on server chipsets and some laptops). This does not fully replace VoodooTscSync or TSCAdjustReset due to the need to sync on S3 as well and may also work far less reliably due to the limitation of UEFI firmware not permitting MSR update runs in parallel with BSP and AP cores. However, it lets debug kernels work most of the time till the time TSC kexts start.
[in] | Cpu | A pointer to the cpu info. |
[in] | Timeout | Amount of time to wait for CPU core rendezvous. |
EFI_SUCCESS | on success. |
Definition at line 1324 of file OcCpuLib.c.
EFI_STATUS OcCpuEnableVmx | ( | VOID | ) |
Enable VMX in FeatureControl MSR if supported and not already locked by BIOS. Required to use virtualization in Windows on some Mac hardware.
REF: https://github.com/acidanthera/bugtracker/issues/1870 REF: https://www.thomas-krenn.com/en/wiki/Activating_the_Intel_VT_Virtualization_Feature (via rEFInd) REF: 'Intel 64 and IA-32 Architectures Software Developer's Manual Volume 3', p.1296 etc.
Definition at line 1256 of file OcCpuLib.c.
UINT16 OcCpuFrequencyToDisplayFrequency | ( | IN UINT64 | Frequency | ) |
Converts calculated CPU frequency in Hz to rounded value in MHz.
[in] | Frequency | CPU frequency in Hz. |
Definition at line 742 of file AppleCpuSupport.c.
VOID OcCpuGetMsrReport | ( | IN OC_CPU_INFO * | CpuInfo, |
OUT OC_CPU_MSR_REPORT * | Report ) |
Get the MSR report of one core on the CPU.
[in] | CpuInfo | A pointer to the cpu info. |
[out] | Report | The report generated based on CpuInfo. |
Definition at line 1049 of file OcCpuLib.c.
VOID EFIAPI OcCpuGetMsrReportPerCore | ( | IN OUT VOID * | Buffer | ) |
Get the MSR report of a single core on the CPU. Used as a parameter of MpServices->StartupAllAPs ().
[in,out] | Buffer | The pointer to private data buffer. |
Definition at line 1131 of file OcCpuLib.c.
OC_CPU_MSR_REPORT * OcCpuGetMsrReports | ( | IN OC_CPU_INFO * | CpuInfo, |
OUT UINTN * | EntryCount ) |
Get the MSR reports of all cores on the CPU.
[in] | CpuInfo | A pointer to the cpu info. |
[out] | EntryCount | Number of CPU cores. |
Definition at line 1153 of file OcCpuLib.c.
UINT32 OcCpuModelToAppleFamily | ( | IN CPUID_VERSION_INFO_EAX | VersionEax | ) |
Converts CPUID Family and Model extracted from EAX CPUID (1) call to AppleFamily value. This implements cpuid_set_cpufamily functionality as it is in XNU.
[in] | VersionEax | CPUID (1) EAX value. |
Apple | Family (e.g. CPUFAMILY_UNKNOWN) |
Definition at line 686 of file AppleCpuSupport.c.
VOID OcCpuScanProcessor | ( | IN OUT OC_CPU_INFO * | Cpu | ) |
Scan the processor and fill the cpu info structure with results.
[in,out] | Cpu | A pointer to the cpu info structure to fill with results. |
Definition at line 832 of file OcCpuLib.c.
UINT64 OcGetTSCFrequency | ( | VOID | ) |
Obtain CPU's invariant TSC frequency.
CPU's | TSC frequency or OC_FALLBACK_CPU_FREQUENCY. |
Definition at line 762 of file FrequencyDetect.c.