OpenCore  1.0.4
OpenCore Bootloader
Loading...
Searching...
No Matches
OcCpuInternals.h File Reference
#include <Library/OcCpuLib.h>

Go to the source code of this file.

Data Structures

struct  OC_CPU_TSC_SYNC
 

Macros

#define OC_CPU_FREQUENCY_TOLERANCE   50000000LL
 

Functions

UINT32 EFIAPI AsmReadIntelMicrocodeRevision (VOID)
 
VOID EFIAPI AsmMeasureTicks (IN UINT32 AcpiTicksDuration, IN UINT16 TimerAddr, OUT UINT32 *AcpiTicksDelta, OUT UINT64 *TscTicksDelta)
 
UINT8 InternalDetectAppleMajorType (IN CONST CHAR8 *BrandString)
 
UINT16 InternalDetectAppleProcessorType (IN UINT8 Model, IN UINT8 Stepping, IN UINT8 AppleMajorType, IN UINT16 CoreCount, IN BOOLEAN Is64Bit)
 
OC_CPU_GENERATION InternalDetectIntelProcessorGeneration (IN OC_CPU_INFO *CpuInfo)
 
UINTN InternalGetPmTimerAddr (OUT CONST CHAR8 **Type OPTIONAL)
 
UINT64 InternalCalculateTSCFromPMTimer (IN BOOLEAN Recalculate)
 
UINT64 InternalCalculateTSCFromApplePlatformInfo (OUT UINT64 *FSBFrequency OPTIONAL, IN BOOLEAN Recalculate)
 
UINT64 InternalCalculateARTFrequencyIntel (OUT UINT64 *CPUFrequency, OUT UINT64 *TscAdjustPtr OPTIONAL, IN BOOLEAN Recalculate)
 
UINT64 InternalCalculateVMTFrequency (OUT UINT64 *FSBFrequency OPTIONAL, OUT BOOLEAN *UnderHypervisor OPTIONAL)
 
UINT64 InternalConvertAppleFSBToTSCFrequency (IN UINT64 FSBFrequency)
 
UINT32 EFIAPI AsmIncrementUint32 (IN volatile UINT32 *Value)
 

Detailed Description

Copyright (C) 2020, vit9696. 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 OcCpuInternals.h.

Macro Definition Documentation

◆ OC_CPU_FREQUENCY_TOLERANCE

#define OC_CPU_FREQUENCY_TOLERANCE   50000000LL

Definition at line 24 of file OcCpuInternals.h.

Function Documentation

◆ AsmIncrementUint32()

UINT32 EFIAPI AsmIncrementUint32 ( IN volatile UINT32 * Value)

Atomically increment 32-bit integer. This is required to be locally implemented as we cannot use SynchronizationLib, which depends on TimerLib, and our TimerLib depends on this library.

Parameters
[in]ValuePointer to 32-bit integer to increment.
Return values
valueafter incrementing.

Definition at line 176 of file UserMisc.c.

◆ AsmMeasureTicks()

VOID EFIAPI AsmMeasureTicks ( IN UINT32 AcpiTicksDuration,
IN UINT16 TimerAddr,
OUT UINT32 * AcpiTicksDelta,
OUT UINT64 * TscTicksDelta )

Measures TSC and ACPI ticks over specified ACPI tick amount.

Parameters
[in]AcpiTicksDurationNumber of ACPI ticks for calculation.
[in]TimerAddrACPI timer address.
[out]AcpiTicksDeltaReported ACPI ticks delta.
[out]TscTicksDeltaReported TSC ticks delta.

Definition at line 22 of file MeasureTicks.c.

◆ AsmReadIntelMicrocodeRevision()

UINT32 EFIAPI AsmReadIntelMicrocodeRevision ( VOID )

Returns microcode revision for Intel CPUs.

Return values
microcoderevision.

Definition at line 187 of file UserMisc.c.

◆ InternalCalculateARTFrequencyIntel()

UINT64 InternalCalculateARTFrequencyIntel ( OUT UINT64 * CPUFrequency,
OUT UINT64 *TscAdjustPtr OPTIONAL,
IN BOOLEAN Recalculate )

Calculate the ART frequency and derieve the CPU frequency for Intel CPUs

Parameters
[out]CPUFrequencyThe derieved CPU frequency.
[out]TscAdjustPtrAdjustment value for TSC, optional.
[in]RecalculateDo not re-use previously cached information.
Return values
Thecalculated ART frequency.

Definition at line 474 of file FrequencyDetect.c.

◆ InternalCalculateTSCFromApplePlatformInfo()

UINT64 InternalCalculateTSCFromApplePlatformInfo ( OUT UINT64 *FSBFrequency OPTIONAL,
IN BOOLEAN Recalculate )

Calculate the TSC frequency via Apple Platform Info

Parameters
[out]FSBFrequencyUpdated FSB frequency, optional.
[in]RecalculateDo not re-use previously cached information.
Return values
Thecalculated TSC frequency.

Definition at line 345 of file FrequencyDetect.c.

◆ InternalCalculateTSCFromPMTimer()

UINT64 InternalCalculateTSCFromPMTimer ( IN BOOLEAN Recalculate)

Calculate the TSC frequency via PM timer

Parameters
[in]RecalculateDo not re-use previously cached information.
Return values
Thecalculated TSC frequency.

Definition at line 173 of file FrequencyDetect.c.

◆ InternalCalculateVMTFrequency()

UINT64 InternalCalculateVMTFrequency ( OUT UINT64 *FSBFrequency OPTIONAL,
OUT BOOLEAN *UnderHypervisor OPTIONAL )

Calculate the CPU frequency via VMT for hypervisors

Parameters
[out]FSBFrequencyFSB frequency, optional.
[out]UnderHypervisorHypervisor status, optional.
Return values
CPUfrequency or 0.

Definition at line 646 of file FrequencyDetect.c.

◆ InternalConvertAppleFSBToTSCFrequency()

UINT64 InternalConvertAppleFSBToTSCFrequency ( IN UINT64 FSBFrequency)

Convert Apple FSB frequency to TSC frequency

Parameters
[in]FSBFrequencyFrequency in Apple FSB format.
Return values
ConvertedTSC frequency.

Definition at line 383 of file OcCpuLib.c.

◆ InternalDetectAppleMajorType()

UINT8 InternalDetectAppleMajorType ( IN CONST CHAR8 * BrandString)

Detect Apple CPU major type.

Parameters
[in]BrandStringCPU Brand String from CPUID.
Return values
AppleCPU major type.

Definition at line 26 of file AppleCpuSupport.c.

◆ InternalDetectAppleProcessorType()

UINT16 InternalDetectAppleProcessorType ( IN UINT8 Model,
IN UINT8 Stepping,
IN UINT8 AppleMajorType,
IN UINT16 CoreCount,
IN BOOLEAN Is64Bit )

Detect Apple CPU type.

Parameters
[in]ModelCPU model from CPUID.
[in]SteppingCPU stepping from CPUID.
[in]AppleMajorTypeApple CPU major type.
[in]CoreCountNumber of physical cores.
[in]Is64BitCPU supports 64-bit mode.
Return values
AppleCPU type.

Definition at line 132 of file AppleCpuSupport.c.

◆ InternalDetectIntelProcessorGeneration()

OC_CPU_GENERATION InternalDetectIntelProcessorGeneration ( IN OC_CPU_INFO * CpuInfo)

Obtain Intel CPU generation.

Parameters
[in]ModelCPU model from CPUID.
Return values
CPU'sgeneration (e.g. OcCpuGenerationUnknown).

Definition at line 1396 of file OcCpuLib.c.

◆ InternalGetPmTimerAddr()

UINTN InternalGetPmTimerAddr ( OUT CONST CHAR8 **Type OPTIONAL)

Obtain ACPI PM timer address for this BSP.

Parameters
[out]TypeAddress source type, optional.
Return values
ACPIPM timer address or 0.

Definition at line 46 of file FrequencyDetect.c.