]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/x86/kernel/genx2apic_phys.c
x86, apic, 32-bit: add self-IPI methods
[linux-2.6-omap-h63xx.git] / arch / x86 / kernel / genx2apic_phys.c
index 80cba49cfd89bea6155d2e813914d993a8c6a3e6..5cbae8aa0408886a874bfa5e7263e720abb7b1e2 100644 (file)
@@ -55,8 +55,8 @@ static void __x2apic_send_IPI_dest(unsigned int apicid, int vector,
 
 static void x2apic_send_IPI_mask(const struct cpumask *mask, int vector)
 {
-       unsigned long flags;
        unsigned long query_cpu;
+       unsigned long flags;
 
        local_irq_save(flags);
        for_each_cpu(query_cpu, mask) {
@@ -66,12 +66,12 @@ static void x2apic_send_IPI_mask(const struct cpumask *mask, int vector)
        local_irq_restore(flags);
 }
 
-static void x2apic_send_IPI_mask_allbutself(const struct cpumask *mask,
                                          int vector)
+static void
x2apic_send_IPI_mask_allbutself(const struct cpumask *mask, int vector)
 {
-       unsigned long flags;
-       unsigned long query_cpu;
        unsigned long this_cpu = smp_processor_id();
+       unsigned long query_cpu;
+       unsigned long flags;
 
        local_irq_save(flags);
        for_each_cpu(query_cpu, mask) {
@@ -85,16 +85,17 @@ static void x2apic_send_IPI_mask_allbutself(const struct cpumask *mask,
 
 static void x2apic_send_IPI_allbutself(int vector)
 {
-       unsigned long flags;
-       unsigned long query_cpu;
        unsigned long this_cpu = smp_processor_id();
+       unsigned long query_cpu;
+       unsigned long flags;
 
        local_irq_save(flags);
-       for_each_online_cpu(query_cpu)
-               if (query_cpu != this_cpu)
-                       __x2apic_send_IPI_dest(
-                               per_cpu(x86_cpu_to_apicid, query_cpu),
-                               vector, APIC_DEST_PHYSICAL);
+       for_each_online_cpu(query_cpu) {
+               if (query_cpu == this_cpu)
+                       continue;
+               __x2apic_send_IPI_dest(per_cpu(x86_cpu_to_apicid, query_cpu),
+                                      vector, APIC_DEST_PHYSICAL);
+       }
        local_irq_restore(flags);
 }
 
@@ -110,21 +111,21 @@ static int x2apic_apic_id_registered(void)
 
 static unsigned int x2apic_cpu_mask_to_apicid(const struct cpumask *cpumask)
 {
-       int cpu;
-
        /*
         * We're using fixed IRQ delivery, can only return one phys APIC ID.
         * May as well be the first.
         */
-       cpu = cpumask_first(cpumask);
+       int cpu = cpumask_first(cpumask);
+
        if ((unsigned)cpu < nr_cpu_ids)
                return per_cpu(x86_cpu_to_apicid, cpu);
        else
                return BAD_APICID;
 }
 
-static unsigned int x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
-                                                 const struct cpumask *andmask)
+static unsigned int
+x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
+                             const struct cpumask *andmask)
 {
        int cpu;
 
@@ -132,28 +133,25 @@ static unsigned int x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
         * We're using fixed IRQ delivery, can only return one phys APIC ID.
         * May as well be the first.
         */
-       for_each_cpu_and(cpu, cpumask, andmask)
+       for_each_cpu_and(cpu, cpumask, andmask) {
                if (cpumask_test_cpu(cpu, cpu_online_mask))
                        break;
+       }
+
        if (cpu < nr_cpu_ids)
                return per_cpu(x86_cpu_to_apicid, cpu);
+
        return BAD_APICID;
 }
 
 static unsigned int x2apic_phys_get_apic_id(unsigned long x)
 {
-       unsigned int id;
-
-       id = x;
-       return id;
+       return x;
 }
 
 static unsigned long set_apic_id(unsigned int id)
 {
-       unsigned long x;
-
-       x = id;
-       return x;
+       return id;
 }
 
 static int x2apic_phys_pkg_id(int initial_apicid, int index_msb)
@@ -168,7 +166,6 @@ static void x2apic_send_IPI_self(int vector)
 
 static void init_x2apic_ldr(void)
 {
-       return;
 }
 
 struct genapic apic_x2apic_phys = {
@@ -217,11 +214,10 @@ struct genapic apic_x2apic_phys = {
        .send_IPI_self                  = x2apic_send_IPI_self,
 
        .wakeup_cpu                     = NULL,
-       .trampoline_phys_low            = 0,
-       .trampoline_phys_high           = 0,
+       .trampoline_phys_low            = DEFAULT_TRAMPOLINE_PHYS_LOW,
+       .trampoline_phys_high           = DEFAULT_TRAMPOLINE_PHYS_HIGH,
        .wait_for_init_deassert         = NULL,
        .smp_callin_clear_local_apic    = NULL,
        .store_NMI_vector               = NULL,
-       .restore_NMI_vector             = NULL,
        .inquire_remote_apic            = NULL,
 };