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