summaryrefslogtreecommitdiffstats
path: root/arch/x86/include/asm/genapic.h
diff options
context:
space:
mode:
authorYinghai Lu <yinghai@kernel.org>2009-02-16 23:02:14 -0800
committerIngo Molnar <mingo@elte.hu>2009-02-17 12:22:20 +0100
commitc1eeb2de41d7015678bdd412b48a5f071b84e29a (patch)
tree6af99f46f557f9e854e882deac52d23b2fadb5a2 /arch/x86/include/asm/genapic.h
parent06cd9a7dc8a58186060a91b6ddc031057435fd34 (diff)
downloadblackbird-op-linux-c1eeb2de41d7015678bdd412b48a5f071b84e29a.tar.gz
blackbird-op-linux-c1eeb2de41d7015678bdd412b48a5f071b84e29a.zip
x86: fold apic_ops into genapic
Impact: cleanup make it simpler, don't need have one extra struct. v2: fix the sgi_uv build Signed-off-by: Yinghai Lu <yinghai@kernel.org> Cc: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/include/asm/genapic.h')
-rw-r--r--arch/x86/include/asm/genapic.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/arch/x86/include/asm/genapic.h b/arch/x86/include/asm/genapic.h
index 273b99452ae0..a6d0b00a544c 100644
--- a/arch/x86/include/asm/genapic.h
+++ b/arch/x86/include/asm/genapic.h
@@ -5,6 +5,7 @@
#include <asm/mpspec.h>
#include <asm/atomic.h>
+#include <asm/apic.h>
/*
* Copyright 2004 James Cleverdon, IBM.
@@ -83,10 +84,70 @@ struct genapic {
void (*smp_callin_clear_local_apic)(void);
void (*store_NMI_vector)(unsigned short *high, unsigned short *low);
void (*inquire_remote_apic)(int apicid);
+
+ /* apic ops */
+ u32 (*read)(u32 reg);
+ void (*write)(u32 reg, u32 v);
+ u64 (*icr_read)(void);
+ void (*icr_write)(u32 low, u32 high);
+ void (*wait_icr_idle)(void);
+ u32 (*safe_wait_icr_idle)(void);
};
extern struct genapic *apic;
+static inline u32 apic_read(u32 reg)
+{
+ return apic->read(reg);
+}
+
+static inline void apic_write(u32 reg, u32 val)
+{
+ apic->write(reg, val);
+}
+
+static inline u64 apic_icr_read(void)
+{
+ return apic->icr_read();
+}
+
+static inline void apic_icr_write(u32 low, u32 high)
+{
+ apic->icr_write(low, high);
+}
+
+static inline void apic_wait_icr_idle(void)
+{
+ apic->wait_icr_idle();
+}
+
+static inline u32 safe_apic_wait_icr_idle(void)
+{
+ return apic->safe_wait_icr_idle();
+}
+
+
+static inline void ack_APIC_irq(void)
+{
+ /*
+ * ack_APIC_irq() actually gets compiled as a single instruction
+ * ... yummie.
+ */
+
+ /* Docs say use 0 for future compatibility */
+ apic_write(APIC_EOI, 0);
+}
+
+static inline unsigned default_get_apic_id(unsigned long x)
+{
+ unsigned int ver = GET_APIC_VERSION(apic_read(APIC_LVR));
+
+ if (APIC_XAPIC(ver))
+ return (x >> 24) & 0xFF;
+ else
+ return (x >> 24) & 0x0F;
+}
+
/*
* Warm reset vector default position:
*/
OpenPOWER on IntegriCloud