#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
 
 
 #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
 
 #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);
 
 
 #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 */
 
 #ifndef APIC_DEFINITION
 #include <asm/genapic.h>
 
-#define GET_APIC_ID (apic->get_apic_id)
 #define APIC_ID_MASK (apic->apic_id_mask)
 #endif
 
 
 #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
 
 
        reg = *(u32 *)(APIC_BASE + APIC_ID);
 
-       return GET_APIC_ID(reg);
+       return apic->get_apic_id(reg);
 }
 #endif
 
 
 
 #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
 
                __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;
 }
 
 {
        unsigned int id;
 
-       id = get_apic_id(apic_read(APIC_ID));
+       id = flat_get_apic_id(apic_read(APIC_ID));
        return id;
 }
 
        .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,
 
        .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,
 
 
        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;
 
        .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,
 
 
        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;
 
        .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,
 
 
        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;
 
 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)
        .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,
 
 
        .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,
 
 
        .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,
 
 
        .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,
 
 
        .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,
 
 
        .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,