aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Steiner <steiner@sgi.com>2008-03-28 15:12:02 -0400
committerIngo Molnar <mingo@elte.hu>2008-04-17 11:41:33 -0400
commit05f2d12c3563dea8c81b301f9f3cf7919af23b13 (patch)
treed696f29159d311d8d1fde7f6bd1b01261ca713b9
parenta5c15d419d4b68535222b51f9054dd08d5e67470 (diff)
x86: change GET_APIC_ID() from an inline function to an out-of-line function
Introduce a function to read the local APIC_ID. This change is in preparation for additional changes to the APICID functions that will come in a later patch. Signed-off-by: Jack Steiner <steiner@sgi.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--arch/x86/kernel/apic_32.c4
-rw-r--r--arch/x86/kernel/apic_64.c10
-rw-r--r--arch/x86/kernel/genapic_flat_64.c2
-rw-r--r--arch/x86/kernel/io_apic_32.c6
-rw-r--r--arch/x86/kernel/io_apic_64.c5
-rw-r--r--arch/x86/kernel/mpparse_32.c2
-rw-r--r--arch/x86/kernel/mpparse_64.c2
-rw-r--r--arch/x86/kernel/smpboot.c6
-rw-r--r--include/asm-x86/mach-default/mach_apic.h2
-rw-r--r--include/asm-x86/mach-es7000/mach_apic.h2
-rw-r--r--include/asm-x86/mach-visws/mach_apic.h2
-rw-r--r--include/asm-x86/smp.h7
12 files changed, 27 insertions, 23 deletions
diff --git a/arch/x86/kernel/apic_32.c b/arch/x86/kernel/apic_32.c
index a99398f71234..4905a11b30e3 100644
--- a/arch/x86/kernel/apic_32.c
+++ b/arch/x86/kernel/apic_32.c
@@ -1195,7 +1195,7 @@ void __init init_apic_mappings(void)
1195 * default configuration (or the MP table is broken). 1195 * default configuration (or the MP table is broken).
1196 */ 1196 */
1197 if (boot_cpu_physical_apicid == -1U) 1197 if (boot_cpu_physical_apicid == -1U)
1198 boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID)); 1198 boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id());
1199 1199
1200#ifdef CONFIG_X86_IO_APIC 1200#ifdef CONFIG_X86_IO_APIC
1201 { 1201 {
@@ -1265,7 +1265,7 @@ int __init APIC_init_uniprocessor(void)
1265 * might be zero if read from MP tables. Get it from LAPIC. 1265 * might be zero if read from MP tables. Get it from LAPIC.
1266 */ 1266 */
1267#ifdef CONFIG_CRASH_DUMP 1267#ifdef CONFIG_CRASH_DUMP
1268 boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID)); 1268 boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id());
1269#endif 1269#endif
1270 phys_cpu_present_map = physid_mask_of_physid(boot_cpu_physical_apicid); 1270 phys_cpu_present_map = physid_mask_of_physid(boot_cpu_physical_apicid);
1271 1271
diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c
index 4ee521ff0a3e..9b4cacdfd74f 100644
--- a/arch/x86/kernel/apic_64.c
+++ b/arch/x86/kernel/apic_64.c
@@ -650,10 +650,10 @@ int __init verify_local_APIC(void)
650 /* 650 /*
651 * The ID register is read/write in a real APIC. 651 * The ID register is read/write in a real APIC.
652 */ 652 */
653 reg0 = apic_read(APIC_ID); 653 reg0 = read_apic_id();
654 apic_printk(APIC_DEBUG, "Getting ID: %x\n", reg0); 654 apic_printk(APIC_DEBUG, "Getting ID: %x\n", reg0);
655 apic_write(APIC_ID, reg0 ^ APIC_ID_MASK); 655 apic_write(APIC_ID, reg0 ^ APIC_ID_MASK);
656 reg1 = apic_read(APIC_ID); 656 reg1 = read_apic_id();
657 apic_printk(APIC_DEBUG, "Getting ID: %x\n", reg1); 657 apic_printk(APIC_DEBUG, "Getting ID: %x\n", reg1);
658 apic_write(APIC_ID, reg0); 658 apic_write(APIC_ID, reg0);
659 if (reg1 != (reg0 ^ APIC_ID_MASK)) 659 if (reg1 != (reg0 ^ APIC_ID_MASK))
@@ -892,7 +892,7 @@ void __init early_init_lapic_mapping(void)
892 * Fetch the APIC ID of the BSP in case we have a 892 * Fetch the APIC ID of the BSP in case we have a
893 * default configuration (or the MP table is broken). 893 * default configuration (or the MP table is broken).
894 */ 894 */
895 boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID)); 895 boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id());
896} 896}
897 897
898/** 898/**
@@ -919,7 +919,7 @@ void __init init_apic_mappings(void)
919 * Fetch the APIC ID of the BSP in case we have a 919 * Fetch the APIC ID of the BSP in case we have a
920 * default configuration (or the MP table is broken). 920 * default configuration (or the MP table is broken).
921 */ 921 */
922 boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID)); 922 boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id());
923} 923}
924 924
925/* 925/*
@@ -1140,7 +1140,7 @@ static int lapic_suspend(struct sys_device *dev, pm_message_t state)
1140 1140
1141 maxlvt = lapic_get_maxlvt(); 1141 maxlvt = lapic_get_maxlvt();
1142 1142
1143 apic_pm_state.apic_id = apic_read(APIC_ID); 1143 apic_pm_state.apic_id = read_apic_id();
1144 apic_pm_state.apic_taskpri = apic_read(APIC_TASKPRI); 1144 apic_pm_state.apic_taskpri = apic_read(APIC_TASKPRI);
1145 apic_pm_state.apic_ldr = apic_read(APIC_LDR); 1145 apic_pm_state.apic_ldr = apic_read(APIC_LDR);
1146 apic_pm_state.apic_dfr = apic_read(APIC_DFR); 1146 apic_pm_state.apic_dfr = apic_read(APIC_DFR);
diff --git a/arch/x86/kernel/genapic_flat_64.c b/arch/x86/kernel/genapic_flat_64.c
index 07352b74bda6..6a44e8dace37 100644
--- a/arch/x86/kernel/genapic_flat_64.c
+++ b/arch/x86/kernel/genapic_flat_64.c
@@ -97,7 +97,7 @@ static void flat_send_IPI_all(int vector)
97 97
98static int flat_apic_id_registered(void) 98static int flat_apic_id_registered(void)
99{ 99{
100 return physid_isset(GET_APIC_ID(apic_read(APIC_ID)), phys_cpu_present_map); 100 return physid_isset(GET_APIC_ID(read_apic_id()), phys_cpu_present_map);
101} 101}
102 102
103static unsigned int flat_cpu_mask_to_apicid(cpumask_t cpumask) 103static unsigned int flat_cpu_mask_to_apicid(cpumask_t cpumask)
diff --git a/arch/x86/kernel/io_apic_32.c b/arch/x86/kernel/io_apic_32.c
index 8ed6eb967652..bfebe7a1966d 100644
--- a/arch/x86/kernel/io_apic_32.c
+++ b/arch/x86/kernel/io_apic_32.c
@@ -1482,8 +1482,8 @@ void /*__init*/ print_local_APIC(void * dummy)
1482 1482
1483 printk("\n" KERN_DEBUG "printing local APIC contents on CPU#%d/%d:\n", 1483 printk("\n" KERN_DEBUG "printing local APIC contents on CPU#%d/%d:\n",
1484 smp_processor_id(), hard_smp_processor_id()); 1484 smp_processor_id(), hard_smp_processor_id());
1485 v = apic_read(APIC_ID); 1485 printk(KERN_INFO "... APIC ID: %08x (%01x)\n", v,
1486 printk(KERN_INFO "... APIC ID: %08x (%01x)\n", v, GET_APIC_ID(v)); 1486 GET_APIC_ID(read_apic_id()));
1487 v = apic_read(APIC_LVR); 1487 v = apic_read(APIC_LVR);
1488 printk(KERN_INFO "... APIC VERSION: %08x\n", v); 1488 printk(KERN_INFO "... APIC VERSION: %08x\n", v);
1489 ver = GET_APIC_VERSION(v); 1489 ver = GET_APIC_VERSION(v);
@@ -1692,7 +1692,7 @@ void disable_IO_APIC(void)
1692 entry.delivery_mode = dest_ExtINT; /* ExtInt */ 1692 entry.delivery_mode = dest_ExtINT; /* ExtInt */
1693 entry.vector = 0; 1693 entry.vector = 0;
1694 entry.dest.physical.physical_dest = 1694 entry.dest.physical.physical_dest =
1695 GET_APIC_ID(apic_read(APIC_ID)); 1695 GET_APIC_ID(read_apic_id());
1696 1696
1697 /* 1697 /*
1698 * Add it to the IO-APIC irq-routing table: 1698 * 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 6dd33628f28a..0ac92d6acf57 100644
--- a/arch/x86/kernel/io_apic_64.c
+++ b/arch/x86/kernel/io_apic_64.c
@@ -1068,8 +1068,7 @@ void __apicdebuginit print_local_APIC(void * dummy)
1068 1068
1069 printk("\n" KERN_DEBUG "printing local APIC contents on CPU#%d/%d:\n", 1069 printk("\n" KERN_DEBUG "printing local APIC contents on CPU#%d/%d:\n",
1070 smp_processor_id(), hard_smp_processor_id()); 1070 smp_processor_id(), hard_smp_processor_id());
1071 v = apic_read(APIC_ID); 1071 printk(KERN_INFO "... APIC ID: %08x (%01x)\n", v, GET_APIC_ID(read_apic_id()));
1072 printk(KERN_INFO "... APIC ID: %08x (%01x)\n", v, GET_APIC_ID(v));
1073 v = apic_read(APIC_LVR); 1072 v = apic_read(APIC_LVR);
1074 printk(KERN_INFO "... APIC VERSION: %08x\n", v); 1073 printk(KERN_INFO "... APIC VERSION: %08x\n", v);
1075 ver = GET_APIC_VERSION(v); 1074 ver = GET_APIC_VERSION(v);
@@ -1263,7 +1262,7 @@ void disable_IO_APIC(void)
1263 entry.dest_mode = 0; /* Physical */ 1262 entry.dest_mode = 0; /* Physical */
1264 entry.delivery_mode = dest_ExtINT; /* ExtInt */ 1263 entry.delivery_mode = dest_ExtINT; /* ExtInt */
1265 entry.vector = 0; 1264 entry.vector = 0;
1266 entry.dest = GET_APIC_ID(apic_read(APIC_ID)); 1265 entry.dest = GET_APIC_ID(read_apic_id());
1267 1266
1268 /* 1267 /*
1269 * Add it to the IO-APIC irq-routing table: 1268 * Add it to the IO-APIC irq-routing table:
diff --git a/arch/x86/kernel/mpparse_32.c b/arch/x86/kernel/mpparse_32.c
index cd4522b3e90e..4b46a37e0634 100644
--- a/arch/x86/kernel/mpparse_32.c
+++ b/arch/x86/kernel/mpparse_32.c
@@ -802,7 +802,7 @@ void __init mp_register_lapic_address(u64 address)
802 set_fixmap_nocache(FIX_APIC_BASE, mp_lapic_addr); 802 set_fixmap_nocache(FIX_APIC_BASE, mp_lapic_addr);
803 803
804 if (boot_cpu_physical_apicid == -1U) 804 if (boot_cpu_physical_apicid == -1U)
805 boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID)); 805 boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id());
806 806
807 Dprintk("Boot CPU = %d\n", boot_cpu_physical_apicid); 807 Dprintk("Boot CPU = %d\n", boot_cpu_physical_apicid);
808} 808}
diff --git a/arch/x86/kernel/mpparse_64.c b/arch/x86/kernel/mpparse_64.c
index 5e789bdb34fa..29d2c40e54a2 100644
--- a/arch/x86/kernel/mpparse_64.c
+++ b/arch/x86/kernel/mpparse_64.c
@@ -631,7 +631,7 @@ void __init mp_register_lapic_address(u64 address)
631 mp_lapic_addr = (unsigned long)address; 631 mp_lapic_addr = (unsigned long)address;
632 set_fixmap_nocache(FIX_APIC_BASE, mp_lapic_addr); 632 set_fixmap_nocache(FIX_APIC_BASE, mp_lapic_addr);
633 if (boot_cpu_physical_apicid == -1U) 633 if (boot_cpu_physical_apicid == -1U)
634 boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID)); 634 boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id());
635} 635}
636void __cpuinit mp_register_lapic(u8 id, u8 enabled) 636void __cpuinit mp_register_lapic(u8 id, u8 enabled)
637{ 637{
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index f45d740b1b6a..5da35d2cdbd8 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -237,7 +237,7 @@ void __cpuinit smp_callin(void)
237 /* 237 /*
238 * (This works even if the APIC is not enabled.) 238 * (This works even if the APIC is not enabled.)
239 */ 239 */
240 phys_id = GET_APIC_ID(apic_read(APIC_ID)); 240 phys_id = GET_APIC_ID(read_apic_id());
241 cpuid = smp_processor_id(); 241 cpuid = smp_processor_id();
242 if (cpu_isset(cpuid, cpu_callin_map)) { 242 if (cpu_isset(cpuid, cpu_callin_map)) {
243 panic("%s: phys CPU#%d, CPU#%d already present??\n", __func__, 243 panic("%s: phys CPU#%d, CPU#%d already present??\n", __func__,
@@ -1205,9 +1205,9 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
1205 return; 1205 return;
1206 } 1206 }
1207 1207
1208 if (GET_APIC_ID(apic_read(APIC_ID)) != boot_cpu_physical_apicid) { 1208 if (GET_APIC_ID(read_apic_id()) != boot_cpu_physical_apicid) {
1209 panic("Boot APIC ID in local APIC unexpected (%d vs %d)", 1209 panic("Boot APIC ID in local APIC unexpected (%d vs %d)",
1210 GET_APIC_ID(apic_read(APIC_ID)), boot_cpu_physical_apicid); 1210 GET_APIC_ID(read_apic_id()), boot_cpu_physical_apicid);
1211 /* Or can we switch back to PIC here? */ 1211 /* Or can we switch back to PIC here? */
1212 } 1212 }
1213 1213
diff --git a/include/asm-x86/mach-default/mach_apic.h b/include/asm-x86/mach-default/mach_apic.h
index 1f56e7d5bfdd..14217a970c5e 100644
--- a/include/asm-x86/mach-default/mach_apic.h
+++ b/include/asm-x86/mach-default/mach_apic.h
@@ -54,7 +54,7 @@ static inline void init_apic_ldr(void)
54 54
55static inline int apic_id_registered(void) 55static inline int apic_id_registered(void)
56{ 56{
57 return physid_isset(GET_APIC_ID(apic_read(APIC_ID)), phys_cpu_present_map); 57 return physid_isset(GET_APIC_ID(read_apic_id()), phys_cpu_present_map);
58} 58}
59 59
60static inline unsigned int cpu_mask_to_apicid(cpumask_t cpumask) 60static inline unsigned int cpu_mask_to_apicid(cpumask_t cpumask)
diff --git a/include/asm-x86/mach-es7000/mach_apic.h b/include/asm-x86/mach-es7000/mach_apic.h
index 0137b6e142cc..fbc8ad256f5a 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)
141extern unsigned int boot_cpu_physical_apicid; 141extern unsigned int boot_cpu_physical_apicid;
142static inline int check_phys_apicid_present(int cpu_physical_apicid) 142static inline int check_phys_apicid_present(int cpu_physical_apicid)
143{ 143{
144 boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID)); 144 boot_cpu_physical_apicid = GET_APIC_ID(read_apic_id());
145 return (1); 145 return (1);
146} 146}
147 147
diff --git a/include/asm-x86/mach-visws/mach_apic.h b/include/asm-x86/mach-visws/mach_apic.h
index efac6f0d139f..a9ef33a8a995 100644
--- a/include/asm-x86/mach-visws/mach_apic.h
+++ b/include/asm-x86/mach-visws/mach_apic.h
@@ -23,7 +23,7 @@
23 23
24static inline int apic_id_registered(void) 24static inline int apic_id_registered(void)
25{ 25{
26 return physid_isset(GET_APIC_ID(apic_read(APIC_ID)), phys_cpu_present_map); 26 return physid_isset(GET_APIC_ID(read_apic_id()), phys_cpu_present_map);
27} 27}
28 28
29/* 29/*
diff --git a/include/asm-x86/smp.h b/include/asm-x86/smp.h
index bcbd25cbd863..c0d693ca4357 100644
--- a/include/asm-x86/smp.h
+++ b/include/asm-x86/smp.h
@@ -174,6 +174,11 @@ static inline int logical_smp_processor_id(void)
174 return GET_APIC_LOGICAL_ID(*(u32 *)(APIC_BASE + APIC_LDR)); 174 return GET_APIC_LOGICAL_ID(*(u32 *)(APIC_BASE + APIC_LDR));
175} 175}
176 176
177static inline unsigned int read_apic_id(void)
178{
179 return *(u32 *)(APIC_BASE + APIC_ID);
180}
181
177# ifdef APIC_DEFINITION 182# ifdef APIC_DEFINITION
178extern int hard_smp_processor_id(void); 183extern int hard_smp_processor_id(void);
179# else 184# else
@@ -181,7 +186,7 @@ extern int hard_smp_processor_id(void);
181static inline int hard_smp_processor_id(void) 186static inline int hard_smp_processor_id(void)
182{ 187{
183 /* we don't want to mark this access volatile - bad code generation */ 188 /* we don't want to mark this access volatile - bad code generation */
184 return GET_APIC_ID(*(u32 *)(APIC_BASE + APIC_ID)); 189 return GET_APIC_ID(read_apic_id());
185} 190}
186# endif /* APIC_DEFINITION */ 191# endif /* APIC_DEFINITION */
187 192