Commit a1420f39 authored by Yinghai Lu's avatar Yinghai Lu Committed by Ingo Molnar

x86: add irq_cfg for 32bit

it only contains vector ...
Signed-off-by: default avatarYinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 8b8e8c1b
...@@ -94,6 +94,43 @@ DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES); ...@@ -94,6 +94,43 @@ DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES);
static int disable_timer_pin_1 __initdata; static int disable_timer_pin_1 __initdata;
struct irq_cfg {
u8 vector;
};
/* irq_cfg is indexed by the sum of all RTEs in all I/O APICs. */
static struct irq_cfg irq_cfg_legacy[] __initdata = {
[0] = { .vector = FIRST_DEVICE_VECTOR, },
};
static void __init init_work(void *data)
{
struct dyn_array *da = data;
struct irq_cfg *cfg;
int legacy_count;
int i;
cfg = *da->name;
legacy_count = sizeof(irq_cfg_legacy)/sizeof(irq_cfg_legacy[0]);
BUG_ON(legacy_count > nr_irqs);
memcpy(cfg, irq_cfg_legacy, sizeof(irq_cfg_legacy));
}
static struct irq_cfg *irq_cfgx;
DEFINE_DYN_ARRAY(irq_cfgx, sizeof(struct irq_cfg), nr_irqs, PAGE_SIZE, init_work);
static struct irq_cfg *irq_cfg(unsigned int irq)
{
if (irq >= nr_irqs)
return NULL;
return &irq_cfgx[irq];
}
/* /*
* Rough estimation of how many shared IRQs there are, can * Rough estimation of how many shared IRQs there are, can
* be changed anytime. * be changed anytime.
...@@ -794,22 +831,6 @@ static inline int IO_APIC_irq_trigger(int irq) ...@@ -794,22 +831,6 @@ static inline int IO_APIC_irq_trigger(int irq)
return 0; return 0;
} }
/* irq_vectors is indexed by the sum of all RTEs in all I/O APICs. */
static u8 irq_vector_init_first __initdata = FIRST_DEVICE_VECTOR;
static u8 *irq_vector;
static void __init irq_vector_init_work(void *data)
{
struct dyn_array *da = data;
u8 *irq_vec;
irq_vec = *da->name;
irq_vec[0] = irq_vector_init_first;
}
DEFINE_DYN_ARRAY(irq_vector, sizeof(u8), nr_irqs, PAGE_SIZE, irq_vector_init_work);
static int __assign_irq_vector(int irq) static int __assign_irq_vector(int irq)
{ {
...@@ -818,8 +839,8 @@ static int __assign_irq_vector(int irq) ...@@ -818,8 +839,8 @@ static int __assign_irq_vector(int irq)
BUG_ON((unsigned)irq >= nr_irqs); BUG_ON((unsigned)irq >= nr_irqs);
if (irq_vector[irq] > 0) if (irq_cfg(irq)->vector > 0)
return irq_vector[irq]; return irq_cfg(irq)->vector;
vector = current_vector; vector = current_vector;
offset = current_offset; offset = current_offset;
...@@ -836,7 +857,7 @@ next: ...@@ -836,7 +857,7 @@ next:
current_vector = vector; current_vector = vector;
current_offset = offset; current_offset = offset;
irq_vector[irq] = vector; irq_cfg(irq)->vector = vector;
return vector; return vector;
} }
...@@ -1598,7 +1619,7 @@ static void ack_ioapic_quirk_irq(unsigned int irq) ...@@ -1598,7 +1619,7 @@ static void ack_ioapic_quirk_irq(unsigned int irq)
* operation to prevent an edge-triggered interrupt escaping meanwhile. * operation to prevent an edge-triggered interrupt escaping meanwhile.
* The idea is from Manfred Spraul. --macro * The idea is from Manfred Spraul. --macro
*/ */
i = irq_vector[irq]; i = irq_cfg(irq)->vector;
v = apic_read(APIC_TMR + ((i & ~0x1f) >> 1)); v = apic_read(APIC_TMR + ((i & ~0x1f) >> 1));
...@@ -1615,7 +1636,7 @@ static void ack_ioapic_quirk_irq(unsigned int irq) ...@@ -1615,7 +1636,7 @@ static void ack_ioapic_quirk_irq(unsigned int irq)
static int ioapic_retrigger_irq(unsigned int irq) static int ioapic_retrigger_irq(unsigned int irq)
{ {
send_IPI_self(irq_vector[irq]); send_IPI_self(irq_cfg(irq)->vector);
return 1; return 1;
} }
...@@ -1651,7 +1672,7 @@ static inline void init_IO_APIC_traps(void) ...@@ -1651,7 +1672,7 @@ static inline void init_IO_APIC_traps(void)
* 0x80, because int 0x80 is hm, kind of importantish. ;) * 0x80, because int 0x80 is hm, kind of importantish. ;)
*/ */
for (irq = 0; irq < nr_irqs ; irq++) { for (irq = 0; irq < nr_irqs ; irq++) {
if (IO_APIC_IRQ(irq) && !irq_vector[irq]) { if (IO_APIC_IRQ(irq) && !irq_cfg(irq)->vector) {
/* /*
* Hmm.. We don't have an entry for this, * Hmm.. We don't have an entry for this,
* so default to an old-fashioned 8259 * so default to an old-fashioned 8259
...@@ -2102,7 +2123,7 @@ int create_irq(void) ...@@ -2102,7 +2123,7 @@ int create_irq(void)
for (new = (nr_irqs - 1); new >= 0; new--) { for (new = (nr_irqs - 1); new >= 0; new--) {
if (platform_legacy_irq(new)) if (platform_legacy_irq(new))
continue; continue;
if (irq_vector[new] != 0) if (irq_cfg(new)->vector != 0)
continue; continue;
vector = __assign_irq_vector(new); vector = __assign_irq_vector(new);
if (likely(vector > 0)) if (likely(vector > 0))
...@@ -2125,8 +2146,8 @@ void destroy_irq(unsigned int irq) ...@@ -2125,8 +2146,8 @@ void destroy_irq(unsigned int irq)
dynamic_irq_cleanup(irq); dynamic_irq_cleanup(irq);
spin_lock_irqsave(&vector_lock, flags); spin_lock_irqsave(&vector_lock, flags);
clear_bit(irq_vector[irq], used_vectors); clear_bit(irq_cfg(irq)->vector, used_vectors);
irq_vector[irq] = 0; irq_cfg(irq)->vector = 0;
spin_unlock_irqrestore(&vector_lock, flags); spin_unlock_irqrestore(&vector_lock, flags);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment