Function report |
Source Code:arch\x86\kernel\tsc.c |
Create Date:2022-07-28 07:46:22 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:alibrate cpu using pit, hpet, and ptimer methods. They are available* later in boot after acpi is initialized.
Proto:static unsigned long pit_hpet_ptimer_calibrate_cpu(void)
Type:unsigned long
Parameter:Nothing
| 712 | tsc_pit_min = ULONG_MAX , tsc_ref_min = ULONG_MAX |
| 714 | hpet = is_hpet_enabled() |
| 744 | loopmin = CAL_PIT_LOOPS |
| 755 | local_irq_save(flags) |
| 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. |
| 759 | local_irq_restore(flags) |
| 762 | tsc_pit_min = min - return minimum of two values of the same or compatible types*@x: first value*@y: second value(tsc_pit_min, tsc_pit_khz) |
| 769 | If tsc1 == ULLONG_MAX || tsc2 == ULLONG_MAX Then Continue |
| 773 | If hpet Then tsc2 = Calculate the TSC frequency from HPET reference |
| 778 | tsc_ref_min = min - return minimum of two values of the same or compatible types*@x: first value*@y: second value(tsc_ref_min, (unsignedlong)tsc2) |
| 781 | delta = tsc_pit_min * 100 |
| 793 | Return tsc_ref_min |
| 802 | If i == 1 && tsc_pit_min == ULONG_MAX Then |
| 812 | If tsc_pit_min == ULONG_MAX Then |
| 814 | pr_warn("Unable to calibrate against PIT\n") |
| 818 | pr_notice("No reference (HPET/PMTIMER) available\n") |
| 819 | Return 0 |
| 823 | If tsc_ref_min == ULONG_MAX Then |
| 824 | pr_warn("HPET/PMTIMER calibration failed\n") |
| 825 | Return 0 |
| 832 | Return tsc_ref_min |
| 837 | pr_info("Using PIT calibration value\n") |
| 838 | Return tsc_pit_min |
| 842 | If tsc_ref_min == ULONG_MAX Then |
| 843 | pr_warn("HPET/PMTIMER calibration failed. Using PIT calibration.\n") |
| 844 | Return tsc_pit_min |
| 852 | pr_warn("PIT calibration deviates from %s: %lu %lu\n", hpet ? "HPET" : "PMTIMER", tsc_pit_min, tsc_ref_min) |
| 854 | pr_info("Using PIT calibration value\n") |
| 855 | Return tsc_pit_min |
| Name | Describe |
|---|---|
| native_calibrate_cpu | ative_calibrate_cpu - calibrate the cpu |
| determine_cpu_tsc_frequencies |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |