]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] Better fix for ia32 subarch circular dependencies
authorAndrew Morton <akpm@digeo.com>
Sun, 25 May 2003 08:14:18 +0000 (01:14 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Sun, 25 May 2003 08:14:18 +0000 (01:14 -0700)
From: john stultz <johnstul@us.ibm.com>

This is a rework of John's recent change which resolved a circular include
dependency: a function in mach_apic.h requires hard_smp_processor_id() and
hard_smp_processor_id() requires macros from mach_apic.h

So this patch (against bk-current) reverts the previous, and fixes the same
circular dependency in a much cleaner way, by moving a piece of the circular
chain into its own .h file, rather then removing hard_smp_processor_id() and
accessing the apic by hand.

14 files changed:
arch/i386/mach-generic/bigsmp.c
arch/i386/mach-generic/default.c
arch/i386/mach-generic/summit.c
include/asm-i386/mach-bigsmp/mach_apic.h
include/asm-i386/mach-bigsmp/mach_apicdef.h [new file with mode: 0644]
include/asm-i386/mach-default/mach_apic.h
include/asm-i386/mach-default/mach_apicdef.h [new file with mode: 0644]
include/asm-i386/mach-numaq/mach_apic.h
include/asm-i386/mach-numaq/mach_apicdef.h [new file with mode: 0644]
include/asm-i386/mach-summit/mach_apic.h
include/asm-i386/mach-summit/mach_apicdef.h [new file with mode: 0644]
include/asm-i386/mach-visws/mach_apic.h
include/asm-i386/mach-visws/mach_apicdef.h [new file with mode: 0644]
include/asm-i386/smp.h

index 13951aa60c184e579d0f395d7f655195080c06ba..59aa05f8ddc8bef2f854dd686994445f2bc9315e 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/smp.h>
 #include <linux/init.h>
 #include <asm/mach-bigsmp/mach_apic.h>
+#include <asm/mach-bigsmp/mach_apicdef.h>
 #include <asm/mach-bigsmp/mach_ipi.h>
 #include <asm/mach-default/mach_mpparse.h>
 
index 01093057f8d29bd124cb5acc03bd7fbb33836717..013ea644ffdac6278425dfa5175112b32f14b509 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/smp.h>
 #include <linux/init.h>
 #include <asm/mach-default/mach_apic.h>
+#include <asm/mach-default/mach_apicdef.h>
 #include <asm/mach-default/mach_ipi.h>
 #include <asm/mach-default/mach_mpparse.h>
 
index d4f573c6721967a537d02518359a83417a902dd4..4176c54338933b8fc0c927e79a66c68df9ef076f 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/smp.h>
 #include <linux/init.h>
 #include <asm/mach-summit/mach_apic.h>
+#include <asm/mach-summit/mach_apicdef.h>
 #include <asm/mach-summit/mach_ipi.h>
 #include <asm/mach-summit/mach_mpparse.h>
 
index 7b84277e526c1b716100bd7d99f5b3e72a570bda..519571a849453ca695f14695b06d7612c32a75aa 100644 (file)
@@ -1,5 +1,6 @@
 #ifndef __ASM_MACH_APIC_H
 #define __ASM_MACH_APIC_H
+#include <asm/smp.h>
 
 #define SEQUENTIAL_APICID
 #ifdef SEQUENTIAL_APICID
@@ -40,18 +41,10 @@ static inline unsigned long check_apicid_present(int bit)
 
 #define apicid_cluster(apicid) (apicid & 0xF0)
 
-static inline unsigned get_apic_id(unsigned long x) 
-{ 
-       return (((x)>>24)&0x0F);
-} 
-
-#define                GET_APIC_ID(x)  get_apic_id(x)
-
 static inline unsigned long calculate_ldr(unsigned long old)
 {
        unsigned long id;
-       id = xapic_phys_to_log_apicid(
-                       GET_APIC_LOGICAL_ID(*(unsigned long *)(APIC_BASE+APIC_LDR)));
+       id = xapic_phys_to_log_apicid(hard_smp_processor_id());
        return ((old & ~APIC_LDR_MASK) | SET_APIC_LOGICAL_ID(id));
 }
 
@@ -135,8 +128,6 @@ static inline int check_phys_apicid_present(int boot_cpu_physical_apicid)
        return (1);
 }
 
-#define                APIC_ID_MASK            (0x0F<<24)
-
 static inline unsigned int cpu_mask_to_apicid (unsigned long cpumask)
 {
        int num_bits_set;
diff --git a/include/asm-i386/mach-bigsmp/mach_apicdef.h b/include/asm-i386/mach-bigsmp/mach_apicdef.h
new file mode 100644 (file)
index 0000000..23e58b3
--- /dev/null
@@ -0,0 +1,13 @@
+#ifndef __ASM_MACH_APICDEF_H
+#define __ASM_MACH_APICDEF_H
+
+#define                APIC_ID_MASK            (0x0F<<24)
+
+static inline unsigned get_apic_id(unsigned long x) 
+{ 
+       return (((x)>>24)&0x0F);
+} 
+
+#define                GET_APIC_ID(x)  get_apic_id(x)
+
+#endif
index ad40d96b38246116ceb2d96892531a060e9e6157..f0d615e4a9248cb0f8df6c95e42564b3bb7e3917 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef __ASM_MACH_APIC_H
 #define __ASM_MACH_APIC_H
 
+#include <mach_apicdef.h>
+
 #define APIC_DFR_VALUE (APIC_DFR_FLAT)
 
 static inline unsigned long target_cpus(void)
@@ -105,15 +107,6 @@ static inline int check_phys_apicid_present(int boot_cpu_physical_apicid)
        return test_bit(boot_cpu_physical_apicid, &phys_cpu_present_map);
 }
 
-#define                APIC_ID_MASK            (0xF<<24)
-
-static inline unsigned get_apic_id(unsigned long x) 
-{ 
-       return (((x)>>24)&0xF);
-} 
-
-#define                GET_APIC_ID(x)  get_apic_id(x)
-
 static inline int apic_id_registered(void)
 {
        return (test_bit(GET_APIC_ID(apic_read(APIC_ID)), 
diff --git a/include/asm-i386/mach-default/mach_apicdef.h b/include/asm-i386/mach-default/mach_apicdef.h
new file mode 100644 (file)
index 0000000..7bcb350
--- /dev/null
@@ -0,0 +1,13 @@
+#ifndef __ASM_MACH_APICDEF_H
+#define __ASM_MACH_APICDEF_H
+
+#define                APIC_ID_MASK            (0xF<<24)
+
+static inline unsigned get_apic_id(unsigned long x) 
+{ 
+       return (((x)>>24)&0xF);
+} 
+
+#define                GET_APIC_ID(x)  get_apic_id(x)
+
+#endif
index d5160168908a25c49dee467866493063c492f3b4..bdf7cc780cbe45ed30e12473464f5bf25c1e682f 100644 (file)
@@ -107,15 +107,6 @@ static inline int check_phys_apicid_present(int boot_cpu_physical_apicid)
        return (1);
 }
 
-#define APIC_ID_MASK (0xF<<24)
-
-static inline unsigned get_apic_id(unsigned long x)
-{
-               return (((x)>>24)&0x0F);
-}
-
-#define         GET_APIC_ID(x)  get_apic_id(x)
-
 static inline unsigned int cpu_mask_to_apicid (unsigned long cpumask)
 {
        int num_bits_set;
diff --git a/include/asm-i386/mach-numaq/mach_apicdef.h b/include/asm-i386/mach-numaq/mach_apicdef.h
new file mode 100644 (file)
index 0000000..bf439d0
--- /dev/null
@@ -0,0 +1,14 @@
+#ifndef __ASM_MACH_APICDEF_H
+#define __ASM_MACH_APICDEF_H
+
+
+#define APIC_ID_MASK (0xF<<24)
+
+static inline unsigned get_apic_id(unsigned long x)
+{
+               return (((x)>>24)&0x0F);
+}
+
+#define         GET_APIC_ID(x)  get_apic_id(x)
+
+#endif
index cc5a532f6c9516535f4ef5892c40b33bed500af2..f576880b5343e2cf75e54c20a75f6e68462e0352 100644 (file)
@@ -2,6 +2,7 @@
 #define __ASM_MACH_APIC_H
 
 #include <linux/config.h>
+#include <asm/smp.h>
 
 #ifdef CONFIG_X86_GENERICARCH
 #define x86_summit 1   /* must be an constant expressiona for generic arch */
@@ -48,20 +49,12 @@ static inline unsigned long check_apicid_present(int bit)
 
 extern u8 bios_cpu_apicid[];
 
-static inline unsigned get_apic_id(unsigned long x) 
-{ 
-       return (((x)>>24)&0xFF);
-} 
-
-#define                GET_APIC_ID(x)  get_apic_id(x)
-
 static inline void init_apic_ldr(void)
 {
        unsigned long val, id;
 
        if (x86_summit)
-               id = xapic_phys_to_log_apicid(
-                       GET_APIC_ID(*(unsigned long *)(APIC_BASE+APIC_ID)));
+               id = xapic_phys_to_log_apicid(hard_smp_processor_id());
        else
                id = 1UL << smp_processor_id();
        apic_write_around(APIC_DFR, APIC_DFR_VALUE);
@@ -143,8 +136,6 @@ static inline int check_phys_apicid_present(int boot_cpu_physical_apicid)
                return test_bit(boot_cpu_physical_apicid, &phys_cpu_present_map);
 }
 
-#define                APIC_ID_MASK            (0xFF<<24)
-
 static inline unsigned int cpu_mask_to_apicid (unsigned long cpumask)
 {
        int num_bits_set;
diff --git a/include/asm-i386/mach-summit/mach_apicdef.h b/include/asm-i386/mach-summit/mach_apicdef.h
new file mode 100644 (file)
index 0000000..a58ab5a
--- /dev/null
@@ -0,0 +1,13 @@
+#ifndef __ASM_MACH_APICDEF_H
+#define __ASM_MACH_APICDEF_H
+
+#define                APIC_ID_MASK            (0xFF<<24)
+
+static inline unsigned get_apic_id(unsigned long x) 
+{ 
+       return (((x)>>24)&0xFF);
+} 
+
+#define                GET_APIC_ID(x)  get_apic_id(x)
+
+#endif
index c2681d88b3beccfb9919170ceee3e404b4bf6cf5..641c173d4f768643aeb429e191ac2e9ad7892921 100644 (file)
 #define check_apicid_used(bitmap, apicid) (bitmap & (1 << apicid))
 #define check_apicid_present(bit) (phys_cpu_present_map & (1 << bit))
 
-#define         APIC_ID_MASK            (0xF<<24)
-
-static inline unsigned get_apic_id(unsigned long x)
-{
-               return (((x)>>24)&0xF);
-}
-#define         GET_APIC_ID(x)  get_apic_id(x)
-
 static inline int apic_id_registered(void)
 {
        return (test_bit(GET_APIC_ID(apic_read(APIC_ID)), 
diff --git a/include/asm-i386/mach-visws/mach_apicdef.h b/include/asm-i386/mach-visws/mach_apicdef.h
new file mode 100644 (file)
index 0000000..826cfa9
--- /dev/null
@@ -0,0 +1,12 @@
+#ifndef __ASM_MACH_APICDEF_H
+#define __ASM_MACH_APICDEF_H
+
+#define         APIC_ID_MASK            (0xF<<24)
+
+static inline unsigned get_apic_id(unsigned long x)
+{
+               return (((x)>>24)&0xF);
+}
+#define         GET_APIC_ID(x)  get_apic_id(x)
+
+#endif
index 67a5353fdb591eb49cff80ad440776f7f9cf3a75..f72e82945a575653ba7fad9012e60a3c7c5559af 100644 (file)
@@ -91,7 +91,7 @@ extern inline int any_online_cpu(unsigned int mask)
 #ifdef APIC_DEFINITION
 extern int hard_smp_processor_id(void);
 #else
-#include <mach_apic.h>
+#include <mach_apicdef.h>
 static inline int hard_smp_processor_id(void)
 {
        /* we don't want to mark this access volatile - bad code generation */