diff options
author | Suresh Siddha <suresh.b.siddha@intel.com> | 2011-05-18 19:31:37 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-05-20 07:40:59 -0400 |
commit | d5371430840f3e8d3b8bdbc9c02867808f299449 (patch) | |
tree | 49d9fafac8fa03714920aa242b766ed8c7895ea9 /arch/x86 | |
parent | 57a6f74023c7fd943160d7635bbc8d9f66e2ab54 (diff) |
x86, ioapic: Consolidate mp_ioapics[] into 'struct ioapic'
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Cc: daniel.blueman@gmail.com
Link: http://lkml.kernel.org/r/20110518233157.909013179@sbsiddha-MOBL3.sc.intel.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/include/asm/io_apic.h | 6 | ||||
-rw-r--r-- | arch/x86/kernel/acpi/boot.c | 8 | ||||
-rw-r--r-- | arch/x86/kernel/apic/io_apic.c | 94 | ||||
-rw-r--r-- | arch/x86/kernel/devicetree.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/mpparse.c | 2 |
5 files changed, 62 insertions, 50 deletions
diff --git a/arch/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h index 147700a3f56c..4f07bf637eb3 100644 --- a/arch/x86/include/asm/io_apic.h +++ b/arch/x86/include/asm/io_apic.h | |||
@@ -106,10 +106,10 @@ struct IR_IO_APIC_route_entry { | |||
106 | */ | 106 | */ |
107 | extern int nr_ioapics; | 107 | extern int nr_ioapics; |
108 | 108 | ||
109 | #define MP_MAX_IOAPIC_PIN 127 | 109 | extern int mpc_ioapic_id(int ioapic); |
110 | extern unsigned int mpc_ioapic_addr(int ioapic); | ||
110 | 111 | ||
111 | /* I/O APIC entries */ | 112 | #define MP_MAX_IOAPIC_PIN 127 |
112 | extern struct mpc_ioapic mp_ioapics[MAX_IO_APICS]; | ||
113 | 113 | ||
114 | /* # of MP IRQ source entries */ | 114 | /* # of MP IRQ source entries */ |
115 | extern int mp_irq_entries; | 115 | extern int mp_irq_entries; |
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index 9a966c579af5..4558f0d0822d 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c | |||
@@ -970,7 +970,7 @@ void __init mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger, u32 gsi) | |||
970 | mp_irq.irqflag = (trigger << 2) | polarity; | 970 | mp_irq.irqflag = (trigger << 2) | polarity; |
971 | mp_irq.srcbus = MP_ISA_BUS; | 971 | mp_irq.srcbus = MP_ISA_BUS; |
972 | mp_irq.srcbusirq = bus_irq; /* IRQ */ | 972 | mp_irq.srcbusirq = bus_irq; /* IRQ */ |
973 | mp_irq.dstapic = mp_ioapics[ioapic].apicid; /* APIC ID */ | 973 | mp_irq.dstapic = mpc_ioapic_id(ioapic); /* APIC ID */ |
974 | mp_irq.dstirq = pin; /* INTIN# */ | 974 | mp_irq.dstirq = pin; /* INTIN# */ |
975 | 975 | ||
976 | mp_save_irq(&mp_irq); | 976 | mp_save_irq(&mp_irq); |
@@ -1021,7 +1021,7 @@ void __init mp_config_acpi_legacy_irqs(void) | |||
1021 | if (ioapic < 0) | 1021 | if (ioapic < 0) |
1022 | continue; | 1022 | continue; |
1023 | pin = mp_find_ioapic_pin(ioapic, gsi); | 1023 | pin = mp_find_ioapic_pin(ioapic, gsi); |
1024 | dstapic = mp_ioapics[ioapic].apicid; | 1024 | dstapic = mpc_ioapic_id(ioapic); |
1025 | 1025 | ||
1026 | for (idx = 0; idx < mp_irq_entries; idx++) { | 1026 | for (idx = 0; idx < mp_irq_entries; idx++) { |
1027 | struct mpc_intsrc *irq = mp_irqs + idx; | 1027 | struct mpc_intsrc *irq = mp_irqs + idx; |
@@ -1082,7 +1082,7 @@ static int mp_config_acpi_gsi(struct device *dev, u32 gsi, int trigger, | |||
1082 | mp_irq.srcbus = number; | 1082 | mp_irq.srcbus = number; |
1083 | mp_irq.srcbusirq = (((devfn >> 3) & 0x1f) << 2) | ((pin - 1) & 3); | 1083 | mp_irq.srcbusirq = (((devfn >> 3) & 0x1f) << 2) | ((pin - 1) & 3); |
1084 | ioapic = mp_find_ioapic(gsi); | 1084 | ioapic = mp_find_ioapic(gsi); |
1085 | mp_irq.dstapic = mp_ioapics[ioapic].apicid; | 1085 | mp_irq.dstapic = mpc_ioapic_id(ioapic); |
1086 | mp_irq.dstirq = mp_find_ioapic_pin(ioapic, gsi); | 1086 | mp_irq.dstirq = mp_find_ioapic_pin(ioapic, gsi); |
1087 | 1087 | ||
1088 | mp_save_irq(&mp_irq); | 1088 | mp_save_irq(&mp_irq); |
@@ -1113,7 +1113,7 @@ int mp_register_gsi(struct device *dev, u32 gsi, int trigger, int polarity) | |||
1113 | 1113 | ||
1114 | if (ioapic_pin > MP_MAX_IOAPIC_PIN) { | 1114 | if (ioapic_pin > MP_MAX_IOAPIC_PIN) { |
1115 | printk(KERN_ERR "Invalid reference to IOAPIC pin " | 1115 | printk(KERN_ERR "Invalid reference to IOAPIC pin " |
1116 | "%d-%d\n", mp_ioapics[ioapic].apicid, | 1116 | "%d-%d\n", mpc_ioapic_id(ioapic), |
1117 | ioapic_pin); | 1117 | ioapic_pin); |
1118 | return gsi; | 1118 | return gsi; |
1119 | } | 1119 | } |
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index ceff2d26e498..e91131557b79 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c | |||
@@ -85,10 +85,22 @@ static struct ioapic { | |||
85 | * Saved state during suspend/resume, or while enabling intr-remap. | 85 | * Saved state during suspend/resume, or while enabling intr-remap. |
86 | */ | 86 | */ |
87 | struct IO_APIC_route_entry *saved_registers; | 87 | struct IO_APIC_route_entry *saved_registers; |
88 | /* I/O APIC config */ | ||
89 | struct mpc_ioapic mp_config; | ||
88 | } ioapics[MAX_IO_APICS]; | 90 | } ioapics[MAX_IO_APICS]; |
89 | 91 | ||
90 | /* I/O APIC entries */ | 92 | #define mpc_ioapic_ver(id) ioapics[id].mp_config.apicver |
91 | struct mpc_ioapic mp_ioapics[MAX_IO_APICS]; | 93 | |
94 | int mpc_ioapic_id(int id) | ||
95 | { | ||
96 | return ioapics[id].mp_config.apicid; | ||
97 | } | ||
98 | |||
99 | unsigned int mpc_ioapic_addr(int id) | ||
100 | { | ||
101 | return ioapics[id].mp_config.apicaddr; | ||
102 | } | ||
103 | |||
92 | int nr_ioapics; | 104 | int nr_ioapics; |
93 | 105 | ||
94 | /* IO APIC gsi routing info */ | 106 | /* IO APIC gsi routing info */ |
@@ -311,7 +323,7 @@ struct io_apic { | |||
311 | static __attribute_const__ struct io_apic __iomem *io_apic_base(int idx) | 323 | static __attribute_const__ struct io_apic __iomem *io_apic_base(int idx) |
312 | { | 324 | { |
313 | return (void __iomem *) __fix_to_virt(FIX_IO_APIC_BASE_0 + idx) | 325 | return (void __iomem *) __fix_to_virt(FIX_IO_APIC_BASE_0 + idx) |
314 | + (mp_ioapics[idx].apicaddr & ~PAGE_MASK); | 326 | + (mpc_ioapic_addr(idx) & ~PAGE_MASK); |
315 | } | 327 | } |
316 | 328 | ||
317 | static inline void io_apic_eoi(unsigned int apic, unsigned int vector) | 329 | static inline void io_apic_eoi(unsigned int apic, unsigned int vector) |
@@ -701,7 +713,7 @@ static int find_irq_entry(int apic, int pin, int type) | |||
701 | 713 | ||
702 | for (i = 0; i < mp_irq_entries; i++) | 714 | for (i = 0; i < mp_irq_entries; i++) |
703 | if (mp_irqs[i].irqtype == type && | 715 | if (mp_irqs[i].irqtype == type && |
704 | (mp_irqs[i].dstapic == mp_ioapics[apic].apicid || | 716 | (mp_irqs[i].dstapic == mpc_ioapic_id(apic) || |
705 | mp_irqs[i].dstapic == MP_APIC_ALL) && | 717 | mp_irqs[i].dstapic == MP_APIC_ALL) && |
706 | mp_irqs[i].dstirq == pin) | 718 | mp_irqs[i].dstirq == pin) |
707 | return i; | 719 | return i; |
@@ -743,7 +755,7 @@ static int __init find_isa_irq_apic(int irq, int type) | |||
743 | if (i < mp_irq_entries) { | 755 | if (i < mp_irq_entries) { |
744 | int apic; | 756 | int apic; |
745 | for(apic = 0; apic < nr_ioapics; apic++) { | 757 | for(apic = 0; apic < nr_ioapics; apic++) { |
746 | if (mp_ioapics[apic].apicid == mp_irqs[i].dstapic) | 758 | if (mpc_ioapic_id(apic) == mp_irqs[i].dstapic) |
747 | return apic; | 759 | return apic; |
748 | } | 760 | } |
749 | } | 761 | } |
@@ -973,7 +985,7 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin, | |||
973 | int lbus = mp_irqs[i].srcbus; | 985 | int lbus = mp_irqs[i].srcbus; |
974 | 986 | ||
975 | for (apic = 0; apic < nr_ioapics; apic++) | 987 | for (apic = 0; apic < nr_ioapics; apic++) |
976 | if (mp_ioapics[apic].apicid == mp_irqs[i].dstapic || | 988 | if (mpc_ioapic_id(apic) == mp_irqs[i].dstapic || |
977 | mp_irqs[i].dstapic == MP_APIC_ALL) | 989 | mp_irqs[i].dstapic == MP_APIC_ALL) |
978 | break; | 990 | break; |
979 | 991 | ||
@@ -1320,14 +1332,14 @@ static void setup_ioapic_irq(int apic_id, int pin, unsigned int irq, | |||
1320 | apic_printk(APIC_VERBOSE,KERN_DEBUG | 1332 | apic_printk(APIC_VERBOSE,KERN_DEBUG |
1321 | "IOAPIC[%d]: Set routing entry (%d-%d -> 0x%x -> " | 1333 | "IOAPIC[%d]: Set routing entry (%d-%d -> 0x%x -> " |
1322 | "IRQ %d Mode:%i Active:%i)\n", | 1334 | "IRQ %d Mode:%i Active:%i)\n", |
1323 | apic_id, mp_ioapics[apic_id].apicid, pin, cfg->vector, | 1335 | apic_id, mpc_ioapic_id(apic_id), pin, cfg->vector, |
1324 | irq, trigger, polarity); | 1336 | irq, trigger, polarity); |
1325 | 1337 | ||
1326 | 1338 | ||
1327 | if (setup_ioapic_entry(mp_ioapics[apic_id].apicid, irq, &entry, | 1339 | if (setup_ioapic_entry(mpc_ioapic_id(apic_id), irq, &entry, |
1328 | dest, trigger, polarity, cfg->vector, pin)) { | 1340 | dest, trigger, polarity, cfg->vector, pin)) { |
1329 | printk("Failed to setup ioapic entry for ioapic %d, pin %d\n", | 1341 | printk("Failed to setup ioapic entry for ioapic %d, pin %d\n", |
1330 | mp_ioapics[apic_id].apicid, pin); | 1342 | mpc_ioapic_id(apic_id), pin); |
1331 | __clear_irq_vector(irq, cfg); | 1343 | __clear_irq_vector(irq, cfg); |
1332 | return; | 1344 | return; |
1333 | } | 1345 | } |
@@ -1349,7 +1361,7 @@ static bool __init io_apic_pin_not_connected(int idx, int apic_id, int pin) | |||
1349 | return false; | 1361 | return false; |
1350 | 1362 | ||
1351 | apic_printk(APIC_VERBOSE, KERN_DEBUG " apic %d pin %d not connected\n", | 1363 | apic_printk(APIC_VERBOSE, KERN_DEBUG " apic %d pin %d not connected\n", |
1352 | mp_ioapics[apic_id].apicid, pin); | 1364 | mpc_ioapic_id(apic_id), pin); |
1353 | return true; | 1365 | return true; |
1354 | } | 1366 | } |
1355 | 1367 | ||
@@ -1481,7 +1493,7 @@ __apicdebuginit(void) print_IO_APIC(void) | |||
1481 | printk(KERN_DEBUG "number of MP IRQ sources: %d.\n", mp_irq_entries); | 1493 | printk(KERN_DEBUG "number of MP IRQ sources: %d.\n", mp_irq_entries); |
1482 | for (i = 0; i < nr_ioapics; i++) | 1494 | for (i = 0; i < nr_ioapics; i++) |
1483 | printk(KERN_DEBUG "number of IO-APIC #%d registers: %d.\n", | 1495 | printk(KERN_DEBUG "number of IO-APIC #%d registers: %d.\n", |
1484 | mp_ioapics[i].apicid, ioapics[i].nr_registers); | 1496 | mpc_ioapic_id(i), ioapics[i].nr_registers); |
1485 | 1497 | ||
1486 | /* | 1498 | /* |
1487 | * We are a bit conservative about what we expect. We have to | 1499 | * We are a bit conservative about what we expect. We have to |
@@ -1501,7 +1513,7 @@ __apicdebuginit(void) print_IO_APIC(void) | |||
1501 | raw_spin_unlock_irqrestore(&ioapic_lock, flags); | 1513 | raw_spin_unlock_irqrestore(&ioapic_lock, flags); |
1502 | 1514 | ||
1503 | printk("\n"); | 1515 | printk("\n"); |
1504 | printk(KERN_DEBUG "IO APIC #%d......\n", mp_ioapics[apic].apicid); | 1516 | printk(KERN_DEBUG "IO APIC #%d......\n", mpc_ioapic_id(apic)); |
1505 | printk(KERN_DEBUG ".... register #00: %08X\n", reg_00.raw); | 1517 | printk(KERN_DEBUG ".... register #00: %08X\n", reg_00.raw); |
1506 | printk(KERN_DEBUG "....... : physical APIC id: %02X\n", reg_00.bits.ID); | 1518 | printk(KERN_DEBUG "....... : physical APIC id: %02X\n", reg_00.bits.ID); |
1507 | printk(KERN_DEBUG "....... : Delivery Type: %X\n", reg_00.bits.delivery_type); | 1519 | printk(KERN_DEBUG "....... : Delivery Type: %X\n", reg_00.bits.delivery_type); |
@@ -1919,14 +1931,14 @@ void __init setup_ioapic_ids_from_mpc_nocheck(void) | |||
1919 | reg_00.raw = io_apic_read(apic_id, 0); | 1931 | reg_00.raw = io_apic_read(apic_id, 0); |
1920 | raw_spin_unlock_irqrestore(&ioapic_lock, flags); | 1932 | raw_spin_unlock_irqrestore(&ioapic_lock, flags); |
1921 | 1933 | ||
1922 | old_id = mp_ioapics[apic_id].apicid; | 1934 | old_id = mpc_ioapic_id(apic_id); |
1923 | 1935 | ||
1924 | if (mp_ioapics[apic_id].apicid >= get_physical_broadcast()) { | 1936 | if (mpc_ioapic_id(apic_id) >= get_physical_broadcast()) { |
1925 | printk(KERN_ERR "BIOS bug, IO-APIC#%d ID is %d in the MPC table!...\n", | 1937 | printk(KERN_ERR "BIOS bug, IO-APIC#%d ID is %d in the MPC table!...\n", |
1926 | apic_id, mp_ioapics[apic_id].apicid); | 1938 | apic_id, mpc_ioapic_id(apic_id)); |
1927 | printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n", | 1939 | printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n", |
1928 | reg_00.bits.ID); | 1940 | reg_00.bits.ID); |
1929 | mp_ioapics[apic_id].apicid = reg_00.bits.ID; | 1941 | ioapics[apic_id].mp_config.apicid = reg_00.bits.ID; |
1930 | } | 1942 | } |
1931 | 1943 | ||
1932 | /* | 1944 | /* |
@@ -1935,9 +1947,9 @@ void __init setup_ioapic_ids_from_mpc_nocheck(void) | |||
1935 | * 'stuck on smp_invalidate_needed IPI wait' messages. | 1947 | * 'stuck on smp_invalidate_needed IPI wait' messages. |
1936 | */ | 1948 | */ |
1937 | if (apic->check_apicid_used(&phys_id_present_map, | 1949 | if (apic->check_apicid_used(&phys_id_present_map, |
1938 | mp_ioapics[apic_id].apicid)) { | 1950 | mpc_ioapic_id(apic_id))) { |
1939 | printk(KERN_ERR "BIOS bug, IO-APIC#%d ID %d is already used!...\n", | 1951 | printk(KERN_ERR "BIOS bug, IO-APIC#%d ID %d is already used!...\n", |
1940 | apic_id, mp_ioapics[apic_id].apicid); | 1952 | apic_id, mpc_ioapic_id(apic_id)); |
1941 | for (i = 0; i < get_physical_broadcast(); i++) | 1953 | for (i = 0; i < get_physical_broadcast(); i++) |
1942 | if (!physid_isset(i, phys_id_present_map)) | 1954 | if (!physid_isset(i, phys_id_present_map)) |
1943 | break; | 1955 | break; |
@@ -1946,13 +1958,14 @@ void __init setup_ioapic_ids_from_mpc_nocheck(void) | |||
1946 | printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n", | 1958 | printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n", |
1947 | i); | 1959 | i); |
1948 | physid_set(i, phys_id_present_map); | 1960 | physid_set(i, phys_id_present_map); |
1949 | mp_ioapics[apic_id].apicid = i; | 1961 | ioapics[apic_id].mp_config.apicid = i; |
1950 | } else { | 1962 | } else { |
1951 | physid_mask_t tmp; | 1963 | physid_mask_t tmp; |
1952 | apic->apicid_to_cpu_present(mp_ioapics[apic_id].apicid, &tmp); | 1964 | apic->apicid_to_cpu_present(mpc_ioapic_id(apic_id), |
1965 | &tmp); | ||
1953 | apic_printk(APIC_VERBOSE, "Setting %d in the " | 1966 | apic_printk(APIC_VERBOSE, "Setting %d in the " |
1954 | "phys_id_present_map\n", | 1967 | "phys_id_present_map\n", |
1955 | mp_ioapics[apic_id].apicid); | 1968 | mpc_ioapic_id(apic_id)); |
1956 | physids_or(phys_id_present_map, phys_id_present_map, tmp); | 1969 | physids_or(phys_id_present_map, phys_id_present_map, tmp); |
1957 | } | 1970 | } |
1958 | 1971 | ||
@@ -1960,24 +1973,24 @@ void __init setup_ioapic_ids_from_mpc_nocheck(void) | |||
1960 | * We need to adjust the IRQ routing table | 1973 | * We need to adjust the IRQ routing table |
1961 | * if the ID changed. | 1974 | * if the ID changed. |
1962 | */ | 1975 | */ |
1963 | if (old_id != mp_ioapics[apic_id].apicid) | 1976 | if (old_id != mpc_ioapic_id(apic_id)) |
1964 | for (i = 0; i < mp_irq_entries; i++) | 1977 | for (i = 0; i < mp_irq_entries; i++) |
1965 | if (mp_irqs[i].dstapic == old_id) | 1978 | if (mp_irqs[i].dstapic == old_id) |
1966 | mp_irqs[i].dstapic | 1979 | mp_irqs[i].dstapic |
1967 | = mp_ioapics[apic_id].apicid; | 1980 | = mpc_ioapic_id(apic_id); |
1968 | 1981 | ||
1969 | /* | 1982 | /* |
1970 | * Update the ID register according to the right value | 1983 | * Update the ID register according to the right value |
1971 | * from the MPC table if they are different. | 1984 | * from the MPC table if they are different. |
1972 | */ | 1985 | */ |
1973 | if (mp_ioapics[apic_id].apicid == reg_00.bits.ID) | 1986 | if (mpc_ioapic_id(apic_id) == reg_00.bits.ID) |
1974 | continue; | 1987 | continue; |
1975 | 1988 | ||
1976 | apic_printk(APIC_VERBOSE, KERN_INFO | 1989 | apic_printk(APIC_VERBOSE, KERN_INFO |
1977 | "...changing IO-APIC physical APIC ID to %d ...", | 1990 | "...changing IO-APIC physical APIC ID to %d ...", |
1978 | mp_ioapics[apic_id].apicid); | 1991 | mpc_ioapic_id(apic_id)); |
1979 | 1992 | ||
1980 | reg_00.bits.ID = mp_ioapics[apic_id].apicid; | 1993 | reg_00.bits.ID = mpc_ioapic_id(apic_id); |
1981 | raw_spin_lock_irqsave(&ioapic_lock, flags); | 1994 | raw_spin_lock_irqsave(&ioapic_lock, flags); |
1982 | io_apic_write(apic_id, 0, reg_00.raw); | 1995 | io_apic_write(apic_id, 0, reg_00.raw); |
1983 | raw_spin_unlock_irqrestore(&ioapic_lock, flags); | 1996 | raw_spin_unlock_irqrestore(&ioapic_lock, flags); |
@@ -1988,7 +2001,7 @@ void __init setup_ioapic_ids_from_mpc_nocheck(void) | |||
1988 | raw_spin_lock_irqsave(&ioapic_lock, flags); | 2001 | raw_spin_lock_irqsave(&ioapic_lock, flags); |
1989 | reg_00.raw = io_apic_read(apic_id, 0); | 2002 | reg_00.raw = io_apic_read(apic_id, 0); |
1990 | raw_spin_unlock_irqrestore(&ioapic_lock, flags); | 2003 | raw_spin_unlock_irqrestore(&ioapic_lock, flags); |
1991 | if (reg_00.bits.ID != mp_ioapics[apic_id].apicid) | 2004 | if (reg_00.bits.ID != mpc_ioapic_id(apic_id)) |
1992 | printk("could not set ID!\n"); | 2005 | printk("could not set ID!\n"); |
1993 | else | 2006 | else |
1994 | apic_printk(APIC_VERBOSE, " ok.\n"); | 2007 | apic_printk(APIC_VERBOSE, " ok.\n"); |
@@ -2374,7 +2387,7 @@ static void eoi_ioapic_irq(unsigned int irq, struct irq_cfg *cfg) | |||
2374 | 2387 | ||
2375 | raw_spin_lock_irqsave(&ioapic_lock, flags); | 2388 | raw_spin_lock_irqsave(&ioapic_lock, flags); |
2376 | for_each_irq_pin(entry, cfg->irq_2_pin) { | 2389 | for_each_irq_pin(entry, cfg->irq_2_pin) { |
2377 | if (mp_ioapics[entry->apic].apicver >= 0x20) { | 2390 | if (mpc_ioapic_ver(entry->apic) >= 0x20) { |
2378 | /* | 2391 | /* |
2379 | * Intr-remapping uses pin number as the virtual vector | 2392 | * Intr-remapping uses pin number as the virtual vector |
2380 | * in the RTE. Actual vector is programmed in | 2393 | * in the RTE. Actual vector is programmed in |
@@ -2896,8 +2909,8 @@ static void resume_ioapic_id(int ioapic_id) | |||
2896 | 2909 | ||
2897 | raw_spin_lock_irqsave(&ioapic_lock, flags); | 2910 | raw_spin_lock_irqsave(&ioapic_lock, flags); |
2898 | reg_00.raw = io_apic_read(ioapic_id, 0); | 2911 | reg_00.raw = io_apic_read(ioapic_id, 0); |
2899 | if (reg_00.bits.ID != mp_ioapics[ioapic_id].apicid) { | 2912 | if (reg_00.bits.ID != mpc_ioapic_id(ioapic_id)) { |
2900 | reg_00.bits.ID = mp_ioapics[ioapic_id].apicid; | 2913 | reg_00.bits.ID = mpc_ioapic_id(ioapic_id); |
2901 | io_apic_write(ioapic_id, 0, reg_00.raw); | 2914 | io_apic_write(ioapic_id, 0, reg_00.raw); |
2902 | } | 2915 | } |
2903 | raw_spin_unlock_irqrestore(&ioapic_lock, flags); | 2916 | raw_spin_unlock_irqrestore(&ioapic_lock, flags); |
@@ -3524,7 +3537,7 @@ int io_apic_setup_irq_pin_once(unsigned int irq, int node, | |||
3524 | /* Avoid redundant programming */ | 3537 | /* Avoid redundant programming */ |
3525 | if (test_bit(pin, mp_ioapic_routing[id].pin_programmed)) { | 3538 | if (test_bit(pin, mp_ioapic_routing[id].pin_programmed)) { |
3526 | pr_debug("Pin %d-%d already programmed\n", | 3539 | pr_debug("Pin %d-%d already programmed\n", |
3527 | mp_ioapics[id].apicid, pin); | 3540 | mpc_ioapic_id(id), pin); |
3528 | return 0; | 3541 | return 0; |
3529 | } | 3542 | } |
3530 | ret = io_apic_setup_irq_pin(irq, node, attr); | 3543 | ret = io_apic_setup_irq_pin(irq, node, attr); |
@@ -3694,8 +3707,7 @@ static u8 __init io_apic_unique_id(u8 id) | |||
3694 | 3707 | ||
3695 | bitmap_zero(used, 256); | 3708 | bitmap_zero(used, 256); |
3696 | for (i = 0; i < nr_ioapics; i++) { | 3709 | for (i = 0; i < nr_ioapics; i++) { |
3697 | struct mpc_ioapic *ia = &mp_ioapics[i]; | 3710 | __set_bit(mpc_ioapic_id(i), used); |
3698 | __set_bit(ia->apicid, used); | ||
3699 | } | 3711 | } |
3700 | if (!test_bit(id, used)) | 3712 | if (!test_bit(id, used)) |
3701 | return id; | 3713 | return id; |
@@ -3826,7 +3838,7 @@ void __init ioapic_and_gsi_init(void) | |||
3826 | ioapic_res = ioapic_setup_resources(nr_ioapics); | 3838 | ioapic_res = ioapic_setup_resources(nr_ioapics); |
3827 | for (i = 0; i < nr_ioapics; i++) { | 3839 | for (i = 0; i < nr_ioapics; i++) { |
3828 | if (smp_found_config) { | 3840 | if (smp_found_config) { |
3829 | ioapic_phys = mp_ioapics[i].apicaddr; | 3841 | ioapic_phys = mpc_ioapic_addr(i); |
3830 | #ifdef CONFIG_X86_32 | 3842 | #ifdef CONFIG_X86_32 |
3831 | if (!ioapic_phys) { | 3843 | if (!ioapic_phys) { |
3832 | printk(KERN_ERR | 3844 | printk(KERN_ERR |
@@ -3930,13 +3942,13 @@ void __init mp_register_ioapic(int id, u32 address, u32 gsi_base) | |||
3930 | 3942 | ||
3931 | idx = nr_ioapics; | 3943 | idx = nr_ioapics; |
3932 | 3944 | ||
3933 | mp_ioapics[idx].type = MP_IOAPIC; | 3945 | ioapics[idx].mp_config.type = MP_IOAPIC; |
3934 | mp_ioapics[idx].flags = MPC_APIC_USABLE; | 3946 | ioapics[idx].mp_config.flags = MPC_APIC_USABLE; |
3935 | mp_ioapics[idx].apicaddr = address; | 3947 | ioapics[idx].mp_config.apicaddr = address; |
3936 | 3948 | ||
3937 | set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address); | 3949 | set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address); |
3938 | mp_ioapics[idx].apicid = io_apic_unique_id(id); | 3950 | ioapics[idx].mp_config.apicid = io_apic_unique_id(id); |
3939 | mp_ioapics[idx].apicver = io_apic_get_version(idx); | 3951 | ioapics[idx].mp_config.apicver = io_apic_get_version(idx); |
3940 | 3952 | ||
3941 | /* | 3953 | /* |
3942 | * Build basic GSI lookup table to facilitate gsi->io_apic lookups | 3954 | * Build basic GSI lookup table to facilitate gsi->io_apic lookups |
@@ -3955,8 +3967,8 @@ void __init mp_register_ioapic(int id, u32 address, u32 gsi_base) | |||
3955 | gsi_top = mp_gsi_routing[idx].gsi_end + 1; | 3967 | gsi_top = mp_gsi_routing[idx].gsi_end + 1; |
3956 | 3968 | ||
3957 | printk(KERN_INFO "IOAPIC[%d]: apic_id %d, version %d, address 0x%x, " | 3969 | printk(KERN_INFO "IOAPIC[%d]: apic_id %d, version %d, address 0x%x, " |
3958 | "GSI %d-%d\n", idx, mp_ioapics[idx].apicid, | 3970 | "GSI %d-%d\n", idx, mpc_ioapic_id(idx), |
3959 | mp_ioapics[idx].apicver, mp_ioapics[idx].apicaddr, | 3971 | mpc_ioapic_ver(idx), mpc_ioapic_addr(idx), |
3960 | mp_gsi_routing[idx].gsi_base, mp_gsi_routing[idx].gsi_end); | 3972 | mp_gsi_routing[idx].gsi_base, mp_gsi_routing[idx].gsi_end); |
3961 | 3973 | ||
3962 | nr_ioapics++; | 3974 | nr_ioapics++; |
diff --git a/arch/x86/kernel/devicetree.c b/arch/x86/kernel/devicetree.c index e90f08458e6b..f06494e93760 100644 --- a/arch/x86/kernel/devicetree.c +++ b/arch/x86/kernel/devicetree.c | |||
@@ -407,7 +407,7 @@ static void __init ioapic_add_ofnode(struct device_node *np) | |||
407 | } | 407 | } |
408 | 408 | ||
409 | for (i = 0; i < nr_ioapics; i++) { | 409 | for (i = 0; i < nr_ioapics; i++) { |
410 | if (r.start == mp_ioapics[i].apicaddr) { | 410 | if (r.start == mpc_ioapic_addr(i)) { |
411 | struct irq_domain *id; | 411 | struct irq_domain *id; |
412 | 412 | ||
413 | id = kzalloc(sizeof(*id), GFP_KERNEL); | 413 | id = kzalloc(sizeof(*id), GFP_KERNEL); |
diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c index 6f9bfffb2720..9103b89c145a 100644 --- a/arch/x86/kernel/mpparse.c +++ b/arch/x86/kernel/mpparse.c | |||
@@ -285,7 +285,7 @@ static void __init construct_default_ioirq_mptable(int mpc_default_type) | |||
285 | intsrc.type = MP_INTSRC; | 285 | intsrc.type = MP_INTSRC; |
286 | intsrc.irqflag = 0; /* conforming */ | 286 | intsrc.irqflag = 0; /* conforming */ |
287 | intsrc.srcbus = 0; | 287 | intsrc.srcbus = 0; |
288 | intsrc.dstapic = mp_ioapics[0].apicid; | 288 | intsrc.dstapic = mpc_ioapic_id(0); |
289 | 289 | ||
290 | intsrc.irqtype = mp_INT; | 290 | intsrc.irqtype = mp_INT; |
291 | 291 | ||