x86, apic: Make apic drivers static
[linux-2.6-block.git] / arch / x86 / kernel / apic / apic_flat_64.c
CommitLineData
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>
1da177e4 19#include <asm/smp.h>
7b6aa335 20#include <asm/apic.h>
c1eeb2de 21#include <asm/ipi.h>
1da177e4 22
1b9b89e7
YL
23#ifdef CONFIG_ACPI
24#include <acpi/acpi_bus.h>
25#endif
26
1a8880a1
SS
27static struct apic apic_physflat;
28static struct apic apic_flat;
29
30struct apic __read_mostly *apic = &apic_flat;
31EXPORT_SYMBOL_GPL(apic);
32
983f91ff 33static int flat_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
1b9b89e7
YL
34{
35 return 1;
36}
37
bcda016e 38static const struct cpumask *flat_target_cpus(void)
1da177e4 39{
bcda016e 40 return cpu_online_mask;
1da177e4
LT
41}
42
bcda016e 43static void flat_vector_allocation_domain(int cpu, struct cpumask *retmask)
c7111c13
EB
44{
45 /* Careful. Some cpus do not strictly honor the set of cpus
46 * specified in the interrupt destination when using lowest
47 * priority interrupt delivery mode.
48 *
49 * In particular there was a hyperthreading cpu observed to
50 * deliver interrupts to the wrong hyperthread when only one
51 * hyperthread was specified in the interrupt desitination.
52 */
bcda016e
MT
53 cpumask_clear(retmask);
54 cpumask_bits(retmask)[0] = APIC_ALL_CPUS;
c7111c13
EB
55}
56
1da177e4
LT
57/*
58 * Set up the logical destination ID.
59 *
60 * Intel recommends to set DFR, LDR and TPR before enabling
61 * an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel
62 * document number 292116). So here it goes...
63 */
64static void flat_init_apic_ldr(void)
65{
66 unsigned long val;
67 unsigned long num, id;
68
69 num = smp_processor_id();
70 id = 1UL << num;
eddfb4ed 71 apic_write(APIC_DFR, APIC_DFR_FLAT);
1da177e4
LT
72 val = apic_read(APIC_LDR) & ~APIC_LDR_MASK;
73 val |= SET_APIC_LOGICAL_ID(id);
eddfb4ed 74 apic_write(APIC_LDR, val);
1da177e4
LT
75}
76
e7986739 77static inline void _flat_send_IPI_mask(unsigned long mask, int vector)
1da177e4 78{
1da177e4
LT
79 unsigned long flags;
80