blob: 0ac17d33a8c7114a015ba2bb4971e3b5e381a6da [file] [log] [blame]
H. Peter Anvin1965aae2008-10-22 22:26:29 -07001#ifndef _ASM_X86_GENAPIC_32_H
2#define _ASM_X86_GENAPIC_32_H
Linus Torvalds1da177e2005-04-16 15:20:36 -07003
Andi Kleen874c4fe2006-09-26 10:52:26 +02004#include <asm/mpspec.h>
Yinghai Lu569712b2008-11-16 03:12:49 -08005#include <asm/atomic.h>
Andi Kleen874c4fe2006-09-26 10:52:26 +02006
Linus Torvalds1da177e2005-04-16 15:20:36 -07007/*
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 Torvalds1da177e2005-04-16 15:20:36 -070018struct mpc_config_bus;
19struct mp_config_table;
20struct mpc_config_processor;
21
Joe Percheseee28c22008-03-23 01:02:13 -070022struct genapic {
23 char *name;
24 int (*probe)(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070025
26 int (*apic_id_registered)(void);
27 cpumask_t (*target_cpus)(void);
28 int int_delivery_mode;
Joe Percheseee28c22008-03-23 01:02:13 -070029 int int_dest_mode;
Linus Torvalds1da177e2005-04-16 15:20:36 -070030 int ESR_DISABLE;
31 int apic_destination_logical;
32 unsigned long (*check_apicid_used)(physid_mask_t bitmap, int apicid);
Joe Percheseee28c22008-03-23 01:02:13 -070033 unsigned long (*check_apicid_present)(int apicid);
Linus Torvalds1da177e2005-04-16 15:20:36 -070034 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 Molnar3c43f032007-05-02 19:27:04 +020039 void (*setup_apic_routing)(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070040 int (*multi_timer_check)(int apic, int irq);
Joe Percheseee28c22008-03-23 01:02:13 -070041 int (*apicid_to_node)(int logical_apicid);
Linus Torvalds1da177e2005-04-16 15:20:36 -070042 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 Percheseee28c22008-03-23 01:02:13 -070045 void (*setup_portio_remap)(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070046 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 Torvalds1da177e2005-04-16 15:20:36 -070051 /* When one of the next two hooks returns 1 the genapic
Joe Percheseee28c22008-03-23 01:02:13 -070052 is switched to this. Essentially they are additional probe
Linus Torvalds1da177e2005-04-16 15:20:36 -070053 functions. */
Joe Percheseee28c22008-03-23 01:02:13 -070054 int (*mps_oem_check)(struct mp_config_table *mpc, char *oem,
55 char *productid);
Linus Torvalds1da177e2005-04-16 15:20:36 -070056 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;
60 unsigned int (*cpu_mask_to_apicid)(cpumask_t cpumask);
Yinghai Lu497c9a12008-08-19 20:50:28 -070061 cpumask_t (*vector_allocation_domain)(int cpu);
Andi Kleen874c4fe2006-09-26 10:52:26 +020062
63#ifdef CONFIG_SMP
Linus Torvalds1da177e2005-04-16 15:20:36 -070064 /* ipi */
65 void (*send_IPI_mask)(cpumask_t mask, int vector);
66 void (*send_IPI_allbutself)(int vector);
67 void (*send_IPI_all)(int vector);
Andi Kleen874c4fe2006-09-26 10:52:26 +020068#endif
Yinghai Lu54ac14a2008-11-17 15:19:53 -080069 int (*wakeup_cpu)(int apicid, unsigned long start_eip);
Yinghai Lu569712b2008-11-16 03:12:49 -080070 int trampoline_phys_low;
71 int trampoline_phys_high;
72 void (*wait_for_init_deassert)(atomic_t *deassert);
73 void (*smp_callin_clear_local_apic)(void);
74 void (*store_NMI_vector)(unsigned short *high, unsigned short *low);
75 void (*restore_NMI_vector)(unsigned short *high, unsigned short *low);
76 void (*inquire_remote_apic)(int apicid);
Joe Percheseee28c22008-03-23 01:02:13 -070077};
Linus Torvalds1da177e2005-04-16 15:20:36 -070078
Andi Kleen874c4fe2006-09-26 10:52:26 +020079#define APICFUNC(x) .x = x,
80
81/* More functions could be probably marked IPIFUNC and save some space
82 in UP GENERICARCH kernels, but I don't have the nerve right now
83 to untangle this mess. -AK */
84#ifdef CONFIG_SMP
85#define IPIFUNC(x) APICFUNC(x)
86#else
87#define IPIFUNC(x)
88#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070089
Joe Percheseee28c22008-03-23 01:02:13 -070090#define APIC_INIT(aname, aprobe) \
91{ \
92 .name = aname, \
93 .probe = aprobe, \
94 .int_delivery_mode = INT_DELIVERY_MODE, \
95 .int_dest_mode = INT_DEST_MODE, \
96 .no_balance_irq = NO_BALANCE_IRQ, \
97 .ESR_DISABLE = esr_disable, \
98 .apic_destination_logical = APIC_DEST_LOGICAL, \
99 APICFUNC(apic_id_registered) \
100 APICFUNC(target_cpus) \
101 APICFUNC(check_apicid_used) \
102 APICFUNC(check_apicid_present) \
103 APICFUNC(init_apic_ldr) \
104 APICFUNC(ioapic_phys_id_map) \
105 APICFUNC(setup_apic_routing) \
106 APICFUNC(multi_timer_check) \
107 APICFUNC(apicid_to_node) \
108 APICFUNC(cpu_to_logical_apicid) \
109 APICFUNC(cpu_present_to_apicid) \
110 APICFUNC(apicid_to_cpu_present) \
111 APICFUNC(setup_portio_remap) \
112 APICFUNC(check_phys_apicid_present) \
113 APICFUNC(mps_oem_check) \
114 APICFUNC(get_apic_id) \
115 .apic_id_mask = APIC_ID_MASK, \
116 APICFUNC(cpu_mask_to_apicid) \
Yinghai Lu569712b2008-11-16 03:12:49 -0800117 APICFUNC(vector_allocation_domain) \
Joe Percheseee28c22008-03-23 01:02:13 -0700118 APICFUNC(acpi_madt_oem_check) \
119 IPIFUNC(send_IPI_mask) \
120 IPIFUNC(send_IPI_allbutself) \
121 IPIFUNC(send_IPI_all) \
122 APICFUNC(enable_apic_mode) \
123 APICFUNC(phys_pkg_id) \
Yinghai Lu569712b2008-11-16 03:12:49 -0800124 .trampoline_phys_low = TRAMPOLINE_PHYS_LOW, \
125 .trampoline_phys_high = TRAMPOLINE_PHYS_HIGH, \
126 APICFUNC(wait_for_init_deassert) \
127 APICFUNC(smp_callin_clear_local_apic) \
128 APICFUNC(store_NMI_vector) \
129 APICFUNC(restore_NMI_vector) \
130 APICFUNC(inquire_remote_apic) \
Joe Percheseee28c22008-03-23 01:02:13 -0700131}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700132
Andrew Mortona86f34b2007-05-02 19:27:04 +0200133extern struct genapic *genapic;
Yinghai Lub5fe3632008-11-18 08:14:14 -0800134extern void es7000_update_genapic_to_cluster(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700135
Jack Steinerae261862008-03-28 14:12:06 -0500136enum uv_system_type {UV_NONE, UV_LEGACY_APIC, UV_X2APIC, UV_NON_UNIQUE_APIC};
137#define get_uv_system_type() UV_NONE
138#define is_uv_system() 0
Jack Steiner34d05592008-04-16 11:45:15 -0500139#define uv_wakeup_secondary(a, b) 1
Marcin Slusarzc4bd1fd2008-08-21 20:49:05 +0200140#define uv_system_init() do {} while (0)
Jack Steinerae261862008-03-28 14:12:06 -0500141
142
H. Peter Anvin1965aae2008-10-22 22:26:29 -0700143#endif /* _ASM_X86_GENAPIC_32_H */