Index: trunk/i386/libsaio/acpi_patcher.c =================================================================== --- trunk/i386/libsaio/acpi_patcher.c (revision 608) +++ trunk/i386/libsaio/acpi_patcher.c (revision 609) @@ -233,11 +233,16 @@ if (acpi_cpu_count > 0) { - bool c2_enabled = fadt->C2_Latency < 100; - bool c3_enabled = fadt->C3_Latency < 1000; + bool c2_enabled = false; + bool c3_enabled = false; bool c4_enabled = false; + getBoolForKey(kEnableC2States, &c2_enabled, &bootInfo->bootConfig); + getBoolForKey(kEnableC3States, &c3_enabled, &bootInfo->bootConfig); getBoolForKey(kEnableC4States, &c4_enabled, &bootInfo->bootConfig); + + c2_enabled = c2_enabled | (fadt->C2_Latency < 100); + c3_enabled = c3_enabled | (fadt->C3_Latency < 1000); unsigned char cstates_count = 1 + (c2_enabled ? 1 : 0) + (c3_enabled ? 1 : 0); @@ -429,7 +434,7 @@ if (maximum.CID < minimum.CID) { DBG("Insane FID values!"); - p_states_count = 1; + p_states_count = 0; } else { @@ -479,7 +484,9 @@ p_states_count -= invalid; } - } break; + + break; + } case CPU_MODEL_FIELDS: case CPU_MODEL_DALES: case CPU_MODEL_DALES_32NM: @@ -487,6 +494,36 @@ case CPU_MODEL_NEHALEM_EX: case CPU_MODEL_WESTMERE: case CPU_MODEL_WESTMERE_EX: + { + uint8_t i; + + maximum.Control = rdmsr64(MSR_IA32_PERF_STATUS) & 0xff; // Is it allways the maximum multiplier? + + // fix me: dirty method to get lowest multiplier... Hardcoded value! + minimum.Control = 0x09; + + // Sanity check + if (maximum.Control < minimum.Control) + { + DBG("Insane control values!"); + p_states_count = 0; + } + else + { + uint8_t i; + p_states_count = 0; + + for (i = maximum.Control; i >= minimum.Control; i--) + { + p_states[p_states_count].Control = i; + p_states[p_states_count].CID = p_states[p_states_count].Control << 1; + p_states[p_states_count].Frequency = (Platform.CPU.FSBFrequency / 1000000) * i; + p_states_count++; + } + } + + break; + } default: verbose ("Unsupported CPU: P-States not generated !!!\n"); break; Index: trunk/i386/boot2/boot.h =================================================================== --- trunk/i386/boot2/boot.h (revision 608) +++ trunk/i386/boot2/boot.h (revision 609) @@ -70,6 +70,8 @@ #define kRestartFix "RestartFix" /* acpi_patcher.c */ #define kGeneratePStates "GeneratePStates" /* acpi_patcher.c */ #define kGenerateCStates "GenerateCStates" /* acpi_patcher.c */ +#define kEnableC2States "EnableC2State" /* acpi_patcher.c */ +#define kEnableC3States "EnableC3State" /* acpi_patcher.c */ #define kEnableC4States "EnableC4State" /* acpi_patcher.c */ #define kDeviceProperties "device-properties" /* device_inject.c */ #define kHidePartition "Hide Partition" /* disk.c */