aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/io_apic.c
diff options
context:
space:
mode:
authorJaswinder Singh Rajput <jaswinderrajput@gmail.com>2009-01-12 07:16:17 -0500
committerIngo Molnar <mingo@elte.hu>2009-01-14 05:58:27 -0500
commitb5ba7e6d1e7e2ac808afd21be1e56dc34caf20e6 (patch)
treec9c0b8fcf2cb12a639b63c3060028d89d3a265ca /arch/x86/kernel/io_apic.c
parent3b9dc9f2f123286aaade54c45fef6723d587c664 (diff)
x86: replacing mp_config_ioapic with mpc_ioapic
Impact: cleanup, solve 80 columns wrap problems Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/io_apic.c')
-rw-r--r--arch/x86/kernel/io_apic.c60
1 files changed, 29 insertions, 31 deletions
diff --git a/arch/x86/kernel/io_apic.c b/arch/x86/kernel/io_apic.c
index 109c91db202..6c51ecdfbf4 100644
--- a/arch/x86/kernel/io_apic.c
+++ b/arch/x86/kernel/io_apic.c
@@ -83,7 +83,7 @@ static DEFINE_SPINLOCK(vector_lock);
83int nr_ioapic_registers[MAX_IO_APICS]; 83int nr_ioapic_registers[MAX_IO_APICS];
84 84
85/* I/O APIC entries */ 85/* I/O APIC entries */
86struct mp_config_ioapic mp_ioapics[MAX_IO_APICS]; 86struct mpc_ioapic mp_ioapics[MAX_IO_APICS];
87int nr_ioapics; 87int nr_ioapics;
88 88
89/* MP IRQ source entries */ 89/* MP IRQ source entries */
@@ -387,7 +387,7 @@ struct io_apic {
387static __attribute_const__ struct io_apic __iomem *io_apic_base(int idx) 387static __attribute_const__ struct io_apic __iomem *io_apic_base(int idx)
388{ 388{
389 return (void __iomem *) __fix_to_virt(FIX_IO_APIC_BASE_0 + idx) 389 return (void __iomem *) __fix_to_virt(FIX_IO_APIC_BASE_0 + idx)
390 + (mp_ioapics[idx].mp_apicaddr & ~PAGE_MASK); 390 + (mp_ioapics[idx].apicaddr & ~PAGE_MASK);
391} 391}
392 392
393static inline unsigned int io_apic_read(unsigned int apic, unsigned int reg) 393static inline unsigned int io_apic_read(unsigned int apic, unsigned int reg)
@@ -946,7 +946,7 @@ static int find_irq_entry(int apic, int pin, int type)
946 946
947 for (i = 0; i < mp_irq_entries; i++) 947 for (i = 0; i < mp_irq_entries; i++)
948 if (mp_irqs[i].mp_irqtype == type && 948 if (mp_irqs[i].mp_irqtype == type &&
949 (mp_irqs[i].mp_dstapic == mp_ioapics[apic].mp_apicid || 949 (mp_irqs[i].mp_dstapic == mp_ioapics[apic].apicid ||
950 mp_irqs[i].mp_dstapic == MP_APIC_ALL) && 950 mp_irqs[i].mp_dstapic == MP_APIC_ALL) &&
951 mp_irqs[i].mp_dstirq == pin) 951 mp_irqs[i].mp_dstirq == pin)
952 return i; 952 return i;
@@ -988,7 +988,7 @@ static int __init find_isa_irq_apic(int irq, int type)
988 if (i < mp_irq_entries) { 988 if (i < mp_irq_entries) {
989 int apic; 989 int apic;
990 for(apic = 0; apic < nr_ioapics; apic++) { 990 for(apic = 0; apic < nr_ioapics; apic++) {
991 if (mp_ioapics[apic].mp_apicid == mp_irqs[i].mp_dstapic) 991 if (mp_ioapics[apic].apicid == mp_irqs[i].mp_dstapic)
992 return apic; 992 return apic;
993 } 993 }
994 } 994 }
@@ -1016,7 +1016,7 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin)
1016 int lbus = mp_irqs[i].mp_srcbus; 1016 int lbus = mp_irqs[i].mp_srcbus;
1017 1017
1018 for (apic = 0; apic < nr_ioapics; apic++) 1018 for (apic = 0; apic < nr_ioapics; apic++)
1019 if (mp_ioapics[apic].mp_apicid == mp_irqs[i].mp_dstapic || 1019 if (mp_ioapics[apic].apicid == mp_irqs[i].mp_dstapic ||
1020 mp_irqs[i].mp_dstapic == MP_APIC_ALL) 1020 mp_irqs[i].mp_dstapic == MP_APIC_ALL)
1021 break; 1021 break;
1022 1022
@@ -1567,14 +1567,14 @@ static void setup_IO_APIC_irq(int apic, int pin, unsigned int irq, struct irq_de
1567 apic_printk(APIC_VERBOSE,KERN_DEBUG 1567 apic_printk(APIC_VERBOSE,KERN_DEBUG
1568 "IOAPIC[%d]: Set routing entry (%d-%d -> 0x%x -> " 1568 "IOAPIC[%d]: Set routing entry (%d-%d -> 0x%x -> "
1569 "IRQ %d Mode:%i Active:%i)\n", 1569 "IRQ %d Mode:%i Active:%i)\n",
1570 apic, mp_ioapics[apic].mp_apicid, pin, cfg->vector, 1570 apic, mp_ioapics[apic].apicid, pin, cfg->vector,
1571 irq, trigger, polarity); 1571 irq, trigger, polarity);
1572 1572
1573 1573
1574 if (setup_ioapic_entry(mp_ioapics[apic].mp_apicid, irq, &entry, 1574 if (setup_ioapic_entry(mp_ioapics[apic].apicid, irq, &entry,
1575 dest, trigger, polarity, cfg->vector)) { 1575 dest, trigger, polarity, cfg->vector)) {
1576 printk("Failed to setup ioapic entry for ioapic %d, pin %d\n", 1576 printk("Failed to setup ioapic entry for ioapic %d, pin %d\n",
1577 mp_ioapics[apic].mp_apicid, pin); 1577 mp_ioapics[apic].apicid, pin);
1578 __clear_irq_vector(irq, cfg); 1578 __clear_irq_vector(irq, cfg);
1579 return; 1579 return;
1580 } 1580 }
@@ -1605,12 +1605,10 @@ static void __init setup_IO_APIC_irqs(void)
1605 notcon = 1; 1605 notcon = 1;
1606 apic_printk(APIC_VERBOSE, 1606 apic_printk(APIC_VERBOSE,
1607 KERN_DEBUG " %d-%d", 1607 KERN_DEBUG " %d-%d",
1608 mp_ioapics[apic].mp_apicid, 1608 mp_ioapics[apic].apicid, pin);
1609 pin);
1610 } else 1609 } else
1611 apic_printk(APIC_VERBOSE, " %d-%d", 1610 apic_printk(APIC_VERBOSE, " %d-%d",
1612 mp_ioapics[apic].mp_apicid, 1611 mp_ioapics[apic].apicid, pin);
1613 pin);
1614 continue; 1612 continue;
1615 } 1613 }
1616 if (notcon) { 1614 if (notcon) {
@@ -1700,7 +1698,7 @@ __apicdebuginit(void) print_IO_APIC(void)
1700 printk(KERN_DEBUG "number of MP IRQ sources: %d.\n", mp_irq_entries); 1698 printk(KERN_DEBUG "number of MP IRQ sources: %d.\n", mp_irq_entries);
1701 for (i = 0; i < nr_ioapics; i++) 1699 for (i = 0; i < nr_ioapics; i++)
1702 printk(KERN_DEBUG "number of IO-APIC #%d registers: %d.\n", 1700 printk(KERN_DEBUG "number of IO-APIC #%d registers: %d.\n",
1703 mp_ioapics[i].mp_apicid, nr_ioapic_registers[i]); 1701 mp_ioapics[i].apicid, nr_ioapic_registers[i]);
1704 1702
1705 /* 1703 /*
1706 * We are a bit conservative about what we expect. We have to 1704 * We are a bit conservative about what we expect. We have to
@@ -1720,7 +1718,7 @@ __apicdebuginit(void) print_IO_APIC(void)
1720 spin_unlock_irqrestore(&ioapic_lock, flags); 1718 spin_unlock_irqrestore(&ioapic_lock, flags);
1721 1719
1722 printk("\n"); 1720 printk("\n");
1723 printk(KERN_DEBUG "IO APIC #%d......\n", mp_ioapics[apic].mp_apicid); 1721 printk(KERN_DEBUG "IO APIC #%d......\n", mp_ioapics[apic].apicid);
1724 printk(KERN_DEBUG ".... register #00: %08X\n", reg_00.raw); 1722 printk(KERN_DEBUG ".... register #00: %08X\n", reg_00.raw);
1725 printk(KERN_DEBUG "....... : physical APIC id: %02X\n", reg_00.bits.ID); 1723 printk(KERN_DEBUG "....... : physical APIC id: %02X\n", reg_00.bits.ID);
1726 printk(KERN_DEBUG "....... : Delivery Type: %X\n", reg_00.bits.delivery_type); 1724 printk(KERN_DEBUG "....... : Delivery Type: %X\n", reg_00.bits.delivery_type);
@@ -2122,14 +2120,14 @@ static void __init setup_ioapic_ids_from_mpc(void)
2122 reg_00.raw = io_apic_read(apic, 0); 2120 reg_00.raw = io_apic_read(apic, 0);
2123 spin_unlock_irqrestore(&ioapic_lock, flags); 2121 spin_unlock_irqrestore(&ioapic_lock, flags);
2124 2122
2125 old_id = mp_ioapics[apic].mp_apicid; 2123 old_id = mp_ioapics[apic].apicid;
2126 2124
2127 if (mp_ioapics[apic].mp_apicid >= get_physical_broadcast()) { 2125 if (mp_ioapics[apic].apicid >= get_physical_broadcast()) {
2128 printk(KERN_ERR "BIOS bug, IO-APIC#%d ID is %d in the MPC table!...\n", 2126 printk(KERN_ERR "BIOS bug, IO-APIC#%d ID is %d in the MPC table!...\n",
2129 apic, mp_ioapics[apic].mp_apicid); 2127 apic, mp_ioapics[apic].apicid);
2130 printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n", 2128 printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n",
2131 reg_00.bits.ID); 2129 reg_00.bits.ID);
2132 mp_ioapics[apic].mp_apicid = reg_00.bits.ID; 2130 mp_ioapics[apic].apicid = reg_00.bits.ID;
2133 } 2131 }
2134 2132
2135 /* 2133 /*
@@ -2138,9 +2136,9 @@ static void __init setup_ioapic_ids_from_mpc(void)
2138 * 'stuck on smp_invalidate_needed IPI wait' messages. 2136 * 'stuck on smp_invalidate_needed IPI wait' messages.
2139 */ 2137 */
2140 if (check_apicid_used(phys_id_present_map, 2138 if (check_apicid_used(phys_id_present_map,
2141 mp_ioapics[apic].mp_apicid)) { 2139 mp_ioapics[apic].apicid)) {
2142 printk(KERN_ERR "BIOS bug, IO-APIC#%d ID %d is already used!...\n", 2140 printk(KERN_ERR "BIOS bug, IO-APIC#%d ID %d is already used!...\n",
2143 apic, mp_ioapics[apic].mp_apicid); 2141 apic, mp_ioapics[apic].apicid);
2144 for (i = 0; i < get_physical_broadcast(); i++) 2142 for (i = 0; i < get_physical_broadcast(); i++)
2145 if (!physid_isset(i, phys_id_present_map)) 2143 if (!physid_isset(i, phys_id_present_map))
2146 break; 2144 break;
@@ -2149,13 +2147,13 @@ static void __init setup_ioapic_ids_from_mpc(void)
2149 printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n", 2147 printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n",
2150 i); 2148 i);
2151 physid_set(i, phys_id_present_map); 2149 physid_set(i, phys_id_present_map);
2152 mp_ioapics[apic].mp_apicid = i; 2150 mp_ioapics[apic].apicid = i;
2153 } else { 2151 } else {
2154 physid_mask_t tmp; 2152 physid_mask_t tmp;
2155 tmp = apicid_to_cpu_present(mp_ioapics[apic].mp_apicid); 2153 tmp = apicid_to_cpu_present(mp_ioapics[apic].apicid);
2156 apic_printk(APIC_VERBOSE, "Setting %d in the " 2154 apic_printk(APIC_VERBOSE, "Setting %d in the "
2157 "phys_id_present_map\n", 2155 "phys_id_present_map\n",
2158 mp_ioapics[apic].mp_apicid); 2156 mp_ioapics[apic].apicid);
2159 physids_or(phys_id_present_map, phys_id_present_map, tmp); 2157 physids_or(phys_id_present_map, phys_id_present_map, tmp);
2160 } 2158 }
2161 2159
@@ -2164,11 +2162,11 @@ static void __init setup_ioapic_ids_from_mpc(void)
2164 * We need to adjust the IRQ routing table 2162 * We need to adjust the IRQ routing table
2165 * if the ID changed. 2163 * if the ID changed.
2166 */ 2164 */
2167 if (old_id != mp_ioapics[apic].mp_apicid) 2165 if (old_id != mp_ioapics[apic].apicid)
2168 for (i = 0; i < mp_irq_entries; i++) 2166 for (i = 0; i < mp_irq_entries; i++)
2169 if (mp_irqs[i].mp_dstapic == old_id) 2167 if (mp_irqs[i].mp_dstapic == old_id)
2170 mp_irqs[i].mp_dstapic 2168 mp_irqs[i].mp_dstapic
2171 = mp_ioapics[apic].mp_apicid; 2169 = mp_ioapics[apic].apicid;
2172 2170
2173 /* 2171 /*
2174 * Read the right value from the MPC table and 2172 * Read the right value from the MPC table and
@@ -2176,9 +2174,9 @@ static void __init setup_ioapic_ids_from_mpc(void)
2176 */ 2174 */
2177 apic_printk(APIC_VERBOSE, KERN_INFO 2175 apic_printk(APIC_VERBOSE, KERN_INFO
2178 "...changing IO-APIC physical APIC ID to %d ...", 2176 "...changing IO-APIC physical APIC ID to %d ...",
2179 mp_ioapics[apic].mp_apicid); 2177 mp_ioapics[apic].apicid);
2180 2178
2181 reg_00.bits.ID = mp_ioapics[apic].mp_apicid; 2179 reg_00.bits.ID = mp_ioapics[apic].apicid;
2182 spin_lock_irqsave(&ioapic_lock, flags); 2180 spin_lock_irqsave(&ioapic_lock, flags);
2183 io_apic_write(apic, 0, reg_00.raw); 2181 io_apic_write(apic, 0, reg_00.raw);
2184 spin_unlock_irqrestore(&ioapic_lock, flags); 2182 spin_unlock_irqrestore(&ioapic_lock, flags);
@@ -2189,7 +2187,7 @@ static void __init setup_ioapic_ids_from_mpc(void)
2189 spin_lock_irqsave(&ioapic_lock, flags); 2187 spin_lock_irqsave(&ioapic_lock, flags);
2190 reg_00.raw = io_apic_read(apic, 0); 2188 reg_00.raw = io_apic_read(apic, 0);
2191 spin_unlock_irqrestore(&ioapic_lock, flags); 2189 spin_unlock_irqrestore(&ioapic_lock, flags);
2192 if (reg_00.bits.ID != mp_ioapics[apic].mp_apicid) 2190 if (reg_00.bits.ID != mp_ioapics[apic].apicid)
2193 printk("could not set ID!\n"); 2191 printk("could not set ID!\n");
2194 else 2192 else
2195 apic_printk(APIC_VERBOSE, " ok.\n"); 2193 apic_printk(APIC_VERBOSE, " ok.\n");
@@ -3118,8 +3116,8 @@ static int ioapic_resume(struct sys_device *dev)
3118 3116
3119 spin_lock_irqsave(&ioapic_lock, flags); 3117 spin_lock_irqsave(&ioapic_lock, flags);
3120 reg_00.raw = io_apic_read(dev->id, 0); 3118 reg_00.raw = io_apic_read(dev->id, 0);
3121 if (reg_00.bits.ID != mp_ioapics[dev->id].mp_apicid) { 3119 if (reg_00.bits.ID != mp_ioapics[dev->id].apicid) {
3122 reg_00.bits.ID = mp_ioapics[dev->id].mp_apicid; 3120 reg_00.bits.ID = mp_ioapics[dev->id].apicid;
3123 io_apic_write(dev->id, 0, reg_00.raw); 3121 io_apic_write(dev->id, 0, reg_00.raw);
3124 } 3122 }
3125 spin_unlock_irqrestore(&ioapic_lock, flags); 3123 spin_unlock_irqrestore(&ioapic_lock, flags);
@@ -4101,7 +4099,7 @@ void __init ioapic_init_mappings(void)
4101 ioapic_res = ioapic_setup_resources(); 4099 ioapic_res = ioapic_setup_resources();
4102 for (i = 0; i < nr_ioapics; i++) { 4100 for (i = 0; i < nr_ioapics; i++) {
4103 if (smp_found_config) { 4101 if (smp_found_config) {
4104 ioapic_phys = mp_ioapics[i].mp_apicaddr; 4102 ioapic_phys = mp_ioapics[i].apicaddr;
4105#ifdef CONFIG_X86_32 4103#ifdef CONFIG_X86_32
4106 if (!ioapic_phys) { 4104 if (!ioapic_phys) {
4107 printk(KERN_ERR 4105 printk(KERN_ERR