aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/Kconfig2
-rw-r--r--arch/x86/kernel/Makefile1
-rw-r--r--arch/x86/kernel/setup.c3
-rw-r--r--arch/x86/kernel/sfi.c133
4 files changed, 139 insertions, 0 deletions
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 13ffa5df37d7..d8ba42418d33 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1683,6 +1683,8 @@ source "kernel/power/Kconfig"
1683 1683
1684source "drivers/acpi/Kconfig" 1684source "drivers/acpi/Kconfig"
1685 1685
1686source "drivers/sfi/Kconfig"
1687
1686config X86_APM_BOOT 1688config X86_APM_BOOT
1687 bool 1689 bool
1688 default y 1690 default y
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 430d5b24af7b..6321afaafb26 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -55,6 +55,7 @@ obj-y += step.o
55obj-$(CONFIG_STACKTRACE) += stacktrace.o 55obj-$(CONFIG_STACKTRACE) += stacktrace.o
56obj-y += cpu/ 56obj-y += cpu/
57obj-y += acpi/ 57obj-y += acpi/
58obj-$(CONFIG_SFI) += sfi.o
58obj-y += reboot.o 59obj-y += reboot.o
59obj-$(CONFIG_MCA) += mca_32.o 60obj-$(CONFIG_MCA) += mca_32.o
60obj-$(CONFIG_X86_MSR) += msr.o 61obj-$(CONFIG_X86_MSR) += msr.o
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 63f32d220ef2..d784ea207606 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -27,6 +27,7 @@
27#include <linux/screen_info.h> 27#include <linux/screen_info.h>
28#include <linux/ioport.h> 28#include <linux/ioport.h>
29#include <linux/acpi.h> 29#include <linux/acpi.h>
30#include <linux/sfi.h>
30#include <linux/apm_bios.h> 31#include <linux/apm_bios.h>
31#include <linux/initrd.h> 32#include <linux/initrd.h>
32#include <linux/bootmem.h> 33#include <linux/bootmem.h>
@@ -990,6 +991,8 @@ void __init setup_arch(char **cmdline_p)
990 */ 991 */
991 acpi_boot_init(); 992 acpi_boot_init();
992 993
994 sfi_init();
995
993#if defined(CONFIG_X86_MPPARSE) || defined(CONFIG_X86_VISWS) 996#if defined(CONFIG_X86_MPPARSE) || defined(CONFIG_X86_VISWS)
994 /* 997 /*
995 * get boot-time SMP configuration: 998 * get boot-time SMP configuration:
diff --git a/arch/x86/kernel/sfi.c b/arch/x86/kernel/sfi.c
new file mode 100644
index 000000000000..761df3f759c1
--- /dev/null
+++ b/arch/x86/kernel/sfi.c
@@ -0,0 +1,133 @@
1/*
2 * sfi.c - x86 architecture SFI support.
3 *
4 * Copyright (c) 2009, Intel Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 */
20
21#define KMSG_COMPONENT "SFI"
22#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
23
24#include <linux/bootmem.h>
25#include <linux/cpumask.h>
26#include <linux/module.h>
27#include <linux/acpi.h>
28#include <linux/init.h>
29#include <linux/efi.h>
30#include <linux/irq.h>
31#include <linux/sfi.h>
32#include <linux/io.h>
33
34#include <asm/io_apic.h>
35#include <asm/pgtable.h>
36#include <asm/mpspec.h>
37#include <asm/setup.h>
38#include <asm/apic.h>
39#include <asm/e820.h>
40
41#ifdef CONFIG_X86_LOCAL_APIC
42static unsigned long sfi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE;
43
44void __init mp_sfi_register_lapic_address(unsigned long address)
45{
46 mp_lapic_addr = address;
47
48 set_fixmap_nocache(FIX_APIC_BASE, mp_lapic_addr);
49 if (boot_cpu_physical_apicid == -1U)
50 boot_cpu_physical_apicid = read_apic_id();
51
52 pr_info("Boot CPU = %d\n", boot_cpu_physical_apicid);
53}
54
55/* All CPUs enumerated by SFI must be present and enabled */
56void __cpuinit mp_sfi_register_lapic(u8 id)
57{
58 int boot_cpu = 0;
59
60 if (MAX_APICS - id <= 0) {
61 pr_warning("Processor #%d invalid (max %d)\n",
62 id, MAX_APICS);
63 return;
64 }
65
66 if (id == boot_cpu_physical_apicid)
67 boot_cpu = 1;
68 pr_info("registering lapic[%d]\n", id);
69
70 generic_processor_info(id, GET_APIC_VERSION(apic_read(APIC_LVR)));
71}
72
73static int __init sfi_parse_cpus(struct sfi_table_header *table)
74{
75 struct sfi_table_simple *sb;
76 struct sfi_cpu_table_entry *pentry;
77 int i;
78 int cpu_num;
79
80 sb = (struct sfi_table_simple *)table;
81 cpu_num = SFI_GET_NUM_ENTRIES(sb, struct sfi_cpu_table_entry);
82 pentry = (struct sfi_cpu_table_entry *)sb->pentry;
83
84 for (i = 0; i < cpu_num; i++) {
85 mp_sfi_register_lapic(pentry->apic_id);
86 pentry++;
87 }
88
89 smp_found_config = 1;
90 return 0;
91}
92#endif /* CONFIG_X86_LOCAL_APIC */
93
94#ifdef CONFIG_X86_IO_APIC
95static u32 gsi_base;
96
97static int __init sfi_parse_ioapic(struct sfi_table_header *table)
98{
99 struct sfi_table_simple *sb;
100 struct sfi_apic_table_entry *pentry;
101 int i, num;
102
103 sb = (struct sfi_table_simple *)table;
104 num = SFI_GET_NUM_ENTRIES(sb, struct sfi_apic_table_entry);
105 pentry = (struct sfi_apic_table_entry *)sb->pentry;
106
107 for (i = 0; i < num; i++) {
108 mp_register_ioapic(i, pentry->phys_addr, gsi_base);
109 gsi_base += io_apic_get_redir_entries(i);
110 pentry++;
111 }
112
113 WARN(pic_mode, KERN_WARNING
114 "SFI: pic_mod shouldn't be 1 when IOAPIC table is present\n");
115 pic_mode = 0;
116 return 0;
117}
118#endif /* CONFIG_X86_IO_APIC */
119
120/*
121 * sfi_platform_init(): register lapics & io-apics
122 */
123int __init sfi_platform_init(void)
124{
125#ifdef CONFIG_X86_LOCAL_APIC
126 mp_sfi_register_lapic_address(sfi_lapic_addr);
127 sfi_table_parse(SFI_SIG_CPUS, NULL, NULL, sfi_parse_cpus);
128#endif
129#ifdef CONFIG_X86_IO_APIC
130 sfi_table_parse(SFI_SIG_APIC, NULL, NULL, sfi_parse_ioapic);
131#endif
132 return 0;
133}