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 | ||
1da177e4 LT |
39 | /* |
40 | * Set up the logical destination ID. | |
41 | * | |
42 | * Intel recommends to set DFR, LDR and TPR before enabling | |
43 | * an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel | |
44 | * document number 292116). So here it goes... | |
45 | */ | |
9a0ebfbe | 46 | void flat_init_apic_ldr(void) |
1da177e4 LT |
47 | { |
48 | unsigned long val; | |
49 | unsigned long num, id; | |
50 | ||
51 | num = smp_processor_id(); | |
52 | id = 1UL << num; | |
eddfb4ed | 53 | apic_write(APIC_DFR, APIC_DFR_FLAT); |
1da177e4 LT |
54 | val = apic_read(APIC_LDR) & ~APIC_LDR_MASK; |
55 | val |= SET_APIC_LOGICAL_ID(id); | |
eddfb4ed | 56 | apic_write(APIC_LDR, val); |
1da177e4 LT |
57 | } |
58 | ||
e7986739 | 59 | static inline void _flat_send_IPI_mask(unsigned long mask, int vector) |
1da177e4 | 60 | { |
1da177e4 LT |
61 | unsigned long flags; |
62 | ||