kernel/x86: detect power subfeatures

Change-Id: Id159f0d7fc7816b6a40b9cf28f53dfdbebd04a73
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3211
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
This commit is contained in:
Jérôme Duval 2020-09-05 17:11:32 +02:00 committed by Axel Dörfler
parent 99d96cefd9
commit eb7ac342a0
2 changed files with 40 additions and 1 deletions

View File

@ -222,13 +222,26 @@
#define IA32_FEATURE_INTERRUPT_MWAIT (1 << 1)
// x86 defined features from cpuid eax 6, eax register
// reference http://www.intel.com/Assets/en_US/PDF/appnote/241618.pdf (Table 5-11)
// reference https://software.intel.com/content/dam/develop/public/us/en/documents/253666-sdm-vol-2a.pdf (Table 3-8)
#define IA32_FEATURE_DTS (1 << 0) // Digital Thermal Sensor
#define IA32_FEATURE_ITB (1 << 1) // Intel Turbo Boost Technology
#define IA32_FEATURE_ARAT (1 << 2) // Always running APIC Timer
#define IA32_FEATURE_PLN (1 << 4) // Power Limit Notification
#define IA32_FEATURE_ECMD (1 << 5) // Extended Clock Modulation Duty
#define IA32_FEATURE_PTM (1 << 6) // Package Thermal Management
#define IA32_FEATURE_HWP (1 << 7) // Hardware P-states
#define IA32_FEATURE_HWP_NOTIFY (1 << 8) // HWP Notification
#define IA32_FEATURE_HWP_ACTWIN (1 << 9) // HWP Activity Window
#define IA32_FEATURE_HWP_EPP (1 << 10) // HWP Energy Performance Preference
#define IA32_FEATURE_HWP_PLR (1 << 11) // HWP Package Level Request
#define IA32_FEATURE_HDC (1 << 13) // Hardware Duty Cycling
#define IA32_FEATURE_TBMT3 (1 << 14) // Turbo Boost Max Technology 3.0
#define IA32_FEATURE_HWP_CAP (1 << 15) // HWP Capabilities
#define IA32_FEATURE_HWP_PECI (1 << 16) // HWP PECI override
#define IA32_FEATURE_HWP_FLEX (1 << 17) // Flexible HWP
#define IA32_FEATURE_HWP_FAST (1 << 18) // Fast access for HWP_REQUEST MSR
#define IA32_FEATURE_HW_FEEDBACK (1 << 19) // HW_FEEDBACK*, PACKAGE_THERM*
#define IA32_FEATURE_HWP_IGNIDL (1 << 20) // Ignore Idle Logical Processor HWP
// x86 defined features from cpuid eax 6, ecx register
// reference http://www.intel.com/Assets/en_US/PDF/appnote/241618.pdf (Table 5-11)

View File

@ -495,6 +495,32 @@ dump_feature_string(int currentCPU, cpu_ent* cpu)
strlcat(features, "ecmd ", sizeof(features));
if (cpu->arch.feature[FEATURE_6_EAX] & IA32_FEATURE_PTM)
strlcat(features, "ptm ", sizeof(features));
if (cpu->arch.feature[FEATURE_6_EAX] & IA32_FEATURE_HWP)
strlcat(features, "hwp ", sizeof(features));
if (cpu->arch.feature[FEATURE_6_EAX] & IA32_FEATURE_HWP_NOTIFY)
strlcat(features, "hwp_notify ", sizeof(features));
if (cpu->arch.feature[FEATURE_6_EAX] & IA32_FEATURE_HWP_ACTWIN)
strlcat(features, "hwp_actwin ", sizeof(features));
if (cpu->arch.feature[FEATURE_6_EAX] & IA32_FEATURE_HWP_EPP)
strlcat(features, "hwp_epp ", sizeof(features));
if (cpu->arch.feature[FEATURE_6_EAX] & IA32_FEATURE_HWP_PLR)
strlcat(features, "hwp_plr ", sizeof(features));
if (cpu->arch.feature[FEATURE_6_EAX] & IA32_FEATURE_HDC)
strlcat(features, "hdc ", sizeof(features));
if (cpu->arch.feature[FEATURE_6_EAX] & IA32_FEATURE_TBMT3)
strlcat(features, "tbmt3 ", sizeof(features));
if (cpu->arch.feature[FEATURE_6_EAX] & IA32_FEATURE_HWP_CAP)
strlcat(features, "hwp_cap ", sizeof(features));
if (cpu->arch.feature[FEATURE_6_EAX] & IA32_FEATURE_HWP_PECI)
strlcat(features, "hwp_peci ", sizeof(features));
if (cpu->arch.feature[FEATURE_6_EAX] & IA32_FEATURE_HWP_FLEX)
strlcat(features, "hwp_flex ", sizeof(features));
if (cpu->arch.feature[FEATURE_6_EAX] & IA32_FEATURE_HWP_FAST)
strlcat(features, "hwp_fast ", sizeof(features));
if (cpu->arch.feature[FEATURE_6_EAX] & IA32_FEATURE_HW_FEEDBACK)
strlcat(features, "hw_feedback ", sizeof(features));
if (cpu->arch.feature[FEATURE_6_EAX] & IA32_FEATURE_HWP_IGNIDL)
strlcat(features, "hwp_ignidl ", sizeof(features));
if (cpu->arch.feature[FEATURE_6_ECX] & IA32_FEATURE_APERFMPERF)
strlcat(features, "aperfmperf ", sizeof(features));
if (cpu->arch.feature[FEATURE_6_ECX] & IA32_FEATURE_EPB)