Skip to content

Commit

Permalink
ioapic: Let callers of pin_setup() to hold imen_spinlock
Browse files Browse the repository at this point in the history
  • Loading branch information
Sepherosa Ziehau committed Mar 20, 2011
1 parent cf93bb1 commit 7bceaa1
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 12 deletions.
8 changes: 8 additions & 0 deletions sys/platform/pc32/apic/ioapic_abi.c
Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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 */
8 changes: 2 additions & 6 deletions sys/platform/pc32/apic/mpapic.c
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
8 changes: 8 additions & 0 deletions sys/platform/pc64/apic/ioapic_abi.c
Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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 */
8 changes: 2 additions & 6 deletions sys/platform/pc64/apic/mpapic.c
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 7bceaa1

Please sign in to comment.