Merge branch 'x86-headers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[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>
0c81c746 17#include <linux/hardirq.h>
186f4360 18#include <linux/export.h>
1da177e4 19#include <asm/smp.h>
7b6aa335 20#include <asm/apic.h>
c1eeb2de 21#include <asm/ipi.h>
1da177e4 22
8b48463f 23#include <linux/acpi.h>
1b9b89e7 24
1a8880a1
SS
25static struct apic apic_physflat;
26static struct apic apic_flat;
27
28struct apic __read_mostly *apic = &apic_flat;
29EXPORT_SYMBOL_GPL(apic);
30
983f91ff 31static int flat_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
1b9b89e7
YL
32{
33 return 1;
34}
35
1da177e4
LT
36/*
37 * Set up the logical destination ID.
38 *
39 * Intel recommends to set DFR, LDR and TPR before enabling
40 * an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel
41 * document number 292116). So here it goes...
42 */
9a0ebfbe 43void flat_init_apic_ldr(void)
1da177e4
LT
44{
45 unsigned long val;
46 unsigned long num, id;
47
48 num = smp_processor_id();
49 id = 1UL << num;
eddfb4ed 50 apic_write(APIC_DFR, APIC_DFR_FLAT);
1da177e4
LT
51 val = apic_read(APIC_LDR) & ~APIC_LDR_MASK;
52 val |= SET_APIC_LOGICAL_ID(id);
eddfb4ed 53 apic_write(APIC_LDR, val);
1da177e4
LT
54}
55
fe2f9546 56static void _flat_send_IPI_mask(unsigned long mask, int vector)
1da177e4 57{
1da177e4
LT
58 unsigned long flags;
59