diff options
Diffstat (limited to 'arch/x86/kernel/acpi/boot.c')
-rw-r--r-- | arch/x86/kernel/acpi/boot.c | 169 |
1 files changed, 73 insertions, 96 deletions
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index 7678f10c4568..a18eb7ce2236 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c | |||
@@ -37,15 +37,10 @@ | |||
37 | #include <asm/pgtable.h> | 37 | #include <asm/pgtable.h> |
38 | #include <asm/io_apic.h> | 38 | #include <asm/io_apic.h> |
39 | #include <asm/apic.h> | 39 | #include <asm/apic.h> |
40 | #include <asm/genapic.h> | ||
41 | #include <asm/io.h> | 40 | #include <asm/io.h> |
42 | #include <asm/mpspec.h> | 41 | #include <asm/mpspec.h> |
43 | #include <asm/smp.h> | 42 | #include <asm/smp.h> |
44 | 43 | ||
45 | #ifdef CONFIG_X86_LOCAL_APIC | ||
46 | # include <mach_apic.h> | ||
47 | #endif | ||
48 | |||
49 | static int __initdata acpi_force = 0; | 44 | static int __initdata acpi_force = 0; |
50 | u32 acpi_rsdt_forced; | 45 | u32 acpi_rsdt_forced; |
51 | #ifdef CONFIG_ACPI | 46 | #ifdef CONFIG_ACPI |
@@ -56,16 +51,7 @@ int acpi_disabled = 1; | |||
56 | EXPORT_SYMBOL(acpi_disabled); | 51 | EXPORT_SYMBOL(acpi_disabled); |
57 | 52 | ||
58 | #ifdef CONFIG_X86_64 | 53 | #ifdef CONFIG_X86_64 |
59 | 54 | # include <asm/proto.h> | |
60 | #include <asm/proto.h> | ||
61 | |||
62 | #else /* X86 */ | ||
63 | |||
64 | #ifdef CONFIG_X86_LOCAL_APIC | ||
65 | #include <mach_apic.h> | ||
66 | #include <mach_mpparse.h> | ||
67 | #endif /* CONFIG_X86_LOCAL_APIC */ | ||
68 | |||
69 | #endif /* X86 */ | 55 | #endif /* X86 */ |
70 | 56 | ||
71 | #define BAD_MADT_ENTRY(entry, end) ( \ | 57 | #define BAD_MADT_ENTRY(entry, end) ( \ |
@@ -121,35 +107,18 @@ enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_PIC; | |||
121 | */ | 107 | */ |
122 | char *__init __acpi_map_table(unsigned long phys, unsigned long size) | 108 | char *__init __acpi_map_table(unsigned long phys, unsigned long size) |
123 | { | 109 | { |
124 | unsigned long base, offset, mapped_size; | ||
125 | int idx; | ||
126 | 110 | ||
127 | if (!phys || !size) | 111 | if (!phys || !size) |
128 | return NULL; | 112 | return NULL; |
129 | 113 | ||
130 | if (phys+size <= (max_low_pfn_mapped << PAGE_SHIFT)) | 114 | return early_ioremap(phys, size); |
131 | return __va(phys); | 115 | } |
132 | 116 | void __init __acpi_unmap_table(char *map, unsigned long size) | |
133 | offset = phys & (PAGE_SIZE - 1); | 117 | { |
134 | mapped_size = PAGE_SIZE - offset; | 118 | if (!map || !size) |
135 | clear_fixmap(FIX_ACPI_END); | 119 | return; |
136 | set_fixmap(FIX_ACPI_END, phys); | ||
137 | base = fix_to_virt(FIX_ACPI_END); | ||
138 | |||
139 | /* | ||
140 | * Most cases can be covered by the below. | ||
141 | */ | ||
142 | idx = FIX_ACPI_END; | ||
143 | while (mapped_size < size) { | ||
144 | if (--idx < FIX_ACPI_BEGIN) | ||
145 | return NULL; /* cannot handle this */ | ||
146 | phys += PAGE_SIZE; | ||
147 | clear_fixmap(idx); | ||
148 | set_fixmap(idx, phys); | ||
149 | mapped_size += PAGE_SIZE; | ||
150 | } | ||
151 | 120 | ||
152 | return ((unsigned char *)base + offset); | 121 | early_iounmap(map, size); |
153 | } | 122 | } |
154 | 123 | ||
155 | #ifdef CONFIG_PCI_MMCONFIG | 124 | #ifdef CONFIG_PCI_MMCONFIG |
@@ -239,7 +208,8 @@ static int __init acpi_parse_madt(struct acpi_table_header *table) | |||
239 | madt->address); | 208 | madt->address); |
240 | } | 209 | } |
241 | 210 | ||
242 | acpi_madt_oem_check(madt->header.oem_id, madt->header.oem_table_id); | 211 | default_acpi_madt_oem_check(madt->header.oem_id, |
212 | madt->header.oem_table_id); | ||
243 | 213 | ||
244 | return 0; | 214 | return 0; |
245 | } | 215 | } |
@@ -884,7 +854,7 @@ static struct { | |||
884 | DECLARE_BITMAP(pin_programmed, MP_MAX_IOAPIC_PIN + 1); | 854 | DECLARE_BITMAP(pin_programmed, MP_MAX_IOAPIC_PIN + 1); |
885 | } mp_ioapic_routing[MAX_IO_APICS]; | 855 | } mp_ioapic_routing[MAX_IO_APICS]; |
886 | 856 | ||
887 | static int mp_find_ioapic(int gsi) | 857 | int mp_find_ioapic(int gsi) |
888 | { | 858 | { |
889 | int i = 0; | 859 | int i = 0; |
890 | 860 | ||
@@ -899,6 +869,16 @@ static int mp_find_ioapic(int gsi) | |||
899 | return -1; | 869 | return -1; |
900 | } | 870 | } |
901 | 871 | ||
872 | int mp_find_ioapic_pin(int ioapic, int gsi) | ||
873 | { | ||
874 | if (WARN_ON(ioapic == -1)) | ||
875 | return -1; | ||
876 | if (WARN_ON(gsi > mp_ioapic_routing[ioapic].gsi_end)) | ||
877 | return -1; | ||
878 | |||
879 | return gsi - mp_ioapic_routing[ioapic].gsi_base; | ||
880 | } | ||
881 | |||
902 | static u8 __init uniq_ioapic_id(u8 id) | 882 | static u8 __init uniq_ioapic_id(u8 id) |
903 | { | 883 | { |
904 | #ifdef CONFIG_X86_32 | 884 | #ifdef CONFIG_X86_32 |
@@ -912,8 +892,8 @@ static u8 __init uniq_ioapic_id(u8 id) | |||
912 | DECLARE_BITMAP(used, 256); | 892 | DECLARE_BITMAP(used, 256); |
913 | bitmap_zero(used, 256); | 893 | bitmap_zero(used, 256); |
914 | for (i = 0; i < nr_ioapics; i++) { | 894 | for (i = 0; i < nr_ioapics; i++) { |
915 | struct mp_config_ioapic *ia = &mp_ioapics[i]; | 895 | struct mpc_ioapic *ia = &mp_ioapics[i]; |
916 | __set_bit(ia->mp_apicid, used); | 896 | __set_bit(ia->apicid, used); |
917 | } | 897 | } |
918 | if (!test_bit(id, used)) | 898 | if (!test_bit(id, used)) |
919 | return id; | 899 | return id; |
@@ -945,29 +925,29 @@ void __init mp_register_ioapic(int id, u32 address, u32 gsi_base) | |||
945 | 925 | ||
946 | idx = nr_ioapics; | 926 | idx = nr_ioapics; |
947 | 927 | ||
948 | mp_ioapics[idx].mp_type = MP_IOAPIC; | 928 | mp_ioapics[idx].type = MP_IOAPIC; |
949 | mp_ioapics[idx].mp_flags = MPC_APIC_USABLE; | 929 | mp_ioapics[idx].flags = MPC_APIC_USABLE; |
950 | mp_ioapics[idx].mp_apicaddr = address; | 930 | mp_ioapics[idx].apicaddr = address; |
951 | 931 | ||
952 | set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address); | 932 | set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address); |
953 | mp_ioapics[idx].mp_apicid = uniq_ioapic_id(id); | 933 | mp_ioapics[idx].apicid = uniq_ioapic_id(id); |
954 | #ifdef CONFIG_X86_32 | 934 | #ifdef CONFIG_X86_32 |
955 | mp_ioapics[idx].mp_apicver = io_apic_get_version(idx); | 935 | mp_ioapics[idx].apicver = io_apic_get_version(idx); |
956 | #else | 936 | #else |
957 | mp_ioapics[idx].mp_apicver = 0; | 937 | mp_ioapics[idx].apicver = 0; |
958 | #endif | 938 | #endif |
959 | /* | 939 | /* |
960 | * Build basic GSI lookup table to facilitate gsi->io_apic lookups | 940 | * Build basic GSI lookup table to facilitate gsi->io_apic lookups |
961 | * and to prevent reprogramming of IOAPIC pins (PCI GSIs). | 941 | * and to prevent reprogramming of IOAPIC pins (PCI GSIs). |
962 | */ | 942 | */ |
963 | mp_ioapic_routing[idx].apic_id = mp_ioapics[idx].mp_apicid; | 943 | mp_ioapic_routing[idx].apic_id = mp_ioapics[idx].apicid; |
964 | mp_ioapic_routing[idx].gsi_base = gsi_base; | 944 | mp_ioapic_routing[idx].gsi_base = gsi_base; |
965 | mp_ioapic_routing[idx].gsi_end = gsi_base + | 945 | mp_ioapic_routing[idx].gsi_end = gsi_base + |
966 | io_apic_get_redir_entries(idx); | 946 | io_apic_get_redir_entries(idx); |
967 | 947 | ||
968 | printk(KERN_INFO "IOAPIC[%d]: apic_id %d, version %d, address 0x%lx, " | 948 | printk(KERN_INFO "IOAPIC[%d]: apic_id %d, version %d, address 0x%x, " |
969 | "GSI %d-%d\n", idx, mp_ioapics[idx].mp_apicid, | 949 | "GSI %d-%d\n", idx, mp_ioapics[idx].apicid, |
970 | mp_ioapics[idx].mp_apicver, mp_ioapics[idx].mp_apicaddr, | 950 | mp_ioapics[idx].apicver, mp_ioapics[idx].apicaddr, |
971 | mp_ioapic_routing[idx].gsi_base, mp_ioapic_routing[idx].gsi_end); | 951 | mp_ioapic_routing[idx].gsi_base, mp_ioapic_routing[idx].gsi_end); |
972 | 952 | ||
973 | nr_ioapics++; | 953 | nr_ioapics++; |
@@ -996,19 +976,19 @@ int __init acpi_probe_gsi(void) | |||
996 | return max_gsi + 1; | 976 | return max_gsi + 1; |
997 | } | 977 | } |
998 | 978 | ||
999 | static void assign_to_mp_irq(struct mp_config_intsrc *m, | 979 | static void assign_to_mp_irq(struct mpc_intsrc *m, |
1000 | struct mp_config_intsrc *mp_irq) | 980 | struct mpc_intsrc *mp_irq) |
1001 | { | 981 | { |
1002 | memcpy(mp_irq, m, sizeof(struct mp_config_intsrc)); | 982 | memcpy(mp_irq, m, sizeof(struct mpc_intsrc)); |
1003 | } | 983 | } |
1004 | 984 | ||
1005 | static int mp_irq_cmp(struct mp_config_intsrc *mp_irq, | 985 | static int mp_irq_cmp(struct mpc_intsrc *mp_irq, |
1006 | struct mp_config_intsrc *m) | 986 | struct mpc_intsrc *m) |
1007 | { | 987 | { |
1008 | return memcmp(mp_irq, m, sizeof(struct mp_config_intsrc)); | 988 | return memcmp(mp_irq, m, sizeof(struct mpc_intsrc)); |
1009 | } | 989 | } |
1010 | 990 | ||
1011 | static void save_mp_irq(struct mp_config_intsrc *m) | 991 | static void save_mp_irq(struct mpc_intsrc *m) |
1012 | { | 992 | { |
1013 | int i; | 993 | int i; |
1014 | 994 | ||
@@ -1026,7 +1006,7 @@ void __init mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger, u32 gsi) | |||
1026 | { | 1006 | { |
1027 | int ioapic; | 1007 | int ioapic; |
1028 | int pin; | 1008 | int pin; |
1029 | struct mp_config_intsrc mp_irq; | 1009 | struct mpc_intsrc mp_irq; |
1030 | 1010 | ||
1031 | /* | 1011 | /* |
1032 | * Convert 'gsi' to 'ioapic.pin'. | 1012 | * Convert 'gsi' to 'ioapic.pin'. |
@@ -1034,7 +1014,7 @@ void __init mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger, u32 gsi) | |||
1034 | ioapic = mp_find_ioapic(gsi); | 1014 | ioapic = mp_find_ioapic(gsi); |
1035 | if (ioapic < 0) | 1015 | if (ioapic < 0) |
1036 | return; | 1016 | return; |
1037 | pin = gsi - mp_ioapic_routing[ioapic].gsi_base; | 1017 | pin = mp_find_ioapic_pin(ioapic, gsi); |
1038 | 1018 | ||
1039 | /* | 1019 | /* |
1040 | * TBD: This check is for faulty timer entries, where the override | 1020 | * TBD: This check is for faulty timer entries, where the override |
@@ -1044,13 +1024,13 @@ void __init mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger, u32 gsi) | |||
1044 | if ((bus_irq == 0) && (trigger == 3)) | 1024 | if ((bus_irq == 0) && (trigger == 3)) |
1045 | trigger = 1; | 1025 | trigger = 1; |
1046 | 1026 | ||
1047 | mp_irq.mp_type = MP_INTSRC; | 1027 | mp_irq.type = MP_INTSRC; |
1048 | mp_irq.mp_irqtype = mp_INT; | 1028 | mp_irq.irqtype = mp_INT; |
1049 | mp_irq.mp_irqflag = (trigger << 2) | polarity; | 1029 | mp_irq.irqflag = (trigger << 2) | polarity; |
1050 | mp_irq.mp_srcbus = MP_ISA_BUS; | 1030 | mp_irq.srcbus = MP_ISA_BUS; |
1051 | mp_irq.mp_srcbusirq = bus_irq; /* IRQ */ | 1031 | mp_irq.srcbusirq = bus_irq; /* IRQ */ |
1052 | mp_irq.mp_dstapic = mp_ioapics[ioapic].mp_apicid; /* APIC ID */ | 1032 | mp_irq.dstapic = mp_ioapics[ioapic].apicid; /* APIC ID */ |
1053 | mp_irq.mp_dstirq = pin; /* INTIN# */ | 1033 | mp_irq.dstirq = pin; /* INTIN# */ |
1054 | 1034 | ||
1055 | save_mp_irq(&mp_irq); | 1035 | save_mp_irq(&mp_irq); |
1056 | } | 1036 | } |
@@ -1060,7 +1040,7 @@ void __init mp_config_acpi_legacy_irqs(void) | |||
1060 | int i; | 1040 | int i; |
1061 | int ioapic; | 1041 | int ioapic; |
1062 | unsigned int dstapic; | 1042 | unsigned int dstapic; |
1063 | struct mp_config_intsrc mp_irq; | 1043 | struct mpc_intsrc mp_irq; |
1064 | 1044 | ||
1065 | #if defined (CONFIG_MCA) || defined (CONFIG_EISA) | 1045 | #if defined (CONFIG_MCA) || defined (CONFIG_EISA) |
1066 | /* | 1046 | /* |
@@ -1085,7 +1065,7 @@ void __init mp_config_acpi_legacy_irqs(void) | |||
1085 | ioapic = mp_find_ioapic(0); | 1065 | ioapic = mp_find_ioapic(0); |
1086 | if (ioapic < 0) | 1066 | if (ioapic < 0) |
1087 | return; | 1067 | return; |
1088 | dstapic = mp_ioapics[ioapic].mp_apicid; | 1068 | dstapic = mp_ioapics[ioapic].apicid; |
1089 | 1069 | ||
1090 | /* | 1070 | /* |
1091 | * Use the default configuration for the IRQs 0-15. Unless | 1071 | * Use the default configuration for the IRQs 0-15. Unless |
@@ -1095,16 +1075,14 @@ void __init mp_config_acpi_legacy_irqs(void) | |||
1095 | int idx; | 1075 | int idx; |
1096 | 1076 | ||
1097 | for (idx = 0; idx < mp_irq_entries; idx++) { | 1077 | for (idx = 0; idx < mp_irq_entries; idx++) { |
1098 | struct mp_config_intsrc *irq = mp_irqs + idx; | 1078 | struct mpc_intsrc *irq = mp_irqs + idx; |
1099 | 1079 | ||
1100 | /* Do we already have a mapping for this ISA IRQ? */ | 1080 | /* Do we already have a mapping for this ISA IRQ? */ |
1101 | if (irq->mp_srcbus == MP_ISA_BUS | 1081 | if (irq->srcbus == MP_ISA_BUS && irq->srcbusirq == i) |
1102 | && irq->mp_srcbusirq == i) | ||
1103 | break; | 1082 | break; |
1104 | 1083 | ||
1105 | /* Do we already have a mapping for this IOAPIC pin */ | 1084 | /* Do we already have a mapping for this IOAPIC pin */ |
1106 | if (irq->mp_dstapic == dstapic && | 1085 | if (irq->dstapic == dstapic && irq->dstirq == i) |
1107 | irq->mp_dstirq == i) | ||
1108 | break; | 1086 | break; |
1109 | } | 1087 | } |
1110 | 1088 | ||
@@ -1113,13 +1091,13 @@ void __init mp_config_acpi_legacy_irqs(void) | |||
1113 | continue; /* IRQ already used */ | 1091 | continue; /* IRQ already used */ |
1114 | } | 1092 | } |
1115 | 1093 | ||
1116 | mp_irq.mp_type = MP_INTSRC; | 1094 | mp_irq.type = MP_INTSRC; |
1117 | mp_irq.mp_irqflag = 0; /* Conforming */ | 1095 | mp_irq.irqflag = 0; /* Conforming */ |
1118 | mp_irq.mp_srcbus = MP_ISA_BUS; | 1096 | mp_irq.srcbus = MP_ISA_BUS; |
1119 | mp_irq.mp_dstapic = dstapic; | 1097 | mp_irq.dstapic = dstapic; |
1120 | mp_irq.mp_irqtype = mp_INT; | 1098 | mp_irq.irqtype = mp_INT; |
1121 | mp_irq.mp_srcbusirq = i; /* Identity mapped */ | 1099 | mp_irq.srcbusirq = i; /* Identity mapped */ |
1122 | mp_irq.mp_dstirq = i; | 1100 | mp_irq.dstirq = i; |
1123 | 1101 | ||
1124 | save_mp_irq(&mp_irq); | 1102 | save_mp_irq(&mp_irq); |
1125 | } | 1103 | } |
@@ -1156,7 +1134,7 @@ int mp_register_gsi(u32 gsi, int triggering, int polarity) | |||
1156 | return gsi; | 1134 | return gsi; |
1157 | } | 1135 | } |
1158 | 1136 | ||
1159 | ioapic_pin = gsi - mp_ioapic_routing[ioapic].gsi_base; | 1137 | ioapic_pin = mp_find_ioapic_pin(ioapic, gsi); |
1160 | 1138 | ||
1161 | #ifdef CONFIG_X86_32 | 1139 | #ifdef CONFIG_X86_32 |
1162 | if (ioapic_renumber_irq) | 1140 | if (ioapic_renumber_irq) |
@@ -1230,22 +1208,22 @@ int mp_config_acpi_gsi(unsigned char number, unsigned int devfn, u8 pin, | |||
1230 | u32 gsi, int triggering, int polarity) | 1208 | u32 gsi, int triggering, int polarity) |
1231 | { | 1209 | { |
1232 | #ifdef CONFIG_X86_MPPARSE | 1210 | #ifdef CONFIG_X86_MPPARSE |
1233 | struct mp_config_intsrc mp_irq; | 1211 | struct mpc_intsrc mp_irq; |
1234 | int ioapic; | 1212 | int ioapic; |
1235 | 1213 | ||
1236 | if (!acpi_ioapic) | 1214 | if (!acpi_ioapic) |
1237 | return 0; | 1215 | return 0; |
1238 | 1216 | ||
1239 | /* print the entry should happen on mptable identically */ | 1217 | /* print the entry should happen on mptable identically */ |
1240 | mp_irq.mp_type = MP_INTSRC; | 1218 | mp_irq.type = MP_INTSRC; |
1241 | mp_irq.mp_irqtype = mp_INT; | 1219 | mp_irq.irqtype = mp_INT; |
1242 | mp_irq.mp_irqflag = (triggering == ACPI_EDGE_SENSITIVE ? 4 : 0x0c) | | 1220 | mp_irq.irqflag = (triggering == ACPI_EDGE_SENSITIVE ? 4 : 0x0c) | |
1243 | (polarity == ACPI_ACTIVE_HIGH ? 1 : 3); | 1221 | (polarity == ACPI_ACTIVE_HIGH ? 1 : 3); |
1244 | mp_irq.mp_srcbus = number; | 1222 | mp_irq.srcbus = number; |
1245 | mp_irq.mp_srcbusirq = (((devfn >> 3) & 0x1f) << 2) | ((pin - 1) & 3); | 1223 | mp_irq.srcbusirq = (((devfn >> 3) & 0x1f) << 2) | ((pin - 1) & 3); |
1246 | ioapic = mp_find_ioapic(gsi); | 1224 | ioapic = mp_find_ioapic(gsi); |
1247 | mp_irq.mp_dstapic = mp_ioapic_routing[ioapic].apic_id; | 1225 | mp_irq.dstapic = mp_ioapic_routing[ioapic].apic_id; |
1248 | mp_irq.mp_dstirq = gsi - mp_ioapic_routing[ioapic].gsi_base; | 1226 | mp_irq.dstirq = mp_find_ioapic_pin(ioapic, gsi); |
1249 | 1227 | ||
1250 | save_mp_irq(&mp_irq); | 1228 | save_mp_irq(&mp_irq); |
1251 | #endif | 1229 | #endif |
@@ -1372,7 +1350,7 @@ static void __init acpi_process_madt(void) | |||
1372 | if (!error) { | 1350 | if (!error) { |
1373 | acpi_lapic = 1; | 1351 | acpi_lapic = 1; |
1374 | 1352 | ||
1375 | #ifdef CONFIG_X86_GENERICARCH | 1353 | #ifdef CONFIG_X86_BIGSMP |
1376 | generic_bigsmp_probe(); | 1354 | generic_bigsmp_probe(); |
1377 | #endif | 1355 | #endif |
1378 | /* | 1356 | /* |
@@ -1384,9 +1362,8 @@ static void __init acpi_process_madt(void) | |||
1384 | acpi_ioapic = 1; | 1362 | acpi_ioapic = 1; |
1385 | 1363 | ||
1386 | smp_found_config = 1; | 1364 | smp_found_config = 1; |
1387 | #ifdef CONFIG_X86_32 | 1365 | if (apic->setup_apic_routing) |
1388 | setup_apic_routing(); | 1366 | apic->setup_apic_routing(); |
1389 | #endif | ||
1390 | } | 1367 | } |
1391 | } | 1368 | } |
1392 | if (error == -EINVAL) { | 1369 | if (error == -EINVAL) { |