Skip to content

Commit

Permalink
intr/x86: remove architecture copy of PIC device
Browse files Browse the repository at this point in the history
Now that the value is on the event, there is no need for x86 to
duplicate the value on the intsrc structure.
  • Loading branch information
ehem committed Oct 14, 2024
1 parent 0e6931f commit d14a01e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
1 change: 0 additions & 1 deletion sys/x86/include/intr_machdep.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ typedef device_t x86pic_t;
*/
struct intsrc {
struct intr_event is_event;
x86pic_t is_pic;
u_long *is_count;
u_long *is_straycount;
u_int is_index;
Expand Down
22 changes: 11 additions & 11 deletions sys/x86/x86/intr_machdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,12 +257,12 @@ intr_register_source(u_int vector, struct intsrc *isrc)
{
int error;

KASSERT(intr_pic_registered(isrc->is_pic), ("unregistered PIC"));
KASSERT(intr_pic_registered(isrc->is_event.ie_pic), ("unregistered PIC"));
KASSERT(vector < num_io_irqs, ("IRQ %d too large (%u irqs)", vector,
num_io_irqs));
if (interrupt_sources[vector] != NULL)
return (EEXIST);
error = intr_event_init(&isrc->is_event, isrc->is_pic, vector, 0,
error = intr_event_init(&isrc->is_event, isrc->is_event.ie_pic, vector, 0,
"irq%d:", vector);
if (error)
return (error);
Expand Down Expand Up @@ -303,8 +303,8 @@ intr_add_handler(struct intsrc *isrc, const char *name, driver_filter_t filter,
isrc->is_handlers++;
if (isrc->is_handlers == 1) {
isrc->is_domain = domain;
PIC_ENABLE_INTR(isrc->is_pic, isrc);
PIC_ENABLE_SOURCE(isrc->is_pic, isrc);
PIC_ENABLE_INTR(isrc->is_event.ie_pic, isrc);
PIC_ENABLE_SOURCE(isrc->is_event.ie_pic, isrc);
}
sx_xunlock(&intrsrc_lock);
}
Expand All @@ -323,8 +323,8 @@ intr_remove_handler(void *cookie)
sx_xlock(&intrsrc_lock);
isrc->is_handlers--;
if (isrc->is_handlers == 0) {
PIC_DISABLE_SOURCE(isrc->is_pic, isrc, PIC_NO_EOI);
PIC_DISABLE_INTR(isrc->is_pic, isrc);
PIC_DISABLE_SOURCE(isrc->is_event.ie_pic, isrc, PIC_NO_EOI);
PIC_DISABLE_INTR(isrc->is_event.ie_pic, isrc);
}
intrcnt_updatename(isrc);
sx_xunlock(&intrsrc_lock);
Expand All @@ -337,7 +337,7 @@ intr_config_intr(struct intsrc *isrc, enum intr_trigger trig,
enum intr_polarity pol)
{

return (PIC_CONFIG_INTR(isrc->is_pic, isrc, trig, pol));
return (PIC_CONFIG_INTR(isrc->is_event.ie_pic, isrc, trig, pol));
}

static void
Expand Down Expand Up @@ -377,7 +377,7 @@ intr_execute_handlers(struct intsrc *isrc, struct trapframe *frame)
* stray count, and log the condition.
*/
if (intr_event_handle(ie, frame) != 0) {
PIC_DISABLE_SOURCE(isrc->is_pic, isrc, PIC_EOI);
PIC_DISABLE_SOURCE(isrc->is_event.ie_pic, isrc, PIC_EOI);
(*isrc->is_straycount)++;
if (*isrc->is_straycount < INTR_STRAY_LOG_MAX)
log(LOG_ERR, "stray irq%d\n", vector);
Expand Down Expand Up @@ -428,7 +428,7 @@ intr_assign_cpu(device_t pic, interrupt_t *isrc, u_int cpu)
/* Nothing to do if there is only a single CPU. */
if (mp_ncpus > 1 && cpu != NOCPU) {
sx_xlock(&intrsrc_lock);
error = PIC_ASSIGN_CPU(isrc->is_pic, isrc, cpu_apic_ids[cpu]);
error = PIC_ASSIGN_CPU(isrc->is_event.ie_pic, isrc, cpu_apic_ids[cpu]);
if (error == 0)
isrc->is_cpu = cpu;
sx_xunlock(&intrsrc_lock);
Expand Down Expand Up @@ -565,7 +565,7 @@ intr_reprogram(void)
is = interrupt_sources[v];
if (is == NULL)
continue;
PIC_REPROGRAM_PIN(is->is_pic, is);
PIC_REPROGRAM_PIN(is->is_event.ie_pic, is);
}
sx_xunlock(&intrsrc_lock);
}
Expand Down Expand Up @@ -782,7 +782,7 @@ intr_balance(void *dummy __unused, int pending __unused)
cpu = current_cpu[isrc->is_domain];
intr_next_cpu(isrc->is_domain);
if (isrc->is_cpu != cpu &&
PIC_ASSIGN_CPU(isrc->is_pic, isrc, cpu_apic_ids[cpu]) == 0)
PIC_ASSIGN_CPU(isrc->is_event.ie_pic, isrc, cpu_apic_ids[cpu]) == 0)
isrc->is_cpu = cpu;
}
sx_xunlock(&intrsrc_lock);
Expand Down

0 comments on commit d14a01e

Please sign in to comment.