linux/drivers/char/hpet.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Intel & MS High Precision Event Timer Implementation.
 *
 * Copyright (C) 2003 Intel Corporation
 *	Venki Pallipadi
 * (c) Copyright 2004 Hewlett-Packard Development Company, L.P.
 *	Bob Picco <[email protected]>
 */

#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/miscdevice.h>
#include <linux/major.h>
#include <linux/ioport.h>
#include <linux/fcntl.h>
#include <linux/init.h>
#include <linux/io-64-nonatomic-lo-hi.h>
#include <linux/poll.h>
#include <linux/mm.h>
#include <linux/proc_fs.h>
#include <linux/spinlock.h>
#include <linux/sysctl.h>
#include <linux/wait.h>
#include <linux/sched/signal.h>
#include <linux/bcd.h>
#include <linux/seq_file.h>
#include <linux/bitops.h>
#include <linux/compat.h>
#include <linux/clocksource.h>
#include <linux/uaccess.h>
#include <linux/slab.h>
#include <linux/io.h>
#include <linux/acpi.h>
#include <linux/hpet.h>
#include <asm/current.h>
#include <asm/irq.h>
#include <asm/div64.h>

/*
 * The High Precision Event Timer driver.
 * This driver is closely modelled after the rtc.c driver.
 * See HPET spec revision 1.
 */
#define HPET_USER_FREQ
#define HPET_DRIFT

#define HPET_RANGE_SIZE


/* WARNING -- don't get confused.  These macros are never used
 * to write the (single) counter, and rarely to read it.
 * They're badly named; to fix, someday.
 */
#if BITS_PER_LONG == 64
#define write_counter(V, MC)
#define read_counter(MC)
#else
#define write_counter
#define read_counter
#endif

static DEFINE_MUTEX(hpet_mutex); /* replaces BKL */
static u32 hpet_nhpet, hpet_max_freq =;

/* A lock for concurrent access by app and isr hpet activity. */
static DEFINE_SPINLOCK(hpet_lock);

#define HPET_DEV_NAME

struct hpet_dev {};

struct hpets {};

static struct hpets *hpets;

#define HPET_OPEN
#define HPET_IE
#define HPET_PERIODIC
#define HPET_SHARED_IRQ

static irqreturn_t hpet_interrupt(int irq, void *data)
{}

static void hpet_timer_set_irq(struct hpet_dev *devp)
{}

static int hpet_open(struct inode *inode, struct file *file)
{}

static ssize_t
hpet_read(struct file *file, char __user *buf, size_t count, loff_t * ppos)
{}

static __poll_t hpet_poll(struct file *file, poll_table * wait)
{}

#ifdef CONFIG_HPET_MMAP
#ifdef CONFIG_HPET_MMAP_DEFAULT
static int hpet_mmap_enabled =;
#else
static int hpet_mmap_enabled = 0;
#endif

static __init int hpet_mmap_enable(char *str)
{}
__setup();

static int hpet_mmap(struct file *file, struct vm_area_struct *vma)
{}
#else
static int hpet_mmap(struct file *file, struct vm_area_struct *vma)
{
	return -ENOSYS;
}
#endif

static int hpet_fasync(int fd, struct file *file, int on)
{}

static int hpet_release(struct inode *inode, struct file *file)
{}

static int hpet_ioctl_ieon(struct hpet_dev *devp)
{}

/* converts Hz to number of timer ticks */
static inline unsigned long hpet_time_div(struct hpets *hpets,
					  unsigned long dis)
{}

static int
hpet_ioctl_common(struct hpet_dev *devp, unsigned int cmd, unsigned long arg,
		  struct hpet_info *info)
{}

static long
hpet_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{}

#ifdef CONFIG_COMPAT
struct compat_hpet_info {};

/* 32-bit types would lead to different command codes which should be
 * translated into 64-bit ones before passed to hpet_ioctl_common
 */
#define COMPAT_HPET_INFO
#define COMPAT_HPET_IRQFREQ

static long
hpet_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{}
#endif

static const struct file_operations hpet_fops =;

static int hpet_is_known(struct hpet_data *hdp)
{}

static struct ctl_table hpet_table[] =;

static struct ctl_table_header *sysctl_header;

/*
 * Adjustment for when arming the timer with
 * initial conditions.  That is, main counter
 * ticks expired before interrupts are enabled.
 */
#define TICK_CALIBRATE

static unsigned long __hpet_calibrate(struct hpets *hpetp)
{}

static unsigned long hpet_calibrate(struct hpets *hpetp)
{}

int hpet_alloc(struct hpet_data *hdp)
{}

static acpi_status hpet_resources(struct acpi_resource *res, void *data)
{}

static int hpet_acpi_add(struct acpi_device *device)
{}

static const struct acpi_device_id hpet_device_ids[] =;

static struct acpi_driver hpet_acpi_driver =;

static struct miscdevice hpet_misc =;

static int __init hpet_init(void)
{}
device_initcall(hpet_init);

/*
MODULE_AUTHOR("Bob Picco <[email protected]>");
MODULE_LICENSE("GPL");
*/