diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2010-10-16 04:16:59 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2010-10-27 08:30:01 -0400 |
commit | 937f961a6539b0ac5ebf31472b90810bc1f02200 (patch) | |
tree | 9f3b7eecdfda205078490dcabd823576c563bf48 /arch/x86/platform | |
parent | 3adbb7f4a32dd34993ebe3829c69694f0c5fc85b (diff) |
x86: Move sfi to platform
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Len Brown <lenb@kernel.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Diffstat (limited to 'arch/x86/platform')
-rw-r--r-- | arch/x86/platform/Makefile | 1 | ||||
-rw-r--r-- | arch/x86/platform/sfi/Makefile | 1 | ||||
-rw-r--r-- | arch/x86/platform/sfi/sfi.c | 120 |
3 files changed, 122 insertions, 0 deletions
diff --git a/arch/x86/platform/Makefile b/arch/x86/platform/Makefile index fdf4113befba..a964fa3c0868 100644 --- a/arch/x86/platform/Makefile +++ b/arch/x86/platform/Makefile | |||
@@ -1 +1,2 @@ | |||
1 | # Platform specific code goes here | 1 | # Platform specific code goes here |
2 | obj-y += sfi/ | ||
diff --git a/arch/x86/platform/sfi/Makefile b/arch/x86/platform/sfi/Makefile new file mode 100644 index 000000000000..cc5db1168a5e --- /dev/null +++ b/arch/x86/platform/sfi/Makefile | |||
@@ -0,0 +1 @@ | |||
obj-$(CONFIG_SFI) += sfi.o | |||
diff --git a/arch/x86/platform/sfi/sfi.c b/arch/x86/platform/sfi/sfi.c new file mode 100644 index 000000000000..dd4c281ffe57 --- /dev/null +++ b/arch/x86/platform/sfi/sfi.c | |||
@@ -0,0 +1,120 @@ | |||
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/acpi.h> | ||
25 | #include <linux/init.h> | ||
26 | #include <linux/sfi.h> | ||
27 | #include <linux/io.h> | ||
28 | |||
29 | #include <asm/io_apic.h> | ||
30 | #include <asm/mpspec.h> | ||
31 | #include <asm/setup.h> | ||
32 | #include <asm/apic.h> | ||
33 | |||
34 | #ifdef CONFIG_X86_LOCAL_APIC | ||
35 | static unsigned long sfi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE; | ||
36 | |||
37 | static void __init mp_sfi_register_lapic_address(unsigned long address) | ||
38 | { | ||
39 | mp_lapic_addr = address; | ||
40 | |||
41 | set_fixmap_nocache(FIX_APIC_BASE, mp_lapic_addr); | ||
42 | if (boot_cpu_physical_apicid == -1U) | ||
43 | boot_cpu_physical_apicid = read_apic_id(); | ||
44 | |||
45 | pr_info("Boot CPU = %d\n", boot_cpu_physical_apicid); | ||
46 | } | ||
47 | |||
48 | /* All CPUs enumerated by SFI must be present and enabled */ | ||
49 | static void __cpuinit mp_sfi_register_lapic(u8 id) | ||
50 | { | ||
51 | if (MAX_APICS - id <= 0) { | ||
52 | pr_warning("Processor #%d invalid (max %d)\n", | ||
53 | id, MAX_APICS); | ||
54 | return; | ||
55 | } | ||
56 | |||
57 | pr_info("registering lapic[%d]\n", id); | ||
58 | |||
59 | generic_processor_info(id, GET_APIC_VERSION(apic_read(APIC_LVR))); | ||
60 | } | ||
61 | |||
62 | static int __init sfi_parse_cpus(struct sfi_table_header *table) | ||
63 | { | ||
64 | struct sfi_table_simple *sb; | ||
65 | struct sfi_cpu_table_entry *pentry; | ||
66 | int i; | ||
67 | int cpu_num; | ||
68 | |||
69 | sb = (struct sfi_table_simple *)table; | ||
70 | cpu_num = SFI_GET_NUM_ENTRIES(sb, struct sfi_cpu_table_entry); | ||
71 | pentry = (struct sfi_cpu_table_entry *)sb->pentry; | ||
72 | |||
73 | for (i = 0; i < cpu_num; i++) { | ||
74 | mp_sfi_register_lapic(pentry->apic_id); | ||
75 | pentry++; | ||
76 | } | ||
77 | |||
78 | smp_found_config = 1; | ||
79 | return 0; | ||
80 | } | ||
81 | #endif /* CONFIG_X86_LOCAL_APIC */ | ||
82 | |||
83 | #ifdef CONFIG_X86_IO_APIC | ||
84 | |||
85 | static int __init sfi_parse_ioapic(struct sfi_table_header *table) | ||
86 | { | ||
87 | struct sfi_table_simple *sb; | ||
88 | struct sfi_apic_table_entry *pentry; | ||
89 | int i, num; | ||
90 | |||
91 | sb = (struct sfi_table_simple *)table; | ||
92 | num = SFI_GET_NUM_ENTRIES(sb, struct sfi_apic_table_entry); | ||
93 | pentry = (struct sfi_apic_table_entry *)sb->pentry; | ||
94 | |||
95 | for (i = 0; i < num; i++) { | ||
96 | mp_register_ioapic(i, pentry->phys_addr, gsi_top); | ||
97 | pentry++; | ||
98 | } | ||
99 | |||
100 | WARN(pic_mode, KERN_WARNING | ||
101 | "SFI: pic_mod shouldn't be 1 when IOAPIC table is present\n"); | ||
102 | pic_mode = 0; | ||
103 | return 0; | ||
104 | } | ||
105 | #endif /* CONFIG_X86_IO_APIC */ | ||
106 | |||
107 | /* | ||
108 | * sfi_platform_init(): register lapics & io-apics | ||
109 | */ | ||
110 | int __init sfi_platform_init(void) | ||
111 | { | ||
112 | #ifdef CONFIG_X86_LOCAL_APIC | ||
113 | mp_sfi_register_lapic_address(sfi_lapic_addr); | ||
114 | sfi_table_parse(SFI_SIG_CPUS, NULL, NULL, sfi_parse_cpus); | ||
115 | #endif | ||
116 | #ifdef CONFIG_X86_IO_APIC | ||
117 | sfi_table_parse(SFI_SIG_APIC, NULL, NULL, sfi_parse_ioapic); | ||
118 | #endif | ||
119 | return 0; | ||
120 | } | ||