OcCpuLib: Add support for NetBurst models

This commit is contained in:
Goldfish64 2020-10-01 19:15:28 -05:00
parent 7c6cc2aa21
commit 1029e98ffc
4 changed files with 40 additions and 10 deletions

View File

@ -144,6 +144,11 @@ enum {
#define K10_COFVID_STATUS 0xC0010071
#define K10_PSTATE_STATUS 0xC0010064
#define CPU_MODEL_WILLAMETTE 0x01 ///< Willamette, Foster
#define CPU_MODEL_NORTHWOOD 0x02 ///< Northwood, Prestonia, Gallatin
#define CPU_MODEL_PRESCOTT 0x03 ///< Prescott, Nocona, Cranford, Potomac
#define CPU_MODEL_PRESCOTT_2M 0x04 ///< Prescott 2M, Smithfield, Irwindale, Paxville
#define CPU_MODEL_CEDAR_MILL 0x06 ///< Cedar Mill, Presler, Tusla, Dempsey
#define CPU_MODEL_DOTHAN 0x0D ///< Dothan
#define CPU_MODEL_YONAH 0x0E ///< Sossaman, Yonah
#define CPU_MODEL_MEROM 0x0F ///< Allendale, Conroe, Kentsfield, Woodcrest, Clovertown, Tigerton, Merom

View File

@ -117,31 +117,48 @@ InternalDetectAppleMajorType (
UINT16
InternalDetectAppleProcessorType (
IN UINT8 Model,
IN UINT8 Stepping,
IN UINT8 AppleMajorType,
IN UINT16 CoreCount
IN UINT8 Model,
IN UINT8 Stepping,
IN UINT8 AppleMajorType,
IN UINT16 CoreCount,
IN BOOLEAN Is64Bit
)
{
switch (Model) {
//
// Yonah: https://en.wikipedia.org/wiki/Yonah_(microprocessor)#Models_and_brand_names
// Willamette: https://en.wikipedia.org/wiki/Pentium_4#Willamette
// Northwood: same page.
// Yonah: https://en.wikipedia.org/wiki/Yonah_(microprocessor)#Models_and_brand_names
//
// Used by Apple:
// Core Duo, Core Solo
//
// NOT used by Apple:
// Not used by Apple:
// Pentium, Celeron
//
// All 0x0201.
//
case CPU_MODEL_DOTHAN: // 0x0D
case CPU_MODEL_YONAH: // 0x0E
case CPU_MODEL_WILLAMETTE: // 0x01
case CPU_MODEL_NORTHWOOD: // 0x02
case CPU_MODEL_DOTHAN: // 0x0D
case CPU_MODEL_YONAH: // 0x0E
// IM41 (T2400/T2500), MM11 (Solo T1200 / Duo T2300/T2400),
// MBP11 (L2400/T2400/T2500/T2600), MBP12 (T2600),
// MB11 (T2400/T2500)
return AppleProcessorTypeCoreSolo; // 0x0201
//
// Prescott: https://en.wikipedia.org/wiki/Pentium_4#Prescott
// Prescott-2M: same page.
// Cedar Mill: same page.
//
// Not used by Apple.
//
case CPU_MODEL_PRESCOTT: // 0x03
case CPU_MODEL_PRESCOTT_2M: // 0x04
case CPU_MODEL_CEDAR_MILL: // 0x06
return Is64Bit ? AppleProcessorTypeCore2DuoType1 : AppleProcessorTypeCoreSolo; // 0x0301 if 64-bit, otherwise 0x0201
//
// Merom: https://en.wikipedia.org/wiki/Merom_(microprocessor)#Variants
// Penryn: https://en.wikipedia.org/wiki/Penryn_(microprocessor)#Variants

View File

@ -60,6 +60,7 @@ InternalDetectAppleMajorType (
@param[in] Stepping CPU stepping from CPUID.
@param[in] AppleMajorType Apple CPU major type.
@param[in] CoreCount Number of physical cores.
@param[in] Is64Bit CPU supports 64-bit mode.
@retval Apple CPU type.
**/
@ -68,7 +69,8 @@ InternalDetectAppleProcessorType (
IN UINT8 Model,
IN UINT8 Stepping,
IN UINT8 AppleMajorType,
IN UINT16 CoreCount
IN UINT16 CoreCount,
IN BOOLEAN Is64Bit
);
/**

View File

@ -279,7 +279,13 @@ ScanIntelProcessorApple (
UINT8 AppleMajorType;
AppleMajorType = InternalDetectAppleMajorType (Cpu->BrandString);
Cpu->AppleProcessorType = InternalDetectAppleProcessorType (Cpu->Model, Cpu->Stepping, AppleMajorType, Cpu->CoreCount);
Cpu->AppleProcessorType = InternalDetectAppleProcessorType (
Cpu->Model,
Cpu->Stepping,
AppleMajorType,
Cpu->CoreCount,
(Cpu->ExtFeatures & CPUID_EXTFEATURE_EM64T) != 0
);
DEBUG ((DEBUG_INFO, "OCCPU: Detected Apple Processor Type: %02X -> %04X\n", AppleMajorType, Cpu->AppleProcessorType));
}