probe_64.c 2.0 KB
Newer Older
L
Linus Torvalds 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13
/*
 * Copyright 2004 James Cleverdon, IBM.
 * Subject to the GNU Public License, v.2
 *
 * Generic APIC sub-arch probe layer.
 *
 * Hacked for x86-64 by James Cleverdon from i386 architecture code by
 * Martin Bligh, Andi Kleen, James Bottomley, John Stultz, and
 * James Cleverdon.
 */
#include <linux/threads.h>
#include <linux/cpumask.h>
#include <linux/string.h>
14
#include <linux/module.h>
L
Linus Torvalds 已提交
15 16 17
#include <linux/kernel.h>
#include <linux/ctype.h>
#include <linux/init.h>
J
Jack Steiner 已提交
18
#include <linux/hardirq.h>
19
#include <linux/dmar.h>
L
Linus Torvalds 已提交
20 21

#include <asm/smp.h>
I
Ingo Molnar 已提交
22
#include <asm/apic.h>
Y
Yinghai Lu 已提交
23
#include <asm/ipi.h>
24
#include <asm/setup.h>
L
Linus Torvalds 已提交
25

26 27 28 29 30
extern struct apic apic_flat;
extern struct apic apic_physflat;
extern struct apic apic_x2xpic_uv_x;
extern struct apic apic_x2apic_phys;
extern struct apic apic_x2apic_cluster;
L
Linus Torvalds 已提交
31

32
struct apic __read_mostly *apic = &apic_flat;
33
EXPORT_SYMBOL_GPL(apic);
L
Linus Torvalds 已提交
34

35
static struct apic *apic_probe[] __initdata = {
N
Nick Piggin 已提交
36
#ifdef CONFIG_X86_UV
37
	&apic_x2apic_uv_x,
N
Nick Piggin 已提交
38
#endif
Y
Yinghai Lu 已提交
39
#ifdef CONFIG_X86_X2APIC
40 41
	&apic_x2apic_phys,
	&apic_x2apic_cluster,
Y
Yinghai Lu 已提交
42
#endif
43 44 45
	&apic_physflat,
	NULL,
};
46

L
Linus Torvalds 已提交
47 48 49
/*
 * Check the APIC IDs in bios_cpu_apicid and choose the APIC mode.
 */
50
void __init default_setup_apic_routing(void)
L
Linus Torvalds 已提交
51
{
Y
Yinghai Lu 已提交
52
#ifdef CONFIG_X86_X2APIC
I
Ingo Molnar 已提交
53
	if (apic == &apic_x2apic_phys || apic == &apic_x2apic_cluster) {
54
		if (!intr_remapping_enabled)
I
Ingo Molnar 已提交
55
			apic = &apic_flat;
56
	}
Y
Yinghai Lu 已提交
57
#endif
58

I
Ingo Molnar 已提交
59
	if (apic == &apic_flat) {
60
		if (max_physical_apicid >= 8)
I
Ingo Molnar 已提交
61 62
			apic = &apic_physflat;
		printk(KERN_INFO "Setting APIC routing to %s\n", apic->name);
63
	}
64

65 66
	if (x86_quirks->update_apic)
		x86_quirks->update_apic();
L
Linus Torvalds 已提交
67 68
}

69
/* Same for both flat and physical. */
L
Linus Torvalds 已提交
70

71
void apic_send_IPI_self(int vector)
L
Linus Torvalds 已提交
72
{
73
	__default_send_IPI_shortcut(APIC_DEST_SELF, vector, APIC_DEST_PHYSICAL);
L
Linus Torvalds 已提交
74
}
75

76
int __init default_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
77
{
78 79 80 81
	int i;

	for (i = 0; apic_probe[i]; ++i) {
		if (apic_probe[i]->acpi_madt_oem_check(oem_id, oem_table_id)) {
I
Ingo Molnar 已提交
82
			apic = apic_probe[i];
83
			printk(KERN_INFO "Setting APIC routing to %s.\n",
I
Ingo Molnar 已提交
84
				apic->name);
85 86
			return 1;
		}
87 88 89
	}
	return 0;
}