blob: fd2be593b06e76b20380d17214dc0c17736bd140 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef _ASM_GENAPIC_H
2#define _ASM_GENAPIC_H 1
3
Andi Kleen874c4fe2006-09-26 10:52:26 +02004#include <asm/mpspec.h>
5
Linus Torvalds1da177e2005-04-16 15:20:36 -07006/*
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
17struct mpc_config_translation;
18struct mpc_config_bus;
19struct mp_config_table;
20struct mpc_config_processor;
21
22struct genapic {
23 char *name;
24 int (*probe)(void);
25
26 int (*apic_id_registered)(void);
27 cpumask_t (*target_cpus)(void);
28 int int_delivery_mode;
29 int int_dest_mode;
30 int ESR_DISABLE;
31 int apic_destination_logical;
32 unsigned long (*check_apicid_used)(physid_mask_t bitmap, int apicid);
33 unsigned long (*check_apicid_present)(int apicid);
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
39 void (*clustered_apic_check)(void);
40 int (*multi_timer_check)(int apic, int irq);
41 int (*apicid_to_node)(int logical_apicid);
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);
45 int (*mpc_apic_id)(struct mpc_config_processor *m,
46 struct mpc_config_translation *t);
47 void (*setup_portio_remap)(void);
48 int (*check_phys_apicid_present)(int boot_cpu_physical_apicid);
49 void (*enable_apic_mode)(void);
50 u32 (*phys_pkg_id)(u32 cpuid_apic, int index_msb);
51
52 /* mpparse */
53 void (*mpc_oem_bus_info)(struct mpc_config_bus *, char *,
54 struct mpc_config_translation *);
55 void (*mpc_oem_pci_bus)(struct mpc_config_bus *,
56 struct mpc_config_translation *);
57
58 /* When one of the next two hooks returns 1 the genapic
59 is switched to this. Essentially they are additional probe
60 functions. */
61 int (*mps_oem_check)(struct mp_config_table *mpc, char *oem,
62 char *productid);
63 int (*acpi_madt_oem_check)(char *oem_id, char *oem_table_id);
64
65 unsigned (*get_apic_id)(unsigned long x);
66 unsigned long apic_id_mask;
67 unsigned int (*cpu_mask_to_apicid)(cpumask_t cpumask);
Andi Kleen874c4fe2006-09-26 10:52:26 +020068
69#ifdef CONFIG_SMP
Linus Torvalds1da177e2005-04-16 15:20:36 -070070 /* ipi */
71 void (*send_IPI_mask)(cpumask_t mask, int vector);
72 void (*send_IPI_allbutself)(int vector);
73 void (*send_IPI_all)(int vector);
Andi Kleen874c4fe2006-09-26 10:52:26 +020074#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070075};
76
Andi Kleen874c4fe2006-09-26 10:52:26 +020077#define APICFUNC(x) .x = x,
78
79/* More functions could be probably marked IPIFUNC and save some space
80 in UP GENERICARCH kernels, but I don't have the nerve right now
81 to untangle this mess. -AK */
82#ifdef CONFIG_SMP
83#define IPIFUNC(x) APICFUNC(x)
84#else
85#define IPIFUNC(x)
86#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070087
88#define APIC_INIT(aname, aprobe) { \
89 .name = aname, \
90 .probe = aprobe, \
91 .int_delivery_mode = INT_DELIVERY_MODE, \
92 .int_dest_mode = INT_DEST_MODE, \
93 .no_balance_irq = NO_BALANCE_IRQ, \
Linus Torvalds1da177e2005-04-16 15:20:36 -070094 .ESR_DISABLE = esr_disable, \
95 .apic_destination_logical = APIC_DEST_LOGICAL, \
Andi Kleen874c4fe2006-09-26 10:52:26 +020096 APICFUNC(apic_id_registered) \
97 APICFUNC(target_cpus) \
98 APICFUNC(check_apicid_used) \
99 APICFUNC(check_apicid_present) \
100 APICFUNC(init_apic_ldr) \
101 APICFUNC(ioapic_phys_id_map) \
102 APICFUNC(clustered_apic_check) \
103 APICFUNC(multi_timer_check) \
104 APICFUNC(apicid_to_node) \
105 APICFUNC(cpu_to_logical_apicid) \
106 APICFUNC(cpu_present_to_apicid) \
107 APICFUNC(apicid_to_cpu_present) \
108 APICFUNC(mpc_apic_id) \
109 APICFUNC(setup_portio_remap) \
110 APICFUNC(check_phys_apicid_present) \
111 APICFUNC(mpc_oem_bus_info) \
112 APICFUNC(mpc_oem_pci_bus) \
113 APICFUNC(mps_oem_check) \
114 APICFUNC(get_apic_id) \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700115 .apic_id_mask = APIC_ID_MASK, \
Andi Kleen874c4fe2006-09-26 10:52:26 +0200116 APICFUNC(cpu_mask_to_apicid) \
117 APICFUNC(acpi_madt_oem_check) \
118 IPIFUNC(send_IPI_mask) \
119 IPIFUNC(send_IPI_allbutself) \
120 IPIFUNC(send_IPI_all) \
121 APICFUNC(enable_apic_mode) \
122 APICFUNC(phys_pkg_id) \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700123 }
124
Siddha, Suresh Bb0d0a4b2006-12-07 02:14:10 +0100125extern struct genapic *genapic, apic_default;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700126
127#endif