| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _ASM_GENAPIC_H | 
|  | 2 | #define _ASM_GENAPIC_H 1 | 
|  | 3 |  | 
| Andi Kleen | 874c4fe | 2006-09-26 10:52:26 +0200 | [diff] [blame] | 4 | #include <asm/mpspec.h> | 
|  | 5 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | /* | 
|  | 7 | * Generic APIC driver interface. | 
|  | 8 | * | 
|  | 9 | * An straight forward mapping of the APIC related parts of the | 
|  | 10 | * x86 subarchitecture interface to a dynamic object. | 
|  | 11 | * | 
|  | 12 | * This is used by the "generic" x86 subarchitecture. | 
|  | 13 | * | 
|  | 14 | * Copyright 2003 Andi Kleen, SuSE Labs. | 
|  | 15 | */ | 
|  | 16 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | struct mpc_config_bus; | 
|  | 18 | struct mp_config_table; | 
|  | 19 | struct mpc_config_processor; | 
|  | 20 |  | 
| Joe Perches | eee28c2 | 2008-03-23 01:02:13 -0700 | [diff] [blame] | 21 | struct genapic { | 
|  | 22 | char *name; | 
|  | 23 | int (*probe)(void); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 |  | 
|  | 25 | int (*apic_id_registered)(void); | 
|  | 26 | cpumask_t (*target_cpus)(void); | 
|  | 27 | int int_delivery_mode; | 
| Joe Perches | eee28c2 | 2008-03-23 01:02:13 -0700 | [diff] [blame] | 28 | int int_dest_mode; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | int ESR_DISABLE; | 
|  | 30 | int apic_destination_logical; | 
|  | 31 | unsigned long (*check_apicid_used)(physid_mask_t bitmap, int apicid); | 
| Joe Perches | eee28c2 | 2008-03-23 01:02:13 -0700 | [diff] [blame] | 32 | unsigned long (*check_apicid_present)(int apicid); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | int no_balance_irq; | 
|  | 34 | int no_ioapic_check; | 
|  | 35 | void (*init_apic_ldr)(void); | 
|  | 36 | physid_mask_t (*ioapic_phys_id_map)(physid_mask_t map); | 
|  | 37 |  | 
| Ingo Molnar | 3c43f03 | 2007-05-02 19:27:04 +0200 | [diff] [blame] | 38 | void (*setup_apic_routing)(void); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | int (*multi_timer_check)(int apic, int irq); | 
| Joe Perches | eee28c2 | 2008-03-23 01:02:13 -0700 | [diff] [blame] | 40 | int (*apicid_to_node)(int logical_apicid); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | int (*cpu_to_logical_apicid)(int cpu); | 
|  | 42 | int (*cpu_present_to_apicid)(int mps_cpu); | 
|  | 43 | physid_mask_t (*apicid_to_cpu_present)(int phys_apicid); | 
| Joe Perches | eee28c2 | 2008-03-23 01:02:13 -0700 | [diff] [blame] | 44 | void (*setup_portio_remap)(void); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | int (*check_phys_apicid_present)(int boot_cpu_physical_apicid); | 
|  | 46 | void (*enable_apic_mode)(void); | 
|  | 47 | u32 (*phys_pkg_id)(u32 cpuid_apic, int index_msb); | 
|  | 48 |  | 
|  | 49 | /* mpparse */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | /* When one of the next two hooks returns 1 the genapic | 
| Joe Perches | eee28c2 | 2008-03-23 01:02:13 -0700 | [diff] [blame] | 51 | is switched to this. Essentially they are additional probe | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | functions. */ | 
| Joe Perches | eee28c2 | 2008-03-23 01:02:13 -0700 | [diff] [blame] | 53 | int (*mps_oem_check)(struct mp_config_table *mpc, char *oem, | 
|  | 54 | char *productid); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | int (*acpi_madt_oem_check)(char *oem_id, char *oem_table_id); | 
|  | 56 |  | 
|  | 57 | unsigned (*get_apic_id)(unsigned long x); | 
|  | 58 | unsigned long apic_id_mask; | 
|  | 59 | unsigned int (*cpu_mask_to_apicid)(cpumask_t cpumask); | 
| Andi Kleen | 874c4fe | 2006-09-26 10:52:26 +0200 | [diff] [blame] | 60 |  | 
|  | 61 | #ifdef CONFIG_SMP | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 62 | /* ipi */ | 
|  | 63 | void (*send_IPI_mask)(cpumask_t mask, int vector); | 
|  | 64 | void (*send_IPI_allbutself)(int vector); | 
|  | 65 | void (*send_IPI_all)(int vector); | 
| Andi Kleen | 874c4fe | 2006-09-26 10:52:26 +0200 | [diff] [blame] | 66 | #endif | 
| Joe Perches | eee28c2 | 2008-03-23 01:02:13 -0700 | [diff] [blame] | 67 | }; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 |  | 
| Andi Kleen | 874c4fe | 2006-09-26 10:52:26 +0200 | [diff] [blame] | 69 | #define APICFUNC(x) .x = x, | 
|  | 70 |  | 
|  | 71 | /* More functions could be probably marked IPIFUNC and save some space | 
|  | 72 | in UP GENERICARCH kernels, but I don't have the nerve right now | 
|  | 73 | to untangle this mess. -AK  */ | 
|  | 74 | #ifdef CONFIG_SMP | 
|  | 75 | #define IPIFUNC(x) APICFUNC(x) | 
|  | 76 | #else | 
|  | 77 | #define IPIFUNC(x) | 
|  | 78 | #endif | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 79 |  | 
| Joe Perches | eee28c2 | 2008-03-23 01:02:13 -0700 | [diff] [blame] | 80 | #define APIC_INIT(aname, aprobe)			\ | 
|  | 81 | {							\ | 
|  | 82 | .name = aname,					\ | 
|  | 83 | .probe = aprobe,				\ | 
|  | 84 | .int_delivery_mode = INT_DELIVERY_MODE,		\ | 
|  | 85 | .int_dest_mode = INT_DEST_MODE,			\ | 
|  | 86 | .no_balance_irq = NO_BALANCE_IRQ,		\ | 
|  | 87 | .ESR_DISABLE = esr_disable,			\ | 
|  | 88 | .apic_destination_logical = APIC_DEST_LOGICAL,	\ | 
|  | 89 | APICFUNC(apic_id_registered)			\ | 
|  | 90 | APICFUNC(target_cpus)				\ | 
|  | 91 | APICFUNC(check_apicid_used)			\ | 
|  | 92 | APICFUNC(check_apicid_present)			\ | 
|  | 93 | APICFUNC(init_apic_ldr)				\ | 
|  | 94 | APICFUNC(ioapic_phys_id_map)			\ | 
|  | 95 | APICFUNC(setup_apic_routing)			\ | 
|  | 96 | APICFUNC(multi_timer_check)			\ | 
|  | 97 | APICFUNC(apicid_to_node)			\ | 
|  | 98 | APICFUNC(cpu_to_logical_apicid)			\ | 
|  | 99 | APICFUNC(cpu_present_to_apicid)			\ | 
|  | 100 | APICFUNC(apicid_to_cpu_present)			\ | 
|  | 101 | APICFUNC(setup_portio_remap)			\ | 
|  | 102 | APICFUNC(check_phys_apicid_present)		\ | 
|  | 103 | APICFUNC(mps_oem_check)				\ | 
|  | 104 | APICFUNC(get_apic_id)				\ | 
|  | 105 | .apic_id_mask = APIC_ID_MASK,			\ | 
|  | 106 | APICFUNC(cpu_mask_to_apicid)			\ | 
|  | 107 | APICFUNC(acpi_madt_oem_check)			\ | 
|  | 108 | IPIFUNC(send_IPI_mask)				\ | 
|  | 109 | IPIFUNC(send_IPI_allbutself)			\ | 
|  | 110 | IPIFUNC(send_IPI_all)				\ | 
|  | 111 | APICFUNC(enable_apic_mode)			\ | 
|  | 112 | APICFUNC(phys_pkg_id)				\ | 
|  | 113 | } | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 114 |  | 
| Andrew Morton | a86f34b | 2007-05-02 19:27:04 +0200 | [diff] [blame] | 115 | extern struct genapic *genapic; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 116 |  | 
| Jack Steiner | ae26186 | 2008-03-28 14:12:06 -0500 | [diff] [blame] | 117 | enum uv_system_type {UV_NONE, UV_LEGACY_APIC, UV_X2APIC, UV_NON_UNIQUE_APIC}; | 
|  | 118 | #define get_uv_system_type()		UV_NONE | 
|  | 119 | #define is_uv_system()			0 | 
| Jack Steiner | 34d0559 | 2008-04-16 11:45:15 -0500 | [diff] [blame] | 120 | #define uv_wakeup_secondary(a, b)	1 | 
| Marcin Slusarz | c4bd1fd | 2008-08-21 20:49:05 +0200 | [diff] [blame] | 121 | #define uv_system_init()		do {} while (0) | 
| Jack Steiner | ae26186 | 2008-03-28 14:12:06 -0500 | [diff] [blame] | 122 |  | 
|  | 123 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 124 | #endif |