aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorYinghai Lu <yhlu.kernel@gmail.com>2008-08-19 23:50:24 -0400
committerIngo Molnar <mingo@elte.hu>2008-10-16 10:52:52 -0400
commita1420f395d7721895c05ba3dedf150294d2c0e4d (patch)
tree432c4d718ddfd3d576e38ea1dda5615bae2c69e0 /arch
parent8b8e8c1bf7275eca859fe551dfa484134eaf013b (diff)
x86: add irq_cfg for 32bit
it only contains vector ... Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kernel/io_apic_32.c71
1 files changed, 46 insertions, 25 deletions
diff --git a/arch/x86/kernel/io_apic_32.c b/arch/x86/kernel/io_apic_32.c
index 668edf226067..033ad953bee3 100644
--- a/arch/x86/kernel/io_apic_32.c
+++ b/arch/x86/kernel/io_apic_32.c
@@ -94,6 +94,43 @@ DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES);
94 94
95static int disable_timer_pin_1 __initdata; 95static int disable_timer_pin_1 __initdata;
96 96
97struct irq_cfg {
98 u8 vector;
99};
100
101
102/* irq_cfg is indexed by the sum of all RTEs in all I/O APICs. */
103static struct irq_cfg irq_cfg_legacy[] __initdata = {
104 [0] = { .vector = FIRST_DEVICE_VECTOR, },
105};
106
107static void __init init_work(void *data)
108{
109 struct dyn_array *da = data;
110 struct irq_cfg *cfg;
111 int legacy_count;
112 int i;
113
114 cfg = *da->name;
115
116 legacy_count = sizeof(irq_cfg_legacy)/sizeof(irq_cfg_legacy[0]);
117
118 BUG_ON(legacy_count > nr_irqs);
119
120 memcpy(cfg, irq_cfg_legacy, sizeof(irq_cfg_legacy));
121}
122
123static struct irq_cfg *irq_cfgx;
124DEFINE_DYN_ARRAY(irq_cfgx, sizeof(struct irq_cfg), nr_irqs, PAGE_SIZE, init_work);
125
126static struct irq_cfg *irq_cfg(unsigned int irq)
127{
128 if (irq >= nr_irqs)
129 return NULL;
130
131 return &irq_cfgx[irq];
132}
133
97/* 134/*
98 * Rough estimation of how many shared IRQs there are, can 135 * Rough estimation of how many shared IRQs there are, can
99 * be changed anytime. 136 * be changed anytime.
@@ -794,22 +831,6 @@ static inline int IO_APIC_irq_trigger(int irq)
794 return 0; 831 return 0;
795} 832}
796 833
797/* irq_vectors is indexed by the sum of all RTEs in all I/O APICs. */
798static u8 irq_vector_init_first __initdata = FIRST_DEVICE_VECTOR;
799static u8 *irq_vector;
800
801static void __init irq_vector_init_work(void *data)
802{
803 struct dyn_array *da = data;
804
805 u8 *irq_vec;
806
807 irq_vec = *da->name;
808
809 irq_vec[0] = irq_vector_init_first;
810}
811
812DEFINE_DYN_ARRAY(irq_vector, sizeof(u8), nr_irqs, PAGE_SIZE, irq_vector_init_work);
813 834
814static int __assign_irq_vector(int irq) 835static int __assign_irq_vector(int irq)
815{ 836{
@@ -818,8 +839,8 @@ static int __assign_irq_vector(int irq)
818 839
819 BUG_ON((unsigned)irq >= nr_irqs); 840 BUG_ON((unsigned)irq >= nr_irqs);
820 841
821 if (irq_vector[irq] > 0) 842 if (irq_cfg(irq)->vector > 0)
822 return irq_vector[irq]; 843 return irq_cfg(irq)->vector;
823 844
824 vector = current_vector; 845 vector = current_vector;
825 offset = current_offset; 846 offset = current_offset;
@@ -836,7 +857,7 @@ next:
836 857
837 current_vector = vector; 858 current_vector = vector;
838 current_offset = offset; 859 current_offset = offset;
839 irq_vector[irq] = vector; 860 irq_cfg(irq)->vector = vector;
840 861
841 return vector; 862 return vector;
842} 863}
@@ -1598,7 +1619,7 @@ static void ack_ioapic_quirk_irq(unsigned int irq)
1598 * operation to prevent an edge-triggered interrupt escaping meanwhile. 1619 * operation to prevent an edge-triggered interrupt escaping meanwhile.
1599 * The idea is from Manfred Spraul. --macro 1620 * The idea is from Manfred Spraul. --macro
1600 */ 1621 */
1601 i = irq_vector[irq]; 1622 i = irq_cfg(irq)->vector;
1602 1623
1603 v = apic_read(APIC_TMR + ((i & ~0x1f) >> 1)); 1624 v = apic_read(APIC_TMR + ((i & ~0x1f) >> 1));
1604 1625
@@ -1615,7 +1636,7 @@ static void ack_ioapic_quirk_irq(unsigned int irq)
1615 1636
1616static int ioapic_retrigger_irq(unsigned int irq) 1637static int ioapic_retrigger_irq(unsigned int irq)
1617{ 1638{
1618 send_IPI_self(irq_vector[irq]); 1639 send_IPI_self(irq_cfg(irq)->vector);
1619 1640
1620 return 1; 1641 return 1;
1621} 1642}
@@ -1651,7 +1672,7 @@ static inline void init_IO_APIC_traps(void)
1651 * 0x80, because int 0x80 is hm, kind of importantish. ;) 1672 * 0x80, because int 0x80 is hm, kind of importantish. ;)
1652 */ 1673 */
1653 for (irq = 0; irq < nr_irqs ; irq++) { 1674 for (irq = 0; irq < nr_irqs ; irq++) {
1654 if (IO_APIC_IRQ(irq) && !irq_vector[irq]) { 1675 if (IO_APIC_IRQ(irq) && !irq_cfg(irq)->vector) {
1655 /* 1676 /*
1656 * Hmm.. We don't have an entry for this, 1677 * Hmm.. We don't have an entry for this,
1657 * so default to an old-fashioned 8259 1678 * so default to an old-fashioned 8259
@@ -2102,7 +2123,7 @@ int create_irq(void)
2102 for (new = (nr_irqs - 1); new >= 0; new--) { 2123 for (new = (nr_irqs - 1); new >= 0; new--) {
2103 if (platform_legacy_irq(new)) 2124 if (platform_legacy_irq(new))
2104 continue; 2125 continue;
2105 if (irq_vector[new] != 0) 2126 if (irq_cfg(new)->vector != 0)
2106 continue; 2127 continue;
2107 vector = __assign_irq_vector(new); 2128 vector = __assign_irq_vector(new);
2108 if (likely(vector > 0)) 2129 if (likely(vector > 0))
@@ -2125,8 +2146,8 @@ void destroy_irq(unsigned int irq)
2125 dynamic_irq_cleanup(irq); 2146 dynamic_irq_cleanup(irq);
2126 2147
2127 spin_lock_irqsave(&vector_lock, flags); 2148 spin_lock_irqsave(&vector_lock, flags);
2128 clear_bit(irq_vector[irq], used_vectors); 2149 clear_bit(irq_cfg(irq)->vector, used_vectors);
2129 irq_vector[irq] = 0; 2150 irq_cfg(irq)->vector = 0;
2130 spin_unlock_irqrestore(&vector_lock, flags); 2151 spin_unlock_irqrestore(&vector_lock, flags);
2131} 2152}
2132 2153