aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-09-06 08:19:17 -0400
committerIngo Molnar <mingo@elte.hu>2008-10-16 10:53:07 -0400
commit4588c1f0354ac96a358b3f9e8e4331c51cf3336f (patch)
treefe0258cb843a2a974a52814e1344ee8126be5c23 /arch
parent58ac1e76ce77d515bd5cb65dbc465a040da341c6 (diff)
x86: HPET_MSI Basic HPET_MSI setup code, cleanups
small style cleanups. Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kernel/hpet.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index 3f10d16a8348..03d3655734b4 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -1,39 +1,39 @@
1#include <linux/clocksource.h> 1#include <linux/clocksource.h>
2#include <linux/clockchips.h> 2#include <linux/clockchips.h>
3#include <linux/interrupt.h>
4#include <linux/sysdev.h>
3#include <linux/delay.h> 5#include <linux/delay.h>
4#include <linux/errno.h> 6#include <linux/errno.h>
5#include <linux/hpet.h> 7#include <linux/hpet.h>
6#include <linux/init.h> 8#include <linux/init.h>
7#include <linux/sysdev.h>
8#include <linux/pm.h>
9#include <linux/interrupt.h>
10#include <linux/cpu.h> 9#include <linux/cpu.h>
10#include <linux/pm.h>
11#include <linux/io.h>
11 12
12#include <asm/fixmap.h> 13#include <asm/fixmap.h>
13#include <asm/hpet.h>
14#include <asm/i8253.h> 14#include <asm/i8253.h>
15#include <asm/io.h> 15#include <asm/hpet.h>
16 16
17#define HPET_MASK CLOCKSOURCE_MASK(32) 17#define HPET_MASK CLOCKSOURCE_MASK(32)
18#define HPET_SHIFT 22 18#define HPET_SHIFT 22
19 19
20/* FSEC = 10^-15 20/* FSEC = 10^-15
21 NSEC = 10^-9 */ 21 NSEC = 10^-9 */
22#define FSEC_PER_NSEC 1000000L 22#define FSEC_PER_NSEC 1000000L
23 23
24/* 24/*
25 * HPET address is set in acpi/boot.c, when an ACPI entry exists 25 * HPET address is set in acpi/boot.c, when an ACPI entry exists
26 */ 26 */
27unsigned long hpet_address; 27unsigned long hpet_address;
28static void __iomem *hpet_virt_address; 28static void __iomem *hpet_virt_address;
29 29
30struct hpet_dev { 30struct hpet_dev {
31 struct clock_event_device evt; 31 struct clock_event_device evt;
32 unsigned int num; 32 unsigned int num;
33 int cpu; 33 int cpu;
34 unsigned int irq; 34 unsigned int irq;
35 unsigned int flags; 35 unsigned int flags;
36 char name[10]; 36 char name[10];
37}; 37};
38 38
39unsigned long hpet_readl(unsigned long a) 39unsigned long hpet_readl(unsigned long a)
@@ -70,7 +70,7 @@ static inline void hpet_clear_mapping(void)
70static int boot_hpet_disable; 70static int boot_hpet_disable;
71int hpet_force_user; 71int hpet_force_user;
72 72
73static int __init hpet_setup(char* str) 73static int __init hpet_setup(char *str)
74{ 74{
75 if (str) { 75 if (str) {
76 if (!strncmp("disable", str, 7)) 76 if (!strncmp("disable", str, 7))
@@ -91,7 +91,7 @@ __setup("nohpet", disable_hpet);
91 91
92static inline int is_hpet_capable(void) 92static inline int is_hpet_capable(void)
93{ 93{
94 return (!boot_hpet_disable && hpet_address); 94 return !boot_hpet_disable && hpet_address;
95} 95}
96 96
97/* 97/*
@@ -122,10 +122,10 @@ static void hpet_reserve_platform_timers(unsigned long id)
122 122
123 nrtimers = ((id & HPET_ID_NUMBER) >> HPET_ID_NUMBER_SHIFT) + 1; 123 nrtimers = ((id & HPET_ID_NUMBER) >> HPET_ID_NUMBER_SHIFT) + 1;
124 124
125 memset(&hd, 0, sizeof (hd)); 125 memset(&hd, 0, sizeof(hd));
126 hd.hd_phys_address = hpet_address; 126 hd.hd_phys_address = hpet_address;
127 hd.hd_address = hpet; 127 hd.hd_address = hpet;
128 hd.hd_nirqs = nrtimers; 128 hd.hd_nirqs = nrtimers;
129 hpet_reserve_timer(&hd, 0); 129 hpet_reserve_timer(&hd, 0);
130 130
131#ifdef CONFIG_HPET_EMULATE_RTC 131#ifdef CONFIG_HPET_EMULATE_RTC
@@ -141,8 +141,8 @@ static void hpet_reserve_platform_timers(unsigned long id)
141 hd.hd_irq[1] = HPET_LEGACY_RTC; 141 hd.hd_irq[1] = HPET_LEGACY_RTC;
142 142
143 for (i = 2; i < nrtimers; timer++, i++) { 143 for (i = 2; i < nrtimers; timer++, i++) {
144 hd.hd_irq[i] = (readl(&timer->hpet_config) & Tn_INT_ROUTE_CNF_MASK) >> 144 hd.hd_irq[i] = (readl(&timer->hpet_config) &
145 Tn_INT_ROUTE_CNF_SHIFT; 145 Tn_INT_ROUTE_CNF_MASK) >> Tn_INT_ROUTE_CNF_SHIFT;
146 } 146 }
147 147
148 hpet_alloc(&hd); 148 hpet_alloc(&hd);
@@ -244,7 +244,7 @@ static void hpet_set_mode(enum clock_event_mode mode,
244 unsigned long cfg, cmp, now; 244 unsigned long cfg, cmp, now;
245 uint64_t delta; 245 uint64_t delta;
246 246
247 switch(mode) { 247 switch (mode) {
248 case CLOCK_EVT_MODE_PERIODIC: 248 case CLOCK_EVT_MODE_PERIODIC:
249 delta = ((uint64_t)(NSEC_PER_SEC/HZ)) * evt->mult; 249 delta = ((uint64_t)(NSEC_PER_SEC/HZ)) * evt->mult;
250 delta >>= evt->shift; 250 delta >>= evt->shift;