]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * Copyright 2004 James Cleverdon, IBM. | |
3 | * Subject to the GNU Public License, v.2 | |
4 | * | |
f8d31193 | 5 | * Flat APIC subarch code. |
1da177e4 LT |
6 | * |
7 | * Hacked for x86-64 by James Cleverdon from i386 architecture code by | |
8 | * Martin Bligh, Andi Kleen, James Bottomley, John Stultz, and | |
9 | * James Cleverdon. | |
10 | */ | |
f19cccf3 | 11 | #include <linux/errno.h> |
1da177e4 LT |
12 | #include <linux/threads.h> |
13 | #include <linux/cpumask.h> | |
14 | #include <linux/string.h> | |
15 | #include <linux/kernel.h> | |
16 | #include <linux/ctype.h> | |
17 | #include <linux/init.h> | |
0c81c746 | 18 | #include <linux/hardirq.h> |
b18bf094 | 19 | #include <linux/module.h> |
1da177e4 | 20 | #include <asm/smp.h> |
7b6aa335 | 21 | #include <asm/apic.h> |
c1eeb2de | 22 | #include <asm/ipi.h> |
1da177e4 | 23 | |
1b9b89e7 YL |
24 | #ifdef CONFIG_ACPI |
25 | #include <acpi/acpi_bus.h> | |
26 | #endif | |
27 | ||
1a8880a1 SS |
28 | static struct apic apic_physflat; |
29 | static struct apic apic_flat; | |
30 | ||
31 | struct apic __read_mostly *apic = &apic_flat; | |
32 | EXPORT_SYMBOL_GPL(apic); | |
33 | ||
983f91ff | 34 | static int flat_acpi_madt_oem_check(char *oem_id, char *oem_table_id) |
1b9b89e7 YL |
35 | { |
36 | return 1; | |
37 | } | |
38 | ||
bcda016e | 39 | static const struct cpumask *flat_target_cpus(void) |
1da177e4 | 40 | { |
bcda016e | 41 | return cpu_online_mask; |
1da177e4 LT |
42 | } |
43 | ||
bcda016e | 44 | static void flat_vector_allocation_domain(int cpu, struct cpumask *retmask) |
c7111c13 EB |
45 | { |
46 | /* Careful. Some cpus do not strictly honor the set of cpus | |
47 | * specified in the interrupt destination when using lowest | |
48 | * priority interrupt delivery mode. | |
49 | * | |
50 | * In particular there was a hyperthreading cpu observed to | |
51 | * deliver interrupts to the wrong hyperthread when only one | |
52 | * hyperthread was specified in the interrupt desitination. | |
53 | */ | |
bcda016e MT |
54 | cpumask_clear(retmask); |
55 | cpumask_bits(retmask)[0] = APIC_ALL_CPUS; | |
c7111c13 EB |
56 | } |
57 | ||
1da177e4 LT |
58 | /* |
59 | * Set up the logical destination ID. | |
60 | * | |
61 | * Intel recommends to set DFR, LDR and TPR before enabling | |
62 | * an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel | |
63 | * document number 292116). So here it goes... | |
64 | */ | |
65 | static void flat_init_apic_ldr(void) | |
66 | { | |
67 | unsigned long val; | |
68 | unsigned long num, id; | |
69 | ||
70 | num = smp_processor_id(); | |
71 | id = 1UL << num; | |
eddfb4ed | 72 | apic_write(APIC_DFR, APIC_DFR_FLAT); |
1da177e4 LT |
73 | val = apic_read(APIC_LDR) & ~APIC_LDR_MASK; |
74 | val |= SET_APIC_LOGICAL_ID(id); | |
eddfb4ed | 75 | apic_write(APIC_LDR, val); |
1da177e4 LT |
76 | } |
77 | ||
e7986739 | 78 | static inline void _flat_send_IPI_mask(unsigned long mask, int vector) |
1da177e4 | 79 | { |
1da177e4 LT |
80 | unsigned long flags; |
81 | ||