]> err.no Git - linux-2.6/commitdiff
x86: extended interrupt LVT support for AMD Barcelona
authorRobert Richter <robert.richter@amd.com>
Wed, 30 Jan 2008 12:30:40 +0000 (13:30 +0100)
committerIngo Molnar <mingo@elte.hu>
Wed, 30 Jan 2008 12:30:40 +0000 (13:30 +0100)
Also macro definitions in apicdef.h has been updated.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
arch/x86/kernel/apic_64.c
arch/x86/kernel/cpu/mcheck/mce_amd_64.c
include/asm-x86/apic.h
include/asm-x86/apicdef.h

index d341f798255ce77810707ad6a931edfb687cb962..027004262105a21b28eae9cb467a026f501ecd4b 100644 (file)
@@ -187,17 +187,35 @@ static void __setup_APIC_LVTT(unsigned int clocks, int oneshot, int irqen)
 }
 
 /*
- * Setup extended LVT (K8 specific)
+ * Setup extended LVT, AMD specific (K8, family 10h)
+ *
+ * Vector mappings are hard coded. On K8 only offset 0 (APIC500) and
+ * MCE interrupts are supported. Thus MCE offset must be set to 0.
  */
-void setup_APIC_extended_lvt(unsigned char lvt_off, unsigned char vector,
-                            unsigned char msg_type, unsigned char mask)
+
+#define APIC_EILVT_LVTOFF_MCE 0
+#define APIC_EILVT_LVTOFF_IBS 1
+
+static void setup_APIC_eilvt(u8 lvt_off, u8 vector, u8 msg_type, u8 mask)
 {
-       unsigned long reg = (lvt_off << 4) + K8_APIC_EXT_LVT_BASE;
+       unsigned long reg = (lvt_off << 4) + APIC_EILVT0;
        unsigned int  v   = (mask << 16) | (msg_type << 8) | vector;
 
        apic_write(reg, v);
 }
 
+u8 setup_APIC_eilvt_mce(u8 vector, u8 msg_type, u8 mask)
+{
+       setup_APIC_eilvt(APIC_EILVT_LVTOFF_MCE, vector, msg_type, mask);
+       return APIC_EILVT_LVTOFF_MCE;
+}
+
+u8 setup_APIC_eilvt_ibs(u8 vector, u8 msg_type, u8 mask)
+{
+       setup_APIC_eilvt(APIC_EILVT_LVTOFF_IBS, vector, msg_type, mask);
+       return APIC_EILVT_LVTOFF_IBS;
+}
+
 /*
  * Program the next event, relative to now
  */
index 073afa7dd89a08f851a08ba89f55487da653e13f..550502596ca3eef8a4816c73285db47fd6fef602 100644 (file)
@@ -118,6 +118,7 @@ void __cpuinit mce_amd_feature_init(struct cpuinfo_x86 *c)
 {
        unsigned int bank, block;
        unsigned int cpu = smp_processor_id();
+       u8 lvt_off;
        u32 low = 0, high = 0, address = 0;
 
        for (bank = 0; bank < NR_BANKS; ++bank) {
@@ -153,14 +154,13 @@ void __cpuinit mce_amd_feature_init(struct cpuinfo_x86 *c)
                        if (shared_bank[bank] && c->cpu_core_id)
                                break;
 #endif
+                       lvt_off = setup_APIC_eilvt_mce(THRESHOLD_APIC_VECTOR,
+                                                      APIC_EILVT_MSG_FIX, 0);
+
                        high &= ~MASK_LVTOFF_HI;
-                       high |= K8_APIC_EXT_LVT_ENTRY_THRESHOLD << 20;
+                       high |= lvt_off << 20;
                        wrmsr(address, low, high);
 
-                       setup_APIC_extended_lvt(K8_APIC_EXT_LVT_ENTRY_THRESHOLD,
-                                               THRESHOLD_APIC_VECTOR,
-                                               K8_APIC_EXT_INT_MSG_FIX, 0);
-
                        threshold_defaults.address = address;
                        threshold_restart_bank(&threshold_defaults, 0, 0);
                }
index 5e8192d36e5ae6f2917a3d983505a34e46c4a66b..423022759cb2e84660c66f6f050366b216d2a109 100644 (file)
@@ -126,8 +126,8 @@ extern void enable_NMI_through_LVT0(void *dummy);
 extern void setup_apic_routing(void);
 #endif
 
-extern void setup_APIC_extended_lvt(unsigned char lvt_off, unsigned char vector,
-                                   unsigned char msg_type, unsigned char mask);
+extern u8 setup_APIC_eilvt_mce(u8 vector, u8 msg_type, u8 mask);
+extern u8 setup_APIC_eilvt_ibs(u8 vector, u8 msg_type, u8 mask);
 
 extern int apic_is_clustered_box(void);
 
index 5f7abe9b5f8798a37e128550a8d01cca2d5bba82..550af7a6f88e7e935f7553a4005ffd9f2599ca86 100644 (file)
 #define                APIC_TDR_DIV_32         0x8
 #define                APIC_TDR_DIV_64         0x9
 #define                APIC_TDR_DIV_128        0xA
-
-#define K8_APIC_EXT_LVT_BASE           0x500
-#define K8_APIC_EXT_INT_MSG_FIX                0x0
-#define K8_APIC_EXT_INT_MSG_SMI                0x2
-#define K8_APIC_EXT_INT_MSG_NMI                0x4
-#define K8_APIC_EXT_INT_MSG_EXT                0x7
-#define K8_APIC_EXT_LVT_ENTRY_THRESHOLD        0
+#define        APIC_EILVT0     0x500
+#define                APIC_EILVT_NR_AMD_K8    1       /* Number of extended interrupts */
+#define                APIC_EILVT_NR_AMD_10H   4
+#define                APIC_EILVT_LVTOFF(x)    (((x)>>4)&0xF)
+#define                APIC_EILVT_MSG_FIX      0x0
+#define                APIC_EILVT_MSG_SMI      0x2
+#define                APIC_EILVT_MSG_NMI      0x4
+#define                APIC_EILVT_MSG_EXT      0x7
+#define                APIC_EILVT_MASKED       (1<<16)
+#define        APIC_EILVT1     0x510
+#define        APIC_EILVT2     0x520
+#define        APIC_EILVT3     0x530
 
 #define APIC_BASE (fix_to_virt(FIX_APIC_BASE))