uint32_t flex_ratio_min = 0;
uint32_t flex_ratio_max = 0;
+uint64_t tsc_at_boot = 0;
#define bit(n) (1ULL << (n))
#define bitmask(h,l) ((bit(h)|(bit(h)-1)) & ~(bit(l)-1))
#define CPU_FAMILY_PENTIUM_M (0x6)
static const char FSB_Frequency_prop[] = "FSBFrequency";
+static const char TSC_at_boot_prop[] = "InitialTSC";
/*
* This routine extracts the bus frequency in Hz from the device tree.
+ * Also reads any initial TSC value at boot from the device tree.
*/
static uint64_t
EFI_FSB_frequency(void)
} else {
kprintf("EFI_FSB_frequency: unexpected size %d\n", size);
}
+
+ /*
+ * While we're here, see if EFI published an initial TSC value.
+ */
+ if (DTGetProperty(entry,TSC_at_boot_prop,&value,&size) == kSuccess) {
+ if (size == sizeof(uint64_t)) {
+ tsc_at_boot = *(uint64_t *) value;
+ kprintf("EFI_FSB_frequency: read %s value: %llu\n",
+ TSC_at_boot_prop, tsc_at_boot);
+ }
+ }
+
return frequency;
}
busFreq = EFI_FSB_frequency();
switch (cpuid_cpufamily()) {
+ case CPUFAMILY_INTEL_HASWELL:
case CPUFAMILY_INTEL_IVYBRIDGE:
case CPUFAMILY_INTEL_SANDYBRIDGE:
case CPUFAMILY_INTEL_WESTMERE:
}
kprintf(" BUS: Frequency = %6d.%06dMHz, "
- "cvtt2n = %08Xx.%08Xx, cvtn2t = %08Xx.%08Xx\n",
+ "cvtt2n = %08X.%08X, cvtn2t = %08X.%08X\n",
(uint32_t)(busFreq / Mega),
(uint32_t)(busFreq % Mega),
(uint32_t)(busFCvtt2n >> 32), (uint32_t)busFCvtt2n,
tscFCvtn2t = 0xFFFFFFFFFFFFFFFFULL / tscFCvtt2n;
kprintf(" TSC: Frequency = %6d.%06dMHz, "
- "cvtt2n = %08Xx.%08Xx, cvtn2t = %08Xx.%08Xx, gran = %lld%s\n",
+ "cvtt2n = %08X.%08X, cvtn2t = %08X.%08X, gran = %lld%s\n",
(uint32_t)(tscFreq / Mega),
(uint32_t)(tscFreq % Mega),
(uint32_t)(tscFCvtt2n >> 32), (uint32_t)tscFCvtt2n,