linux/arch/x86/include/asm/hpet.h

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _ASM_X86_HPET_H
#define _ASM_X86_HPET_H

#include <linux/msi.h>

#ifdef CONFIG_HPET_TIMER

#define HPET_MMAP_SIZE

#define HPET_ID
#define HPET_PERIOD
#define HPET_CFG
#define HPET_STATUS
#define HPET_COUNTER

#define HPET_Tn_CFG(n)
#define HPET_Tn_CMP(n)
#define HPET_Tn_ROUTE(n)

#define HPET_T0_CFG
#define HPET_T0_CMP
#define HPET_T0_ROUTE
#define HPET_T1_CFG
#define HPET_T1_CMP
#define HPET_T1_ROUTE
#define HPET_T2_CFG
#define HPET_T2_CMP
#define HPET_T2_ROUTE

#define HPET_ID_REV
#define HPET_ID_NUMBER
#define HPET_ID_64BIT
#define HPET_ID_LEGSUP
#define HPET_ID_VENDOR
#define HPET_ID_NUMBER_SHIFT
#define HPET_ID_VENDOR_SHIFT

#define HPET_CFG_ENABLE
#define HPET_CFG_LEGACY
#define HPET_LEGACY_8254
#define HPET_LEGACY_RTC

#define HPET_TN_LEVEL
#define HPET_TN_ENABLE
#define HPET_TN_PERIODIC
#define HPET_TN_PERIODIC_CAP
#define HPET_TN_64BIT_CAP
#define HPET_TN_SETVAL
#define HPET_TN_32BIT
#define HPET_TN_ROUTE
#define HPET_TN_FSB
#define HPET_TN_FSB_CAP
#define HPET_TN_ROUTE_SHIFT

/* Max HPET Period is 10^8 femto sec as in HPET spec */
#define HPET_MAX_PERIOD
/*
 * Min HPET period is 10^5 femto sec just for safety. If it is less than this,
 * then 32 bit HPET counter wrapsaround in less than 0.5 sec.
 */
#define HPET_MIN_PERIOD

/* hpet memory map physical address */
extern unsigned long hpet_address;
extern unsigned long force_hpet_address;
extern bool boot_hpet_disable;
extern u8 hpet_blockid;
extern bool hpet_force_user;
extern bool hpet_msi_disable;
extern int is_hpet_enabled(void);
extern int hpet_enable(void);
extern void hpet_disable(void);
extern unsigned int hpet_readl(unsigned int a);
extern void force_hpet_resume(void);

#ifdef CONFIG_HPET_EMULATE_RTC

#include <linux/interrupt.h>

rtc_irq_handler;
extern int hpet_mask_rtc_irq_bit(unsigned long bit_mask);
extern int hpet_set_rtc_irq_bit(unsigned long bit_mask);
extern int hpet_set_alarm_time(unsigned char hrs, unsigned char min,
			       unsigned char sec);
extern int hpet_set_periodic_freq(unsigned long freq);
extern int hpet_rtc_dropped_irq(void);
extern int hpet_rtc_timer_init(void);
extern irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id);
extern int hpet_register_irq_handler(rtc_irq_handler handler);
extern void hpet_unregister_irq_handler(rtc_irq_handler handler);

#endif /* CONFIG_HPET_EMULATE_RTC */

#else /* CONFIG_HPET_TIMER */

static inline int hpet_enable(void) { return 0; }
static inline int is_hpet_enabled(void) { return 0; }
#define hpet_readl
#define default_setup_hpet_msi

#endif
#endif /* _ASM_X86_HPET_H */