diff options
author | Yinghai Lu <yhlu.kernel@gmail.com> | 2008-07-11 21:44:16 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-12 02:45:14 -0400 |
commit | 4c9961d56ec20c27ec5d02e49fd7427748312741 (patch) | |
tree | e3a0fd508aae031dcd06705a2ce77f7dd0a68c11 | |
parent | 4696ca5bfd2697f5686f96d59cf0b6de14869b4e (diff) |
x86: make read_apic_id return final apicid
also remove GET_APIC_ID when read_apic_id is used.
need to apply after
[PATCH] x86: mach_apicdef.h need to include before smp.h
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Cc: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | arch/x86/kernel/acpi/boot.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/apic_32.c | 4 | ||||
-rw-r--r-- | arch/x86/kernel/apic_64.c | 6 | ||||
-rw-r--r-- | arch/x86/kernel/genapic_flat_64.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/io_apic_32.c | 5 | ||||
-rw-r--r-- | arch/x86/kernel/io_apic_64.c | 4 | ||||
-rw-r--r-- | arch/x86/kernel/smpboot.c | 6 | ||||
-rw-r--r-- | include/asm-x86/mach-default/mach_apic.h | 2 | ||||
-rw-r--r-- | include/asm-x86/mach-default/mach_apicdef.h | 3 | ||||
-rw-r--r-- | include/asm-x86/mach-es7000/mach_apic.h | 2 | ||||
-rw-r--r-- | include/asm-x86/smp.h | 11 |
11 files changed, 25 insertions, 22 deletions
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index 8705262ddcda..b314bcd08406 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c | |||
@@ -761,7 +761,7 @@ static void __init acpi_register_lapic_address(unsigned long address) | |||
761 | 761 | ||
762 | set_fixmap_nocache(FIX_APIC_BASE, address); | 762 | set_fixmap_nocache(FIX_APIC_BASE, address); |
763 | if (boot_cpu_physical_apicid == -1U) { | 763 | if (boot_cpu_physical_apicid == -1U) { |
764 | boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id()); | 764 | boot_cpu_physical_apicid = read_apic_id(); |
765 | #ifdef CONFIG_X86_32 | 765 | #ifdef CONFIG_X86_32 |
766 | apic_version[boot_cpu_physical_apicid] = | 766 | apic_version[boot_cpu_physical_apicid] = |
767 | GET_APIC_VERSION(apic_read(APIC_LVR)); | 767 | GET_APIC_VERSION(apic_read(APIC_LVR)); |
diff --git a/arch/x86/kernel/apic_32.c b/arch/x86/kernel/apic_32.c index 7413354c9ffd..47ff978aecfd 100644 --- a/arch/x86/kernel/apic_32.c +++ b/arch/x86/kernel/apic_32.c | |||
@@ -1230,7 +1230,7 @@ void __init init_apic_mappings(void) | |||
1230 | * default configuration (or the MP table is broken). | 1230 | * default configuration (or the MP table is broken). |
1231 | */ | 1231 | */ |
1232 | if (boot_cpu_physical_apicid == -1U) | 1232 | if (boot_cpu_physical_apicid == -1U) |
1233 | boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id()); | 1233 | boot_cpu_physical_apicid = read_apic_id(); |
1234 | 1234 | ||
1235 | } | 1235 | } |
1236 | 1236 | ||
@@ -1270,7 +1270,7 @@ int __init APIC_init_uniprocessor(void) | |||
1270 | * might be zero if read from MP tables. Get it from LAPIC. | 1270 | * might be zero if read from MP tables. Get it from LAPIC. |
1271 | */ | 1271 | */ |
1272 | #ifdef CONFIG_CRASH_DUMP | 1272 | #ifdef CONFIG_CRASH_DUMP |
1273 | boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id()); | 1273 | boot_cpu_physical_apicid = read_apic_id(); |
1274 | #endif | 1274 | #endif |
1275 | physid_set_mask_of_physid(boot_cpu_physical_apicid, &phys_cpu_present_map); | 1275 | physid_set_mask_of_physid(boot_cpu_physical_apicid, &phys_cpu_present_map); |
1276 | 1276 | ||
diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c index dd0501039f09..c75f58a66d8e 100644 --- a/arch/x86/kernel/apic_64.c +++ b/arch/x86/kernel/apic_64.c | |||
@@ -1060,7 +1060,7 @@ void __init early_init_lapic_mapping(void) | |||
1060 | * Fetch the APIC ID of the BSP in case we have a | 1060 | * Fetch the APIC ID of the BSP in case we have a |
1061 | * default configuration (or the MP table is broken). | 1061 | * default configuration (or the MP table is broken). |
1062 | */ | 1062 | */ |
1063 | boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id()); | 1063 | boot_cpu_physical_apicid = read_apic_id(); |
1064 | } | 1064 | } |
1065 | 1065 | ||
1066 | /** | 1066 | /** |
@@ -1069,7 +1069,7 @@ void __init early_init_lapic_mapping(void) | |||
1069 | void __init init_apic_mappings(void) | 1069 | void __init init_apic_mappings(void) |
1070 | { | 1070 | { |
1071 | if (x2apic) { | 1071 | if (x2apic) { |
1072 | boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id()); | 1072 | boot_cpu_physical_apicid = read_apic_id(); |
1073 | return; | 1073 | return; |
1074 | } | 1074 | } |
1075 | 1075 | ||
@@ -1092,7 +1092,7 @@ void __init init_apic_mappings(void) | |||
1092 | * Fetch the APIC ID of the BSP in case we have a | 1092 | * Fetch the APIC ID of the BSP in case we have a |
1093 | * default configuration (or the MP table is broken). | 1093 | * default configuration (or the MP table is broken). |
1094 | */ | 1094 | */ |
1095 | boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id()); | 1095 | boot_cpu_physical_apicid = read_apic_id(); |
1096 | } | 1096 | } |
1097 | 1097 | ||
1098 | /* | 1098 | /* |
diff --git a/arch/x86/kernel/genapic_flat_64.c b/arch/x86/kernel/genapic_flat_64.c index 735586822135..7dac2f275fad 100644 --- a/arch/x86/kernel/genapic_flat_64.c +++ b/arch/x86/kernel/genapic_flat_64.c | |||
@@ -101,7 +101,7 @@ static unsigned int read_xapic_id(void) | |||
101 | { | 101 | { |
102 | unsigned int id; | 102 | unsigned int id; |
103 | 103 | ||
104 | id = GET_XAPIC_ID(apic_read(APIC_ID)); | 104 | id = GET_APIC_ID(apic_read(APIC_ID)); |
105 | return id; | 105 | return id; |
106 | } | 106 | } |
107 | 107 | ||
diff --git a/arch/x86/kernel/io_apic_32.c b/arch/x86/kernel/io_apic_32.c index c50adb84ea6f..382208d11f8d 100644 --- a/arch/x86/kernel/io_apic_32.c +++ b/arch/x86/kernel/io_apic_32.c | |||
@@ -1501,7 +1501,7 @@ void /*__init*/ print_local_APIC(void *dummy) | |||
1501 | smp_processor_id(), hard_smp_processor_id()); | 1501 | smp_processor_id(), hard_smp_processor_id()); |
1502 | v = apic_read(APIC_ID); | 1502 | v = apic_read(APIC_ID); |
1503 | printk(KERN_INFO "... APIC ID: %08x (%01x)\n", v, | 1503 | printk(KERN_INFO "... APIC ID: %08x (%01x)\n", v, |
1504 | GET_APIC_ID(read_apic_id())); | 1504 | GET_APIC_ID(v)); |
1505 | v = apic_read(APIC_LVR); | 1505 | v = apic_read(APIC_LVR); |
1506 | printk(KERN_INFO "... APIC VERSION: %08x\n", v); | 1506 | printk(KERN_INFO "... APIC VERSION: %08x\n", v); |
1507 | ver = GET_APIC_VERSION(v); | 1507 | ver = GET_APIC_VERSION(v); |
@@ -1709,8 +1709,7 @@ void disable_IO_APIC(void) | |||
1709 | entry.dest_mode = 0; /* Physical */ | 1709 | entry.dest_mode = 0; /* Physical */ |
1710 | entry.delivery_mode = dest_ExtINT; /* ExtInt */ | 1710 | entry.delivery_mode = dest_ExtINT; /* ExtInt */ |
1711 | entry.vector = 0; | 1711 | entry.vector = 0; |
1712 | entry.dest.physical.physical_dest = | 1712 | entry.dest.physical.physical_dest = read_apic_id(); |
1713 | GET_APIC_ID(read_apic_id()); | ||
1714 | 1713 | ||
1715 | /* | 1714 | /* |
1716 | * Add it to the IO-APIC irq-routing table: | 1715 | * Add it to the IO-APIC irq-routing table: |
diff --git a/arch/x86/kernel/io_apic_64.c b/arch/x86/kernel/io_apic_64.c index 877aa2e9d7e8..2db0f98e2af5 100644 --- a/arch/x86/kernel/io_apic_64.c +++ b/arch/x86/kernel/io_apic_64.c | |||
@@ -1246,7 +1246,7 @@ void __apicdebuginit print_local_APIC(void * dummy) | |||
1246 | printk("\n" KERN_DEBUG "printing local APIC contents on CPU#%d/%d:\n", | 1246 | printk("\n" KERN_DEBUG "printing local APIC contents on CPU#%d/%d:\n", |
1247 | smp_processor_id(), hard_smp_processor_id()); | 1247 | smp_processor_id(), hard_smp_processor_id()); |
1248 | v = apic_read(APIC_ID); | 1248 | v = apic_read(APIC_ID); |
1249 | printk(KERN_INFO "... APIC ID: %08x (%01x)\n", v, GET_APIC_ID(read_apic_id())); | 1249 | printk(KERN_INFO "... APIC ID: %08x (%01x)\n", v, read_apic_id()); |
1250 | v = apic_read(APIC_LVR); | 1250 | v = apic_read(APIC_LVR); |
1251 | printk(KERN_INFO "... APIC VERSION: %08x\n", v); | 1251 | printk(KERN_INFO "... APIC VERSION: %08x\n", v); |
1252 | ver = GET_APIC_VERSION(v); | 1252 | ver = GET_APIC_VERSION(v); |
@@ -1439,7 +1439,7 @@ void disable_IO_APIC(void) | |||
1439 | entry.dest_mode = 0; /* Physical */ | 1439 | entry.dest_mode = 0; /* Physical */ |
1440 | entry.delivery_mode = dest_ExtINT; /* ExtInt */ | 1440 | entry.delivery_mode = dest_ExtINT; /* ExtInt */ |
1441 | entry.vector = 0; | 1441 | entry.vector = 0; |
1442 | entry.dest = GET_APIC_ID(read_apic_id()); | 1442 | entry.dest = read_apic_id(); |
1443 | 1443 | ||
1444 | /* | 1444 | /* |
1445 | * Add it to the IO-APIC irq-routing table: | 1445 | * Add it to the IO-APIC irq-routing table: |
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 0c43e1f2e7d3..6cd002f3e20e 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c | |||
@@ -211,7 +211,7 @@ static void __cpuinit smp_callin(void) | |||
211 | /* | 211 | /* |
212 | * (This works even if the APIC is not enabled.) | 212 | * (This works even if the APIC is not enabled.) |
213 | */ | 213 | */ |
214 | phys_id = GET_APIC_ID(read_apic_id()); | 214 | phys_id = read_apic_id(); |
215 | cpuid = smp_processor_id(); | 215 | cpuid = smp_processor_id(); |
216 | if (cpu_isset(cpuid, cpu_callin_map)) { | 216 | if (cpu_isset(cpuid, cpu_callin_map)) { |
217 | panic("%s: phys CPU#%d, CPU#%d already present??\n", __func__, | 217 | panic("%s: phys CPU#%d, CPU#%d already present??\n", __func__, |
@@ -1157,9 +1157,9 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus) | |||
1157 | } | 1157 | } |
1158 | 1158 | ||
1159 | preempt_disable(); | 1159 | preempt_disable(); |
1160 | if (GET_APIC_ID(read_apic_id()) != boot_cpu_physical_apicid) { | 1160 | if (read_apic_id() != boot_cpu_physical_apicid) { |
1161 | panic("Boot APIC ID in local APIC unexpected (%d vs %d)", | 1161 | panic("Boot APIC ID in local APIC unexpected (%d vs %d)", |
1162 | GET_APIC_ID(read_apic_id()), boot_cpu_physical_apicid); | 1162 | read_apic_id(), boot_cpu_physical_apicid); |
1163 | /* Or can we switch back to PIC here? */ | 1163 | /* Or can we switch back to PIC here? */ |
1164 | } | 1164 | } |
1165 | preempt_enable(); | 1165 | preempt_enable(); |
diff --git a/include/asm-x86/mach-default/mach_apic.h b/include/asm-x86/mach-default/mach_apic.h index e06d23975d6a..925b797e2a26 100644 --- a/include/asm-x86/mach-default/mach_apic.h +++ b/include/asm-x86/mach-default/mach_apic.h | |||
@@ -56,7 +56,7 @@ static inline void init_apic_ldr(void) | |||
56 | 56 | ||
57 | static inline int apic_id_registered(void) | 57 | static inline int apic_id_registered(void) |
58 | { | 58 | { |
59 | return physid_isset(GET_APIC_ID(read_apic_id()), phys_cpu_present_map); | 59 | return physid_isset(read_apic_id(), phys_cpu_present_map); |
60 | } | 60 | } |
61 | 61 | ||
62 | static inline unsigned int cpu_mask_to_apicid(cpumask_t cpumask) | 62 | static inline unsigned int cpu_mask_to_apicid(cpumask_t cpumask) |
diff --git a/include/asm-x86/mach-default/mach_apicdef.h b/include/asm-x86/mach-default/mach_apicdef.h index 453b58a67e29..3e1be6c99b35 100644 --- a/include/asm-x86/mach-default/mach_apicdef.h +++ b/include/asm-x86/mach-default/mach_apicdef.h | |||
@@ -5,9 +5,8 @@ | |||
5 | 5 | ||
6 | #ifdef CONFIG_X86_64 | 6 | #ifdef CONFIG_X86_64 |
7 | #define APIC_ID_MASK (0xFFu<<24) | 7 | #define APIC_ID_MASK (0xFFu<<24) |
8 | #define GET_APIC_ID(x) (x) | 8 | #define GET_APIC_ID(x) (((x)>>24) & 0xFFu) |
9 | #define SET_APIC_ID(x) (((x)<<24)) | 9 | #define SET_APIC_ID(x) (((x)<<24)) |
10 | #define GET_XAPIC_ID(x) (((x) >> 24) & 0xFFu) | ||
11 | #else | 10 | #else |
12 | #define APIC_ID_MASK (0xF<<24) | 11 | #define APIC_ID_MASK (0xF<<24) |
13 | static inline unsigned get_apic_id(unsigned long x) | 12 | static inline unsigned get_apic_id(unsigned long x) |
diff --git a/include/asm-x86/mach-es7000/mach_apic.h b/include/asm-x86/mach-es7000/mach_apic.h index fbc8ad256f5a..b3556ec3bca5 100644 --- a/include/asm-x86/mach-es7000/mach_apic.h +++ b/include/asm-x86/mach-es7000/mach_apic.h | |||
@@ -141,7 +141,7 @@ static inline void setup_portio_remap(void) | |||
141 | extern unsigned int boot_cpu_physical_apicid; | 141 | extern unsigned int boot_cpu_physical_apicid; |
142 | static inline int check_phys_apicid_present(int cpu_physical_apicid) | 142 | static inline int check_phys_apicid_present(int cpu_physical_apicid) |
143 | { | 143 | { |
144 | boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id()); | 144 | boot_cpu_physical_apicid = read_apic_id(); |
145 | return (1); | 145 | return (1); |
146 | } | 146 | } |
147 | 147 | ||
diff --git a/include/asm-x86/smp.h b/include/asm-x86/smp.h index d9d007d22785..3b43ca202c3b 100644 --- a/include/asm-x86/smp.h +++ b/include/asm-x86/smp.h | |||
@@ -165,9 +165,14 @@ static inline int logical_smp_processor_id(void) | |||
165 | return GET_APIC_LOGICAL_ID(*(u32 *)(APIC_BASE + APIC_LDR)); | 165 | return GET_APIC_LOGICAL_ID(*(u32 *)(APIC_BASE + APIC_LDR)); |
166 | } | 166 | } |
167 | 167 | ||
168 | #include <mach_apicdef.h> | ||
168 | static inline unsigned int read_apic_id(void) | 169 | static inline unsigned int read_apic_id(void) |
169 | { | 170 | { |
170 | return *(u32 *)(APIC_BASE + APIC_ID); | 171 | unsigned int reg; |
172 | |||
173 | reg = *(u32 *)(APIC_BASE + APIC_ID); | ||
174 | |||
175 | return GET_APIC_ID(reg); | ||
171 | } | 176 | } |
172 | #endif | 177 | #endif |
173 | 178 | ||
@@ -175,11 +180,11 @@ static inline unsigned int read_apic_id(void) | |||
175 | # if defined(APIC_DEFINITION) || defined(CONFIG_X86_64) | 180 | # if defined(APIC_DEFINITION) || defined(CONFIG_X86_64) |
176 | extern int hard_smp_processor_id(void); | 181 | extern int hard_smp_processor_id(void); |
177 | # else | 182 | # else |
178 | # include <mach_apicdef.h> | 183 | #include <mach_apicdef.h> |
179 | static inline int hard_smp_processor_id(void) | 184 | static inline int hard_smp_processor_id(void) |
180 | { | 185 | { |
181 | /* we don't want to mark this access volatile - bad code generation */ | 186 | /* we don't want to mark this access volatile - bad code generation */ |
182 | return GET_APIC_ID(read_apic_id()); | 187 | return read_apic_id(); |
183 | } | 188 | } |
184 | # endif /* APIC_DEFINITION */ | 189 | # endif /* APIC_DEFINITION */ |
185 | 190 | ||