函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:arch\x86\kernel\tsc.c Create Date:2022-07-27 08:46:19
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:alibrate cpu using pit, hpet, and ptimer methods. They are available* later in boot after acpi is initialized.

函数原型:static unsigned long pit_hpet_ptimer_calibrate_cpu(void)

返回类型:unsigned long

参数:

712  tsc_pit_min等于ULONG_MAX, tsc_ref_min等于ULONG_MAX
714  hpet等于is_hpet_enabled()
742  latch等于CAL_LATCH
743  ms等于CAL_MS
744  loopmin等于CAL_PIT_LOOPS
746 i小于3循环
755  local_irq_save(flags)
756  tsc1等于Read TSC and the reference counters. Take care of any disturbances
757  tsc_pit_khz等于Try to calibrate the TSC against the Programmable* Interrupt Timer and return the frequency of the TSC* in kHz.* Return ULONG_MAX on failure to calibrate.
758  tsc2等于Read TSC and the reference counters. Take care of any disturbances
759  local_irq_restore(flags)
762  tsc_pit_min等于两数取小(tsc_pit_min, tsc_pit_khz)
765  如果ref1恒等于ref2则继续下一循环
769  如果tsc1恒等于ULLONG_MAXtsc2恒等于ULLONG_MAX则继续下一循环
772  tsc2等于tsc2tsc1的差乘1000000LL
773  如果hpettsc2等于Calculate the TSC frequency from HPET reference
775  否则tsc2等于Calculate the TSC frequency from PMTimer reference
778  tsc_ref_min等于两数取小(tsc_ref_min, (unsignedlong)tsc2)
781  delta等于tsc_pit_min乘100
782  do_div() is NOT a C function(delta, tsc_ref_min)
790  如果delta大于等于90且delta小于等于110则
791  打印信息("PIT calibration matches %s. %d loops\n", hpet ? "HPET" : "PMTIMER", i + 1)
793  返回:tsc_ref_min
802  如果i恒等于1且tsc_pit_min恒等于ULONG_MAX
803  latch等于CAL2_LATCH
804  ms等于CAL2_MS
805  loopmin等于CAL2_PIT_LOOPS
812  如果tsc_pit_min恒等于ULONG_MAX
814  打印警告信息("Unable to calibrate against PIT\n")
817  如果非hpet且非ref1且非ref2
818  打印注释信息("No reference (HPET/PMTIMER) available\n")
819  返回:0
823  如果tsc_ref_min恒等于ULONG_MAX
824  打印警告信息("HPET/PMTIMER calibration failed\n")
825  返回:0
829  打印信息("using %s reference calibration\n", hpet ? "HPET" : "PMTIMER")
832  返回:tsc_ref_min
836  如果非hpet且非ref1且非ref2
837  打印信息("Using PIT calibration value\n")
838  返回:tsc_pit_min
842  如果tsc_ref_min恒等于ULONG_MAX
843  打印警告信息("HPET/PMTIMER calibration failed. Using PIT calibration.\n")
844  返回:tsc_pit_min
852  打印警告信息("PIT calibration deviates from %s: %lu %lu\n", hpet ? "HPET" : "PMTIMER", tsc_pit_min, tsc_ref_min)
854  打印信息("Using PIT calibration value\n")
855  返回:tsc_pit_min
调用者
名称描述
native_calibrate_cpuative_calibrate_cpu - calibrate the cpu
determine_cpu_tsc_frequencies