#include <linux/acpi_pmtmr.h>
#include <linux/clocksource.h>
#include <linux/timex.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/pci.h>
#include <linux/delay.h>
#include <asm/io.h>
#include <asm/time.h>
u32 pmtmr_ioport __read_mostly;
static inline u32 read_pmtmr(void)
{ … }
u32 acpi_pm_read_verified(void)
{ … }
static u64 acpi_pm_read(struct clocksource *cs)
{ … }
static struct clocksource clocksource_acpi_pm = …;
#ifdef CONFIG_PCI
static int acpi_pm_good;
static int __init acpi_pm_good_setup(char *__str)
{ … }
__setup(…);
static u64 acpi_pm_read_slow(struct clocksource *cs)
{ … }
static inline void acpi_pm_need_workaround(void)
{ … }
static void acpi_pm_check_blacklist(struct pci_dev *dev)
{ … }
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3,
acpi_pm_check_blacklist);
static void acpi_pm_check_graylist(struct pci_dev *dev)
{ … }
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_0,
acpi_pm_check_graylist);
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_LE,
acpi_pm_check_graylist);
#endif
#ifndef CONFIG_X86_64
#include <asm/mach_timer.h>
#define PMTMR_EXPECTED_RATE …
static int verify_pmtmr_rate(void)
{
u64 value1, value2;
unsigned long count, delta;
mach_prepare_counter();
value1 = clocksource_acpi_pm.read(&clocksource_acpi_pm);
mach_countup(&count);
value2 = clocksource_acpi_pm.read(&clocksource_acpi_pm);
delta = (value2 - value1) & ACPI_PM_MASK;
if (delta < (PMTMR_EXPECTED_RATE * 19) / 20 ||
delta > (PMTMR_EXPECTED_RATE * 21) / 20) {
pr_info("PM-Timer running at invalid rate: %lu%% of normal - aborting.\n",
100UL * delta / PMTMR_EXPECTED_RATE);
return -1;
}
return 0;
}
#else
#define verify_pmtmr_rate() …
#endif
#define ACPI_PM_MONOTONICITY_CHECKS …
#define ACPI_PM_READ_CHECKS …
static int __init init_acpi_pm_clocksource(void)
{ … }
fs_initcall(init_acpi_pm_clocksource);
static int __init parse_pmtmr(char *arg)
{ … }
__setup(…);