2005-04-16 15:20:36 -07:00
/*
* Copyright 2004 James Cleverdon , IBM .
* Subject to the GNU Public License , v .2
*
* Generic APIC sub - arch probe layer .
*
* Hacked for x86 - 64 by James Cleverdon from i386 architecture code by
* Martin Bligh , Andi Kleen , James Bottomley , John Stultz , and
* James Cleverdon .
*/
# include <linux/threads.h>
# include <linux/cpumask.h>
# include <linux/string.h>
2007-05-02 19:27:04 +02:00
# include <linux/module.h>
2005-04-16 15:20:36 -07:00
# include <linux/kernel.h>
# include <linux/ctype.h>
# include <linux/init.h>
2008-03-28 14:12:16 -05:00
# include <linux/hardirq.h>
2008-07-25 19:39:03 -07:00
# include <linux/dmar.h>
2005-04-16 15:20:36 -07:00
# include <asm/smp.h>
2009-02-17 13:58:15 +01:00
# include <asm/apic.h>
2009-02-16 23:02:14 -08:00
# include <asm/ipi.h>
2008-11-17 15:19:53 -08:00
# include <asm/setup.h>
2005-04-16 15:20:36 -07:00
/*
* Check the APIC IDs in bios_cpu_apicid and choose the APIC mode .
*/
2009-01-28 06:50:47 +01:00
void __init default_setup_apic_routing ( void )
2005-04-16 15:20:36 -07:00
{
2011-05-20 17:51:18 -07:00
struct apic * * drv ;
2010-08-27 11:09:50 -07:00
enable_IR_x2apic ( ) ;
2011-05-20 17:51:18 -07:00
for ( drv = __apicdrivers ; drv < __apicdrivers_end ; drv + + ) {
if ( ( * drv ) - > probe & & ( * drv ) - > probe ( ) ) {
if ( apic ! = * drv ) {
apic = * drv ;
pr_info ( " Switched APIC routing to %s. \n " ,
apic - > name ) ;
}
2011-05-19 16:45:46 -07:00
break ;
}
2008-07-25 19:39:03 -07:00
}
2010-01-18 12:10:49 -08:00
2012-06-03 01:11:34 +03:00
if ( x86_platform . apic_post_init )
x86_platform . apic_post_init ( ) ;
2005-04-16 15:20:36 -07:00
}
2007-05-02 19:27:04 +02:00
/* Same for both flat and physical. */
2005-04-16 15:20:36 -07:00
2008-07-10 11:16:53 -07:00
void apic_send_IPI_self ( int vector )
2005-04-16 15:20:36 -07:00
{
2009-01-28 15:42:24 +01:00
__default_send_IPI_shortcut ( APIC_DEST_SELF , vector , APIC_DEST_PHYSICAL ) ;
2005-04-16 15:20:36 -07:00
}
2008-03-28 14:12:06 -05:00
2009-01-28 03:43:47 +01:00
int __init default_acpi_madt_oem_check ( char * oem_id , char * oem_table_id )
2008-03-28 14:12:06 -05:00
{
2011-05-20 17:51:18 -07:00
struct apic * * drv ;
2008-07-21 22:08:21 -07:00
2011-05-20 17:51:18 -07:00
for ( drv = __apicdrivers ; drv < __apicdrivers_end ; drv + + ) {
if ( ( * drv ) - > acpi_madt_oem_check ( oem_id , oem_table_id ) ) {
if ( apic ! = * drv ) {
apic = * drv ;
pr_info ( " Setting APIC routing to %s. \n " ,
apic - > name ) ;
}
2008-07-21 22:08:21 -07:00
return 1 ;
}
2008-03-28 14:12:06 -05:00
}
return 0 ;
}