Furquan Shaikh has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35148 )
Change subject: soc/intel/common/timer: Make TSC frequency calculation dynamically ......................................................................
Patch Set 8:
(1 comment)
https://review.coreboot.org/c/coreboot/+/35148/8/src/soc/intel/common/block/... File src/soc/intel/common/block/timer/timer.c:
https://review.coreboot.org/c/coreboot/+/35148/8/src/soc/intel/common/block/... PS8, Line 68: I am thinking if this function would be more clear if split into multiple functions:
static void get_hardcoded_crystal_freq(void) { ... switch (get_processor_model()) { case CPU_MODEL_INTEL_ATOM_DENVERTON: core_crystal_nominal_freq_khz = 25000; break; }
return core_crystal_nominal_freq_khz; }
static unsigned long calculate_tsc_freq_from_core_crystal(void) { ... if (get_max_cpuid_func() < 0x15) return 0;
cpuidr_15h = cpuid(0x15);
...
if (!core_crystal_nominal_freq_khz) core_crystal_nominal_freq_khz = get_hardcoded_crystal_freq();
return (core_crystal_nominal_freq_khz * cpuidr_15h.ebx / cpuidr_15h.eax) / 1000; }
static unsigned long get_freq_from_cpuid16h(void) { if (get_max_cpuid_func() < 0x15) return 0;
return cpuid_eax(0x16); }
unsigned long tsc_freq_mhz(void) { unsigned long tsc_freq;
tsc_freq = calculate_tsc_freq_from_core_crystal();
if (tsc_freq) return tsc_freq;
return get_freq_from_cpuid16h(); }