diff options
-rw-r--r-- | arch/x86_64/kernel/apic.c | 22 | ||||
-rw-r--r-- | include/asm-x86_64/apic.h | 8 |
2 files changed, 25 insertions, 5 deletions
diff --git a/arch/x86_64/kernel/apic.c b/arch/x86_64/kernel/apic.c index 3421f21b6c70..943ec4d1bd8e 100644 --- a/arch/x86_64/kernel/apic.c +++ b/arch/x86_64/kernel/apic.c | |||
@@ -68,6 +68,28 @@ int using_apic_timer __read_mostly = 0; | |||
68 | 68 | ||
69 | static void apic_pm_activate(void); | 69 | static void apic_pm_activate(void); |
70 | 70 | ||
71 | void apic_wait_icr_idle(void) | ||
72 | { | ||
73 | while (apic_read(APIC_ICR) & APIC_ICR_BUSY) | ||
74 | cpu_relax(); | ||
75 | } | ||
76 | |||
77 | unsigned int safe_apic_wait_icr_idle(void) | ||
78 | { | ||
79 | unsigned int send_status; | ||
80 | int timeout; | ||
81 | |||
82 | timeout = 0; | ||
83 | do { | ||
84 | send_status = apic_read(APIC_ICR) & APIC_ICR_BUSY; | ||
85 | if (!send_status) | ||
86 | break; | ||
87 | udelay(100); | ||
88 | } while (timeout++ < 1000); | ||
89 | |||
90 | return send_status; | ||
91 | } | ||
92 | |||
71 | void enable_NMI_through_LVT0 (void * dummy) | 93 | void enable_NMI_through_LVT0 (void * dummy) |
72 | { | 94 | { |
73 | unsigned int v; | 95 | unsigned int v; |
diff --git a/include/asm-x86_64/apic.h b/include/asm-x86_64/apic.h index 2f3b013595ab..45e9fca1febc 100644 --- a/include/asm-x86_64/apic.h +++ b/include/asm-x86_64/apic.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define __ASM_APIC_H | 2 | #define __ASM_APIC_H |
3 | 3 | ||
4 | #include <linux/pm.h> | 4 | #include <linux/pm.h> |
5 | #include <linux/delay.h> | ||
5 | #include <asm/fixmap.h> | 6 | #include <asm/fixmap.h> |
6 | #include <asm/apicdef.h> | 7 | #include <asm/apicdef.h> |
7 | #include <asm/system.h> | 8 | #include <asm/system.h> |
@@ -47,11 +48,8 @@ static __inline unsigned int apic_read(unsigned long reg) | |||
47 | return *((volatile unsigned int *)(APIC_BASE+reg)); | 48 | return *((volatile unsigned int *)(APIC_BASE+reg)); |
48 | } | 49 | } |
49 | 50 | ||
50 | static __inline__ void apic_wait_icr_idle(void) | 51 | extern void apic_wait_icr_idle(void); |
51 | { | 52 | extern unsigned int safe_apic_wait_icr_idle(void); |
52 | while (apic_read( APIC_ICR ) & APIC_ICR_BUSY) | ||
53 | cpu_relax(); | ||
54 | } | ||
55 | 53 | ||
56 | static inline void ack_APIC_irq(void) | 54 | static inline void ack_APIC_irq(void) |
57 | { | 55 | { |