Patches contributed by Eötvös Lorand University


commit 7da18ed924b182f8174de243c55a323c56398675
Author: Ingo Molnar <mingo@elte.hu>
Date:   Tue Feb 17 15:29:30 2009 +0100

    x86, es7000: misc cleanups
    
    These are cleanups that change the md5 signature:
    
     - asm/ => linux/ include conversion
     - simplify the code flow of find_unisys_acpi_oem_table()
     - move ACPI methods into one #ifdef block
     - remove 0/NULL initialization of statics
     - simplify/standardize printouts
     - update copyrights
     - more cleanups, pointed out by checkpatch
    
    arch/x86/kernel/es7000_32.o:
    
       text    data     bss     dec     hex filename
       2693     192      44    2929     b71 es7000_32.o.before
       2688     192      44    2924     b6c es7000_32.o.after
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/arch/x86/kernel/es7000_32.c b/arch/x86/kernel/es7000_32.c
index 03acbe95d2b5..3519f8cab708 100644
--- a/arch/x86/kernel/es7000_32.c
+++ b/arch/x86/kernel/es7000_32.c
@@ -1,10 +1,14 @@
 /*
  * Written by: Garry Forsgren, Unisys Corporation
  *             Natalie Protasevich, Unisys Corporation
+ *
  * This file contains the code to configure and interface
  * with Unisys ES7000 series hardware system manager.
  *
- * Copyright (c) 2003 Unisys Corporation.  All Rights Reserved.
+ * Copyright (c) 2003 Unisys Corporation.
+ * Copyright (C) 2009, Red Hat, Inc., Ingo Molnar
+ *
+ *   All Rights Reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of version 2 of the GNU General Public License as
@@ -35,7 +39,9 @@
 #include <linux/errno.h>
 #include <linux/acpi.h>
 #include <linux/init.h>
+#include <linux/nmi.h>
 #include <linux/smp.h>
+#include <linux/io.h>
 
 #include <asm/apicdef.h>
 #include <asm/atomic.h>
@@ -44,9 +50,6 @@
 #include <asm/setup.h>
 #include <asm/apic.h>
 #include <asm/ipi.h>
-#include <asm/nmi.h>
-#include <asm/smp.h>
-#include <asm/io.h>
 
 /*
  * ES7000 chipsets
@@ -93,22 +96,28 @@ struct psai {
 };
 
 #ifdef CONFIG_ACPI
+
 struct es7000_oem_table {
 	struct acpi_table_header	Header;
 	u32				OEMTableAddr;
 	u32				OEMTableSize;
 };
+
+static unsigned long			oem_addrX;
+static unsigned long			oem_size;
+
 #endif
 
 /*
  * ES7000 Globals
  */
 
-static volatile unsigned long		*psai = NULL;
+static volatile unsigned long		*psai;
 static struct mip_reg			*mip_reg;
 static struct mip_reg			*host_reg;
 static int 				mip_port;
-static unsigned long			mip_addr, host_addr;
+static unsigned long			mip_addr;
+static unsigned long			host_addr;
 
 int					es7000_plat;
 
@@ -252,31 +261,35 @@ static int __init parse_unisys_oem(char *oemptr)
 }
 
 #ifdef CONFIG_ACPI
-
-static unsigned long			oem_addrX;
-static unsigned long			oem_size;
-
 static int __init find_unisys_acpi_oem_table(unsigned long *oem_addr)
 {
 	struct acpi_table_header *header = NULL;
-	int i = 0;
+	struct es7000_oem_table *table;
 	acpi_size tbl_size;
+	acpi_status ret;
+	int i = 0;
 
-	while (ACPI_SUCCESS(acpi_get_table_with_size("OEM1", i++, &header, &tbl_size))) {
-		if (!memcmp((char *) &header->oem_id, "UNISYS", 6)) {
-			struct es7000_oem_table *t = (void *)header;
+	for (;;) {
+		ret = acpi_get_table_with_size("OEM1", i++, &header, &tbl_size);
+		if (!ACPI_SUCCESS(ret))
+			return -1;
 
-			oem_addrX = t->OEMTableAddr;
-			oem_size = t->OEMTableSize;
-			early_acpi_os_unmap_memory(header, tbl_size);
+		if (!memcmp((char *) &header->oem_id, "UNISYS", 6))
+			break;
 
-			*oem_addr = (unsigned long)__acpi_map_table(oem_addrX,
-								    oem_size);
-			return 0;
-		}
 		early_acpi_os_unmap_memory(header, tbl_size);
 	}
-	return -1;
+
+	table = (void *)header;
+
+	oem_addrX	= table->OEMTableAddr;
+	oem_size	= table->OEMTableSize;
+
+	early_acpi_os_unmap_memory(header, tbl_size);
+
+	*oem_addr	= (unsigned long)__acpi_map_table(oem_addrX, oem_size);
+
+	return 0;
 }
 
 static void __init unmap_unisys_acpi_oem_table(unsigned long oem_addr)
@@ -286,7 +299,47 @@ static void __init unmap_unisys_acpi_oem_table(unsigned long oem_addr)
 
 	__acpi_unmap_table((char *)oem_addr, oem_size);
 }
-#endif
+
+static int es7000_check_dsdt(void)
+{
+	struct acpi_table_header header;
+
+	if (ACPI_SUCCESS(acpi_get_table_header(ACPI_SIG_DSDT, 0, &header)) &&
+	    !strncmp(header.oem_id, "UNISYS", 6))
+		return 1;
+	return 0;
+}
+
+/* Hook from generic ACPI tables.c */
+static int __init es7000_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
+{
+	unsigned long oem_addr = 0;
+	int check_dsdt;
+	int ret = 0;
+
+	/* check dsdt at first to avoid clear fix_map for oem_addr */
+	check_dsdt = es7000_check_dsdt();
+
+	if (!find_unisys_acpi_oem_table(&oem_addr)) {
+		if (check_dsdt) {
+			ret = parse_unisys_oem((char *)oem_addr);
+		} else {
+			setup_unisys();
+			ret = 1;
+		}
+		/*
+		 * we need to unmap it
+		 */
+		unmap_unisys_acpi_oem_table(oem_addr);
+	}
+	return ret;
+}
+#else /* !CONFIG_ACPI: */
+static int __init es7000_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
+{
+	return 0;
+}
+#endif /* !CONFIG_ACPI */
 
 static void es7000_spin(int n)
 {
@@ -305,7 +358,7 @@ es7000_mip_write(struct mip_reg *mip_reg)
 	spin = MIP_SPIN;
 	while ((host_reg->off_0x38 & MIP_VALID) != 0) {
 		if (--spin <= 0) {
-			printk("es7000_mip_write: Timeout waiting for Host Valid Flag");
+			WARN(1,	"Timeout waiting for Host Valid Flag\n");
 			return -1;
 		}
 		es7000_spin(MIP_SPIN);
@@ -318,7 +371,7 @@ es7000_mip_write(struct mip_reg *mip_reg)
 
 	while ((mip_reg->off_0x38 & MIP_VALID) == 0) {
 		if (--spin <= 0) {
-			printk("es7000_mip_write: Timeout waiting for MIP Valid Flag");
+			WARN(1,	"Timeout waiting for MIP Valid Flag\n");
 			return -1;
 		}
 		es7000_spin(MIP_SPIN);
@@ -338,15 +391,13 @@ static void __init es7000_enable_apic_mode(void)
 	if (!es7000_plat)
 		return;
 
-	printk("ES7000: Enabling APIC mode.\n");
+	printk(KERN_INFO "ES7000: Enabling APIC mode.\n");
 	memset(&es7000_mip_reg, 0, sizeof(struct mip_reg));
 	es7000_mip_reg.off_0x00 = MIP_SW_APIC;
 	es7000_mip_reg.off_0x38 = MIP_VALID;
 
-	while ((mip_status = es7000_mip_write(&es7000_mip_reg)) != 0) {
-		printk("es7000_enable_apic_mode: command failed, status = %x\n",
-			mip_status);
-	}
+	while ((mip_status = es7000_mip_write(&es7000_mip_reg)) != 0)
+		WARN(1, "Command failed, status = %x\n", mip_status);
 }
 
 static void es7000_vector_allocation_domain(int cpu, cpumask_t *retmask)
@@ -377,18 +428,6 @@ static unsigned int es7000_get_apic_id(unsigned long x)
 	return (x >> 24) & 0xFF;
 }
 
-#ifdef CONFIG_ACPI
-static int es7000_check_dsdt(void)
-{
-	struct acpi_table_header header;
-
-	if (ACPI_SUCCESS(acpi_get_table_header(ACPI_SIG_DSDT, 0, &header)) &&
-	    !strncmp(header.oem_id, "UNISYS", 6))
-		return 1;
-	return 0;
-}
-#endif
-
 static void es7000_send_IPI_mask(const struct cpumask *mask, int vector)
 {
 	default_send_IPI_mask_sequence_phys(mask, vector);
@@ -466,10 +505,12 @@ static void es7000_init_apic_ldr(void)
 static void es7000_setup_apic_routing(void)
 {
 	int apic = per_cpu(x86_bios_cpu_apicid, smp_processor_id());
-	printk("Enabling APIC mode:  %s. Using %d I/O APICs, target cpus %lx\n",
+
+	printk(KERN_INFO
+	  "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(*es7000_target_cpus())[0]);
+		nr_ioapics, cpus_addr(*es7000_target_cpus())[0]);
 }
 
 static int es7000_apicid_to_node(int logical_apicid)
@@ -488,13 +529,14 @@ static int es7000_cpu_present_to_apicid(int mps_cpu)
 		return BAD_APICID;
 }
 
+static int cpu_id;
+
 static physid_mask_t es7000_apicid_to_cpu_present(int phys_apicid)
 {
-	static int id = 0;
 	physid_mask_t mask;
 
-	mask = physid_mask_of_physid(id);
-	++id;
+	mask = physid_mask_of_physid(cpu_id);
+	++cpu_id;
 
 	return mask;
 }
@@ -547,7 +589,7 @@ es7000_cpu_mask_to_apicid_cluster(const struct cpumask *cpumask)
 			int new_apicid = es7000_cpu_to_logical_apicid(cpu);
 
 			if (APIC_CLUSTER(apicid) != APIC_CLUSTER(new_apicid)) {
-				printk("%s: Not a valid mask!\n", __func__);
+				WARN(1, "Not a valid mask!");
 
 				return 0xFF;
 			}
@@ -648,38 +690,6 @@ es7000_mps_oem_check(struct mpc_table *mpc, char *oem, char *productid)
 	return 0;
 }
 
-#ifdef CONFIG_ACPI
-/* Hook from generic ACPI tables.c */
-static int __init es7000_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
-{
-	unsigned long oem_addr = 0;
-	int check_dsdt;
-	int ret = 0;
-
-	/* check dsdt at first to avoid clear fix_map for oem_addr */
-	check_dsdt = es7000_check_dsdt();
-
-	if (!find_unisys_acpi_oem_table(&oem_addr)) {
-		if (check_dsdt) {
-			ret = parse_unisys_oem((char *)oem_addr);
-		} else {
-			setup_unisys();
-			ret = 1;
-		}
-		/*
-		 * we need to unmap it
-		 */
-		unmap_unisys_acpi_oem_table(oem_addr);
-	}
-	return ret;
-}
-#else
-static int __init es7000_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
-{
-	return 0;
-}
-#endif
-
 
 struct genapic apic_es7000 = {
 

commit 352887d1c9d99d4c2f0fbac6176ef0cd4fe7a820
Author: Ingo Molnar <mingo@elte.hu>
Date:   Tue Feb 17 15:17:55 2009 +0100

    x86, es7000: remove dead code, clean up
    
    Impact: cleanup
    
     - a number of structure definitions were stale
     - remove needless wrappers around apic definitions
     - fix details noticed by checkpatch
    
    No code changed:
    
    md5:
       029d8fde0aaf6e934ea63bd8b36430fd  es7000_32.o.before.asm
       029d8fde0aaf6e934ea63bd8b36430fd  es7000_32.o.after.asm
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/arch/x86/kernel/es7000_32.c b/arch/x86/kernel/es7000_32.c
index d5c3894a9835..03acbe95d2b5 100644
--- a/arch/x86/kernel/es7000_32.c
+++ b/arch/x86/kernel/es7000_32.c
@@ -23,7 +23,6 @@
  *
  * http://www.unisys.com
  */
-
 #include <linux/notifier.h>
 #include <linux/spinlock.h>
 #include <linux/cpumask.h>
@@ -63,11 +62,23 @@
 #define	MIP_BUSY			1
 #define	MIP_SPIN			0xf0000
 #define	MIP_VALID			0x0100000000000000ULL
+#define	MIP_SW_APIC			0x1020b
 
 #define	MIP_PORT(val)			((val >> 32) & 0xffff)
 
 #define	MIP_RD_LO(val)			(val & 0xffffffff)
 
+struct mip_reg {
+	unsigned long long		off_0x00;
+	unsigned long long		off_0x08;
+	unsigned long long		off_0x10;
+	unsigned long long		off_0x18;
+	unsigned long long		off_0x20;
+	unsigned long long		off_0x28;
+	unsigned long long		off_0x30;
+	unsigned long long		off_0x38;
+};
+
 struct mip_reg_info {
 	unsigned long long		mip_info;
 	unsigned long long		delivery_info;
@@ -75,69 +86,20 @@ struct mip_reg_info {
 	unsigned long long		mip_reg;
 };
 
-struct part_info {
-	unsigned char			type;
-	unsigned char			length;
-	unsigned char			part_id;
-	unsigned char			apic_mode;
-	unsigned long			snum;
-	char				ptype[16];
-	char				sname[64];
-	char				pname[64];
-};
-
 struct psai {
 	unsigned long long		entry_type;
 	unsigned long long		addr;
 	unsigned long long		bep_addr;
 };
 
-struct es7000_mem_info {
-	unsigned char			type;
-	unsigned char			length;
-	unsigned char			resv[6];
-	unsigned long long		start;
-	unsigned long long		size;
-};
-
-struct es7000_oem_table {
-	unsigned long long		hdr;
-	struct mip_reg_info		mip;
-	struct part_info		pif;
-	struct es7000_mem_info		shm;
-	struct psai			psai;
-};
-
 #ifdef CONFIG_ACPI
-
-struct oem_table {
+struct es7000_oem_table {
 	struct acpi_table_header	Header;
 	u32				OEMTableAddr;
 	u32				OEMTableSize;
 };
-
 #endif
 
-struct mip_reg {
-	unsigned long long		off_0x00;
-	unsigned long long		off_0x08;
-	unsigned long long		off_0x10;
-	unsigned long long		off_0x18;
-	unsigned long long		off_0x20;
-	unsigned long long		off_0x28;
-	unsigned long long		off_0x30;
-	unsigned long long		off_0x38;
-};
-
-#define	MIP_SW_APIC			0x1020b
-#define	MIP_FUNC(VALUE)			(VALUE & 0xff)
-
-#define APIC_DFR_VALUE_CLUSTER		(APIC_DFR_CLUSTER)
-#define INT_DELIVERY_MODE_CLUSTER	(dest_LowestPrio)
-#define INT_DEST_MODE_CLUSTER		(1) /* logical delivery broadcast to all procs */
-
-#define APIC_DFR_VALUE			(APIC_DFR_FLAT)
-
 /*
  * ES7000 Globals
  */
@@ -228,14 +190,14 @@ static void __init setup_unisys(void)
 /*
  * Parse the OEM Table:
  */
-static int __init parse_unisys_oem (char *oemptr)
+static int __init parse_unisys_oem(char *oemptr)
 {
-	int                     i;
+	int			i;
 	int 			success = 0;
-	unsigned char           type, size;
-	unsigned long           val;
-	char                    *tp = NULL;
-	struct psai             *psaip = NULL;
+	unsigned char		type, size;
+	unsigned long		val;
+	char			*tp = NULL;
+	struct psai		*psaip = NULL;
 	struct mip_reg_info 	*mi;
 	struct mip_reg		*host, *mip;
 
@@ -243,7 +205,7 @@ static int __init parse_unisys_oem (char *oemptr)
 
 	tp += 8;
 
-	for (i=0; i <= 6; i++) {
+	for (i = 0; i <= 6; i++) {
 		type = *tp++;
 		size = *tp++;
 		tp -= 2;
@@ -302,7 +264,7 @@ static int __init find_unisys_acpi_oem_table(unsigned long *oem_addr)
 
 	while (ACPI_SUCCESS(acpi_get_table_with_size("OEM1", i++, &header, &tbl_size))) {
 		if (!memcmp((char *) &header->oem_id, "UNISYS", 6)) {
-			struct oem_table *t = (struct oem_table *)header;
+			struct es7000_oem_table *t = (void *)header;
 
 			oem_addrX = t->OEMTableAddr;
 			oem_size = t->OEMTableSize;
@@ -377,11 +339,11 @@ static void __init es7000_enable_apic_mode(void)
 		return;
 
 	printk("ES7000: Enabling APIC mode.\n");
-       	memset(&es7000_mip_reg, 0, sizeof(struct mip_reg));
-       	es7000_mip_reg.off_0x00 = MIP_SW_APIC;
-       	es7000_mip_reg.off_0x38 = MIP_VALID;
+	memset(&es7000_mip_reg, 0, sizeof(struct mip_reg));
+	es7000_mip_reg.off_0x00 = MIP_SW_APIC;
+	es7000_mip_reg.off_0x38 = MIP_VALID;
 
-       	while ((mip_status = es7000_mip_write(&es7000_mip_reg)) != 0) {
+	while ((mip_status = es7000_mip_write(&es7000_mip_reg)) != 0) {
 		printk("es7000_enable_apic_mode: command failed, status = %x\n",
 			mip_status);
 	}
@@ -444,7 +406,7 @@ static void es7000_send_IPI_all(int vector)
 
 static int es7000_apic_id_registered(void)
 {
-	        return 1;
+	return 1;
 }
 
 static const cpumask_t *target_cpus_cluster(void)
@@ -486,7 +448,7 @@ static void es7000_init_apic_ldr_cluster(void)
 	unsigned long val;
 	int cpu = smp_processor_id();
 
-	apic_write(APIC_DFR, APIC_DFR_VALUE_CLUSTER);
+	apic_write(APIC_DFR, APIC_DFR_CLUSTER);
 	val = calculate_ldr(cpu);
 	apic_write(APIC_LDR, val);
 }
@@ -496,7 +458,7 @@ static void es7000_init_apic_ldr(void)
 	unsigned long val;
 	int cpu = smp_processor_id();
 
-	apic_write(APIC_DFR, APIC_DFR_VALUE);
+	apic_write(APIC_DFR, APIC_DFR_FLAT);
 	val = calculate_ldr(cpu);
 	apic_write(APIC_LDR, val);
 }
@@ -585,7 +547,7 @@ es7000_cpu_mask_to_apicid_cluster(const struct cpumask *cpumask)
 			int new_apicid = es7000_cpu_to_logical_apicid(cpu);
 
 			if (APIC_CLUSTER(apicid) != APIC_CLUSTER(new_apicid)) {
-				printk ("%s: Not a valid mask!\n", __func__);
+				printk("%s: Not a valid mask!\n", __func__);
 
 				return 0xFF;
 			}
@@ -619,7 +581,7 @@ static unsigned int es7000_cpu_mask_to_apicid(const cpumask_t *cpumask)
 			int new_apicid = es7000_cpu_to_logical_apicid(cpu);
 
 			if (APIC_CLUSTER(apicid) != APIC_CLUSTER(new_apicid)) {
-				printk ("%s: Not a valid mask!\n", __func__);
+				printk("%s: Not a valid mask!\n", __func__);
 
 				return es7000_cpu_to_logical_apicid(0);
 			}
@@ -658,8 +620,9 @@ static int es7000_phys_pkg_id(int cpuid_apic, int index_msb)
 void __init es7000_update_genapic_to_cluster(void)
 {
 	apic->target_cpus = target_cpus_cluster;
-	apic->irq_delivery_mode = INT_DELIVERY_MODE_CLUSTER;
-	apic->irq_dest_mode = INT_DEST_MODE_CLUSTER;
+	apic->irq_delivery_mode = dest_LowestPrio;
+	/* logical delivery broadcast to all procs: */
+	apic->irq_dest_mode = 1;
 
 	apic->init_apic_ldr = es7000_init_apic_ldr_cluster;
 

commit d3185b37df05e9ad7ce987a9a0419ffe1af9d23f
Author: Ingo Molnar <mingo@elte.hu>
Date:   Tue Feb 17 15:13:05 2009 +0100

    x86, es7000: remove externs
    
    Impact: cleanup
    
    In the subarch times there were a number of externs between
    various bits of the ES7000 code. Now that there's a single
    es7000-platform support file, the externs can be removed and
    the functions can be changed the statics.
    
    Beyond the cleanup factor, this also shrinks the size of the
    kernel image a bit:
    
    arch/x86/kernel/es7000_32.o:
    
       text    data     bss     dec     hex filename
       2813     192      44    3049     be9 es7000_32.o.before
       2693     192      44    2929     b71 es7000_32.o.after
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/arch/x86/kernel/es7000_32.c b/arch/x86/kernel/es7000_32.c
index 8a20866b2a39..d5c3894a9835 100644
--- a/arch/x86/kernel/es7000_32.c
+++ b/arch/x86/kernel/es7000_32.c
@@ -116,8 +116,6 @@ struct oem_table {
 	u32				OEMTableSize;
 };
 
-extern int find_unisys_acpi_oem_table(unsigned long *oem_addr);
-extern void unmap_unisys_acpi_oem_table(unsigned long oem_addr);
 #endif
 
 struct mip_reg {
@@ -140,12 +138,6 @@ struct mip_reg {
 
 #define APIC_DFR_VALUE			(APIC_DFR_FLAT)
 
-extern void es7000_enable_apic_mode(void);
-extern int parse_unisys_oem (char *oemptr);
-extern int find_unisys_acpi_oem_table(unsigned long *oem_addr);
-extern void unmap_unisys_acpi_oem_table(unsigned long oem_addr);
-extern void setup_unisys(void);
-
 /*
  * ES7000 Globals
  */
@@ -215,7 +207,7 @@ static int __init es7000_update_genapic(void)
 	return 0;
 }
 
-void __init setup_unisys(void)
+static void __init setup_unisys(void)
 {
 	/*
 	 * Determine the generation of the ES7000 currently running.
@@ -234,10 +226,9 @@ void __init setup_unisys(void)
 }
 
 /*
- * Parse the OEM Table
+ * Parse the OEM Table:
  */
-
-int __init parse_unisys_oem (char *oemptr)
+static int __init parse_unisys_oem (char *oemptr)
 {
 	int                     i;
 	int 			success = 0;
@@ -290,9 +281,9 @@ int __init parse_unisys_oem (char *oemptr)
 		tp += size;
 	}
 
-	if (success < 2) {
+	if (success < 2)
 		es7000_plat = NON_UNISYS;
-	} else
+	else
 		setup_unisys();
 
 	return es7000_plat;
@@ -303,7 +294,7 @@ int __init parse_unisys_oem (char *oemptr)
 static unsigned long			oem_addrX;
 static unsigned long			oem_size;
 
-int __init find_unisys_acpi_oem_table(unsigned long *oem_addr)
+static int __init find_unisys_acpi_oem_table(unsigned long *oem_addr)
 {
 	struct acpi_table_header *header = NULL;
 	int i = 0;
@@ -326,7 +317,7 @@ int __init find_unisys_acpi_oem_table(unsigned long *oem_addr)
 	return -1;
 }
 
-void __init unmap_unisys_acpi_oem_table(unsigned long oem_addr)
+static void __init unmap_unisys_acpi_oem_table(unsigned long oem_addr)
 {
 	if (!oem_addr)
 		return;
@@ -377,7 +368,7 @@ es7000_mip_write(struct mip_reg *mip_reg)
 	return status;
 }
 
-void __init es7000_enable_apic_mode(void)
+static void __init es7000_enable_apic_mode(void)
 {
 	struct mip_reg es7000_mip_reg;
 	int mip_status;
@@ -706,9 +697,9 @@ static int __init es7000_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
 	check_dsdt = es7000_check_dsdt();
 
 	if (!find_unisys_acpi_oem_table(&oem_addr)) {
-		if (check_dsdt)
+		if (check_dsdt) {
 			ret = parse_unisys_oem((char *)oem_addr);
-		else {
+		} else {
 			setup_unisys();
 			ret = 1;
 		}

commit b9e0d1aa9767707cad24db32d8ce0409df16d491
Author: Ingo Molnar <mingo@elte.hu>
Date:   Tue Feb 17 15:09:08 2009 +0100

    x86, apic: remove apicid_cluster()
    
    There were multiple definitions of apicid_cluster() scattered around
    in APIC drivers - but the definitions are equivalent to the already
    existing generic APIC_CLUSTER() method.
    
    So remove apicid_cluster() and change all users to APIC_CLUSTER().
    
    No code changed:
    
    md5:
       1b8244ba8d3d6a454593ce10f09dfa58  summit_32.o.before.asm
       1b8244ba8d3d6a454593ce10f09dfa58  summit_32.o.after.asm
    
    md5:
       a593d98a882bf534622c70d9568497ac  es7000_32.o.before.asm
       a593d98a882bf534622c70d9568497ac  es7000_32.o.after.asm
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/arch/x86/kernel/es7000_32.c b/arch/x86/kernel/es7000_32.c
index c7cc9776ccae..8a20866b2a39 100644
--- a/arch/x86/kernel/es7000_32.c
+++ b/arch/x86/kernel/es7000_32.c
@@ -146,8 +146,6 @@ extern int find_unisys_acpi_oem_table(unsigned long *oem_addr);
 extern void unmap_unisys_acpi_oem_table(unsigned long oem_addr);
 extern void setup_unisys(void);
 
-#define apicid_cluster(apicid)		(apicid & 0xF0)
-
 /*
  * ES7000 Globals
  */
@@ -595,8 +593,7 @@ es7000_cpu_mask_to_apicid_cluster(const struct cpumask *cpumask)
 		if (cpumask_test_cpu(cpu, cpumask)) {
 			int new_apicid = es7000_cpu_to_logical_apicid(cpu);
 
-			if (apicid_cluster(apicid) !=
-					apicid_cluster(new_apicid)) {
+			if (APIC_CLUSTER(apicid) != APIC_CLUSTER(new_apicid)) {
 				printk ("%s: Not a valid mask!\n", __func__);
 
 				return 0xFF;
@@ -630,8 +627,7 @@ static unsigned int es7000_cpu_mask_to_apicid(const cpumask_t *cpumask)
 		if (cpu_isset(cpu, *cpumask)) {
 			int new_apicid = es7000_cpu_to_logical_apicid(cpu);
 
-			if (apicid_cluster(apicid) !=
-					apicid_cluster(new_apicid)) {
+			if (APIC_CLUSTER(apicid) != APIC_CLUSTER(new_apicid)) {
 				printk ("%s: Not a valid mask!\n", __func__);
 
 				return es7000_cpu_to_logical_apicid(0);
diff --git a/arch/x86/kernel/numaq_32.c b/arch/x86/kernel/numaq_32.c
index 9abaacde72eb..15328500de6e 100644
--- a/arch/x86/kernel/numaq_32.c
+++ b/arch/x86/kernel/numaq_32.c
@@ -375,8 +375,6 @@ static inline unsigned long numaq_check_apicid_present(int bit)
 	return physid_isset(bit, phys_cpu_present_map);
 }
 
-#define apicid_cluster(apicid) (apicid & 0xF0)
-
 static inline int numaq_apic_id_registered(void)
 {
 	return 1;
diff --git a/arch/x86/kernel/summit_32.c b/arch/x86/kernel/summit_32.c
index 7a1db1f23563..c4690349a54a 100644
--- a/arch/x86/kernel/summit_32.c
+++ b/arch/x86/kernel/summit_32.c
@@ -207,14 +207,12 @@ static inline unsigned long summit_check_apicid_present(int bit)
 	return 1;
 }
 
-#define apicid_cluster(apicid) ((apicid) & XAPIC_DEST_CLUSTER_MASK)
-
 static inline void summit_init_apic_ldr(void)
 {
 	unsigned long val, id;
 	int count = 0;
 	u8 my_id = (u8)hard_smp_processor_id();
-	u8 my_cluster = (u8)apicid_cluster(my_id);
+	u8 my_cluster = APIC_CLUSTER(my_id);
 #ifdef CONFIG_SMP
 	u8 lid;
 	int i;
@@ -222,7 +220,7 @@ static inline void summit_init_apic_ldr(void)
 	/* Create logical APIC IDs by counting CPUs already in cluster. */
 	for (count = 0, i = nr_cpu_ids; --i >= 0; ) {
 		lid = cpu_2_logical_apicid[i];
-		if (lid != BAD_APICID && apicid_cluster(lid) == my_cluster)
+		if (lid != BAD_APICID && APIC_CLUSTER(lid) == my_cluster)
 			++count;
 	}
 #endif
@@ -319,8 +317,7 @@ static inline unsigned int summit_cpu_mask_to_apicid(const cpumask_t *cpumask)
 		if (cpu_isset(cpu, *cpumask)) {
 			int new_apicid = summit_cpu_to_logical_apicid(cpu);
 
-			if (apicid_cluster(apicid) !=
-					apicid_cluster(new_apicid)) {
+			if (APIC_CLUSTER(apicid) != APIC_CLUSTER(new_apicid)) {
 				printk ("%s: Not a valid mask!\n", __func__);
 
 				return 0xFF;

commit 2c4ce18c95d632c9227ebcc6d45da11a9ef1ec70
Author: Ingo Molnar <mingo@elte.hu>
Date:   Tue Feb 17 14:57:16 2009 +0100

    x86, es7000: clean up
    
    No code changed:
    
    arch/x86/kernel/es7000_32.o:
    
       text    data     bss     dec     hex filename
       2813     192      44    3049     be9 es7000_32.o.before
       2813     192      44    3049     be9 es7000_32.o.after
    
    md5:
       a593d98a882bf534622c70d9568497ac  es7000_32.o.before.asm
       a593d98a882bf534622c70d9568497ac  es7000_32.o.after.asm
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/arch/x86/kernel/es7000_32.c b/arch/x86/kernel/es7000_32.c
index 3dc48831eb95..c7cc9776ccae 100644
--- a/arch/x86/kernel/es7000_32.c
+++ b/arch/x86/kernel/es7000_32.c
@@ -24,90 +24,96 @@
  * http://www.unisys.com
  */
 
-#include <linux/module.h>
-#include <linux/types.h>
+#include <linux/notifier.h>
+#include <linux/spinlock.h>
+#include <linux/cpumask.h>
+#include <linux/threads.h>
 #include <linux/kernel.h>
-#include <linux/smp.h>
+#include <linux/module.h>
+#include <linux/reboot.h>
 #include <linux/string.h>
-#include <linux/spinlock.h>
+#include <linux/types.h>
 #include <linux/errno.h>
-#include <linux/notifier.h>
-#include <linux/reboot.h>
-#include <linux/init.h>
 #include <linux/acpi.h>
-#include <asm/io.h>
-#include <asm/nmi.h>
-#include <asm/smp.h>
-#include <asm/atomic.h>
+#include <linux/init.h>
+#include <linux/smp.h>
+
 #include <asm/apicdef.h>
-#include <asm/apic.h>
+#include <asm/atomic.h>
+#include <asm/fixmap.h>
+#include <asm/mpspec.h>
 #include <asm/setup.h>
+#include <asm/apic.h>
+#include <asm/ipi.h>
+#include <asm/nmi.h>
+#include <asm/smp.h>
+#include <asm/io.h>
 
 /*
  * ES7000 chipsets
  */
 
-#define NON_UNISYS		0
-#define ES7000_CLASSIC		1
-#define ES7000_ZORRO		2
+#define NON_UNISYS			0
+#define ES7000_CLASSIC			1
+#define ES7000_ZORRO			2
 
+#define	MIP_REG				1
+#define	MIP_PSAI_REG			4
 
-#define	MIP_REG			1
-#define	MIP_PSAI_REG		4
+#define	MIP_BUSY			1
+#define	MIP_SPIN			0xf0000
+#define	MIP_VALID			0x0100000000000000ULL
 
-#define	MIP_BUSY		1
-#define	MIP_SPIN		0xf0000
-#define	MIP_VALID		0x0100000000000000ULL
-#define	MIP_PORT(VALUE)	((VALUE >> 32) & 0xffff)
+#define	MIP_PORT(val)			((val >> 32) & 0xffff)
 
-#define	MIP_RD_LO(VALUE)	(VALUE & 0xffffffff)
+#define	MIP_RD_LO(val)			(val & 0xffffffff)
 
 struct mip_reg_info {
-	unsigned long long mip_info;
-	unsigned long long delivery_info;
-	unsigned long long host_reg;
-	unsigned long long mip_reg;
+	unsigned long long		mip_info;
+	unsigned long long		delivery_info;
+	unsigned long long		host_reg;
+	unsigned long long		mip_reg;
 };
 
 struct part_info {
-	unsigned char type;
-	unsigned char length;
-	unsigned char part_id;
-	unsigned char apic_mode;
-	unsigned long snum;
-	char ptype[16];
-	char sname[64];
-	char pname[64];
+	unsigned char			type;
+	unsigned char			length;
+	unsigned char			part_id;
+	unsigned char			apic_mode;
+	unsigned long			snum;
+	char				ptype[16];
+	char				sname[64];
+	char				pname[64];
 };
 
 struct psai {
-	unsigned long long entry_type;
-	unsigned long long addr;
-	unsigned long long bep_addr;
+	unsigned long long		entry_type;
+	unsigned long long		addr;
+	unsigned long long		bep_addr;
 };
 
 struct es7000_mem_info {
-	unsigned char type;
-	unsigned char length;
-	unsigned char resv[6];
-	unsigned long long  start;
-	unsigned long long  size;
+	unsigned char			type;
+	unsigned char			length;
+	unsigned char			resv[6];
+	unsigned long long		start;
+	unsigned long long		size;
 };
 
 struct es7000_oem_table {
-	unsigned long long hdr;
-	struct mip_reg_info mip;
-	struct part_info pif;
-	struct es7000_mem_info shm;
-	struct psai psai;
+	unsigned long long		hdr;
+	struct mip_reg_info		mip;
+	struct part_info		pif;
+	struct es7000_mem_info		shm;
+	struct psai			psai;
 };
 
 #ifdef CONFIG_ACPI
 
 struct oem_table {
-	struct acpi_table_header Header;
-	u32 OEMTableAddr;
-	u32 OEMTableSize;
+	struct acpi_table_header	Header;
+	u32				OEMTableAddr;
+	u32				OEMTableSize;
 };
 
 extern int find_unisys_acpi_oem_table(unsigned long *oem_addr);
@@ -115,36 +121,50 @@ extern void unmap_unisys_acpi_oem_table(unsigned long oem_addr);
 #endif
 
 struct mip_reg {
-	unsigned long long off_0;
-	unsigned long long off_8;
-	unsigned long long off_10;
-	unsigned long long off_18;
-	unsigned long long off_20;
-	unsigned long long off_28;
-	unsigned long long off_30;
-	unsigned long long off_38;
+	unsigned long long		off_0x00;
+	unsigned long long		off_0x08;
+	unsigned long long		off_0x10;
+	unsigned long long		off_0x18;
+	unsigned long long		off_0x20;
+	unsigned long long		off_0x28;
+	unsigned long long		off_0x30;
+	unsigned long long		off_0x38;
 };
 
-#define	MIP_SW_APIC		0x1020b
-#define	MIP_FUNC(VALUE)		(VALUE & 0xff)
+#define	MIP_SW_APIC			0x1020b
+#define	MIP_FUNC(VALUE)			(VALUE & 0xff)
+
+#define APIC_DFR_VALUE_CLUSTER		(APIC_DFR_CLUSTER)
+#define INT_DELIVERY_MODE_CLUSTER	(dest_LowestPrio)
+#define INT_DEST_MODE_CLUSTER		(1) /* logical delivery broadcast to all procs */
+
+#define APIC_DFR_VALUE			(APIC_DFR_FLAT)
+
+extern void es7000_enable_apic_mode(void);
+extern int parse_unisys_oem (char *oemptr);
+extern int find_unisys_acpi_oem_table(unsigned long *oem_addr);
+extern void unmap_unisys_acpi_oem_table(unsigned long oem_addr);
+extern void setup_unisys(void);
+
+#define apicid_cluster(apicid)		(apicid & 0xF0)
 
 /*
  * ES7000 Globals
  */
 
-static volatile unsigned long	*psai = NULL;
-static struct mip_reg		*mip_reg;
-static struct mip_reg		*host_reg;
-static int 			mip_port;
-static unsigned long		mip_addr, host_addr;
+static volatile unsigned long		*psai = NULL;
+static struct mip_reg			*mip_reg;
+static struct mip_reg			*host_reg;
+static int 				mip_port;
+static unsigned long			mip_addr, host_addr;
 
-int es7000_plat;
+int					es7000_plat;
 
 /*
  * GSI override for ES7000 platforms.
  */
 
-static unsigned int base;
+static unsigned int			base;
 
 static int
 es7000_rename_gsi(int ioapic, int gsi)
@@ -160,6 +180,7 @@ es7000_rename_gsi(int ioapic, int gsi)
 
 	if (!ioapic && (gsi < 16))
 		gsi += base;
+
 	return gsi;
 }
 
@@ -196,8 +217,7 @@ static int __init es7000_update_genapic(void)
 	return 0;
 }
 
-void __init
-setup_unisys(void)
+void __init setup_unisys(void)
 {
 	/*
 	 * Determine the generation of the ES7000 currently running.
@@ -219,8 +239,7 @@ setup_unisys(void)
  * Parse the OEM Table
  */
 
-int __init
-parse_unisys_oem (char *oemptr)
+int __init parse_unisys_oem (char *oemptr)
 {
 	int                     i;
 	int 			success = 0;
@@ -277,12 +296,15 @@ parse_unisys_oem (char *oemptr)
 		es7000_plat = NON_UNISYS;
 	} else
 		setup_unisys();
+
 	return es7000_plat;
 }
 
 #ifdef CONFIG_ACPI
-static unsigned long oem_addrX;
-static unsigned long oem_size;
+
+static unsigned long			oem_addrX;
+static unsigned long			oem_size;
+
 int __init find_unisys_acpi_oem_table(unsigned long *oem_addr)
 {
 	struct acpi_table_header *header = NULL;
@@ -315,8 +337,7 @@ void __init unmap_unisys_acpi_oem_table(unsigned long oem_addr)
 }
 #endif
 
-static void
-es7000_spin(int n)
+static void es7000_spin(int n)
 {
 	int i = 0;
 
@@ -327,16 +348,15 @@ es7000_spin(int n)
 static int __init
 es7000_mip_write(struct mip_reg *mip_reg)
 {
-	int			status = 0;
-	int			spin;
+	int status = 0;
+	int spin;
 
 	spin = MIP_SPIN;
-	while (((unsigned long long)host_reg->off_38 &
-		(unsigned long long)MIP_VALID) != 0) {
-			if (--spin <= 0) {
-				printk("es7000_mip_write: Timeout waiting for Host Valid Flag");
-				return -1;
-			}
+	while ((host_reg->off_0x38 & MIP_VALID) != 0) {
+		if (--spin <= 0) {
+			printk("es7000_mip_write: Timeout waiting for Host Valid Flag");
+			return -1;
+		}
 		es7000_spin(MIP_SPIN);
 	}
 
@@ -345,8 +365,7 @@ es7000_mip_write(struct mip_reg *mip_reg)
 
 	spin = MIP_SPIN;
 
-	while (((unsigned long long)mip_reg->off_38 &
-		(unsigned long long)MIP_VALID) == 0) {
+	while ((mip_reg->off_0x38 & MIP_VALID) == 0) {
 		if (--spin <= 0) {
 			printk("es7000_mip_write: Timeout waiting for MIP Valid Flag");
 			return -1;
@@ -354,10 +373,9 @@ es7000_mip_write(struct mip_reg *mip_reg)
 		es7000_spin(MIP_SPIN);
 	}
 
-	status = ((unsigned long long)mip_reg->off_0 &
-		(unsigned long long)0xffff0000000000ULL) >> 48;
-	mip_reg->off_38 = ((unsigned long long)mip_reg->off_38 &
-		(unsigned long long)~MIP_VALID);
+	status = (mip_reg->off_0x00 & 0xffff0000000000ULL) >> 48;
+	mip_reg->off_0x38 &= ~MIP_VALID;
+
 	return status;
 }
 
@@ -371,8 +389,8 @@ void __init es7000_enable_apic_mode(void)
 
 	printk("ES7000: Enabling APIC mode.\n");
        	memset(&es7000_mip_reg, 0, sizeof(struct mip_reg));
-       	es7000_mip_reg.off_0 = MIP_SW_APIC;
-       	es7000_mip_reg.off_38 = MIP_VALID;
+       	es7000_mip_reg.off_0x00 = MIP_SW_APIC;
+       	es7000_mip_reg.off_0x38 = MIP_VALID;
 
        	while ((mip_status = es7000_mip_write(&es7000_mip_reg)) != 0) {
 		printk("es7000_enable_apic_mode: command failed, status = %x\n",
@@ -380,39 +398,6 @@ void __init es7000_enable_apic_mode(void)
 	}
 }
 
-/*
- * APIC driver for the Unisys ES7000 chipset.
- */
-#include <linux/threads.h>
-#include <linux/cpumask.h>
-#include <asm/mpspec.h>
-#include <asm/fixmap.h>
-#include <asm/apicdef.h>
-#include <linux/kernel.h>
-#include <linux/string.h>
-#include <linux/init.h>
-#include <linux/acpi.h>
-#include <linux/smp.h>
-#include <asm/ipi.h>
-
-#define APIC_DFR_VALUE_CLUSTER		(APIC_DFR_CLUSTER)
-#define INT_DELIVERY_MODE_CLUSTER	(dest_LowestPrio)
-#define INT_DEST_MODE_CLUSTER		(1) /* logical delivery broadcast to all procs */
-
-#define APIC_DFR_VALUE			(APIC_DFR_FLAT)
-
-extern void es7000_enable_apic_mode(void);
-extern int apic_version [MAX_APICS];
-extern unsigned int boot_cpu_physical_apicid;
-
-extern int parse_unisys_oem (char *oemptr);
-extern int find_unisys_acpi_oem_table(unsigned long *oem_addr);
-extern void unmap_unisys_acpi_oem_table(unsigned long oem_addr);
-extern void setup_unisys(void);
-
-#define apicid_cluster(apicid)		(apicid & 0xF0)
-#define xapic_phys_to_log_apicid(cpu)	per_cpu(x86_bios_cpu_apicid, cpu)
-
 static void es7000_vector_allocation_domain(int cpu, cpumask_t *retmask)
 {
 	/* Careful. Some cpus do not strictly honor the set of cpus
@@ -495,9 +480,9 @@ static unsigned long es7000_check_apicid_present(int bit)
 
 static unsigned long calculate_ldr(int cpu)
 {
-	unsigned long id = xapic_phys_to_log_apicid(cpu);
+	unsigned long id = per_cpu(x86_bios_cpu_apicid, cpu);
 
-	return (SET_APIC_LOGICAL_ID(id));
+	return SET_APIC_LOGICAL_ID(id);
 }
 
 /*
@@ -547,7 +532,7 @@ static int es7000_cpu_present_to_apicid(int mps_cpu)
 	if (!mps_cpu)
 		return boot_cpu_physical_apicid;
 	else if (mps_cpu < nr_cpu_ids)
-		return (int) per_cpu(x86_bios_cpu_apicid, mps_cpu);
+		return per_cpu(x86_bios_cpu_apicid, mps_cpu);
 	else
 		return BAD_APICID;
 }
@@ -584,7 +569,7 @@ static physid_mask_t es7000_ioapic_phys_id_map(physid_mask_t phys_map)
 static int es7000_check_phys_apicid_present(int cpu_physical_apicid)
 {
 	boot_cpu_physical_apicid = read_apic_id();
-	return (1);
+	return 1;
 }
 
 static unsigned int

commit 2f205bc47f615b7bd0c7aba817d67ce25760eaf1
Author: Ingo Molnar <mingo@elte.hu>
Date:   Tue Feb 17 14:45:30 2009 +0100

    x86, apic: clean up the cpu_2_logical_apiciddeclaration
    
    extern declarations were scattered in 4 files - consolidate them
    into apic.h.
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h
index c07f5fbf43c8..2cdd19e4536f 100644
--- a/arch/x86/include/asm/apic.h
+++ b/arch/x86/include/asm/apic.h
@@ -541,4 +541,8 @@ static inline physid_mask_t default_apicid_to_cpu_present(int phys_apicid)
 
 #endif /* CONFIG_X86_LOCAL_APIC */
 
+#ifdef CONFIG_X86_32
+extern u8 cpu_2_logical_apicid[NR_CPUS];
+#endif
+
 #endif /* _ASM_X86_APIC_H */
diff --git a/arch/x86/kernel/bigsmp_32.c b/arch/x86/kernel/bigsmp_32.c
index 41732abd7004..0de9eed7c600 100644
--- a/arch/x86/kernel/bigsmp_32.c
+++ b/arch/x86/kernel/bigsmp_32.c
@@ -99,8 +99,6 @@ static inline physid_mask_t bigsmp_apicid_to_cpu_present(int phys_apicid)
 	return physid_mask_of_physid(phys_apicid);
 }
 
-extern u8 cpu_2_logical_apicid[];
-
 /* Mapping from cpu number to logical apicid */
 static inline int bigsmp_cpu_to_logical_apicid(int cpu)
 {
diff --git a/arch/x86/kernel/es7000_32.c b/arch/x86/kernel/es7000_32.c
index cf53a98dbf10..3dc48831eb95 100644
--- a/arch/x86/kernel/es7000_32.c
+++ b/arch/x86/kernel/es7000_32.c
@@ -403,7 +403,6 @@ void __init es7000_enable_apic_mode(void)
 
 extern void es7000_enable_apic_mode(void);
 extern int apic_version [MAX_APICS];
-extern u8 cpu_2_logical_apicid[];
 extern unsigned int boot_cpu_physical_apicid;
 
 extern int parse_unisys_oem (char *oemptr);
@@ -570,7 +569,7 @@ static int es7000_cpu_to_logical_apicid(int cpu)
 #ifdef CONFIG_SMP
 	if (cpu >= nr_cpu_ids)
 		return BAD_APICID;
-	return (int)cpu_2_logical_apicid[cpu];
+	return cpu_2_logical_apicid[cpu];
 #else
 	return logical_smp_processor_id();
 #endif
diff --git a/arch/x86/kernel/numaq_32.c b/arch/x86/kernel/numaq_32.c
index dcf22f508273..9abaacde72eb 100644
--- a/arch/x86/kernel/numaq_32.c
+++ b/arch/x86/kernel/numaq_32.c
@@ -408,14 +408,11 @@ static inline physid_mask_t numaq_ioapic_phys_id_map(physid_mask_t phys_map)
 	return physids_promote(0xFUL);
 }
 
-/* Mapping from cpu number to logical apicid */
-extern u8 cpu_2_logical_apicid[];
-
 static inline int numaq_cpu_to_logical_apicid(int cpu)
 {
 	if (cpu >= nr_cpu_ids)
 		return BAD_APICID;
-	return (int)cpu_2_logical_apicid[cpu];
+	return cpu_2_logical_apicid[cpu];
 }
 
 /*
diff --git a/arch/x86/kernel/summit_32.c b/arch/x86/kernel/summit_32.c
index 305977789144..7a1db1f23563 100644
--- a/arch/x86/kernel/summit_32.c
+++ b/arch/x86/kernel/summit_32.c
@@ -209,8 +209,6 @@ static inline unsigned long summit_check_apicid_present(int bit)
 
 #define apicid_cluster(apicid) ((apicid) & XAPIC_DEST_CLUSTER_MASK)
 
-extern u8 cpu_2_logical_apicid[];
-
 static inline void summit_init_apic_ldr(void)
 {
 	unsigned long val, id;
@@ -264,7 +262,7 @@ static inline int summit_cpu_to_logical_apicid(int cpu)
 #ifdef CONFIG_SMP
 	if (cpu >= nr_cpu_ids)
 		return BAD_APICID;
-	return (int)cpu_2_logical_apicid[cpu];
+	return cpu_2_logical_apicid[cpu];
 #else
 	return logical_smp_processor_id();
 #endif

commit 77313190d121dd1fffa965aff6e9f0782a307bb8
Author: Ingo Molnar <mingo@elte.hu>
Date:   Tue Feb 17 14:09:20 2009 +0100

    x86, apic: clean up arch/x86/kernel/bigsmp_32.c
    
    Impact: cleanup
    
    - remove unnecessary indirections that were artifacts of the subarch code
    - clean up include file section
    - clean up various small details
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/arch/x86/kernel/bigsmp_32.c b/arch/x86/kernel/bigsmp_32.c
index f49af36351fa..41732abd7004 100644
--- a/arch/x86/kernel/bigsmp_32.c
+++ b/arch/x86/kernel/bigsmp_32.c
@@ -1,27 +1,26 @@
 /*
- * APIC driver for "bigsmp" XAPIC machines with more than 8 virtual CPUs.
+ * APIC driver for "bigsmp" xAPIC machines with more than 8 virtual CPUs.
+ *
  * Drives the local APIC in "clustered mode".
  */
 #include <linux/threads.h>
 #include <linux/cpumask.h>
-#include <asm/mpspec.h>
-#include <asm/apic.h>
-#include <asm/fixmap.h>
-#include <asm/apicdef.h>
-#include <asm/ipi.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/dmi.h>
 #include <linux/smp.h>
 
+#include <asm/apicdef.h>
+#include <asm/fixmap.h>
+#include <asm/mpspec.h>
+#include <asm/apic.h>
+#include <asm/ipi.h>
 
 static inline unsigned bigsmp_get_apic_id(unsigned long x)
 {
 	return (x >> 24) & 0xFF;
 }
 
-#define xapic_phys_to_log_apicid(cpu) (per_cpu(x86_bios_cpu_apicid, cpu))
-
 static inline int bigsmp_apic_id_registered(void)
 {
 	return 1;
@@ -36,8 +35,6 @@ static inline const cpumask_t *bigsmp_target_cpus(void)
 #endif
 }
 
-#define APIC_DFR_VALUE		(APIC_DFR_FLAT)
-
 static inline unsigned long
 bigsmp_check_apicid_used(physid_mask_t bitmap, int apicid)
 {
@@ -52,9 +49,11 @@ static inline unsigned long bigsmp_check_apicid_present(int bit)
 static inline unsigned long calculate_ldr(int cpu)
 {
 	unsigned long val, id;
+
 	val = apic_read(APIC_LDR) & ~APIC_LDR_MASK;
-	id = xapic_phys_to_log_apicid(cpu);
+	id = per_cpu(x86_bios_cpu_apicid, cpu);
 	val |= SET_APIC_LOGICAL_ID(id);
+
 	return val;
 }
 
@@ -70,15 +69,16 @@ static inline void bigsmp_init_apic_ldr(void)
 	unsigned long val;
 	int cpu = smp_processor_id();
 
-	apic_write(APIC_DFR, APIC_DFR_VALUE);
+	apic_write(APIC_DFR, APIC_DFR_FLAT);
 	val = calculate_ldr(cpu);
 	apic_write(APIC_LDR, val);
 }
 
 static inline void bigsmp_setup_apic_routing(void)
 {
-	printk("Enabling APIC mode:  %s.  Using %d I/O APICs\n",
-		"Physflat", nr_ioapics);
+	printk(KERN_INFO
+		"Enabling APIC mode:  Physflat.  Using %d I/O APICs\n",
+		nr_ioapics);
 }
 
 static inline int bigsmp_apicid_to_node(int logical_apicid)
@@ -100,6 +100,7 @@ static inline physid_mask_t bigsmp_apicid_to_cpu_present(int phys_apicid)
 }
 
 extern u8 cpu_2_logical_apicid[];
+
 /* Mapping from cpu number to logical apicid */
 static inline int bigsmp_cpu_to_logical_apicid(int cpu)
 {
@@ -175,21 +176,24 @@ static int hp_ht_bigsmp(const struct dmi_system_id *d)
 {
 	printk(KERN_NOTICE "%s detected: force use of apic=bigsmp\n", d->ident);
 	dmi_bigsmp = 1;
+
 	return 0;
 }
 
 
 static const struct dmi_system_id bigsmp_dmi_table[] = {
 	{ hp_ht_bigsmp, "HP ProLiant DL760 G2",
-	{ DMI_MATCH(DMI_BIOS_VENDOR, "HP"),
-	DMI_MATCH(DMI_BIOS_VERSION, "P44-"),}
+		{	DMI_MATCH(DMI_BIOS_VENDOR, "HP"),
+			DMI_MATCH(DMI_BIOS_VERSION, "P44-"),
+		}
 	},
 
 	{ hp_ht_bigsmp, "HP ProLiant DL740",
-	{ DMI_MATCH(DMI_BIOS_VENDOR, "HP"),
-	DMI_MATCH(DMI_BIOS_VERSION, "P47-"),}
+		{	DMI_MATCH(DMI_BIOS_VENDOR, "HP"),
+			DMI_MATCH(DMI_BIOS_VERSION, "P47-"),
+		}
 	},
-	 { }
+	{ } /* NULL entry stops DMI scanning */
 };
 
 static void bigsmp_vector_allocation_domain(int cpu, cpumask_t *retmask)
@@ -204,6 +208,7 @@ static int probe_bigsmp(void)
 		dmi_bigsmp = 1;
 	else
 		dmi_check_system(bigsmp_dmi_table);
+
 	return dmi_bigsmp;
 }
 

commit 5c615feb90ce63f2293a7ac7809f320f46c75e0a
Author: Ingo Molnar <mingo@elte.hu>
Date:   Tue Feb 17 14:04:24 2009 +0100

    x86, apic: remove stale references to APIC_DEFINITION
    
    Impact: cleanup
    
    APIC_DEFINITION was a hack from the x86 subarch times, it has no
    meaning anymore - remove it.
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/arch/x86/kernel/bigsmp_32.c b/arch/x86/kernel/bigsmp_32.c
index 72f4e534051e..f49af36351fa 100644
--- a/arch/x86/kernel/bigsmp_32.c
+++ b/arch/x86/kernel/bigsmp_32.c
@@ -2,7 +2,6 @@
  * APIC driver for "bigsmp" XAPIC machines with more than 8 virtual CPUs.
  * Drives the local APIC in "clustered mode".
  */
-#define APIC_DEFINITION 1
 #include <linux/threads.h>
 #include <linux/cpumask.h>
 #include <asm/mpspec.h>
diff --git a/arch/x86/kernel/es7000_32.c b/arch/x86/kernel/es7000_32.c
index 352d870e5d55..cf53a98dbf10 100644
--- a/arch/x86/kernel/es7000_32.c
+++ b/arch/x86/kernel/es7000_32.c
@@ -383,7 +383,6 @@ void __init es7000_enable_apic_mode(void)
 /*
  * APIC driver for the Unisys ES7000 chipset.
  */
-#define APIC_DEFINITION 1
 #include <linux/threads.h>
 #include <linux/cpumask.h>
 #include <asm/mpspec.h>
diff --git a/arch/x86/kernel/numaq_32.c b/arch/x86/kernel/numaq_32.c
index 40400a588454..dcf22f508273 100644
--- a/arch/x86/kernel/numaq_32.c
+++ b/arch/x86/kernel/numaq_32.c
@@ -297,7 +297,6 @@ int __init get_memcfg_numaq(void)
 /*
  * APIC driver for the IBM NUMAQ chipset.
  */
-#define APIC_DEFINITION 1
 #include <linux/threads.h>
 #include <linux/cpumask.h>
 #include <asm/mpspec.h>
diff --git a/arch/x86/kernel/summit_32.c b/arch/x86/kernel/summit_32.c
index 577b0bd8e537..305977789144 100644
--- a/arch/x86/kernel/summit_32.c
+++ b/arch/x86/kernel/summit_32.c
@@ -34,7 +34,6 @@
 /*
  * APIC driver for the IBM "Summit" chipset.
  */
-#define APIC_DEFINITION 1
 #include <linux/threads.h>
 #include <linux/cpumask.h>
 #include <asm/mpspec.h>

commit e641f5f525acb163ba71d92de79c9c7366deae03
Author: Ingo Molnar <mingo@elte.hu>
Date:   Tue Feb 17 14:02:01 2009 +0100

    x86, apic: remove duplicate asm/apic.h inclusions
    
    Impact: cleanup
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/arch/x86/include/asm/ipi.h b/arch/x86/include/asm/ipi.h
index 3395c680a976..0b7228268a63 100644
--- a/arch/x86/include/asm/ipi.h
+++ b/arch/x86/include/asm/ipi.h
@@ -123,8 +123,6 @@ extern void default_send_IPI_mask_sequence_phys(const struct cpumask *mask,
 						 int vector);
 extern void default_send_IPI_mask_allbutself_phys(const struct cpumask *mask,
 							 int vector);
-#include <asm/apic.h>
-
 extern void default_send_IPI_mask_sequence_logical(const struct cpumask *mask,
 							 int vector);
 extern void default_send_IPI_mask_allbutself_logical(const struct cpumask *mask,
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 42814152c940..a18eb7ce2236 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -37,7 +37,6 @@
 #include <asm/pgtable.h>
 #include <asm/io_apic.h>
 #include <asm/apic.h>
-#include <asm/apic.h>
 #include <asm/io.h>
 #include <asm/mpspec.h>
 #include <asm/smp.h>
diff --git a/arch/x86/kernel/apic.c b/arch/x86/kernel/apic.c
index 7db03a9b61dc..c12823eb55b5 100644
--- a/arch/x86/kernel/apic.c
+++ b/arch/x86/kernel/apic.c
@@ -36,7 +36,6 @@
 
 #include <asm/arch_hooks.h>
 #include <asm/pgalloc.h>
-#include <asm/apic.h>
 #include <asm/atomic.h>
 #include <asm/mpspec.h>
 #include <asm/i8253.h>
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index c94ba9311e65..25423a5b80ed 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -12,8 +12,6 @@
 # include <asm/cacheflush.h>
 #endif
 
-#include <asm/apic.h>
-
 #include "cpu.h"
 
 #ifdef CONFIG_X86_32
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 41f3788ec9b9..826d5c876278 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -23,11 +23,9 @@
 #include <asm/smp.h>
 #include <asm/cpu.h>
 #include <asm/cpumask.h>
-#ifdef CONFIG_X86_LOCAL_APIC
-#include <asm/mpspec.h>
-#include <asm/apic.h>
-#include <asm/apic.h>
 #include <asm/apic.h>
+
+#ifdef CONFIG_X86_LOCAL_APIC
 #include <asm/uv/uv.h>
 #endif
 
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index 290f92e2b7c6..7aeef1d327b1 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -24,7 +24,6 @@
 #ifdef CONFIG_X86_LOCAL_APIC
 #include <asm/mpspec.h>
 #include <asm/apic.h>
-#include <asm/apic.h>
 #endif
 
 static void __cpuinit early_init_intel(struct cpuinfo_x86 *c)
diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c
index 3340cc0f244e..ff958248e61d 100644
--- a/arch/x86/kernel/crash.c
+++ b/arch/x86/kernel/crash.c
@@ -28,8 +28,6 @@
 #include <asm/reboot.h>
 #include <asm/virtext.h>
 
-#include <asm/apic.h>
-
 
 #if defined(CONFIG_SMP) && defined(CONFIG_X86_LOCAL_APIC)
 
diff --git a/arch/x86/kernel/es7000_32.c b/arch/x86/kernel/es7000_32.c
index 6cdfb3e4dc33..352d870e5d55 100644
--- a/arch/x86/kernel/es7000_32.c
+++ b/arch/x86/kernel/es7000_32.c
@@ -387,7 +387,6 @@ void __init es7000_enable_apic_mode(void)
 #include <linux/threads.h>
 #include <linux/cpumask.h>
 #include <asm/mpspec.h>
-#include <asm/apic.h>
 #include <asm/fixmap.h>
 #include <asm/apicdef.h>
 #include <linux/kernel.h>
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index e4ac7c80e2df..9dc6b2b24275 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -212,7 +212,6 @@ bool handle_irq(unsigned irq, struct pt_regs *regs)
 }
 
 #ifdef CONFIG_HOTPLUG_CPU
-#include <asm/apic.h>
 
 /* A cpu has been removed from cpu_online_mask.  Reset irq affinities. */
 void fixup_irqs(void)
diff --git a/arch/x86/kernel/numaq_32.c b/arch/x86/kernel/numaq_32.c
index 5a2d75d1fd44..40400a588454 100644
--- a/arch/x86/kernel/numaq_32.c
+++ b/arch/x86/kernel/numaq_32.c
@@ -301,7 +301,6 @@ int __init get_memcfg_numaq(void)
 #include <linux/threads.h>
 #include <linux/cpumask.h>
 #include <asm/mpspec.h>
-#include <asm/apic.h>
 #include <asm/fixmap.h>
 #include <asm/apicdef.h>
 #include <asm/ipi.h>
diff --git a/arch/x86/kernel/probe_32.c b/arch/x86/kernel/probe_32.c
index be0d554984a7..fd1352ac909c 100644
--- a/arch/x86/kernel/probe_32.c
+++ b/arch/x86/kernel/probe_32.c
@@ -23,14 +23,12 @@
 #include <linux/threads.h>
 #include <linux/cpumask.h>
 #include <asm/mpspec.h>
-#include <asm/apic.h>
 #include <asm/fixmap.h>
 #include <asm/apicdef.h>
 #include <linux/kernel.h>
 #include <linux/string.h>
 #include <linux/smp.h>
 #include <linux/init.h>
-#include <asm/apic.h>
 #include <asm/ipi.h>
 
 #include <linux/smp.h>
@@ -41,8 +39,6 @@
 #include <asm/e820.h>
 #include <asm/setup.h>
 
-#include <asm/apic.h>
-
 #ifdef CONFIG_HOTPLUG_CPU
 #define DEFAULT_SEND_IPI	(1)
 #else
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index 7c8cd447d5ed..1cc18d439bbb 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -24,8 +24,6 @@
 # include <asm/iommu.h>
 #endif
 
-#include <asm/apic.h>
-
 /*
  * Power off function, if any
  */
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index deaafd2693ee..b2da0b1d15e7 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -97,7 +97,6 @@
 #include <asm/mmu_context.h>
 #include <asm/proto.h>
 
-#include <asm/apic.h>
 #include <asm/paravirt.h>
 #include <asm/hypervisor.h>
 
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 562a9fc3bc34..09e73876a44f 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -65,7 +65,6 @@
 #include <asm/uv/uv.h>
 #include <linux/mc146818rtc.h>
 
-#include <asm/apic.h>
 #include <asm/smpboot_hooks.h>
 
 #ifdef CONFIG_X86_32
diff --git a/arch/x86/kernel/summit_32.c b/arch/x86/kernel/summit_32.c
index eb31ba276bb3..577b0bd8e537 100644
--- a/arch/x86/kernel/summit_32.c
+++ b/arch/x86/kernel/summit_32.c
@@ -40,7 +40,6 @@
 #include <asm/mpspec.h>
 #include <asm/apic.h>
 #include <asm/smp.h>
-#include <asm/apic.h>
 #include <asm/fixmap.h>
 #include <asm/apicdef.h>
 #include <asm/ipi.h>
diff --git a/arch/x86/kernel/tlb_uv.c b/arch/x86/kernel/tlb_uv.c
index 1a7dfa7cb525..f04549afcfe9 100644
--- a/arch/x86/kernel/tlb_uv.c
+++ b/arch/x86/kernel/tlb_uv.c
@@ -20,8 +20,6 @@
 #include <asm/tsc.h>
 #include <asm/irq_vectors.h>
 
-#include <asm/apic.h>
-
 static struct bau_control	**uv_bau_table_bases __read_mostly;
 static int			uv_bau_retry_limit __read_mostly;
 
diff --git a/arch/x86/kernel/visws_quirks.c b/arch/x86/kernel/visws_quirks.c
index 5264fea6c281..34199d30ff46 100644
--- a/arch/x86/kernel/visws_quirks.c
+++ b/arch/x86/kernel/visws_quirks.c
@@ -29,13 +29,10 @@
 #include <asm/fixmap.h>
 #include <asm/reboot.h>
 #include <asm/setup.h>
+#include <asm/apic.h>
 #include <asm/e820.h>
 #include <asm/io.h>
 
-#include <asm/apic.h>
-
-#include <asm/apic.h>
-
 #include <linux/kernel_stat.h>
 
 #include <asm/i8259.h>
@@ -49,8 +46,6 @@
 
 extern int no_broadcast;
 
-#include <asm/apic.h>
-
 char visws_board_type	= -1;
 char visws_board_rev	= -1;
 
diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
index b641349fe077..a654d59e4483 100644
--- a/arch/x86/mm/tlb.c
+++ b/arch/x86/mm/tlb.c
@@ -14,7 +14,6 @@
 DEFINE_PER_CPU_SHARED_ALIGNED(struct tlb_state, cpu_tlbstate)
 			= { &init_mm, 0, };
 
-#include <asm/apic.h>
 /*
  *	Smarter SMP flushing macros.
  *		c/o Linus Torvalds.

commit 7b6aa335ca1a845c2262ec7a595b4521bca0f79d
Author: Ingo Molnar <mingo@elte.hu>
Date:   Tue Feb 17 13:58:15 2009 +0100

    x86, apic: remove genapic.h
    
    Impact: cleanup
    
    Remove genapic.h and remove all references to it.
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>

diff --git a/arch/x86/include/asm/ipi.h b/arch/x86/include/asm/ipi.h
index 5f2efc5d9927..3395c680a976 100644
--- a/arch/x86/include/asm/ipi.h
+++ b/arch/x86/include/asm/ipi.h
@@ -123,7 +123,7 @@ extern void default_send_IPI_mask_sequence_phys(const struct cpumask *mask,
 						 int vector);
 extern void default_send_IPI_mask_allbutself_phys(const struct cpumask *mask,
 							 int vector);
-#include <asm/genapic.h>
+#include <asm/apic.h>
 
 extern void default_send_IPI_mask_sequence_logical(const struct cpumask *mask,
 							 int vector);
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 956c1dee6fbe..42814152c940 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -37,7 +37,7 @@
 #include <asm/pgtable.h>
 #include <asm/io_apic.h>
 #include <asm/apic.h>
-#include <asm/genapic.h>
+#include <asm/apic.h>
 #include <asm/io.h>
 #include <asm/mpspec.h>
 #include <asm/smp.h>
diff --git a/arch/x86/kernel/apic.c b/arch/x86/kernel/apic.c
index af494bad8858..7db03a9b61dc 100644
--- a/arch/x86/kernel/apic.c
+++ b/arch/x86/kernel/apic.c
@@ -36,7 +36,7 @@
 
 #include <asm/arch_hooks.h>
 #include <asm/pgalloc.h>
-#include <asm/genapic.h>
+#include <asm/apic.h>
 #include <asm/atomic.h>
 #include <asm/mpspec.h>
 #include <asm/i8253.h>
diff --git a/arch/x86/kernel/bigsmp_32.c b/arch/x86/kernel/bigsmp_32.c
index 9eeb714c5ded..72f4e534051e 100644
--- a/arch/x86/kernel/bigsmp_32.c
+++ b/arch/x86/kernel/bigsmp_32.c
@@ -6,7 +6,7 @@
 #include <linux/threads.h>
 #include <linux/cpumask.h>
 #include <asm/mpspec.h>
-#include <asm/genapic.h>
+#include <asm/apic.h>
 #include <asm/fixmap.h>
 #include <asm/apicdef.h>
 #include <asm/ipi.h>
diff --git a/arch/x86/kernel/cpu/addon_cpuid_features.c b/arch/x86/kernel/cpu/addon_cpuid_features.c
index e48640cfac0c..6882a735d9c0 100644
--- a/arch/x86/kernel/cpu/addon_cpuid_features.c
+++ b/arch/x86/kernel/cpu/addon_cpuid_features.c
@@ -7,7 +7,7 @@
 #include <asm/pat.h>
 #include <asm/processor.h>
 
-#include <asm/genapic.h>
+#include <asm/apic.h>
 
 struct cpuid_bit {
 	u16 feature;
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index ff4d7b9e32e4..c94ba9311e65 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -12,7 +12,7 @@
 # include <asm/cacheflush.h>
 #endif
 
-#include <asm/genapic.h>
+#include <asm/apic.h>
 
 #include "cpu.h"
 
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 4b5d13e472d6..41f3788ec9b9 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -26,8 +26,8 @@
 #ifdef CONFIG_X86_LOCAL_APIC
 #include <asm/mpspec.h>
 #include <asm/apic.h>
-#include <asm/genapic.h>
-#include <asm/genapic.h>
+#include <asm/apic.h>
+#include <asm/apic.h>
 #include <asm/uv/uv.h>
 #endif
 
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index 1f137a87d4bd..290f92e2b7c6 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -24,7 +24,7 @@
 #ifdef CONFIG_X86_LOCAL_APIC
 #include <asm/mpspec.h>
 #include <asm/apic.h>
-#include <asm/genapic.h>
+#include <asm/apic.h>
 #endif
 
 static void __cpuinit early_init_intel(struct cpuinfo_x86 *c)
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd_64.c b/arch/x86/kernel/cpu/mcheck/mce_amd_64.c
index e22d6ed26e61..4772e91e8246 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd_64.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd_64.c
@@ -24,7 +24,7 @@
 #include <linux/smp.h>
 #include <linux/sysdev.h>
 #include <linux/sysfs.h>
-#include <asm/genapic.h>
+#include <asm/apic.h>
 #include <asm/mce.h>
 #include <asm/msr.h>
 #include <asm/percpu.h>
diff --git a/arch/x86/kernel/cpu/mcheck/mce_intel_64.c b/arch/x86/kernel/cpu/mcheck/mce_intel_64.c
index 42f090702f02..5e8c79e748a6 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_intel_64.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_intel_64.c
@@ -7,7 +7,7 @@
 #include <linux/interrupt.h>
 #include <linux/percpu.h>
 #include <asm/processor.h>
-#include <asm/genapic.h>
+#include <asm/apic.h>
 #include <asm/msr.h>
 #include <asm/mce.h>
 #include <asm/hw_irq.h>
diff --git a/arch/x86/kernel/cpu/mcheck/p4.c b/arch/x86/kernel/cpu/mcheck/p4.c
index f9c92b66dfbe..9b60fce09f75 100644
--- a/arch/x86/kernel/cpu/mcheck/p4.c
+++ b/arch/x86/kernel/cpu/mcheck/p4.c
@@ -11,7 +11,7 @@
 #include <asm/processor.h>
 #include <asm/system.h>
 #include <asm/msr.h>
-#include <asm/genapic.h>
+#include <asm/apic.h>
 
 #include <asm/therm_throt.h>
 
diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c
index ad7f2a696f4a..3340cc0f244e 100644
--- a/arch/x86/kernel/crash.c
+++ b/arch/x86/kernel/crash.c
@@ -28,7 +28,7 @@
 #include <asm/reboot.h>
 #include <asm/virtext.h>
 
-#include <asm/genapic.h>
+#include <asm/apic.h>
 
 
 #if defined(CONFIG_SMP) && defined(CONFIG_X86_LOCAL_APIC)
diff --git a/arch/x86/kernel/es7000_32.c b/arch/x86/kernel/es7000_32.c
index 23f1df4ce18e..6cdfb3e4dc33 100644
--- a/arch/x86/kernel/es7000_32.c
+++ b/arch/x86/kernel/es7000_32.c
@@ -40,7 +40,7 @@
 #include <asm/smp.h>
 #include <asm/atomic.h>
 #include <asm/apicdef.h>
-#include <asm/genapic.h>
+#include <asm/apic.h>
 #include <asm/setup.h>
 
 /*
@@ -387,7 +387,7 @@ void __init es7000_enable_apic_mode(void)
 #include <linux/threads.h>
 #include <linux/cpumask.h>
 #include <asm/mpspec.h>
-#include <asm/genapic.h>
+#include <asm/apic.h>
 #include <asm/fixmap.h>
 #include <asm/apicdef.h>
 #include <linux/kernel.h>
diff --git a/arch/x86/kernel/genapic_64.c b/arch/x86/kernel/genapic_64.c
index ef7886353240..91cae6f6e730 100644
--- a/arch/x86/kernel/genapic_64.c
+++ b/arch/x86/kernel/genapic_64.c
@@ -19,7 +19,7 @@
 #include <linux/dmar.h>
 
 #include <asm/smp.h>
-#include <asm/genapic.h>
+#include <asm/apic.h>
 #include <asm/ipi.h>
 #include <asm/setup.h>
 
diff --git a/arch/x86/kernel/genapic_flat_64.c b/arch/x86/kernel/genapic_flat_64.c
index 36ee760fd133..a7d847636487 100644
--- a/arch/x86/kernel/genapic_flat_64.c
+++ b/arch/x86/kernel/genapic_flat_64.c
@@ -17,7 +17,7 @@
 #include <linux/init.h>
 #include <linux/hardirq.h>
 #include <asm/smp.h>
-#include <asm/genapic.h>
+#include <asm/apic.h>
 #include <asm/ipi.h>
 
 #ifdef CONFIG_ACPI
diff --git a/arch/x86/kernel/genx2apic_cluster.c b/arch/x86/kernel/genx2apic_cluster.c
index dd6e8d685426..f5e02cffa264 100644
--- a/arch/x86/kernel/genx2apic_cluster.c
+++ b/arch/x86/kernel/genx2apic_cluster.c
@@ -7,7 +7,7 @@
 #include <linux/dmar.h>
 
 #include <asm/smp.h>
-#include <asm/genapic.h>
+#include <asm/apic.h>
 #include <asm/ipi.h>
 
 DEFINE_PER_CPU(u32, x86_cpu_to_logical_apicid);
diff --git a/arch/x86/kernel/genx2apic_phys.c b/arch/x86/kernel/genx2apic_phys.c
index eb1486bb002e..11eb4cb7ca3f 100644
--- a/arch/x86/kernel/genx2apic_phys.c
+++ b/arch/x86/kernel/genx2apic_phys.c
@@ -7,7 +7,7 @@
 #include <linux/dmar.h>
 
 #include <asm/smp.h>
-#include <asm/genapic.h>
+#include <asm/apic.h>
 #include <asm/ipi.h>
 
 static int x2apic_phys;
diff --git a/arch/x86/kernel/genx2apic_uv_x.c b/arch/x86/kernel/genx2apic_uv_x.c
index 9ae4a92fac8c..c1746a198bde 100644
--- a/arch/x86/kernel/genx2apic_uv_x.c
+++ b/arch/x86/kernel/genx2apic_uv_x.c
@@ -22,7 +22,7 @@
 #include <linux/proc_fs.h>
 #include <asm/current.h>
 #include <asm/smp.h>
-#include <asm/genapic.h>
+#include <asm/apic.h>
 #include <asm/ipi.h>
 #include <asm/pgtable.h>
 #include <asm/uv/uv.h>
diff --git a/arch/x86/kernel/io_apic.c b/arch/x86/kernel/io_apic.c
index a89878e08a42..00e6071cefc4 100644
--- a/arch/x86/kernel/io_apic.c
+++ b/arch/x86/kernel/io_apic.c
@@ -62,7 +62,7 @@
 #include <asm/uv/uv_hub.h>
 #include <asm/uv/uv_irq.h>
 
-#include <asm/genapic.h>
+#include <asm/apic.h>
 
 #define __apicdebuginit(type) static type __init
 
diff --git a/arch/x86/kernel/ipi.c b/arch/x86/kernel/ipi.c
index 1326272cae43..dbf5445727a9 100644
--- a/arch/x86/kernel/ipi.c
+++ b/arch/x86/kernel/ipi.c
@@ -15,7 +15,7 @@
 #include <asm/mtrr.h>
 #include <asm/tlbflush.h>
 #include <asm/mmu_context.h>
-#include <asm/genapic.h>
+#include <asm/apic.h>
 #include <asm/proto.h>
 #include <asm/ipi.h>
 
diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
index 3957776b1930..f13ca1650aaf 100644
--- a/arch/x86/kernel/irq.c
+++ b/arch/x86/kernel/irq.c
@@ -8,7 +8,7 @@
 #include <linux/smp.h>
 #include <linux/ftrace.h>
 
-#include <asm/genapic.h>
+#include <asm/apic.h>
 #include <asm/io_apic.h>
 #include <asm/irq.h>
 #include <asm/idle.h>
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index 4beb9a13873d..e4ac7c80e2df 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -212,7 +212,7 @@ bool handle_irq(unsigned irq, struct pt_regs *regs)
 }
 
 #ifdef CONFIG_HOTPLUG_CPU
-#include <asm/genapic.h>
+#include <asm/apic.h>
 
 /* A cpu has been removed from cpu_online_mask.  Reset irq affinities. */
 void fixup_irqs(void)
diff --git a/arch/x86/kernel/kgdb.c b/arch/x86/kernel/kgdb.c
index 5c4f55483849..eedfaebe1063 100644
--- a/arch/x86/kernel/kgdb.c
+++ b/arch/x86/kernel/kgdb.c
@@ -46,7 +46,7 @@
 #include <asm/apicdef.h>
 #include <asm/system.h>
 
-#include <asm/genapic.h>
+#include <asm/apic.h>
 
 /*
  * Put the error code here just in case the user cares:
diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c
index 200764453195..7f4d2586972e 100644
--- a/arch/x86/kernel/mpparse.c
+++ b/arch/x86/kernel/mpparse.c
@@ -29,7 +29,7 @@
 #include <asm/setup.h>
 #include <asm/smp.h>
 
-#include <asm/genapic.h>
+#include <asm/apic.h>
 /*
  * Checksum an MP configuration block.
  */
diff --git a/arch/x86/kernel/nmi.c b/arch/x86/kernel/nmi.c
index 48b9ca5e088c..bdfad80c3cf1 100644
--- a/arch/x86/kernel/nmi.c
+++ b/arch/x86/kernel/nmi.c
@@ -11,7 +11,7 @@
  *  Mikael Pettersson	: PM converted to driver model. Disable/enable API.
  */
 
-#include <asm/genapic.h>
+#include <asm/apic.h>
 
 #include <linux/nmi.h>
 #include <linux/mm.h>
diff --git a/arch/x86/kernel/numaq_32.c b/arch/x86/kernel/numaq_32.c
index f0f0c2f0596b..5a2d75d1fd44 100644
--- a/arch/x86/kernel/numaq_32.c
+++ b/arch/x86/kernel/numaq_32.c
@@ -31,7 +31,7 @@
 
 #include <asm/processor.h>
 #include <asm/topology.h>
-#include <asm/genapic.h>
+#include <asm/apic.h>
 #include <asm/numaq.h>
 #include <asm/setup.h>
 #include <asm/e820.h>
@@ -301,7 +301,7 @@ int __init get_memcfg_numaq(void)
 #include <linux/threads.h>
 #include <linux/cpumask.h>
 #include <asm/mpspec.h>
-#include <asm/genapic.h>
+#include <asm/apic.h>
 #include <asm/fixmap.h>
 #include <asm/apicdef.h>
 #include <asm/ipi.h>
diff --git a/arch/x86/kernel/probe_32.c b/arch/x86/kernel/probe_32.c
index b3d5d74e5229..be0d554984a7 100644
--- a/arch/x86/kernel/probe_32.c
+++ b/arch/x86/kernel/probe_32.c
@@ -17,20 +17,20 @@
 #include <asm/fixmap.h>
 #include <asm/mpspec.h>
 #include <asm/apicdef.h>
-#include <asm/genapic.h>
+#include <asm/apic.h>
 #include <asm/setup.h>
 
 #include <linux/threads.h>
 #include <linux/cpumask.h>
 #include <asm/mpspec.h>
-#include <asm/genapic.h>
+#include <asm/apic.h>
 #include <asm/fixmap.h>
 #include <asm/apicdef.h>
 #include <linux/kernel.h>
 #include <linux/string.h>
 #include <linux/smp.h>
 #include <linux/init.h>
-#include <asm/genapic.h>
+#include <asm/apic.h>
 #include <asm/ipi.h>
 
 #include <linux/smp.h>
@@ -41,7 +41,7 @@
 #include <asm/e820.h>
 #include <asm/setup.h>
 
-#include <asm/genapic.h>
+#include <asm/apic.h>
 
 #ifdef CONFIG_HOTPLUG_CPU
 #define DEFAULT_SEND_IPI	(1)
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index 32e8f0af292c..7c8cd447d5ed 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -24,7 +24,7 @@
 # include <asm/iommu.h>
 #endif
 
-#include <asm/genapic.h>
+#include <asm/apic.h>
 
 /*
  * Power off function, if any
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 43d964411c0d..deaafd2693ee 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -97,7 +97,7 @@
 #include <asm/mmu_context.h>
 #include <asm/proto.h>
 
-#include <asm/genapic.h>
+#include <asm/apic.h>
 #include <asm/paravirt.h>
 #include <asm/hypervisor.h>
 
diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c
index eaaffae31cc0..13f33ea8ccaa 100644
--- a/arch/x86/kernel/smp.c
+++ b/arch/x86/kernel/smp.c
@@ -26,7 +26,7 @@
 #include <asm/tlbflush.h>
 #include <asm/mmu_context.h>
 #include <asm/proto.h>
-#include <asm/genapic.h>
+#include <asm/apic.h>
 /*
  *	Some notes on x86 processor bugs affecting SMP operation:
  *
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index b5f2b698973f..562a9fc3bc34 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -60,12 +60,12 @@
 #include <asm/tlbflush.h>
 #include <asm/mtrr.h>
 #include <asm/vmi.h>
-#include <asm/genapic.h>
+#include <asm/apic.h>
 #include <asm/setup.h>
 #include <asm/uv/uv.h>
 #include <linux/mc146818rtc.h>
 
-#include <asm/genapic.h>
+#include <asm/apic.h>
 #include <asm/smpboot_hooks.h>
 
 #ifdef CONFIG_X86_32
diff --git a/arch/x86/kernel/summit_32.c b/arch/x86/kernel/summit_32.c
index 1cf32c325d12..eb31ba276bb3 100644
--- a/arch/x86/kernel/summit_32.c
+++ b/arch/x86/kernel/summit_32.c
@@ -40,7 +40,7 @@
 #include <asm/mpspec.h>
 #include <asm/apic.h>
 #include <asm/smp.h>
-#include <asm/genapic.h>
+#include <asm/apic.h>
 #include <asm/fixmap.h>
 #include <asm/apicdef.h>
 #include <asm/ipi.h>
diff --git a/arch/x86/kernel/tlb_uv.c b/arch/x86/kernel/tlb_uv.c
index f396e61bcb34..1a7dfa7cb525 100644
--- a/arch/x86/kernel/tlb_uv.c
+++ b/arch/x86/kernel/tlb_uv.c
@@ -15,12 +15,12 @@
 #include <asm/uv/uv_mmrs.h>
 #include <asm/uv/uv_hub.h>
 #include <asm/uv/uv_bau.h>
-#include <asm/genapic.h>
+#include <asm/apic.h>
 #include <asm/idle.h>
 #include <asm/tsc.h>
 #include <asm/irq_vectors.h>
 
-#include <asm/genapic.h>
+#include <asm/apic.h>
 
 static struct bau_control	**uv_bau_table_bases __read_mostly;
 static int			uv_bau_retry_limit __read_mostly;
diff --git a/arch/x86/kernel/uv_irq.c b/arch/x86/kernel/uv_irq.c
index 75eb5ec5dd2a..aeef529917e4 100644
--- a/arch/x86/kernel/uv_irq.c
+++ b/arch/x86/kernel/uv_irq.c
@@ -11,7 +11,7 @@
 #include <linux/module.h>
 #include <linux/irq.h>
 
-#include <asm/genapic.h>
+#include <asm/apic.h>
 #include <asm/uv/uv_irq.h>
 
 static void uv_noop(unsigned int irq)
diff --git a/arch/x86/kernel/visws_quirks.c b/arch/x86/kernel/visws_quirks.c
index 4fd646e6dd43..5264fea6c281 100644
--- a/arch/x86/kernel/visws_quirks.c
+++ b/arch/x86/kernel/visws_quirks.c
@@ -32,9 +32,9 @@
 #include <asm/e820.h>
 #include <asm/io.h>
 
-#include <asm/genapic.h>
+#include <asm/apic.h>
 
-#include <asm/genapic.h>
+#include <asm/apic.h>
 
 #include <linux/kernel_stat.h>
 
diff --git a/arch/x86/kernel/vmi_32.c b/arch/x86/kernel/vmi_32.c
index a1c7b71dc0d0..2cc4a90e2cb3 100644
--- a/arch/x86/kernel/vmi_32.c
+++ b/arch/x86/kernel/vmi_32.c
@@ -32,7 +32,7 @@
 #include <asm/io.h>
 #include <asm/fixmap.h>
 #include <asm/apicdef.h>
-#include <asm/genapic.h>
+#include <asm/apic.h>
 #include <asm/processor.h>
 #include <asm/timer.h>
 #include <asm/vmi_time.h>
diff --git a/arch/x86/kernel/vmiclock_32.c b/arch/x86/kernel/vmiclock_32.c
index 2a5e0e6a7c0d..a4791ef412d1 100644
--- a/arch/x86/kernel/vmiclock_32.c
+++ b/arch/x86/kernel/vmiclock_32.c
@@ -30,7 +30,7 @@
 #include <asm/vmi_time.h>
 #include <asm/arch_hooks.h>
 #include <asm/apicdef.h>
-#include <asm/genapic.h>
+#include <asm/apic.h>
 #include <asm/timer.h>
 #include <asm/i8253.h>
 #include <asm/irq_vectors.h>
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c
index bc9893f2c383..f3a5305b8adf 100644
--- a/arch/x86/lguest/boot.c
+++ b/arch/x86/lguest/boot.c
@@ -55,7 +55,7 @@
 #include <linux/lguest_launcher.h>
 #include <linux/virtio_console.h>
 #include <linux/pm.h>
-#include <asm/genapic.h>
+#include <asm/apic.h>
 #include <asm/lguest.h>
 #include <asm/paravirt.h>
 #include <asm/param.h>
diff --git a/arch/x86/mm/srat_64.c b/arch/x86/mm/srat_64.c
index 15df1baee100..574c8bc95ef0 100644
--- a/arch/x86/mm/srat_64.c
+++ b/arch/x86/mm/srat_64.c
@@ -20,7 +20,7 @@
 #include <asm/proto.h>
 #include <asm/numa.h>
 #include <asm/e820.h>
-#include <asm/genapic.h>
+#include <asm/apic.h>
 #include <asm/uv/uv.h>
 
 int acpi_numa __initdata;
diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
index 14c5af4d11e6..b641349fe077 100644
--- a/arch/x86/mm/tlb.c
+++ b/arch/x86/mm/tlb.c
@@ -14,7 +14,7 @@
 DEFINE_PER_CPU_SHARED_ALIGNED(struct tlb_state, cpu_tlbstate)
 			= { &init_mm, 0, };
 
-#include <asm/genapic.h>
+#include <asm/apic.h>
 /*
  *	Smarter SMP flushing macros.
  *		c/o Linus Torvalds.
diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c
index a32a5c7a8ef6..202864ad49a7 100644
--- a/arch/x86/oprofile/nmi_int.c
+++ b/arch/x86/oprofile/nmi_int.c
@@ -19,7 +19,7 @@
 #include <linux/cpu.h>
 #include <asm/nmi.h>
 #include <asm/msr.h>
-#include <asm/genapic.h>
+#include <asm/apic.h>
 
 #include "op_counter.h"
 #include "op_x86_model.h"
diff --git a/arch/x86/oprofile/op_model_p4.c b/arch/x86/oprofile/op_model_p4.c
index 09a237bc9ef6..4c4a51c90bc2 100644
--- a/arch/x86/oprofile/op_model_p4.c
+++ b/arch/x86/oprofile/op_model_p4.c
@@ -14,7 +14,7 @@
 #include <linux/nmi.h>
 #include <asm/msr.h>
 #include <asm/fixmap.h>
-#include <asm/genapic.h>
+#include <asm/apic.h>
 
 
 #include "op_x86_model.h"
diff --git a/arch/x86/oprofile/op_model_ppro.c b/arch/x86/oprofile/op_model_ppro.c
index 5ebd8f605d76..e9f80c744cf3 100644
--- a/arch/x86/oprofile/op_model_ppro.c
+++ b/arch/x86/oprofile/op_model_ppro.c
@@ -16,7 +16,7 @@
 #include <linux/slab.h>
 #include <asm/ptrace.h>
 #include <asm/msr.h>
-#include <asm/genapic.h>
+#include <asm/apic.h>
 #include <asm/nmi.h>
 #include <asm/intel_arch_perfmon.h>
 
diff --git a/arch/x86/pci/numaq_32.c b/arch/x86/pci/numaq_32.c
index 5601e829c387..8eb295e116f6 100644
--- a/arch/x86/pci/numaq_32.c
+++ b/arch/x86/pci/numaq_32.c
@@ -5,7 +5,7 @@
 #include <linux/pci.h>
 #include <linux/init.h>
 #include <linux/nodemask.h>
-#include <asm/genapic.h>
+#include <asm/apic.h>
 #include <asm/mpspec.h>
 #include <asm/pci_x86.h>
 
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index e3dd3fb67290..86497d5f44cd 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -36,7 +36,7 @@
 #include <xen/hvc-console.h>
 
 #include <asm/paravirt.h>
-#include <asm/genapic.h>
+#include <asm/apic.h>
 #include <asm/page.h>
 #include <asm/xen/hypercall.h>
 #include <asm/xen/hypervisor.h>