x86, apic: refactor ->get_apic_id() & GET_APIC_ID()
authorIngo Molnar <mingo@elte.hu>
Wed, 28 Jan 2009 13:08:38 +0000 (14:08 +0100)
committerIngo Molnar <mingo@elte.hu>
Wed, 28 Jan 2009 22:20:29 +0000 (23:20 +0100)
- spread out the namespace on a per driver basis

 - get rid of macro wrappers

 - small cleanups

Signed-off-by: Ingo Molnar <mingo@elte.hu>
17 files changed:
arch/x86/include/asm/bigsmp/apicdef.h
arch/x86/include/asm/es7000/apicdef.h
arch/x86/include/asm/mach-default/mach_apic.h
arch/x86/include/asm/mach-default/mach_apicdef.h
arch/x86/include/asm/mach-generic/mach_apicdef.h
arch/x86/include/asm/numaq/apicdef.h
arch/x86/include/asm/smp.h
arch/x86/include/asm/summit/apicdef.h
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
arch/x86/mach-generic/bigsmp.c
arch/x86/mach-generic/default.c
arch/x86/mach-generic/es7000.c
arch/x86/mach-generic/numaq.c
arch/x86/mach-generic/summit.c

index 392c3f5ef2fe0ad4d3e48e485390f4cb62a7bf83..ed25dd6503b27dd4afd226c1a75a0bfa4fdd512f 100644 (file)
@@ -3,11 +3,9 @@
 
 #define                APIC_ID_MASK            (0xFF<<24)
 
-static inline unsigned get_apic_id(unsigned long x)
+static inline unsigned bigsmp_get_apic_id(unsigned long x)
 {
-       return (((x)>>24)&0xFF);
+       return (x >> 24) & 0xFF;
 }
 
-#define                GET_APIC_ID(x)  get_apic_id(x)
-
 #endif
index 8b234a3cb8514e8bd0af7632dadf72f426960103..e23791762a19c752b15909714a644893bc3c4bf5 100644 (file)
@@ -3,11 +3,9 @@
 
 #define                APIC_ID_MASK            (0xFF<<24)
 
-static inline unsigned get_apic_id(unsigned long x)
+static inline unsigned int es7000_get_apic_id(unsigned long x)
 {
-       return (((x)>>24)&0xFF);
+       return (x >> 24) & 0xFF;
 }
 
-#define                GET_APIC_ID(x)  get_apic_id(x)
-
 #endif
index d0605281a6b767195b604a22cf9833618ae64316..8719208f27354fa47fd3280b6f2fb6108763a919 100644 (file)
@@ -21,7 +21,7 @@ static inline const struct cpumask *default_target_cpus(void)
 #include <asm/genapic.h>
 #define cpu_mask_to_apicid (apic->cpu_mask_to_apicid)
 #define cpu_mask_to_apicid_and (apic->cpu_mask_to_apicid_and)
-#define read_apic_id()  (GET_APIC_ID(apic_read(APIC_ID)))
+#define read_apic_id()  (apic->get_apic_id(apic_read(APIC_ID)))
 #define send_IPI_self (apic->send_IPI_self)
 #define wakeup_secondary_cpu (apic->wakeup_cpu)
 extern void default_setup_apic_routing(void);
index b4dcc0971c76d1e192d4c680fae80085256b4b74..e84d437ba2b2beb3d6acd952d0dae6c60e5ad67b 100644 (file)
@@ -5,20 +5,20 @@
 
 #ifdef CONFIG_X86_64
 #define        APIC_ID_MASK            (apic->apic_id_mask)
-#define GET_APIC_ID(x)         (apic->get_apic_id(x))
 #define        SET_APIC_ID(x)          (apic->set_apic_id(x))
 #else
 #define                APIC_ID_MASK            (0xF<<24)
-static inline unsigned get_apic_id(unsigned long x) 
+
+static inline unsigned default_get_apic_id(unsigned long x) 
 {
        unsigned int ver = GET_APIC_VERSION(apic_read(APIC_LVR));
+
        if (APIC_XAPIC(ver))
-               return (((x)>>24)&0xFF);
+               return (x >> 24) & 0xFF;
        else
-               return (((x)>>24)&0xF);
+               return (x >> 24) & 0x0F;
 } 
 
-#define                GET_APIC_ID(x)  get_apic_id(x)
 #endif
 
 #endif /* _ASM_X86_MACH_DEFAULT_MACH_APICDEF_H */
index acc9adddb3449918d71cbe3a8aa851fba395fc69..645520bcd2c2e41949affea509aacf415ad2946a 100644 (file)
@@ -4,7 +4,6 @@
 #ifndef APIC_DEFINITION
 #include <asm/genapic.h>
 
-#define GET_APIC_ID (apic->get_apic_id)
 #define APIC_ID_MASK (apic->apic_id_mask)
 #endif
 
index e012a46cc22a57baa0946e1b0230696aa7985b17..29f5e3d34e5b28f2e2bd3e01d77669e49b34a0e8 100644 (file)
@@ -1,14 +1,11 @@
 #ifndef __ASM_NUMAQ_APICDEF_H
 #define __ASM_NUMAQ_APICDEF_H
 
-
 #define APIC_ID_MASK (0xF<<24)
 
-static inline unsigned get_apic_id(unsigned long x)
+static inline unsigned int numaq_get_apic_id(unsigned long x)
 {
-               return (((x)>>24)&0x0F);
+       return (x >> 24) & 0x0F;
 }
 
-#define         GET_APIC_ID(x)  get_apic_id(x)
-
 #endif
index 45ef8a1b9d7cb614b283548f4835309213699840..c63d480802af0df3556cd5fa8085f6ab6292e12a 100644 (file)
@@ -189,7 +189,7 @@ static inline unsigned int read_apic_id(void)
 
        reg = *(u32 *)(APIC_BASE + APIC_ID);
 
-       return GET_APIC_ID(reg);
+       return apic->get_apic_id(reg);
 }
 #endif
 
index f3fbca1f61c1df672744ccd06b300447688640e1..4286528af7c654083cce92464a5312d75c8db691 100644 (file)
@@ -3,11 +3,9 @@
 
 #define                APIC_ID_MASK            (0xFF<<24)
 
-static inline unsigned get_apic_id(unsigned long x)
+static inline unsigned summit_get_apic_id(unsigned long x)
 {
-       return (x>>24)&0xFF;
+       return (x >> 24) & 0xFF;
 }
 
-#define                GET_APIC_ID(x)  get_apic_id(x)
-
 #endif
index cc9e07b960949c8b0df607f8149e6a6037ca027a..ab47091dac2b98b366a3073ccd19b2b7f10eb1d6 100644 (file)
@@ -126,11 +126,12 @@ static void flat_send_IPI_all(int vector)
                __send_IPI_shortcut(APIC_DEST_ALLINC, vector, apic->dest_logical);
 }
 
-static unsigned int get_apic_id(unsigned long x)
+static unsigned int flat_get_apic_id(unsigned long x)
 {
        unsigned int id;
 
        id = (((x)>>24) & 0xFFu);
+
        return id;
 }
 
@@ -146,7 +147,7 @@ static unsigned int read_xapic_id(void)
 {
        unsigned int id;
 
-       id = get_apic_id(apic_read(APIC_ID));
+       id = flat_get_apic_id(apic_read(APIC_ID));
        return id;
 }
 
@@ -205,7 +206,7 @@ struct genapic apic_flat =  {
        .phys_pkg_id                    = flat_phys_pkg_id,
        .mps_oem_check                  = NULL,
 
-       .get_apic_id                    = get_apic_id,
+       .get_apic_id                    = flat_get_apic_id,
        .set_apic_id                    = set_apic_id,
        .apic_id_mask                   = 0xFFu << 24,
 
@@ -349,7 +350,7 @@ struct genapic apic_physflat =  {
        .phys_pkg_id                    = flat_phys_pkg_id,
        .mps_oem_check                  = NULL,
 
-       .get_apic_id                    = get_apic_id,
+       .get_apic_id                    = flat_get_apic_id,
        .set_apic_id                    = set_apic_id,
        .apic_id_mask                   = 0xFFu<<24,
 
index 18b6f14376eb2f2078c67c72e1ad0a5d412d5c93..c7557e0518486a114938777a689c373dfd747d05 100644 (file)
@@ -141,7 +141,7 @@ static unsigned int x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
        return BAD_APICID;
 }
 
-static unsigned int get_apic_id(unsigned long x)
+static unsigned int x2apic_cluster_phys_get_apic_id(unsigned long x)
 {
        unsigned int id;
 
@@ -207,7 +207,7 @@ struct genapic apic_x2apic_cluster = {
        .phys_pkg_id                    = x2apic_cluster_phys_pkg_id,
        .mps_oem_check                  = NULL,
 
-       .get_apic_id                    = get_apic_id,
+       .get_apic_id                    = x2apic_cluster_phys_get_apic_id,
        .set_apic_id                    = set_apic_id,
        .apic_id_mask                   = 0xFFFFFFFFu,
 
index 2cb6f49e4c50fc710589d2980a9901088036fa9a..80cba49cfd89bea6155d2e813914d993a8c6a3e6 100644 (file)
@@ -140,7 +140,7 @@ static unsigned int x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
        return BAD_APICID;
 }
 
-static unsigned int get_apic_id(unsigned long x)
+static unsigned int x2apic_phys_get_apic_id(unsigned long x)
 {
        unsigned int id;
 
@@ -203,7 +203,7 @@ struct genapic apic_x2apic_phys = {
        .phys_pkg_id                    = x2apic_phys_pkg_id,
        .mps_oem_check                  = NULL,
 
-       .get_apic_id                    = get_apic_id,
+       .get_apic_id                    = x2apic_phys_get_apic_id,
        .set_apic_id                    = set_apic_id,
        .apic_id_mask                   = 0xFFFFFFFFu,
 
index 67e7658775e7874996d026c8cf1d92482559c7e8..50310b96adc3eb45fb13cf2bda74e915c17a9f08 100644 (file)
@@ -201,7 +201,7 @@ static unsigned int uv_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
        return BAD_APICID;
 }
 
-static unsigned int get_apic_id(unsigned long x)
+static unsigned int x2apic_get_apic_id(unsigned long x)
 {
        unsigned int id;
 
@@ -223,7 +223,7 @@ static unsigned long set_apic_id(unsigned int id)
 static unsigned int uv_read_apic_id(void)
 {
 
-       return get_apic_id(apic_read(APIC_ID));
+       return x2apic_get_apic_id(apic_read(APIC_ID));
 }
 
 static int uv_phys_pkg_id(int initial_apicid, int index_msb)
@@ -268,7 +268,7 @@ struct genapic apic_x2apic_uv_x = {
        .phys_pkg_id                    = uv_phys_pkg_id,
        .mps_oem_check                  = NULL,
 
-       .get_apic_id                    = get_apic_id,
+       .get_apic_id                    = x2apic_get_apic_id,
        .set_apic_id                    = set_apic_id,
        .apic_id_mask                   = 0xFFFFFFFFu,
 
index 6bf6aafeb2c69a22d509ee5ac475cb2ab194d039..9eca977227c457140ad9fd77a2e33c69fba52838 100644 (file)
@@ -90,7 +90,7 @@ struct genapic apic_bigsmp = {
        .phys_pkg_id                    = bigsmp_phys_pkg_id,
        .mps_oem_check                  = NULL,
 
-       .get_apic_id                    = get_apic_id,
+       .get_apic_id                    = bigsmp_get_apic_id,
        .set_apic_id                    = NULL,
        .apic_id_mask                   = APIC_ID_MASK,
 
index e5f85cd75b43a8c6533128980dfb7dc09e68bdcb..d51a3f0335aef822c909594aba74c361ac377d06 100644 (file)
@@ -71,7 +71,7 @@ struct genapic apic_default = {
        .phys_pkg_id                    = default_phys_pkg_id,
        .mps_oem_check                  = NULL,
 
-       .get_apic_id                    = get_apic_id,
+       .get_apic_id                    = default_get_apic_id,
        .set_apic_id                    = NULL,
        .apic_id_mask                   = APIC_ID_MASK,
 
index f861163cd39638063cf9017e616532beb64775df..1944675db629daffbf4e853eb5fac66e3035c639 100644 (file)
@@ -126,7 +126,7 @@ struct genapic apic_es7000 = {
        .phys_pkg_id                    = es7000_phys_pkg_id,
        .mps_oem_check                  = es7000_mps_oem_check,
 
-       .get_apic_id                    = get_apic_id,
+       .get_apic_id                    = es7000_get_apic_id,
        .set_apic_id                    = NULL,
        .apic_id_mask                   = APIC_ID_MASK,
 
index 517882c9c15ab63c76be5ae4276036a618cebdb9..fcbba84c090f72be5bb0c67191abc27031fb79b1 100644 (file)
@@ -90,7 +90,7 @@ struct genapic apic_numaq = {
        .phys_pkg_id                    = numaq_phys_pkg_id,
        .mps_oem_check                  = __numaq_mps_oem_check,
 
-       .get_apic_id                    = get_apic_id,
+       .get_apic_id                    = numaq_get_apic_id,
        .set_apic_id                    = NULL,
        .apic_id_mask                   = APIC_ID_MASK,
 
index 719e944ff308fc993ae12749e32be1596d728f98..5650eaf9061f213f53e30cbe62e008be181e38db 100644 (file)
@@ -70,7 +70,7 @@ struct genapic apic_summit = {
        .phys_pkg_id                    = summit_phys_pkg_id,
        .mps_oem_check                  = summit_mps_oem_check,
 
-       .get_apic_id                    = get_apic_id,
+       .get_apic_id                    = summit_get_apic_id,
        .set_apic_id                    = NULL,
        .apic_id_mask                   = APIC_ID_MASK,