diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/include/asm/hpet.h | 2 | ||||
-rw-r--r-- | arch/x86/kernel/hpet.c | 45 |
2 files changed, 24 insertions, 23 deletions
diff --git a/arch/x86/include/asm/hpet.h b/arch/x86/include/asm/hpet.h index 1c22cb05ad6a..65847c578b70 100644 --- a/arch/x86/include/asm/hpet.h +++ b/arch/x86/include/asm/hpet.h | |||
@@ -69,7 +69,7 @@ extern int hpet_force_user; | |||
69 | extern int is_hpet_enabled(void); | 69 | extern int is_hpet_enabled(void); |
70 | extern int hpet_enable(void); | 70 | extern int hpet_enable(void); |
71 | extern void hpet_disable(void); | 71 | extern void hpet_disable(void); |
72 | extern unsigned long hpet_readl(unsigned long a); | 72 | extern unsigned int hpet_readl(unsigned int a); |
73 | extern void force_hpet_resume(void); | 73 | extern void force_hpet_resume(void); |
74 | 74 | ||
75 | extern void hpet_msi_unmask(unsigned int irq); | 75 | extern void hpet_msi_unmask(unsigned int irq); |
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c index 5969e1078fc2..ba575f0f2e34 100644 --- a/arch/x86/kernel/hpet.c +++ b/arch/x86/kernel/hpet.c | |||
@@ -47,12 +47,12 @@ struct hpet_dev { | |||
47 | char name[10]; | 47 | char name[10]; |
48 | }; | 48 | }; |
49 | 49 | ||
50 | unsigned long hpet_readl(unsigned long a) | 50 | inline unsigned int hpet_readl(unsigned int a) |
51 | { | 51 | { |
52 | return readl(hpet_virt_address + a); | 52 | return readl(hpet_virt_address + a); |
53 | } | 53 | } |
54 | 54 | ||
55 | static inline void hpet_writel(unsigned long d, unsigned long a) | 55 | static inline void hpet_writel(unsigned int d, unsigned int a) |
56 | { | 56 | { |
57 | writel(d, hpet_virt_address + a); | 57 | writel(d, hpet_virt_address + a); |
58 | } | 58 | } |
@@ -167,7 +167,7 @@ do { \ | |||
167 | 167 | ||
168 | static void hpet_reserve_msi_timers(struct hpet_data *hd); | 168 | static void hpet_reserve_msi_timers(struct hpet_data *hd); |
169 | 169 | ||
170 | static void hpet_reserve_platform_timers(unsigned long id) | 170 | static void hpet_reserve_platform_timers(unsigned int id) |
171 | { | 171 | { |
172 | struct hpet __iomem *hpet = hpet_virt_address; | 172 | struct hpet __iomem *hpet = hpet_virt_address; |
173 | struct hpet_timer __iomem *timer = &hpet->hpet_timers[2]; | 173 | struct hpet_timer __iomem *timer = &hpet->hpet_timers[2]; |
@@ -205,7 +205,7 @@ static void hpet_reserve_platform_timers(unsigned long id) | |||
205 | 205 | ||
206 | } | 206 | } |
207 | #else | 207 | #else |
208 | static void hpet_reserve_platform_timers(unsigned long id) { } | 208 | static void hpet_reserve_platform_timers(unsigned int id) { } |
209 | #endif | 209 | #endif |
210 | 210 | ||
211 | /* | 211 | /* |
@@ -246,7 +246,7 @@ static void hpet_reset_counter(void) | |||
246 | 246 | ||
247 | static void hpet_start_counter(void) | 247 | static void hpet_start_counter(void) |
248 | { | 248 | { |
249 | unsigned long cfg = hpet_readl(HPET_CFG); | 249 | unsigned int cfg = hpet_readl(HPET_CFG); |
250 | cfg |= HPET_CFG_ENABLE; | 250 | cfg |= HPET_CFG_ENABLE; |
251 | hpet_writel(cfg, HPET_CFG); | 251 | hpet_writel(cfg, HPET_CFG); |
252 | } | 252 | } |
@@ -271,7 +271,7 @@ static void hpet_resume_counter(void) | |||
271 | 271 | ||
272 | static void hpet_enable_legacy_int(void) | 272 | static void hpet_enable_legacy_int(void) |
273 | { | 273 | { |
274 | unsigned long cfg = hpet_readl(HPET_CFG); | 274 | unsigned int cfg = hpet_readl(HPET_CFG); |
275 | 275 | ||
276 | cfg |= HPET_CFG_LEGACY; | 276 | cfg |= HPET_CFG_LEGACY; |
277 | hpet_writel(cfg, HPET_CFG); | 277 | hpet_writel(cfg, HPET_CFG); |
@@ -314,7 +314,7 @@ static int hpet_setup_msi_irq(unsigned int irq); | |||
314 | static void hpet_set_mode(enum clock_event_mode mode, | 314 | static void hpet_set_mode(enum clock_event_mode mode, |
315 | struct clock_event_device *evt, int timer) | 315 | struct clock_event_device *evt, int timer) |
316 | { | 316 | { |
317 | unsigned long cfg, cmp, now; | 317 | unsigned int cfg, cmp, now; |
318 | uint64_t delta; | 318 | uint64_t delta; |
319 | 319 | ||
320 | switch (mode) { | 320 | switch (mode) { |
@@ -323,7 +323,7 @@ static void hpet_set_mode(enum clock_event_mode mode, | |||
323 | delta = ((uint64_t)(NSEC_PER_SEC/HZ)) * evt->mult; | 323 | delta = ((uint64_t)(NSEC_PER_SEC/HZ)) * evt->mult; |
324 | delta >>= evt->shift; | 324 | delta >>= evt->shift; |
325 | now = hpet_readl(HPET_COUNTER); | 325 | now = hpet_readl(HPET_COUNTER); |
326 | cmp = now + (unsigned long) delta; | 326 | cmp = now + (unsigned int) delta; |
327 | cfg = hpet_readl(HPET_Tn_CFG(timer)); | 327 | cfg = hpet_readl(HPET_Tn_CFG(timer)); |
328 | /* Make sure we use edge triggered interrupts */ | 328 | /* Make sure we use edge triggered interrupts */ |
329 | cfg &= ~HPET_TN_LEVEL; | 329 | cfg &= ~HPET_TN_LEVEL; |
@@ -339,7 +339,7 @@ static void hpet_set_mode(enum clock_event_mode mode, | |||
339 | * (See AMD-8111 HyperTransport I/O Hub Data Sheet, | 339 | * (See AMD-8111 HyperTransport I/O Hub Data Sheet, |
340 | * Publication # 24674) | 340 | * Publication # 24674) |
341 | */ | 341 | */ |
342 | hpet_writel((unsigned long) delta, HPET_Tn_CMP(timer)); | 342 | hpet_writel((unsigned int) delta, HPET_Tn_CMP(timer)); |
343 | hpet_start_counter(); | 343 | hpet_start_counter(); |
344 | hpet_print_config(); | 344 | hpet_print_config(); |
345 | break; | 345 | break; |
@@ -387,9 +387,9 @@ static int hpet_next_event(unsigned long delta, | |||
387 | * what we wrote hit the chip before we compare it to the | 387 | * what we wrote hit the chip before we compare it to the |
388 | * counter. | 388 | * counter. |
389 | */ | 389 | */ |
390 | WARN_ON_ONCE((u32)hpet_readl(HPET_Tn_CMP(timer)) != cnt); | 390 | WARN_ON_ONCE(hpet_readl(HPET_Tn_CMP(timer)) != cnt); |
391 | 391 | ||
392 | return (s32)((u32)hpet_readl(HPET_COUNTER) - cnt) >= 0 ? -ETIME : 0; | 392 | return (s32)(hpet_readl(HPET_COUNTER) - cnt) >= 0 ? -ETIME : 0; |
393 | } | 393 | } |
394 | 394 | ||
395 | static void hpet_legacy_set_mode(enum clock_event_mode mode, | 395 | static void hpet_legacy_set_mode(enum clock_event_mode mode, |
@@ -415,7 +415,7 @@ static struct hpet_dev *hpet_devs; | |||
415 | void hpet_msi_unmask(unsigned int irq) | 415 | void hpet_msi_unmask(unsigned int irq) |
416 | { | 416 | { |
417 | struct hpet_dev *hdev = get_irq_data(irq); | 417 | struct hpet_dev *hdev = get_irq_data(irq); |
418 | unsigned long cfg; | 418 | unsigned int cfg; |
419 | 419 | ||
420 | /* unmask it */ | 420 | /* unmask it */ |
421 | cfg = hpet_readl(HPET_Tn_CFG(hdev->num)); | 421 | cfg = hpet_readl(HPET_Tn_CFG(hdev->num)); |
@@ -425,7 +425,7 @@ void hpet_msi_unmask(unsigned int irq) | |||
425 | 425 | ||
426 | void hpet_msi_mask(unsigned int irq) | 426 | void hpet_msi_mask(unsigned int irq) |
427 | { | 427 | { |
428 | unsigned long cfg; | 428 | unsigned int cfg; |
429 | struct hpet_dev *hdev = get_irq_data(irq); | 429 | struct hpet_dev *hdev = get_irq_data(irq); |
430 | 430 | ||
431 | /* mask it */ | 431 | /* mask it */ |
@@ -600,7 +600,7 @@ static void hpet_msi_capability_lookup(unsigned int start_timer) | |||
600 | 600 | ||
601 | for (i = start_timer; i < num_timers - RESERVE_TIMERS; i++) { | 601 | for (i = start_timer; i < num_timers - RESERVE_TIMERS; i++) { |
602 | struct hpet_dev *hdev = &hpet_devs[num_timers_used]; | 602 | struct hpet_dev *hdev = &hpet_devs[num_timers_used]; |
603 | unsigned long cfg = hpet_readl(HPET_Tn_CFG(i)); | 603 | unsigned int cfg = hpet_readl(HPET_Tn_CFG(i)); |
604 | 604 | ||
605 | /* Only consider HPET timer with MSI support */ | 605 | /* Only consider HPET timer with MSI support */ |
606 | if (!(cfg & HPET_TN_FSB_CAP)) | 606 | if (!(cfg & HPET_TN_FSB_CAP)) |
@@ -815,7 +815,7 @@ static int hpet_clocksource_register(void) | |||
815 | */ | 815 | */ |
816 | int __init hpet_enable(void) | 816 | int __init hpet_enable(void) |
817 | { | 817 | { |
818 | unsigned long id; | 818 | unsigned int id; |
819 | int i; | 819 | int i; |
820 | 820 | ||
821 | if (!is_hpet_capable()) | 821 | if (!is_hpet_capable()) |
@@ -933,7 +933,7 @@ fs_initcall(hpet_late_init); | |||
933 | void hpet_disable(void) | 933 | void hpet_disable(void) |
934 | { | 934 | { |
935 | if (is_hpet_capable()) { | 935 | if (is_hpet_capable()) { |
936 | unsigned long cfg = hpet_readl(HPET_CFG); | 936 | unsigned int cfg = hpet_readl(HPET_CFG); |
937 | 937 | ||
938 | if (hpet_legacy_int_enabled) { | 938 | if (hpet_legacy_int_enabled) { |
939 | cfg &= ~HPET_CFG_LEGACY; | 939 | cfg &= ~HPET_CFG_LEGACY; |
@@ -973,8 +973,8 @@ static int hpet_prev_update_sec; | |||
973 | static struct rtc_time hpet_alarm_time; | 973 | static struct rtc_time hpet_alarm_time; |
974 | static unsigned long hpet_pie_count; | 974 | static unsigned long hpet_pie_count; |
975 | static u32 hpet_t1_cmp; | 975 | static u32 hpet_t1_cmp; |
976 | static unsigned long hpet_default_delta; | 976 | static u32 hpet_default_delta; |
977 | static unsigned long hpet_pie_delta; | 977 | static u32 hpet_pie_delta; |
978 | static unsigned long hpet_pie_limit; | 978 | static unsigned long hpet_pie_limit; |
979 | 979 | ||
980 | static rtc_irq_handler irq_handler; | 980 | static rtc_irq_handler irq_handler; |
@@ -1025,7 +1025,8 @@ EXPORT_SYMBOL_GPL(hpet_unregister_irq_handler); | |||
1025 | */ | 1025 | */ |
1026 | int hpet_rtc_timer_init(void) | 1026 | int hpet_rtc_timer_init(void) |
1027 | { | 1027 | { |
1028 | unsigned long cfg, cnt, delta, flags; | 1028 | unsigned int cfg, cnt, delta; |
1029 | unsigned long flags; | ||
1029 | 1030 | ||
1030 | if (!is_hpet_enabled()) | 1031 | if (!is_hpet_enabled()) |
1031 | return 0; | 1032 | return 0; |
@@ -1035,7 +1036,7 @@ int hpet_rtc_timer_init(void) | |||
1035 | 1036 | ||
1036 | clc = (uint64_t) hpet_clockevent.mult * NSEC_PER_SEC; | 1037 | clc = (uint64_t) hpet_clockevent.mult * NSEC_PER_SEC; |
1037 | clc >>= hpet_clockevent.shift + DEFAULT_RTC_SHIFT; | 1038 | clc >>= hpet_clockevent.shift + DEFAULT_RTC_SHIFT; |
1038 | hpet_default_delta = (unsigned long) clc; | 1039 | hpet_default_delta = clc; |
1039 | } | 1040 | } |
1040 | 1041 | ||
1041 | if (!(hpet_rtc_flags & RTC_PIE) || hpet_pie_limit) | 1042 | if (!(hpet_rtc_flags & RTC_PIE) || hpet_pie_limit) |
@@ -1121,7 +1122,7 @@ int hpet_set_periodic_freq(unsigned long freq) | |||
1121 | clc = (uint64_t) hpet_clockevent.mult * NSEC_PER_SEC; | 1122 | clc = (uint64_t) hpet_clockevent.mult * NSEC_PER_SEC; |
1122 | do_div(clc, freq); | 1123 | do_div(clc, freq); |
1123 | clc >>= hpet_clockevent.shift; | 1124 | clc >>= hpet_clockevent.shift; |
1124 | hpet_pie_delta = (unsigned long) clc; | 1125 | hpet_pie_delta = clc; |
1125 | } | 1126 | } |
1126 | return 1; | 1127 | return 1; |
1127 | } | 1128 | } |
@@ -1135,7 +1136,7 @@ EXPORT_SYMBOL_GPL(hpet_rtc_dropped_irq); | |||
1135 | 1136 | ||
1136 | static void hpet_rtc_timer_reinit(void) | 1137 | static void hpet_rtc_timer_reinit(void) |
1137 | { | 1138 | { |
1138 | unsigned long cfg, delta; | 1139 | unsigned int cfg, delta; |
1139 | int lost_ints = -1; | 1140 | int lost_ints = -1; |
1140 | 1141 | ||
1141 | if (unlikely(!hpet_rtc_flags)) { | 1142 | if (unlikely(!hpet_rtc_flags)) { |