Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:arch\x86\kernel\tsc.c Create Date:2022-07-28 07:46:16
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name: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.

Proto:static unsigned long pit_calibrate_tsc(unsigned int latch, unsigned long ms, int loopmin)

Type:unsigned long

Parameter:

TypeParameterName
unsigned intlatch
unsigned longms
intloopmin
387  If Not has_legacy_pic() Then
393  0x10c7 is 2**32 / 1000000 (rounded up) (10 * USEC_PER_MSEC)
394  0x10c7 is 2**32 / 1000000 (rounded up) (10 * USEC_PER_MSEC)
395  0x10c7 is 2**32 / 1000000 (rounded up) (10 * USEC_PER_MSEC)
396  0x10c7 is 2**32 / 1000000 (rounded up) (10 * USEC_PER_MSEC)
397  0x10c7 is 2**32 / 1000000 (rounded up) (10 * USEC_PER_MSEC)
398  Return ULONG_MAX
402  Basic port I/O
409  Basic port I/O
410  Basic port I/O
411  Basic port I/O
413  tsc = t1 = t2 = get_cycles()
415  pitcnt = 0
416  tscmax = 0
417  tscmin = ULONG_MAX
418  When (inb(0x61) & 0x20) == 0 cycle
419  t2 = get_cycles()
420  delta = t2 - tsc
421  tsc = t2
422  If delta < tscmin Then tscmin = delta
424  If delta > tscmax Then tscmax = delta
426  pitcnt++
438  If pitcnt < loopmin || tscmax > 10 * tscmin Then Return ULONG_MAX
442  delta = t2 - t1
443  do_div() is NOT a C function(delta, ms)
444  Return delta
Caller
NameDescribe
pit_hpet_ptimer_calibrate_cpualibrate cpu using pit, hpet, and ptimer methods. They are available* later in boot after acpi is initialized.