Permalink
Browse files

ioapic: Let callers of pin_setup() to hold imen_spinlock

  • Loading branch information...
1 parent cf93bb1 commit 7bceaa1064b0153e2b961efad1214e141589b9ea Sepherosa Ziehau committed Mar 20, 2011
View
8 sys/platform/pc32/apic/ioapic_abi.c
@@ -694,6 +694,8 @@ ioapic_abi_set_irqmap(int irq, int gsi, enum intr_trigger trig,
info = &int_to_apicintpin[irq];
+ imen_lock();
+
info->ioapic = 0; /* XXX unused */
info->int_pin = pin;
info->apic_address = ioaddr;
@@ -704,6 +706,8 @@ ioapic_abi_set_irqmap(int irq, int gsi, enum intr_trigger trig,
ioapic_pin_setup(ioaddr, pin, IDT_OFFSET + irq,
map->im_trig, map->im_pola);
+
+ imen_unlock();
}
static void
@@ -764,12 +768,16 @@ ioapic_intr_config(int irq, enum intr_trigger trig, enum intr_polarity pola)
info = &int_to_apicintpin[irq];
+ imen_lock();
+
info->flags &= ~IOAPIC_IM_FLAG_LEVEL;
if (map->im_trig == INTR_TRIGGER_LEVEL)
info->flags |= IOAPIC_IM_FLAG_LEVEL;
ioapic_pin_setup(ioaddr, pin, IDT_OFFSET + irq,
map->im_trig, map->im_pola);
+
+ imen_unlock();
}
#endif /* SMP */
View
8 sys/platform/pc32/apic/mpapic.c
@@ -1308,8 +1308,10 @@ ioapic_gsi_setup(int gsi)
if (gsi == 0) {
/* ExtINT */
+ imen_lock();
ioapic_extpin_setup(ioapic_gsi_ioaddr(gsi),
ioapic_gsi_pin(gsi), 0);
+ imen_unlock();
return;
}
@@ -1369,10 +1371,8 @@ ioapic_gsi_search(int gsi)
void
ioapic_extpin_setup(void *addr, int pin, int vec)
{
- imen_lock();
ioapic_pin_prog(addr, pin, vec,
INTR_TRIGGER_CONFORM, INTR_POLARITY_CONFORM, IOART_DELEXINT);
- imen_unlock();
}
void
@@ -1391,13 +1391,9 @@ ioapic_pin_setup(void *addr, int pin, int vec,
* clear IRR so we can later, safely program it as a level
* interrupt.
*/
- imen_lock();
-
ioapic_pin_prog(addr, pin, vec, INTR_TRIGGER_EDGE, INTR_POLARITY_HIGH,
IOART_DELFIXED);
ioapic_pin_prog(addr, pin, vec, trig, pola, IOART_DELFIXED);
-
- imen_unlock();
}
static void
View
8 sys/platform/pc64/apic/ioapic_abi.c
@@ -687,6 +687,8 @@ ioapic_abi_set_irqmap(int irq, int gsi, enum intr_trigger trig,
info = &int_to_apicintpin[irq];
+ imen_lock();
+
info->ioapic = 0; /* XXX unused */
info->int_pin = pin;
info->apic_address = ioaddr;
@@ -697,6 +699,8 @@ ioapic_abi_set_irqmap(int irq, int gsi, enum intr_trigger trig,
ioapic_pin_setup(ioaddr, pin, IDT_OFFSET + irq,
map->im_trig, map->im_pola);
+
+ imen_unlock();
}
static void
@@ -757,12 +761,16 @@ ioapic_intr_config(int irq, enum intr_trigger trig, enum intr_polarity pola)
info = &int_to_apicintpin[irq];
+ imen_lock();
+
info->flags &= ~IOAPIC_IM_FLAG_LEVEL;
if (map->im_trig == INTR_TRIGGER_LEVEL)
info->flags |= IOAPIC_IM_FLAG_LEVEL;
ioapic_pin_setup(ioaddr, pin, IDT_OFFSET + irq,
map->im_trig, map->im_pola);
+
+ imen_unlock();
}
#endif /* SMP */
View
8 sys/platform/pc64/apic/mpapic.c
@@ -1370,8 +1370,10 @@ ioapic_gsi_setup(int gsi)
if (gsi == 0) {
/* ExtINT */
+ imen_lock();
ioapic_extpin_setup(ioapic_gsi_ioaddr(gsi),
ioapic_gsi_pin(gsi), 0);
+ imen_unlock();
return;
}
@@ -1431,10 +1433,8 @@ ioapic_gsi_search(int gsi)
void
ioapic_extpin_setup(void *addr, int pin, int vec)
{
- imen_lock();
ioapic_pin_prog(addr, pin, vec,
INTR_TRIGGER_CONFORM, INTR_POLARITY_CONFORM, IOART_DELEXINT);
- imen_unlock();
}
void
@@ -1453,13 +1453,9 @@ ioapic_pin_setup(void *addr, int pin, int vec,
* clear IRR so we can later, safely program it as a level
* interrupt.
*/
- imen_lock();
-
ioapic_pin_prog(addr, pin, vec, INTR_TRIGGER_EDGE, INTR_POLARITY_HIGH,
IOART_DELFIXED);
ioapic_pin_prog(addr, pin, vec, trig, pola, IOART_DELFIXED);
-
- imen_unlock();
}
static void

0 comments on commit 7bceaa1

Please sign in to comment.