diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
commit | c71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch) | |
tree | ecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /arch/x86/platform/sfi | |
parent | ea53c912f8a86a8567697115b6a0d8152beee5c8 (diff) | |
parent | 6a00f206debf8a5c8899055726ad127dbeeed098 (diff) |
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts:
litmus/sched_cedf.c
Diffstat (limited to 'arch/x86/platform/sfi')
-rw-r--r-- | arch/x86/platform/sfi/Makefile | 1 | ||||
-rw-r--r-- | arch/x86/platform/sfi/sfi.c | 109 |
2 files changed, 110 insertions, 0 deletions
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..7785b72ecc3a --- /dev/null +++ b/arch/x86/platform/sfi/sfi.c | |||
@@ -0,0 +1,109 @@ | |||
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 | /* All CPUs enumerated by SFI must be present and enabled */ | ||
38 | static void __cpuinit mp_sfi_register_lapic(u8 id) | ||
39 | { | ||
40 | if (MAX_LOCAL_APIC - id <= 0) { | ||
41 | pr_warning("Processor #%d invalid (max %d)\n", | ||
42 | id, MAX_LOCAL_APIC); | ||
43 | return; | ||
44 | } | ||
45 | |||
46 | pr_info("registering lapic[%d]\n", id); | ||
47 | |||
48 | generic_processor_info(id, GET_APIC_VERSION(apic_read(APIC_LVR))); | ||
49 | } | ||
50 | |||
51 | static int __init sfi_parse_cpus(struct sfi_table_header *table) | ||
52 | { | ||
53 | struct sfi_table_simple *sb; | ||
54 | struct sfi_cpu_table_entry *pentry; | ||
55 | int i; | ||
56 | int cpu_num; | ||
57 | |||
58 | sb = (struct sfi_table_simple *)table; | ||
59 | cpu_num = SFI_GET_NUM_ENTRIES(sb, struct sfi_cpu_table_entry); | ||
60 | pentry = (struct sfi_cpu_table_entry *)sb->pentry; | ||
61 | |||
62 | for (i = 0; i < cpu_num; i++) { | ||
63 | mp_sfi_register_lapic(pentry->apic_id); | ||
64 | pentry++; | ||
65 | } | ||
66 | |||
67 | smp_found_config = 1; | ||
68 | return 0; | ||
69 | } | ||
70 | #endif /* CONFIG_X86_LOCAL_APIC */ | ||
71 | |||
72 | #ifdef CONFIG_X86_IO_APIC | ||
73 | |||
74 | static int __init sfi_parse_ioapic(struct sfi_table_header *table) | ||
75 | { | ||
76 | struct sfi_table_simple *sb; | ||
77 | struct sfi_apic_table_entry *pentry; | ||
78 | int i, num; | ||
79 | |||
80 | sb = (struct sfi_table_simple *)table; | ||
81 | num = SFI_GET_NUM_ENTRIES(sb, struct sfi_apic_table_entry); | ||
82 | pentry = (struct sfi_apic_table_entry *)sb->pentry; | ||
83 | |||
84 | for (i = 0; i < num; i++) { | ||
85 | mp_register_ioapic(i, pentry->phys_addr, gsi_top); | ||
86 | pentry++; | ||
87 | } | ||
88 | |||
89 | WARN(pic_mode, KERN_WARNING | ||
90 | "SFI: pic_mod shouldn't be 1 when IOAPIC table is present\n"); | ||
91 | pic_mode = 0; | ||
92 | return 0; | ||
93 | } | ||
94 | #endif /* CONFIG_X86_IO_APIC */ | ||
95 | |||
96 | /* | ||
97 | * sfi_platform_init(): register lapics & io-apics | ||
98 | */ | ||
99 | int __init sfi_platform_init(void) | ||
100 | { | ||
101 | #ifdef CONFIG_X86_LOCAL_APIC | ||
102 | register_lapic_address(sfi_lapic_addr); | ||
103 | sfi_table_parse(SFI_SIG_CPUS, NULL, NULL, sfi_parse_cpus); | ||
104 | #endif | ||
105 | #ifdef CONFIG_X86_IO_APIC | ||
106 | sfi_table_parse(SFI_SIG_APIC, NULL, NULL, sfi_parse_ioapic); | ||
107 | #endif | ||
108 | return 0; | ||
109 | } | ||