blob: 14b19de8cd09caf49066937752e7c10000a6cd8f [file] [log] [blame]
Ingo Molnaref7471b2009-01-27 23:12:02 +01001#ifndef _ASM_X86_GENAPIC_H
2#define _ASM_X86_GENAPIC_H
3
4#include <linux/cpumask.h>
5
Ingo Molnar505deeb2009-01-27 23:23:22 +01006#include <asm/mpspec.h>
7#include <asm/atomic.h>
8
Ingo Molnaref7471b2009-01-27 23:12:02 +01009/*
10 * Copyright 2004 James Cleverdon, IBM.
11 * Subject to the GNU Public License, v.2
12 *
13 * Generic APIC sub-arch data struct.
14 *
15 * Hacked for x86-64 by James Cleverdon from i386 architecture code by
16 * Martin Bligh, Andi Kleen, James Bottomley, John Stultz, and
17 * James Cleverdon.
18 */
Ingo Molnaref7471b2009-01-27 23:12:02 +010019struct genapic {
20 char *name;
21
22 int (*probe)(void);
23 int (*acpi_madt_oem_check)(char *oem_id, char *oem_table_id);
24 int (*apic_id_registered)(void);
25
Ingo Molnarf8987a12009-01-28 04:02:31 +010026 u32 irq_delivery_mode;
27 u32 irq_dest_mode;
Ingo Molnaref7471b2009-01-27 23:12:02 +010028
29 const struct cpumask *(*target_cpus)(void);
30
Ingo Molnar08125d32009-01-28 05:08:44 +010031 int disable_esr;
Ingo Molnaref7471b2009-01-27 23:12:02 +010032
Ingo Molnarbdb1a9b2009-01-28 05:29:25 +010033 int dest_logical;
Ingo Molnaref7471b2009-01-27 23:12:02 +010034 unsigned long (*check_apicid_used)(physid_mask_t bitmap, int apicid);
35 unsigned long (*check_apicid_present)(int apicid);
36
Ingo Molnaref7471b2009-01-27 23:12:02 +010037 void (*vector_allocation_domain)(int cpu, struct cpumask *retmask);
38 void (*init_apic_ldr)(void);
39
40 physid_mask_t (*ioapic_phys_id_map)(physid_mask_t map);
41
42 void (*setup_apic_routing)(void);
43 int (*multi_timer_check)(int apic, int irq);
44 int (*apicid_to_node)(int logical_apicid);
45 int (*cpu_to_logical_apicid)(int cpu);
46 int (*cpu_present_to_apicid)(int mps_cpu);
47 physid_mask_t (*apicid_to_cpu_present)(int phys_apicid);
48 void (*setup_portio_remap)(void);
49 int (*check_phys_apicid_present)(int boot_cpu_physical_apicid);
50 void (*enable_apic_mode)(void);
Ingo Molnard4c9a9f2009-01-28 13:31:22 +010051 int (*phys_pkg_id)(int cpuid_apic, int index_msb);
Ingo Molnaref7471b2009-01-27 23:12:02 +010052
53 /*
54 * When one of the next two hooks returns 1 the genapic
55 * is switched to this. Essentially they are additional
56 * probe functions:
57 */
58 int (*mps_oem_check)(struct mpc_table *mpc, char *oem,
59 char *productid);
60
61 unsigned int (*get_apic_id)(unsigned long x);
62 unsigned long (*set_apic_id)(unsigned int id);
63 unsigned long apic_id_mask;
64
65 unsigned int (*cpu_mask_to_apicid)(const struct cpumask *cpumask);
66 unsigned int (*cpu_mask_to_apicid_and)(const struct cpumask *cpumask,
67 const struct cpumask *andmask);
68
Ingo Molnaref7471b2009-01-27 23:12:02 +010069 /* ipi */
70 void (*send_IPI_mask)(const struct cpumask *mask, int vector);
71 void (*send_IPI_mask_allbutself)(const struct cpumask *mask,
72 int vector);
73 void (*send_IPI_allbutself)(int vector);
74 void (*send_IPI_all)(int vector);
75 void (*send_IPI_self)(int vector);
Ingo Molnar6781d942009-01-27 23:54:23 +010076
Ingo Molnaref7471b2009-01-27 23:12:02 +010077 /* wakeup_secondary_cpu */
78 int (*wakeup_cpu)(int apicid, unsigned long start_eip);
79
80 int trampoline_phys_low;
81 int trampoline_phys_high;
Ingo Molnar505deeb2009-01-27 23:23:22 +010082
Ingo Molnaref7471b2009-01-27 23:12:02 +010083 void (*wait_for_init_deassert)(atomic_t *deassert);
84 void (*smp_callin_clear_local_apic)(void);
85 void (*store_NMI_vector)(unsigned short *high, unsigned short *low);
86 void (*restore_NMI_vector)(unsigned short *high, unsigned short *low);
87 void (*inquire_remote_apic)(int apicid);
88};
89
Ingo Molnarc8d46cf2009-01-28 00:14:11 +010090extern struct genapic *apic;
Ingo Molnarced733e2009-01-27 23:15:06 +010091
Ingo Molnar505deeb2009-01-27 23:23:22 +010092#ifdef CONFIG_X86_32
Ingo Molnarced733e2009-01-27 23:15:06 +010093extern void es7000_update_genapic_to_cluster(void);
Ingo Molnar9a6801d2009-01-28 03:18:13 +010094#else
Ingo Molnarced733e2009-01-27 23:15:06 +010095extern struct genapic apic_flat;
96extern struct genapic apic_physflat;
97extern struct genapic apic_x2apic_cluster;
98extern struct genapic apic_x2apic_phys;
Ingo Molnar306db032009-01-28 03:43:47 +010099extern int default_acpi_madt_oem_check(char *, char *);
Ingo Molnarced733e2009-01-27 23:15:06 +0100100
101extern void apic_send_IPI_self(int vector);
102
103extern struct genapic apic_x2apic_uv_x;
104DECLARE_PER_CPU(int, x2apic_extra_bits);
105
Ingo Molnar72ce0162009-01-28 06:50:47 +0100106extern void default_setup_apic_routing(void);
Ingo Molnara21769a42009-01-28 06:50:47 +0100107
108extern int default_cpu_present_to_apicid(int mps_cpu);
Ingo Molnara27a6212009-01-28 12:43:18 +0100109extern int default_check_phys_apicid_present(int boot_cpu_physical_apicid);
Ingo Molnar9a6801d2009-01-28 03:18:13 +0100110#endif
Ingo Molnarced733e2009-01-27 23:15:06 +0100111
Ingo Molnaref7471b2009-01-27 23:12:02 +0100112#endif /* _ASM_X86_GENAPIC_64_H */