#include <linux/clockchips.h>
#include <linux/interrupt.h>
#include <linux/export.h>
#include <linux/delay.h>
#include <linux/hpet.h>
#include <linux/cpu.h>
#include <linux/irq.h>
#include <asm/irq_remapping.h>
#include <asm/hpet.h>
#include <asm/time.h>
#include <asm/mwait.h>
#undef pr_fmt
#define pr_fmt(fmt) …
enum hpet_mode { … };
struct hpet_channel { … };
struct hpet_base { … };
#define HPET_MASK …
#define HPET_MIN_CYCLES …
#define HPET_MIN_PROG_DELTA …
unsigned long hpet_address;
u8 hpet_blockid;
bool hpet_msi_disable;
#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_GENERIC_MSI_IRQ)
static DEFINE_PER_CPU(struct hpet_channel *, cpu_hpet_channel);
static struct irq_domain *hpet_domain;
#endif
static void __iomem *hpet_virt_address;
static struct hpet_base hpet_base;
static bool hpet_legacy_int_enabled;
static unsigned long hpet_freq;
bool boot_hpet_disable;
bool hpet_force_user;
static bool hpet_verbose;
static inline
struct hpet_channel *clockevent_to_channel(struct clock_event_device *evt)
{ … }
inline unsigned int hpet_readl(unsigned int a)
{ … }
static inline void hpet_writel(unsigned int d, unsigned int a)
{ … }
static inline void hpet_set_mapping(void)
{ … }
static inline void hpet_clear_mapping(void)
{ … }
static int __init hpet_setup(char *str)
{ … }
__setup(…);
static int __init disable_hpet(char *str)
{ … }
__setup(…);
static inline int is_hpet_capable(void)
{ … }
int is_hpet_enabled(void)
{ … }
EXPORT_SYMBOL_GPL(…);
static void _hpet_print_config(const char *function, int line)
{ … }
#define hpet_print_config() …
#ifdef CONFIG_HPET
static void __init hpet_reserve_platform_timers(void)
{ … }
static void __init hpet_select_device_channel(void)
{ … }
#else
static inline void hpet_reserve_platform_timers(void) { }
static inline void hpet_select_device_channel(void) {}
#endif
static void hpet_stop_counter(void)
{ … }
static void hpet_reset_counter(void)
{ … }
static void hpet_start_counter(void)
{ … }
static void hpet_restart_counter(void)
{ … }
static void hpet_resume_device(void)
{ … }
static void hpet_resume_counter(struct clocksource *cs)
{ … }
static void hpet_enable_legacy_int(void)
{ … }
static int hpet_clkevt_set_state_periodic(struct clock_event_device *evt)
{ … }
static int hpet_clkevt_set_state_oneshot(struct clock_event_device *evt)
{ … }
static int hpet_clkevt_set_state_shutdown(struct clock_event_device *evt)
{ … }
static int hpet_clkevt_legacy_resume(struct clock_event_device *evt)
{ … }
static int
hpet_clkevt_set_next_event(unsigned long delta, struct clock_event_device *evt)
{ … }
static void hpet_init_clockevent(struct hpet_channel *hc, unsigned int rating)
{ … }
static void __init hpet_legacy_clockevent_register(struct hpet_channel *hc)
{ … }
#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_GENERIC_MSI_IRQ)
static void hpet_msi_unmask(struct irq_data *data)
{ … }
static void hpet_msi_mask(struct irq_data *data)
{ … }
static void hpet_msi_write(struct hpet_channel *hc, struct msi_msg *msg)
{ … }
static void hpet_msi_write_msg(struct irq_data *data, struct msi_msg *msg)
{ … }
static struct irq_chip hpet_msi_controller __ro_after_init = …;
static int hpet_msi_init(struct irq_domain *domain,
struct msi_domain_info *info, unsigned int virq,
irq_hw_number_t hwirq, msi_alloc_info_t *arg)
{ … }
static void hpet_msi_free(struct irq_domain *domain,
struct msi_domain_info *info, unsigned int virq)
{ … }
static struct msi_domain_ops hpet_msi_domain_ops = …;
static struct msi_domain_info hpet_msi_domain_info = …;
static struct irq_domain *hpet_create_irq_domain(int hpet_id)
{ … }
static inline int hpet_dev_id(struct irq_domain *domain)
{ … }
static int hpet_assign_irq(struct irq_domain *domain, struct hpet_channel *hc,
int dev_num)
{ … }
static int hpet_clkevt_msi_resume(struct clock_event_device *evt)
{ … }
static irqreturn_t hpet_msi_interrupt_handler(int irq, void *data)
{ … }
static int hpet_setup_msi_irq(struct hpet_channel *hc)
{ … }
static void init_one_hpet_msi_clockevent(struct hpet_channel *hc, int cpu)
{ … }
static struct hpet_channel *hpet_get_unused_clockevent(void)
{ … }
static int hpet_cpuhp_online(unsigned int cpu)
{ … }
static int hpet_cpuhp_dead(unsigned int cpu)
{ … }
static void __init hpet_select_clockevents(void)
{ … }
#else
static inline void hpet_select_clockevents(void) { }
#define hpet_cpuhp_online …
#define hpet_cpuhp_dead …
#endif
#if defined(CONFIG_SMP) && defined(CONFIG_64BIT)
hpet_lock;
static union hpet_lock hpet __cacheline_aligned = …;
static u64 read_hpet(struct clocksource *cs)
{ … }
#else
static u64 read_hpet(struct clocksource *cs)
{
return (u64)hpet_readl(HPET_COUNTER);
}
#endif
static struct clocksource clocksource_hpet = …;
static bool __init hpet_cfg_working(void)
{ … }
static bool __init hpet_counting(void)
{ … }
static bool __init mwait_pc10_supported(void)
{ … }
static bool __init hpet_is_pc10_damaged(void)
{ … }
int __init hpet_enable(void)
{ … }
static __init int hpet_late_init(void)
{ … }
fs_initcall(hpet_late_init);
void hpet_disable(void)
{ … }
#ifdef CONFIG_HPET_EMULATE_RTC
#include <linux/mc146818rtc.h>
#include <linux/rtc.h>
#define DEFAULT_RTC_INT_FREQ …
#define DEFAULT_RTC_SHIFT …
#define RTC_NUM_INTS …
static unsigned long hpet_rtc_flags;
static int hpet_prev_update_sec;
static struct rtc_time hpet_alarm_time;
static unsigned long hpet_pie_count;
static u32 hpet_t1_cmp;
static u32 hpet_default_delta;
static u32 hpet_pie_delta;
static unsigned long hpet_pie_limit;
static rtc_irq_handler irq_handler;
static inline int hpet_cnt_ahead(u32 c1, u32 c2)
{ … }
int hpet_register_irq_handler(rtc_irq_handler handler)
{ … }
EXPORT_SYMBOL_GPL(…);
void hpet_unregister_irq_handler(rtc_irq_handler handler)
{ … }
EXPORT_SYMBOL_GPL(…);
int hpet_rtc_timer_init(void)
{ … }
EXPORT_SYMBOL_GPL(…);
static void hpet_disable_rtc_channel(void)
{ … }
int hpet_mask_rtc_irq_bit(unsigned long bit_mask)
{ … }
EXPORT_SYMBOL_GPL(…);
int hpet_set_rtc_irq_bit(unsigned long bit_mask)
{ … }
EXPORT_SYMBOL_GPL(…);
int hpet_set_alarm_time(unsigned char hrs, unsigned char min, unsigned char sec)
{ … }
EXPORT_SYMBOL_GPL(…);
int hpet_set_periodic_freq(unsigned long freq)
{ … }
EXPORT_SYMBOL_GPL(…);
int hpet_rtc_dropped_irq(void)
{ … }
EXPORT_SYMBOL_GPL(…);
static void hpet_rtc_timer_reinit(void)
{ … }
irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id)
{ … }
EXPORT_SYMBOL_GPL(…);
#endif