Skip to content

Commit

Permalink
[v0.97] Do not consider CPUID freq == 0 as a bug. Check udev if CPUID…
Browse files Browse the repository at this point in the history
… freq is not supported
  • Loading branch information
Dr-Noob committed Apr 13, 2021
1 parent 9fa7b4c commit 37eba4b
Showing 1 changed file with 13 additions and 23 deletions.
36 changes: 13 additions & 23 deletions src/x86/cpuid.c
Original file line number Diff line number Diff line change
Expand Up @@ -649,12 +649,7 @@ struct frequency* get_frequency_info(struct cpuInfo* cpu) {
freq->max = get_max_freq_from_file(0, cpu->hv->present);

if(freq->max == 0) {
if(cpu->hv->present) {
printWarn("Read max CPU frequency and got 0 MHz");
}
else {
printBug("Read max CPU frequency and got 0 MHz");
}
printWarn("Read max CPU frequency from udev and got 0 MHz");
freq->max = UNKNOWN_FREQ;
}
#endif
Expand All @@ -664,32 +659,27 @@ struct frequency* get_frequency_info(struct cpuInfo* cpu) {
uint32_t ebx = 0;
uint32_t ecx = 0;
uint32_t edx = 0;

cpuid(&eax, &ebx, &ecx, &edx);

freq->base = eax;
freq->max = ebx;
freq->max = ebx;

if(freq->base == 0) {
if(cpu->hv->present) {
printWarn("Read base CPU frequency and got 0 MHz");
}
else {
printBug("Read base CPU frequency and got 0 MHz");
}
printWarn("Read base CPU frequency from CPUID and got 0 MHz");
freq->base = UNKNOWN_FREQ;
}
if(freq->max == 0) {
if(cpu->hv->present) {
printWarn("Read max CPU frequency and got 0 MHz");
}
else {
printBug("Read max CPU frequency and got 0 MHz");
printWarn("Read max CPU frequency from CPUID and got 0 MHz. Using udev");
freq->max = get_max_freq_from_file(0, cpu->hv->present);

if(freq->max == 0) {
printWarn("Read max CPU frequency from udev and got 0 MHz");
freq->max = UNKNOWN_FREQ;
}
freq->max = UNKNOWN_FREQ;
}
}

return freq;
}

Expand Down

0 comments on commit 37eba4b

Please sign in to comment.