Commit ef78a159 authored by Linus Torvalds's avatar Linus Torvalds Committed by Linus Torvalds

annotate HPET driver memory-mapped PCI usage

parent 3e9c0d59
...@@ -29,7 +29,7 @@ unsigned long hpet_address; /* hpet memory map physical address */ ...@@ -29,7 +29,7 @@ unsigned long hpet_address; /* hpet memory map physical address */
static int use_hpet; /* can be used for runtime check of hpet */ static int use_hpet; /* can be used for runtime check of hpet */
static int boot_hpet_disable; /* boottime override for HPET timer */ static int boot_hpet_disable; /* boottime override for HPET timer */
static unsigned long hpet_virt_address; /* hpet kernel virtual address */ static void __iomem * hpet_virt_address; /* hpet kernel virtual address */
#define FSEC_TO_USEC (1000000000UL) #define FSEC_TO_USEC (1000000000UL)
...@@ -76,8 +76,7 @@ int __init hpet_enable(void) ...@@ -76,8 +76,7 @@ int __init hpet_enable(void)
if (!hpet_address) { if (!hpet_address) {
return -1; return -1;
} }
hpet_virt_address = (unsigned long) ioremap_nocache(hpet_address, hpet_virt_address = ioremap_nocache(hpet_address, HPET_MMAP_SIZE);
HPET_MMAP_SIZE);
/* /*
* Read the period, compute tick and quotient. * Read the period, compute tick and quotient.
*/ */
...@@ -162,11 +161,11 @@ int __init hpet_enable(void) ...@@ -162,11 +161,11 @@ int __init hpet_enable(void)
hd.hd_irq[0] = HPET_LEGACY_8254; hd.hd_irq[0] = HPET_LEGACY_8254;
hd.hd_irq[1] = HPET_LEGACY_RTC; hd.hd_irq[1] = HPET_LEGACY_RTC;
if (ntimer > 2) { if (ntimer > 2) {
struct hpet *hpet; struct hpet __iomem *hpet;
struct hpet_timer *timer; struct hpet_timer __iomem *timer;
int i; int i;
hpet = (struct hpet *) hpet_virt_address; hpet = hpet_virt_address;
for (i = 2, timer = &hpet->hpet_timers[2]; i < ntimer; for (i = 2, timer = &hpet->hpet_timers[2]; i < ntimer;
timer++, i++) timer++, i++)
......
...@@ -60,8 +60,8 @@ static spinlock_t hpet_task_lock = SPIN_LOCK_UNLOCKED; ...@@ -60,8 +60,8 @@ static spinlock_t hpet_task_lock = SPIN_LOCK_UNLOCKED;
struct hpet_dev { struct hpet_dev {
struct hpets *hd_hpets; struct hpets *hd_hpets;
struct hpet *hd_hpet; struct hpet __iomem *hd_hpet;
struct hpet_timer *hd_timer; struct hpet_timer __iomem *hd_timer;
unsigned long hd_ireqfreq; unsigned long hd_ireqfreq;
unsigned long hd_irqdata; unsigned long hd_irqdata;
wait_queue_head_t hd_waitqueue; wait_queue_head_t hd_waitqueue;
...@@ -75,7 +75,7 @@ struct hpet_dev { ...@@ -75,7 +75,7 @@ struct hpet_dev {
struct hpets { struct hpets {
struct hpets *hp_next; struct hpets *hp_next;
struct hpet *hp_hpet; struct hpet __iomem *hp_hpet;
unsigned long hp_period; unsigned long hp_period;
unsigned long hp_delta; unsigned long hp_delta;
unsigned int hp_ntimer; unsigned int hp_ntimer;
...@@ -98,14 +98,14 @@ static struct hpets *hpets; ...@@ -98,14 +98,14 @@ static struct hpets *hpets;
#endif #endif
#ifndef readq #ifndef readq
static unsigned long long __inline readq(void *addr) static unsigned long long __inline readq(void __iomem *addr)
{ {
return readl(addr) | (((unsigned long long)readl(addr + 4)) << 32LL); return readl(addr) | (((unsigned long long)readl(addr + 4)) << 32LL);
} }
#endif #endif
#ifndef writeq #ifndef writeq
static void __inline writeq(unsigned long long v, void *addr) static void __inline writeq(unsigned long long v, void __iomem *addr)
{ {
writel(v & 0xffffffff, addr); writel(v & 0xffffffff, addr);
writel(v >> 32, addr + 4); writel(v >> 32, addr + 4);
...@@ -300,7 +300,7 @@ static int hpet_fasync(int fd, struct file *file, int on) ...@@ -300,7 +300,7 @@ static int hpet_fasync(int fd, struct file *file, int on)
static int hpet_release(struct inode *inode, struct file *file) static int hpet_release(struct inode *inode, struct file *file)
{ {
struct hpet_dev *devp; struct hpet_dev *devp;
struct hpet_timer *timer; struct hpet_timer __iomem *timer;
int irq = 0; int irq = 0;
devp = file->private_data; devp = file->private_data;
...@@ -352,8 +352,8 @@ hpet_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -352,8 +352,8 @@ hpet_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
static int hpet_ioctl_ieon(struct hpet_dev *devp) static int hpet_ioctl_ieon(struct hpet_dev *devp)
{ {
struct hpet_timer *timer; struct hpet_timer __iomem *timer;
struct hpet *hpet; struct hpet __iomem *hpet;
struct hpets *hpetp; struct hpets *hpetp;
int irq; int irq;
unsigned long g, v, t, m; unsigned long g, v, t, m;
...@@ -435,8 +435,8 @@ static inline unsigned long hpet_time_div(unsigned long dis) ...@@ -435,8 +435,8 @@ static inline unsigned long hpet_time_div(unsigned long dis)
static int static int
hpet_ioctl_common(struct hpet_dev *devp, int cmd, unsigned long arg, int kernel) hpet_ioctl_common(struct hpet_dev *devp, int cmd, unsigned long arg, int kernel)
{ {
struct hpet_timer *timer; struct hpet_timer __iomem *timer;
struct hpet *hpet; struct hpet __iomem *hpet;
struct hpets *hpetp; struct hpets *hpetp;
int err; int err;
unsigned long v; unsigned long v;
...@@ -547,7 +547,7 @@ int hpet_register(struct hpet_task *tp, int periodic) ...@@ -547,7 +547,7 @@ int hpet_register(struct hpet_task *tp, int periodic)
{ {
unsigned int i; unsigned int i;
u64 mask; u64 mask;
struct hpet_timer *timer; struct hpet_timer __iomem *timer;
struct hpet_dev *devp; struct hpet_dev *devp;
struct hpets *hpetp; struct hpets *hpetp;
...@@ -615,7 +615,7 @@ static inline int hpet_tpcheck(struct hpet_task *tp) ...@@ -615,7 +615,7 @@ static inline int hpet_tpcheck(struct hpet_task *tp)
int hpet_unregister(struct hpet_task *tp) int hpet_unregister(struct hpet_task *tp)
{ {
struct hpet_dev *devp; struct hpet_dev *devp;
struct hpet_timer *timer; struct hpet_timer __iomem *timer;
int err; int err;
if ((err = hpet_tpcheck(tp))) if ((err = hpet_tpcheck(tp)))
...@@ -714,11 +714,11 @@ static struct ctl_table_header *sysctl_header; ...@@ -714,11 +714,11 @@ static struct ctl_table_header *sysctl_header;
static unsigned long __init hpet_calibrate(struct hpets *hpetp) static unsigned long __init hpet_calibrate(struct hpets *hpetp)
{ {
struct hpet_timer *timer = NULL; struct hpet_timer __iomem *timer = NULL;
unsigned long t, m, count, i, flags, start; unsigned long t, m, count, i, flags, start;
struct hpet_dev *devp; struct hpet_dev *devp;
int j; int j;
struct hpet *hpet; struct hpet __iomem *hpet;
for (j = 0, devp = hpetp->hp_dev; j < hpetp->hp_ntimer; j++, devp++) for (j = 0, devp = hpetp->hp_dev; j < hpetp->hp_ntimer; j++, devp++)
if ((devp->hd_flags & HPET_OPEN) == 0) { if ((devp->hd_flags & HPET_OPEN) == 0) {
...@@ -756,7 +756,7 @@ int __init hpet_alloc(struct hpet_data *hdp) ...@@ -756,7 +756,7 @@ int __init hpet_alloc(struct hpet_data *hdp)
u32 i, ntimer; u32 i, ntimer;
struct hpets *hpetp; struct hpets *hpetp;
size_t siz; size_t siz;
struct hpet *hpet; struct hpet __iomem *hpet;
static struct hpets *last __initdata = (struct hpets *)0; static struct hpets *last __initdata = (struct hpets *)0;
unsigned long ns; unsigned long ns;
...@@ -766,7 +766,7 @@ int __init hpet_alloc(struct hpet_data *hdp) ...@@ -766,7 +766,7 @@ int __init hpet_alloc(struct hpet_data *hdp)
* ACPI also reports hpet, then we catch it here. * ACPI also reports hpet, then we catch it here.
*/ */
for (hpetp = hpets; hpetp; hpetp = hpetp->hp_next) for (hpetp = hpets; hpetp; hpetp = hpetp->hp_next)
if (hpetp->hp_hpet == (struct hpet *)(hdp->hd_address)) if (hpetp->hp_hpet == hdp->hd_address)
return 0; return 0;
siz = sizeof(struct hpets) + ((hdp->hd_nirqs - 1) * siz = sizeof(struct hpets) + ((hdp->hd_nirqs - 1) *
...@@ -780,7 +780,7 @@ int __init hpet_alloc(struct hpet_data *hdp) ...@@ -780,7 +780,7 @@ int __init hpet_alloc(struct hpet_data *hdp)
memset(hpetp, 0, siz); memset(hpetp, 0, siz);
hpetp->hp_which = hpet_nhpet++; hpetp->hp_which = hpet_nhpet++;
hpetp->hp_hpet = (struct hpet *)hdp->hd_address; hpetp->hp_hpet = hdp->hd_address;
hpetp->hp_ntimer = hdp->hd_nirqs; hpetp->hp_ntimer = hdp->hd_nirqs;
...@@ -832,7 +832,7 @@ int __init hpet_alloc(struct hpet_data *hdp) ...@@ -832,7 +832,7 @@ int __init hpet_alloc(struct hpet_data *hdp)
for (i = 0, devp = hpetp->hp_dev; i < hpetp->hp_ntimer; for (i = 0, devp = hpetp->hp_dev; i < hpetp->hp_ntimer;
i++, hpet_ntimer++, devp++) { i++, hpet_ntimer++, devp++) {
unsigned long v; unsigned long v;
struct hpet_timer *timer; struct hpet_timer __iomem *timer;
timer = &hpet->hpet_timers[devp - hpetp->hp_dev]; timer = &hpet->hpet_timers[devp - hpetp->hp_dev];
v = readq(&timer->hpet_config); v = readq(&timer->hpet_config);
...@@ -873,11 +873,10 @@ static acpi_status __init hpet_resources(struct acpi_resource *res, void *data) ...@@ -873,11 +873,10 @@ static acpi_status __init hpet_resources(struct acpi_resource *res, void *data)
unsigned long size; unsigned long size;
size = addr.max_address_range - addr.min_address_range + 1; size = addr.max_address_range - addr.min_address_range + 1;
hdp->hd_address = hdp->hd_address = ioremap(addr.min_address_range, size);
(unsigned long)ioremap(addr.min_address_range, size);
for (hpetp = hpets; hpetp; hpetp = hpetp->hp_next) for (hpetp = hpets; hpetp; hpetp = hpetp->hp_next)
if (hpetp->hp_hpet == (struct hpet *)(hdp->hd_address)) if (hpetp->hp_hpet == hdp->hd_address)
return -EBUSY; return -EBUSY;
} else if (res->id == ACPI_RSTYPE_EXT_IRQ) { } else if (res->id == ACPI_RSTYPE_EXT_IRQ) {
struct acpi_resource_ext_irq *irqp; struct acpi_resource_ext_irq *irqp;
......
#ifndef __HPET__ #ifndef __HPET__
#define __HPET__ 1 #define __HPET__ 1
#include <linux/compiler.h>
/* /*
* Offsets into HPET Registers * Offsets into HPET Registers
*/ */
...@@ -110,7 +112,7 @@ struct hpet_task { ...@@ -110,7 +112,7 @@ struct hpet_task {
}; };
struct hpet_data { struct hpet_data {
unsigned long hd_address; void __iomem *hd_address;
unsigned short hd_nirqs; unsigned short hd_nirqs;
unsigned short hd_flags; unsigned short hd_flags;
unsigned int hd_state; /* timer allocated */ unsigned int hd_state; /* timer allocated */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment