Skip to content

Commit

Permalink
intrng: 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 INTRNG to
to duplicate the value on the intr_irqsrc structure.
  • Loading branch information
ehem committed Oct 14, 2024
1 parent d14a01e commit 0647e0f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
27 changes: 13 additions & 14 deletions sys/kern/subr_intr.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ intr_isrc_dispatch(struct intr_irqsrc *isrc, struct trapframe *tf)
if (isrc->isrc_filter != NULL) {
int error;
error = isrc->isrc_filter(isrc->isrc_arg, tf);
PIC_POST_FILTER(isrc->isrc_dev, isrc);
PIC_POST_FILTER(isrc->isrc_event.ie_pic, isrc);
if (error == FILTER_HANDLED)
return (0);
} else
Expand All @@ -431,7 +431,7 @@ intr_isrc_dispatch(struct intr_irqsrc *isrc, struct trapframe *tf)
* constantly...
*/
static inline int
isrc_alloc_irq(struct intr_irqsrc *isrc)
isrc_alloc_irq(struct intr_irqsrc *isrc, device_t dev)
{
u_int irq;
int error;
Expand All @@ -454,7 +454,7 @@ isrc_alloc_irq(struct intr_irqsrc *isrc)
return (ENOSPC);

found:
error = intr_event_init(&isrc->isrc_event, isrc->isrc_dev,
error = intr_event_init(&isrc->isrc_event, dev,
isrc->isrc_irq, 0, "%s:", isrc->isrc_name);
if (error != 0)
return (error);
Expand Down Expand Up @@ -516,7 +516,6 @@ intr_isrc_register(struct intr_irqsrc *isrc, device_t dev, u_int flags,
va_list ap;

bzero(isrc, sizeof(struct intr_irqsrc));
isrc->isrc_dev = dev;
isrc->isrc_irq = INTR_IRQ_INVALID; /* just to be safe */
isrc->isrc_flags = flags;

Expand All @@ -525,7 +524,7 @@ intr_isrc_register(struct intr_irqsrc *isrc, device_t dev, u_int flags,
va_end(ap);

mtx_lock(&isrc_table_lock);
error = isrc_alloc_irq(isrc);
error = isrc_alloc_irq(isrc, dev);
if (error != 0) {
mtx_unlock(&isrc_table_lock);
return (error);
Expand Down Expand Up @@ -976,7 +975,7 @@ intr_activate_irq(device_t dev, struct resource *res)
}
intr_map_set_isrc(res_id, isrc);
rman_set_virtual(res, data);
return (PIC_ACTIVATE_INTR(isrc->isrc_dev, isrc, res, data));
return (PIC_ACTIVATE_INTR(isrc->isrc_event.ie_pic, isrc, res, data));
}

int
Expand All @@ -997,7 +996,7 @@ intr_deactivate_irq(device_t dev, struct resource *res)
res_id);

data = rman_get_virtual(res);
error = PIC_DEACTIVATE_INTR(isrc->isrc_dev, isrc, res, data);
error = PIC_DEACTIVATE_INTR(isrc->isrc_event.ie_pic, isrc, res, data);
intr_map_set_isrc(res_id, NULL);
rman_set_virtual(res, NULL);
free(data, M_INTRNG);
Expand Down Expand Up @@ -1059,11 +1058,11 @@ intr_setup_irq(device_t dev, struct resource *res, driver_filter_t filt,
return (error);

mtx_lock(&isrc_table_lock);
error = PIC_SETUP_INTR(isrc->isrc_dev, isrc, res, data);
error = PIC_SETUP_INTR(isrc->isrc_event.ie_pic, isrc, res, data);
if (error == 0) {
isrc->isrc_handlers++;
if (isrc->isrc_handlers == 1)
PIC_ENABLE(isrc->isrc_dev, isrc);
PIC_ENABLE(isrc->isrc_event.ie_pic, isrc);
}
mtx_unlock(&isrc_table_lock);
if (error != 0)
Expand Down Expand Up @@ -1098,8 +1097,8 @@ intr_teardown_irq(device_t dev, struct resource *res, void *cookie)
isrc->isrc_filter = NULL;
isrc->isrc_arg = NULL;
isrc->isrc_handlers = 0;
PIC_DISABLE(isrc->isrc_dev, isrc);
PIC_TEARDOWN_INTR(isrc->isrc_dev, isrc, res, data);
PIC_DISABLE(isrc->isrc_event.ie_pic, isrc);
PIC_TEARDOWN_INTR(isrc->isrc_event.ie_pic, isrc, res, data);
isrc_update_name(isrc, NULL);
mtx_unlock(&isrc_table_lock);
return (0);
Expand All @@ -1113,8 +1112,8 @@ intr_teardown_irq(device_t dev, struct resource *res, void *cookie)
mtx_lock(&isrc_table_lock);
isrc->isrc_handlers--;
if (isrc->isrc_handlers == 0)
PIC_DISABLE(isrc->isrc_dev, isrc);
PIC_TEARDOWN_INTR(isrc->isrc_dev, isrc, res, data);
PIC_DISABLE(isrc->isrc_event.ie_pic, isrc);
PIC_TEARDOWN_INTR(isrc->isrc_event.ie_pic, isrc, res, data);
intrcnt_updatename(isrc);
mtx_unlock(&isrc_table_lock);
}
Expand Down Expand Up @@ -1238,7 +1237,7 @@ intr_irq_shuffle(void *arg __unused)
* for bound ISRC. The best thing we can do is to clear
* isrc_cpu so inconsistency with ie_cpu will be detectable.
*/
if (PIC_BIND_INTR(isrc->isrc_dev, isrc) != 0)
if (PIC_BIND_INTR(isrc->isrc_event.ie_pic, isrc) != 0)
CPU_ZERO(&isrc->isrc_cpu);
}
mtx_unlock(&isrc_table_lock);
Expand Down
1 change: 0 additions & 1 deletion sys/sys/intr.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ struct intr_pic;
/* Interrupt source definition. */
struct intr_irqsrc {
struct intr_event isrc_event;
device_t isrc_dev; /* where isrc is mapped */
u_int isrc_irq; /* unique identificator */
u_int isrc_flags;
char isrc_name[INTR_ISRC_NAMELEN];
Expand Down

0 comments on commit 0647e0f

Please sign in to comment.