aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2008-04-05 09:39:05 -0400
committerIngo Molnar <mingo@elte.hu>2008-04-17 11:41:36 -0400
commita2249cba2f1d7d06633de09c71353ae6b1567206 (patch)
tree33b46bd7569a90843ca5549ac8de87a984bc4f18 /arch/x86
parent9d25cb0811fd0bca2cfd80095ee7663147363f68 (diff)
x86: use ioapic_read_entry() and ioapic_write_entry()
Remove duplicate code by using ioapic_read_entry() and ioapic_write_entry() in io_apic_{32,64}.c Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kernel/io_apic_32.c10
-rw-r--r--arch/x86/kernel/io_apic_64.c25
2 files changed, 8 insertions, 27 deletions
diff --git a/arch/x86/kernel/io_apic_32.c b/arch/x86/kernel/io_apic_32.c
index db1b1f30b650..6d69de716b5e 100644
--- a/arch/x86/kernel/io_apic_32.c
+++ b/arch/x86/kernel/io_apic_32.c
@@ -1228,7 +1228,6 @@ static void __init setup_IO_APIC_irqs(void)
1228{ 1228{
1229 struct IO_APIC_route_entry entry; 1229 struct IO_APIC_route_entry entry;
1230 int apic, pin, idx, irq, first_notcon = 1, vector; 1230 int apic, pin, idx, irq, first_notcon = 1, vector;
1231 unsigned long flags;
1232 1231
1233 apic_printk(APIC_VERBOSE, KERN_DEBUG "init IO_APIC IRQs\n"); 1232 apic_printk(APIC_VERBOSE, KERN_DEBUG "init IO_APIC IRQs\n");
1234 1233
@@ -1294,9 +1293,7 @@ static void __init setup_IO_APIC_irqs(void)
1294 if (!apic && (irq < 16)) 1293 if (!apic && (irq < 16))
1295 disable_8259A_irq(irq); 1294 disable_8259A_irq(irq);
1296 } 1295 }
1297 spin_lock_irqsave(&ioapic_lock, flags); 1296 ioapic_write_entry(apic, pin, entry);
1298 __ioapic_write_entry(apic, pin, entry);
1299 spin_unlock_irqrestore(&ioapic_lock, flags);
1300 } 1297 }
1301 } 1298 }
1302 1299
@@ -2760,7 +2757,6 @@ int __init io_apic_get_redir_entries (int ioapic)
2760int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int active_high_low) 2757int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int active_high_low)
2761{ 2758{
2762 struct IO_APIC_route_entry entry; 2759 struct IO_APIC_route_entry entry;
2763 unsigned long flags;
2764 2760
2765 if (!IO_APIC_IRQ(irq)) { 2761 if (!IO_APIC_IRQ(irq)) {
2766 printk(KERN_ERR "IOAPIC[%d]: Invalid reference to IRQ 0\n", 2762 printk(KERN_ERR "IOAPIC[%d]: Invalid reference to IRQ 0\n",
@@ -2801,9 +2797,7 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int a
2801 if (!ioapic && (irq < 16)) 2797 if (!ioapic && (irq < 16))
2802 disable_8259A_irq(irq); 2798 disable_8259A_irq(irq);
2803 2799
2804 spin_lock_irqsave(&ioapic_lock, flags); 2800 ioapic_write_entry(ioapic, pin, entry);
2805 __ioapic_write_entry(ioapic, pin, entry);
2806 spin_unlock_irqrestore(&ioapic_lock, flags);
2807 2801
2808 return 0; 2802 return 0;
2809} 2803}
diff --git a/arch/x86/kernel/io_apic_64.c b/arch/x86/kernel/io_apic_64.c
index cd01f3aa17ba..6e383e126db2 100644
--- a/arch/x86/kernel/io_apic_64.c
+++ b/arch/x86/kernel/io_apic_64.c
@@ -917,9 +917,8 @@ static void __init setup_IO_APIC_irqs(void)
917static void __init setup_ExtINT_IRQ0_pin(unsigned int apic, unsigned int pin, int vector) 917static void __init setup_ExtINT_IRQ0_pin(unsigned int apic, unsigned int pin, int vector)
918{ 918{
919 struct IO_APIC_route_entry entry; 919 struct IO_APIC_route_entry entry;
920 unsigned long flags;
921 920
922 memset(&entry,0,sizeof(entry)); 921 memset(&entry, 0, sizeof(entry));
923 922
924 disable_8259A_irq(0); 923 disable_8259A_irq(0);
925 924
@@ -947,10 +946,7 @@ static void __init setup_ExtINT_IRQ0_pin(unsigned int apic, unsigned int pin, in
947 /* 946 /*
948 * Add it to the IO-APIC irq-routing table: 947 * Add it to the IO-APIC irq-routing table:
949 */ 948 */
950 spin_lock_irqsave(&ioapic_lock, flags); 949 ioapic_write_entry(apic, pin, entry);
951 io_apic_write(apic, 0x11+2*pin, *(((int *)&entry)+1));
952 io_apic_write(apic, 0x10+2*pin, *(((int *)&entry)+0));
953 spin_unlock_irqrestore(&ioapic_lock, flags);
954 950
955 enable_8259A_irq(0); 951 enable_8259A_irq(0);
956} 952}
@@ -1611,17 +1607,14 @@ static inline void unlock_ExtINT_logic(void)
1611 int apic, pin, i; 1607 int apic, pin, i;
1612 struct IO_APIC_route_entry entry0, entry1; 1608 struct IO_APIC_route_entry entry0, entry1;
1613 unsigned char save_control, save_freq_select; 1609 unsigned char save_control, save_freq_select;
1614 unsigned long flags;
1615 1610
1616 pin = find_isa_irq_pin(8, mp_INT); 1611 pin = find_isa_irq_pin(8, mp_INT);
1617 apic = find_isa_irq_apic(8, mp_INT); 1612 apic = find_isa_irq_apic(8, mp_INT);
1618 if (pin == -1) 1613 if (pin == -1)
1619 return; 1614 return;
1620 1615
1621 spin_lock_irqsave(&ioapic_lock, flags); 1616 entry0 = ioapic_read_entry(apic, pin);
1622 *(((int *)&entry0) + 1) = io_apic_read(apic, 0x11 + 2 * pin); 1617
1623 *(((int *)&entry0) + 0) = io_apic_read(apic, 0x10 + 2 * pin);
1624 spin_unlock_irqrestore(&ioapic_lock, flags);
1625 clear_IO_APIC_pin(apic, pin); 1618 clear_IO_APIC_pin(apic, pin);
1626 1619
1627 memset(&entry1, 0, sizeof(entry1)); 1620 memset(&entry1, 0, sizeof(entry1));
@@ -1634,10 +1627,7 @@ static inline void unlock_ExtINT_logic(void)
1634 entry1.trigger = 0; 1627 entry1.trigger = 0;
1635 entry1.vector = 0; 1628 entry1.vector = 0;
1636 1629
1637 spin_lock_irqsave(&ioapic_lock, flags); 1630 ioapic_write_entry(apic, pin, entry1);
1638 io_apic_write(apic, 0x11 + 2 * pin, *(((int *)&entry1) + 1));
1639 io_apic_write(apic, 0x10 + 2 * pin, *(((int *)&entry1) + 0));
1640 spin_unlock_irqrestore(&ioapic_lock, flags);
1641 1631
1642 save_control = CMOS_READ(RTC_CONTROL); 1632 save_control = CMOS_READ(RTC_CONTROL);
1643 save_freq_select = CMOS_READ(RTC_FREQ_SELECT); 1633 save_freq_select = CMOS_READ(RTC_FREQ_SELECT);
@@ -1656,10 +1646,7 @@ static inline void unlock_ExtINT_logic(void)
1656 CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT); 1646 CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT);
1657 clear_IO_APIC_pin(apic, pin); 1647 clear_IO_APIC_pin(apic, pin);
1658 1648
1659 spin_lock_irqsave(&ioapic_lock, flags); 1649 ioapic_write_entry(apic, pin, entry0);
1660 io_apic_write(apic, 0x11 + 2 * pin, *(((int *)&entry0) + 1));
1661 io_apic_write(apic, 0x10 + 2 * pin, *(((int *)&entry0) + 0));
1662 spin_unlock_irqrestore(&ioapic_lock, flags);
1663} 1650}
1664 1651
1665/* 1652/*