]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] Summit: infrastructure
authorMartin J. Bligh <martin.bligh@us.ibm.com>
Tue, 15 Oct 2002 12:37:52 +0000 (05:37 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Tue, 15 Oct 2002 12:37:52 +0000 (05:37 -0700)
This puts the DFR (desination format register) value into a #define, and
calculates the LDR (logical desitination register) correctly dependant
on platform. Similarly for TARGET_CPUS.

arch/i386/kernel/apic.c
arch/i386/mach-generic/mach_apic.h
arch/i386/mach-summit/mach_apic.h
include/asm-i386/apicdef.h
include/asm-i386/smp.h

index 24e7a1e74f4a7b81c7e7b882359750a6639b76ee..d7998626bcc094e08b7413a6e15627773265d28b 100644 (file)
@@ -329,15 +329,13 @@ void __init setup_local_APIC (void)
                 * Put the APIC into flat delivery mode.
                 * Must be "all ones" explicitly for 82489DX.
                 */
-               apic_write_around(APIC_DFR, 0xffffffff);
+               apic_write_around(APIC_DFR, APIC_DFR_VALUE);
 
                /*
                 * Set up the logical destination ID.
                 */
                value = apic_read(APIC_LDR);
-               value &= ~APIC_LDR_MASK;
-               value |= (1<<(smp_processor_id()+24));
-               apic_write_around(APIC_LDR, value);
+               apic_write_around(APIC_LDR, calculate_ldr(value));
        }
 
        /*
index a5480d89b58c5a99bd357fe63698a11d97c6f4cf..5d6e15a51d790389e51d18f3e1d1ca6231161461 100644 (file)
@@ -1,4 +1,20 @@
 #ifndef __ASM_MACH_APIC_H
 #define __ASM_MACH_APIC_H
 
+static inline unsigned long calculate_ldr(unsigned long old)
+{
+       unsigned long id;
+
+       id = 1UL << smp_processor_id();
+       return ((old & ~APIC_LDR_MASK) | SET_APIC_LOGICAL_ID(id));
+}
+
+#define APIC_DFR_VALUE (APIC_DFR_FLAT)
+
+#ifdef CONFIG_SMP
+ #define TARGET_CPUS (clustered_apic_mode ? 0xf : cpu_online_map)
+#else
+ #define TARGET_CPUS 0x01
+#endif
+
 #endif /* __ASM_MACH_APIC_H */
index a5480d89b58c5a99bd357fe63698a11d97c6f4cf..f672f5bba209589e2fdbc9017734948fa6511137 100644 (file)
@@ -1,4 +1,26 @@
 #ifndef __ASM_MACH_APIC_H
 #define __ASM_MACH_APIC_H
 
+extern int x86_summit;
+
+#define XAPIC_DEST_CPUS_MASK    0x0Fu
+#define XAPIC_DEST_CLUSTER_MASK 0xF0u
+
+#define xapic_phys_to_log_apicid(phys_apic) ( (1ul << ((phys_apic) & 0x3)) |\
+               ((phys_apic) & XAPIC_DEST_CLUSTER_MASK) )
+
+static inline unsigned long calculate_ldr(unsigned long old)
+{
+       unsigned long id;
+
+       if (x86_summit)
+               id = xapic_phys_to_log_apicid(hard_smp_processor_id());
+       else
+               id = 1UL << smp_processor_id();
+       return ((old & ~APIC_LDR_MASK) | SET_APIC_LOGICAL_ID(id));
+}
+
+#define APIC_DFR_VALUE (x86_summit ? APIC_DFR_CLUSTER : APIC_DFR_FLAT)
+#define TARGET_CPUS    (x86_summit ? XAPIC_DEST_CPUS_MASK : cpu_online_map)
+
 #endif /* __ASM_MACH_APIC_H */
index a91e6ede6b0afd2a726614bc8d2657e9c1273cf2..be81838ef1e9a7924447fa1ba2670f4b32fb883a 100644 (file)
@@ -32,6 +32,8 @@
 #define                        SET_APIC_LOGICAL_ID(x)  (((x)<<24))
 #define                        APIC_ALL_CPUS           0xFF
 #define                APIC_DFR        0xE0
+#define                        APIC_DFR_CLUSTER                0x0FFFFFFFul
+#define                        APIC_DFR_FLAT                   0xFFFFFFFFul
 #define                APIC_SPIV       0xF0
 #define                        APIC_SPIV_FOCUS_DISABLED        (1<<9)
 #define                        APIC_SPIV_APIC_ENABLED          (1<<8)
index 71a71d011842dfe06642a6ef206612791253bdf8..a0d552e5d8435c28704b1fdcc99b4fe0d731683e 100644 (file)
 #endif
 #endif
 
-#ifdef CONFIG_SMP
-# ifdef CONFIG_CLUSTERED_APIC
-#  define TARGET_CPUS 0xf     /* all CPUs in *THIS* quad */
-#  define INT_DELIVERY_MODE 0     /* physical delivery on LOCAL quad */
-# else
-#  define TARGET_CPUS cpu_online_map
-#  define INT_DELIVERY_MODE 1     /* logical delivery broadcast to all procs */
-# endif
+#ifdef CONFIG_CLUSTERED_APIC
+ #define INT_DELIVERY_MODE 0     /* physical delivery on LOCAL quad */
 #else
-# define INT_DELIVERY_MODE 1     /* logical delivery */
-# define TARGET_CPUS 0x01
+ #define INT_DELIVERY_MODE 1     /* logical delivery broadcast to all procs */
 #endif
 
 #ifndef clustered_apic_mode