summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndrew Morton <akpm@digeo.com>2003-05-25 01:14:18 -0700
committerLinus Torvalds <torvalds@home.transmeta.com>2003-05-25 01:14:18 -0700
commitfb8ce05540e5656ea21f10fd8bec40144cde31f1 (patch)
tree1f545081e52a172dd1c6c0a093d21b648eeb520b /include
parentcd3880692151c8368245e2f4c03aa4fb0f06c781 (diff)
[PATCH] Better fix for ia32 subarch circular dependencies
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.
Diffstat (limited to 'include')
-rw-r--r--include/asm-i386/mach-bigsmp/mach_apic.h13
-rw-r--r--include/asm-i386/mach-bigsmp/mach_apicdef.h13
-rw-r--r--include/asm-i386/mach-default/mach_apic.h11
-rw-r--r--include/asm-i386/mach-default/mach_apicdef.h13
-rw-r--r--include/asm-i386/mach-numaq/mach_apic.h9
-rw-r--r--include/asm-i386/mach-numaq/mach_apicdef.h14
-rw-r--r--include/asm-i386/mach-summit/mach_apic.h13
-rw-r--r--include/asm-i386/mach-summit/mach_apicdef.h13
-rw-r--r--include/asm-i386/mach-visws/mach_apic.h8
-rw-r--r--include/asm-i386/mach-visws/mach_apicdef.h12
-rw-r--r--include/asm-i386/smp.h2
11 files changed, 72 insertions, 49 deletions
diff --git a/include/asm-i386/mach-bigsmp/mach_apic.h b/include/asm-i386/mach-bigsmp/mach_apic.h
index 7b84277e526c..519571a84945 100644
--- a/include/asm-i386/mach-bigsmp/mach_apic.h
+++ b/include/asm-i386/mach-bigsmp/mach_apic.h
@@ -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
index 000000000000..23e58b317c79
--- /dev/null
+++ b/include/asm-i386/mach-bigsmp/mach_apicdef.h
@@ -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
diff --git a/include/asm-i386/mach-default/mach_apic.h b/include/asm-i386/mach-default/mach_apic.h
index ad40d96b3824..f0d615e4a924 100644
--- a/include/asm-i386/mach-default/mach_apic.h
+++ b/include/asm-i386/mach-default/mach_apic.h
@@ -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
index 000000000000..7bcb350c3ee8
--- /dev/null
+++ b/include/asm-i386/mach-default/mach_apicdef.h
@@ -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
diff --git a/include/asm-i386/mach-numaq/mach_apic.h b/include/asm-i386/mach-numaq/mach_apic.h
index d5160168908a..bdf7cc780cbe 100644
--- a/include/asm-i386/mach-numaq/mach_apic.h
+++ b/include/asm-i386/mach-numaq/mach_apic.h
@@ -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
index 000000000000..bf439d0690f5
--- /dev/null
+++ b/include/asm-i386/mach-numaq/mach_apicdef.h
@@ -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
diff --git a/include/asm-i386/mach-summit/mach_apic.h b/include/asm-i386/mach-summit/mach_apic.h
index cc5a532f6c95..f576880b5343 100644
--- a/include/asm-i386/mach-summit/mach_apic.h
+++ b/include/asm-i386/mach-summit/mach_apic.h
@@ -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
index 000000000000..a58ab5a75c8c
--- /dev/null
+++ b/include/asm-i386/mach-summit/mach_apicdef.h
@@ -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
diff --git a/include/asm-i386/mach-visws/mach_apic.h b/include/asm-i386/mach-visws/mach_apic.h
index c2681d88b3be..641c173d4f76 100644
--- a/include/asm-i386/mach-visws/mach_apic.h
+++ b/include/asm-i386/mach-visws/mach_apic.h
@@ -19,14 +19,6 @@
#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
index 000000000000..826cfa97d778
--- /dev/null
+++ b/include/asm-i386/mach-visws/mach_apicdef.h
@@ -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
diff --git a/include/asm-i386/smp.h b/include/asm-i386/smp.h
index 67a5353fdb59..f72e82945a57 100644
--- a/include/asm-i386/smp.h
+++ b/include/asm-i386/smp.h
@@ -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 */