1
0
Fork 0
mirror of https://github.com/hermitcore/libhermit.git synced 2025-03-09 00:00:03 +01:00

add debug messges, disable temporary the p-state handling

This commit is contained in:
Stefan Lankes 2016-03-08 16:20:13 +01:00
parent c045e3d5f2
commit eecbf16987
2 changed files with 16 additions and 5 deletions

View file

@ -202,6 +202,11 @@ extern "C" {
#define MSR_XAPIC_ENABLE (1UL << 11)
#define MSR_X2APIC_ENABLE (1UL << 10)
#define MSR_IA32_PLATFORM_ID 0x00000017
#define MSR_IA32_PERFCTR0 0x000000c1
#define MSR_IA32_PERFCTR1 0x000000c2
#define MSR_FSB_FREQ 0x000000cd
#define MSR_PLATFORM_INFO 0x000000ce
#define MSR_IA32_MPERF 0x000000e7

View file

@ -224,11 +224,18 @@ static int get_max_pstate(void)
return (value >> 8) & 0xFF;
}
static uint8_t is_turbo = 0;
static int max_pstate, min_pstate;
static int turbo_pstate;
static int get_turbo_pstate(void)
{
uint64_t value;
int i, ret;
if (!is_turbo)
return get_max_pstate();
value = rdmsr(MSR_NHM_TURBO_RATIO_LIMIT);
i = get_max_pstate();
ret = (value) & 255;
@ -238,10 +245,6 @@ static int get_turbo_pstate(void)
return ret;
}
static uint8_t is_turbo = 0;
static int max_pstate, min_pstate;
static int turbo_pstate;
static void set_pstate(int pstate)
{
uint64_t v = pstate << 8;
@ -323,12 +326,14 @@ static void check_est(uint8_t out)
min_pstate = get_min_pstate();
turbo_pstate = get_turbo_pstate();
#if 0
// set boot_processor to turbo pstate because
// the boot processor has to handle the LwIP thread
if (out)
set_pstate(turbo_pstate);
else
set_pstate(max_pstate);
#endif
if (out)
dump_pstate();
@ -559,10 +564,11 @@ int cpu_detection(void) {
uint64_t msr;
kprintf("IA32_MISC_ENABLE 0x%llx\n", rdmsr(MSR_IA32_MISC_ENABLE));
kprintf("IA32_PLATFORM_ID 0x%llx\n", rdmsr(MSR_IA32_PLATFORM_ID));
if (has_pat()) {
msr = rdmsr(MSR_IA32_CR_PAT);
kprintf("MSR_IA32_CR_PAT 0x%llx\n", msr);
kprintf("IA32_CR_PAT 0x%llx\n", msr);
kprintf("PAT use per default %s\n", (msr & 0xF) == 0x6 ? "writeback." : "NO writeback!");
}