x86, apic: unify phys_pkg_id()
authorIngo Molnar <mingo@elte.hu>
Wed, 28 Jan 2009 12:31:22 +0000 (13:31 +0100)
committerIngo Molnar <mingo@elte.hu>
Wed, 28 Jan 2009 22:20:26 +0000 (23:20 +0100)
- unify the call signature of 64-bit to that of 32-bit

 - clean up the types all around

 - clean up namespace contamination

Signed-off-by: Ingo Molnar <mingo@elte.hu>
12 files changed:
arch/x86/include/asm/bigsmp/apic.h
arch/x86/include/asm/es7000/apic.h
arch/x86/include/asm/genapic.h
arch/x86/include/asm/mach-default/mach_apic.h
arch/x86/include/asm/numaq/apic.h
arch/x86/include/asm/summit/apic.h
arch/x86/kernel/cpu/addon_cpuid_features.c
arch/x86/kernel/cpu/common.c
arch/x86/kernel/genapic_flat_64.c
arch/x86/kernel/genx2apic_cluster.c
arch/x86/kernel/genx2apic_phys.c
arch/x86/kernel/genx2apic_uv_x.c

index f49d440862f1b903634a03ca9b9d9f29b7a1c1e2..b7cba5b5635b065193741f0c5f4629919d5676d0 100644 (file)
@@ -133,7 +133,7 @@ static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *cpumask,
        return BAD_APICID;
 }
 
-static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb)
+static inline int phys_pkg_id(int cpuid_apic, int index_msb)
 {
        return cpuid_apic >> index_msb;
 }
index 038c4f0e480b760474190065b01c3edf0727c2ce..d2c6c202e8bddc9c95ef010ab11d9d35599660fa 100644 (file)
@@ -221,7 +221,7 @@ static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *inmask,
        return apicid;
 }
 
-static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb)
+static inline int phys_pkg_id(int cpuid_apic, int index_msb)
 {
        return cpuid_apic >> index_msb;
 }
index f292fd02ebab95a039520cb6f3336a1a7437ee44..14b19de8cd09caf49066937752e7c10000a6cd8f 100644 (file)
@@ -48,11 +48,7 @@ struct genapic {
        void (*setup_portio_remap)(void);
        int (*check_phys_apicid_present)(int boot_cpu_physical_apicid);
        void (*enable_apic_mode)(void);
-#ifdef CONFIG_X86_32
-       u32 (*phys_pkg_id)(u32 cpuid_apic, int index_msb);
-#else
-       unsigned int (*phys_pkg_id)(int index_msb);
-#endif
+       int (*phys_pkg_id)(int cpuid_apic, int index_msb);
 
        /*
         * When one of the next two hooks returns 1 the genapic
index 3647c92d45e5d94ef34b39e1906055fe1f1f1e0d..55797a35150f018e2368eb90b4cc64c6a9ad6c83 100644 (file)
@@ -65,7 +65,7 @@ static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *cpumask,
        return (unsigned int)(mask1 & mask2 & mask3);
 }
 
-static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb)
+static inline int phys_pkg_id(int cpuid_apic, int index_msb)
 {
        return cpuid_apic >> index_msb;
 }
index dc93c30972e7a6a727a1b87fbd7ddd3399454d64..bc2c8a425c034d2fedaeb0dfdf321795298b5825 100644 (file)
@@ -113,7 +113,7 @@ static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *cpumask,
 }
 
 /* No NUMA-Q box has a HT CPU, but it can't hurt to use the default code. */
-static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb)
+static inline int phys_pkg_id(int cpuid_apic, int index_msb)
 {
        return cpuid_apic >> index_msb;
 }
index 526d19e79447dc45090e8d0a156b3bae5eadcec6..64cd441ae006050d325992084f4da8745297e3fe 100644 (file)
@@ -175,13 +175,14 @@ static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *inmask,
        return apicid;
 }
 
-/* cpuid returns the value latched in the HW at reset, not the APIC ID
+/*
+ * cpuid returns the value latched in the HW at reset, not the APIC ID
  * register's value.  For any box whose BIOS changes APIC IDs, like
  * clustered APIC systems, we must use hard_smp_processor_id.
  *
  * See Intel's IA-32 SW Dev's Manual Vol2 under CPUID.
  */
-static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb)
+static inline int phys_pkg_id(int cpuid_apic, int index_msb)
 {
        return hard_smp_processor_id() >> index_msb;
 }
index 4e581fdc0a5a3b7b278cbb77d50eabc1d0f3caa0..84f8e4a5aef7be4aa0400f4fef956344824352c2 100644 (file)
@@ -116,7 +116,6 @@ void __cpuinit detect_extended_topology(struct cpuinfo_x86 *c)
 
        core_select_mask = (~(-1 << core_plus_mask_width)) >> ht_mask_width;
 
-#ifdef CONFIG_X86_32
        c->cpu_core_id = phys_pkg_id(c->initial_apicid, ht_mask_width)
                                                 & core_select_mask;
        c->phys_proc_id = phys_pkg_id(c->initial_apicid, core_plus_mask_width);
@@ -124,14 +123,7 @@ void __cpuinit detect_extended_topology(struct cpuinfo_x86 *c)
         * Reinit the apicid, now that we have extended initial_apicid.
         */
        c->apicid = phys_pkg_id(c->initial_apicid, 0);
-#else
-       c->cpu_core_id = phys_pkg_id(ht_mask_width) & core_select_mask;
-       c->phys_proc_id = phys_pkg_id(core_plus_mask_width);
-       /*
-        * Reinit the apicid, now that we have extended initial_apicid.
-        */
-       c->apicid = phys_pkg_id(0);
-#endif
+
        c->x86_max_cores = (core_level_siblings / smp_num_siblings);
 
 
index 275e2cb43b91556dee589d394083ad7af17bed01..93c491c4fe7fd75c20a63be9971296bbb98f81eb 100644 (file)
@@ -442,11 +442,7 @@ void __cpuinit detect_ht(struct cpuinfo_x86 *c)
                }
 
                index_msb = get_count_order(smp_num_siblings);
-#ifdef CONFIG_X86_64
-               c->phys_proc_id = phys_pkg_id(index_msb);
-#else
                c->phys_proc_id = phys_pkg_id(c->initial_apicid, index_msb);
-#endif
 
                smp_num_siblings = smp_num_siblings / c->x86_max_cores;
 
@@ -454,13 +450,8 @@ void __cpuinit detect_ht(struct cpuinfo_x86 *c)
 
                core_bits = get_count_order(c->x86_max_cores);
 
-#ifdef CONFIG_X86_64
-               c->cpu_core_id = phys_pkg_id(index_msb) &
-                                              ((1 << core_bits) - 1);
-#else
                c->cpu_core_id = phys_pkg_id(c->initial_apicid, index_msb) &
                                               ((1 << core_bits) - 1);
-#endif
        }
 
 out:
@@ -742,7 +733,7 @@ static void __cpuinit identify_cpu(struct cpuinfo_x86 *c)
                this_cpu->c_identify(c);
 
 #ifdef CONFIG_X86_64
-       c->apicid = phys_pkg_id(0);
+       c->apicid = phys_pkg_id(c->initial_apicid, 0);
 #endif
 
        /*
index 78adf71f7e55af3f4684c7cde7adb4a14881e54b..cc9e07b960949c8b0df607f8149e6a6037ca027a 100644 (file)
@@ -169,7 +169,7 @@ static unsigned int flat_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
        return mask1 & mask2;
 }
 
-static unsigned int phys_pkg_id(int index_msb)
+static int flat_phys_pkg_id(int initial_apic_id, int index_msb)
 {
        return hard_smp_processor_id() >> index_msb;
 }
@@ -202,7 +202,7 @@ struct genapic apic_flat =  {
        .setup_portio_remap             = NULL,
        .check_phys_apicid_present      = default_check_phys_apicid_present,
        .enable_apic_mode               = NULL,
-       .phys_pkg_id                    = phys_pkg_id,
+       .phys_pkg_id                    = flat_phys_pkg_id,
        .mps_oem_check                  = NULL,
 
        .get_apic_id                    = get_apic_id,
@@ -346,7 +346,7 @@ struct genapic apic_physflat =  {
        .setup_portio_remap             = NULL,
        .check_phys_apicid_present      = default_check_phys_apicid_present,
        .enable_apic_mode               = NULL,
-       .phys_pkg_id                    = phys_pkg_id,
+       .phys_pkg_id                    = flat_phys_pkg_id,
        .mps_oem_check                  = NULL,
 
        .get_apic_id                    = get_apic_id,
index 7062e24b18f63ed8da928d511a0480d6a4948adb..18b6f14376eb2f2078c67c72e1ad0a5d412d5c93 100644 (file)
@@ -157,7 +157,7 @@ static unsigned long set_apic_id(unsigned int id)
        return x;
 }
 
-static unsigned int phys_pkg_id(int index_msb)
+static int x2apic_cluster_phys_pkg_id(int initial_apicid, int index_msb)
 {
        return current_cpu_data.initial_apicid >> index_msb;
 }
@@ -204,7 +204,7 @@ struct genapic apic_x2apic_cluster = {
        .setup_portio_remap             = NULL,
        .check_phys_apicid_present      = default_check_phys_apicid_present,
        .enable_apic_mode               = NULL,
-       .phys_pkg_id                    = phys_pkg_id,
+       .phys_pkg_id                    = x2apic_cluster_phys_pkg_id,
        .mps_oem_check                  = NULL,
 
        .get_apic_id                    = get_apic_id,
index 7177a1110f0d3bfdb661d13753c0e1d602958387..2cb6f49e4c50fc710589d2980a9901088036fa9a 100644 (file)
@@ -156,7 +156,7 @@ static unsigned long set_apic_id(unsigned int id)
        return x;
 }
 
-static unsigned int phys_pkg_id(int index_msb)
+static int x2apic_phys_pkg_id(int initial_apicid, int index_msb)
 {
        return current_cpu_data.initial_apicid >> index_msb;
 }
@@ -200,7 +200,7 @@ struct genapic apic_x2apic_phys = {
        .setup_portio_remap             = NULL,
        .check_phys_apicid_present      = default_check_phys_apicid_present,
        .enable_apic_mode               = NULL,
-       .phys_pkg_id                    = phys_pkg_id,
+       .phys_pkg_id                    = x2apic_phys_pkg_id,
        .mps_oem_check                  = NULL,
 
        .get_apic_id                    = get_apic_id,
index debd721f0b4e621b37f029b8721f69bfb79cc182..67e7658775e7874996d026c8cf1d92482559c7e8 100644 (file)
@@ -226,7 +226,7 @@ static unsigned int uv_read_apic_id(void)
        return get_apic_id(apic_read(APIC_ID));
 }
 
-static unsigned int phys_pkg_id(int index_msb)
+static int uv_phys_pkg_id(int initial_apicid, int index_msb)
 {
        return uv_read_apic_id() >> index_msb;
 }
@@ -265,7 +265,7 @@ struct genapic apic_x2apic_uv_x = {
        .setup_portio_remap             = NULL,
        .check_phys_apicid_present      = default_check_phys_apicid_present,
        .enable_apic_mode               = NULL,
-       .phys_pkg_id                    = phys_pkg_id,
+       .phys_pkg_id                    = uv_phys_pkg_id,
        .mps_oem_check                  = NULL,
 
        .get_apic_id                    = get_apic_id,