]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/x86/include/asm/es7000/apic.h
x86, apic: clean up target_cpus methods
[linux-2.6-omap-h63xx.git] / arch / x86 / include / asm / es7000 / apic.h
index 51ac1230294e53561e176904a5d37d05bdfa712b..7e5c31a4f8da57f8a5427b0d6e2c5cdb245a14bd 100644 (file)
@@ -1,12 +1,14 @@
 #ifndef __ASM_ES7000_APIC_H
 #define __ASM_ES7000_APIC_H
 
+#include <linux/gfp.h>
+
 #define xapic_phys_to_log_apicid(cpu) per_cpu(x86_bios_cpu_apicid, cpu)
 #define esr_disable (1)
 
-static inline int apic_id_registered(void)
+static inline int es7000_apic_id_registered(void)
 {
-               return (1);
+               return 1;
 }
 
 static inline const cpumask_t *target_cpus_cluster(void)
@@ -14,7 +16,7 @@ static inline const cpumask_t *target_cpus_cluster(void)
        return &CPU_MASK_ALL;
 }
 
-static inline const cpumask_t *target_cpus(void)
+static inline const cpumask_t *es7000_target_cpus(void)
 {
        return &cpumask_of_cpu(smp_processor_id());
 }
@@ -25,8 +27,6 @@ static inline const cpumask_t *target_cpus(void)
 #define NO_BALANCE_IRQ_CLUSTER         (1)
 
 #define APIC_DFR_VALUE         (APIC_DFR_FLAT)
-#define INT_DELIVERY_MODE      (dest_Fixed)
-#define INT_DEST_MODE          (0)    /* phys delivery to target procs */
 #define NO_BALANCE_IRQ         (0)
 #undef  APIC_DEST_LOGICAL
 #define APIC_DEST_LOGICAL      0x0
@@ -83,7 +83,7 @@ static inline void setup_apic_routing(void)
        printk("Enabling APIC mode:  %s. Using %d I/O APICs, target cpus %lx\n",
                (apic_version[apic] == 0x14) ?
                        "Physical Cluster" : "Logical Cluster",
-                       nr_ioapics, cpus_addr(*target_cpus())[0]);
+                       nr_ioapics, cpus_addr(*es7000_target_cpus())[0]);
 }
 
 static inline int multi_timer_check(int apic, int irq)
@@ -157,7 +157,7 @@ cpu_mask_to_apicid_cluster(const struct cpumask *cpumask)
 
        num_bits_set = cpumask_weight(cpumask);
        /* Return id to all */
-       if (num_bits_set == NR_CPUS)
+       if (num_bits_set == nr_cpu_ids)
                return 0xFF;
        /*
         * The cpus in the mask must all be on the apic cluster.  If are not
@@ -190,7 +190,7 @@ static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask)
 
        num_bits_set = cpus_weight(*cpumask);
        /* Return id to all */
-       if (num_bits_set == NR_CPUS)
+       if (num_bits_set == nr_cpu_ids)
                return cpu_to_logical_apicid(0);
        /*
         * The cpus in the mask must all be on the apic cluster.  If are not
@@ -218,9 +218,6 @@ static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask)
 static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *inmask,
                                                  const struct cpumask *andmask)
 {
-       int num_bits_set;
-       int cpus_found = 0;
-       int cpu;
        int apicid = cpu_to_logical_apicid(0);
        cpumask_var_t cpumask;
 
@@ -229,31 +226,8 @@ static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *inmask,
 
        cpumask_and(cpumask, inmask, andmask);
        cpumask_and(cpumask, cpumask, cpu_online_mask);
+       apicid = cpu_mask_to_apicid(cpumask);
 
-       num_bits_set = cpumask_weight(cpumask);
-       /* Return id to all */
-       if (num_bits_set == NR_CPUS)
-               goto exit;
-       /*
-        * The cpus in the mask must all be on the apic cluster.  If are not
-        * on the same apicid cluster return default value of TARGET_CPUS.
-        */
-       cpu = cpumask_first(cpumask);
-       apicid = cpu_to_logical_apicid(cpu);
-       while (cpus_found < num_bits_set) {
-               if (cpumask_test_cpu(cpu, cpumask)) {
-                       int new_apicid = cpu_to_logical_apicid(cpu);
-                       if (apicid_cluster(apicid) !=
-                                       apicid_cluster(new_apicid)){
-                               printk ("%s: Not a valid mask!\n", __func__);
-                               return cpu_to_logical_apicid(0);
-                       }
-                       apicid = new_apicid;
-                       cpus_found++;
-               }
-               cpu++;
-       }
-exit:
        free_cpumask_var(cpumask);
        return apicid;
 }