diff options
author | Patrick Wildt <patrick@cvs.openbsd.org> | 2020-07-14 15:34:16 +0000 |
---|---|---|
committer | Patrick Wildt <patrick@cvs.openbsd.org> | 2020-07-14 15:34:16 +0000 |
commit | 0840bd11f40b2d645fadc2aad753fe79916db7da (patch) | |
tree | c082ba40314b4d68f122ef8da846e643054706a6 /sys/arch/armv7 | |
parent | 3af178079cbe2efbfa4a5c1c6b27dd6296e47c08 (diff) |
Extend the interrupt API on arm64 and armv7 to be able to pass around
a struct cpu_info *. From a driver point of view the fdt_intr_establish_*
API now also exist same functions with a *_cpu suffix. Internally the
"old" functions now call their *_cpu counterparts, passing NULL as ci.
NULL will be interpreted as primary CPU in the interrupt controller code.
The internal framework for interrupt controllers has been changed so that
the establish methods provided by an interrupt controller function always
takes a struct cpu_info *.
Some drivers, like imxgpio(4) and rkgpio(4), only have a single interrupt
line for multiple pins. On those we simply disallow trying to establish
an interrupt on a non-primary CPU, returning NULL.
Since we do not have MP yet on armv7, all armv7 interrupt controllers do
return NULL if an attempt is made to establish an interrupt on a different
CPU. That said, so far there's no way this can happen. If we ever gain
MP support, this is a reminder that the interrupt controller drivers have
to be adjusted.
Prompted by dlg@
ok kettenis@
Diffstat (limited to 'sys/arch/armv7')
-rw-r--r-- | sys/arch/armv7/armv7/intr.c | 70 | ||||
-rw-r--r-- | sys/arch/armv7/broadcom/bcm2836_intr.c | 32 | ||||
-rw-r--r-- | sys/arch/armv7/include/intr.h | 32 | ||||
-rw-r--r-- | sys/arch/armv7/marvell/mvmpic.c | 9 | ||||
-rw-r--r-- | sys/arch/armv7/omap/intc.c | 20 | ||||
-rw-r--r-- | sys/arch/armv7/omap/intc.h | 6 | ||||
-rw-r--r-- | sys/arch/armv7/sunxi/sxiintc.c | 19 | ||||
-rw-r--r-- | sys/arch/armv7/sunxi/sxiintc.h | 5 |
8 files changed, 129 insertions, 64 deletions
diff --git a/sys/arch/armv7/armv7/intr.c b/sys/arch/armv7/armv7/intr.c index 68b6c7bf525..97ec595c7d8 100644 --- a/sys/arch/armv7/armv7/intr.c +++ b/sys/arch/armv7/armv7/intr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intr.c,v 1.17 2020/04/27 13:02:50 kettenis Exp $ */ +/* $OpenBSD: intr.c,v 1.18 2020/07/14 15:34:14 patrick Exp $ */ /* * Copyright (c) 2011 Dale Rahn <drahn@openbsd.org> * @@ -28,16 +28,16 @@ uint32_t arm_intr_get_parent(int); uint32_t arm_intr_map_msi(int, uint64_t *); -void *arm_intr_prereg_establish_fdt(void *, int *, int, int (*)(void *), - void *, char *); +void *arm_intr_prereg_establish_fdt(void *, int *, int, struct cpu_info *, + int (*)(void *), void *, char *); void arm_intr_prereg_disestablish_fdt(void *); int arm_dflt_splraise(int); int arm_dflt_spllower(int); void arm_dflt_splx(int); void arm_dflt_setipl(int); -void *arm_dflt_intr_establish(int irqno, int level, int (*func)(void *), - void *cookie, char *name); +void *arm_dflt_intr_establish(int irqno, int level, struct cpu_info *, + int (*func)(void *), void *cookie, char *name); void arm_dflt_intr_disestablish(void *cookie); const char *arm_dflt_intr_string(void *cookie); @@ -75,7 +75,7 @@ arm_dflt_intr(void *frame) void *arm_intr_establish(int irqno, int level, int (*func)(void *), void *cookie, char *name) { - return arm_intr_func.intr_establish(irqno, level, func, cookie, name); + return arm_intr_func.intr_establish(irqno, level, NULL, func, cookie, name); } void arm_intr_disestablish(void *cookie) { @@ -188,6 +188,7 @@ struct intr_prereg { uint32_t ip_cell[MAX_INTERRUPT_CELLS]; int ip_level; + struct cpu_info *ip_ci; int (*ip_func)(void *); void *ip_arg; char *ip_name; @@ -201,7 +202,7 @@ LIST_HEAD(, intr_prereg) prereg_interrupts = void * arm_intr_prereg_establish_fdt(void *cookie, int *cell, int level, - int (*func)(void *), void *arg, char *name) + struct cpu_info *ci, int (*func)(void *), void *arg, char *name) { struct interrupt_controller *ic = cookie; struct intr_prereg *ip; @@ -212,6 +213,7 @@ arm_intr_prereg_establish_fdt(void *cookie, int *cell, int level, for (i = 0; i < ic->ic_cells; i++) ip->ip_cell[i] = cell[i]; ip->ip_level = level; + ip->ip_ci = ci; ip->ip_func = func; ip->ip_arg = arg; ip->ip_name = name; @@ -286,7 +288,8 @@ arm_intr_register_fdt(struct interrupt_controller *ic) ip->ip_ic = ic; ip->ip_ih = ic->ic_establish(ic->ic_cookie, ip->ip_cell, - ip->ip_level, ip->ip_func, ip->ip_arg, ip->ip_name); + ip->ip_level, ip->ip_ci, ip->ip_func, ip->ip_arg, + ip->ip_name); if (ip->ip_ih == NULL) printf("can't establish interrupt %s\n", ip->ip_name); @@ -307,9 +310,25 @@ arm_intr_establish_fdt(int node, int level, int (*func)(void *), } void * +arm_intr_establish_fdt_cpu(int node, int level, struct cpu_info *ci, + int (*func)(void *), void *cookie, char *name) +{ + return arm_intr_establish_fdt_idx_cpu(node, 0, level, ci, func, + cookie, name); +} + +void * arm_intr_establish_fdt_idx(int node, int idx, int level, int (*func)(void *), void *cookie, char *name) { + return arm_intr_establish_fdt_idx_cpu(node, idx, level, NULL, func, + cookie, name); +} + +void * +arm_intr_establish_fdt_idx_cpu(int node, int idx, int level, struct cpu_info *ci, + int (*func)(void *), void *cookie, char *name) +{ struct interrupt_controller *ic; int i, len, ncells, extended = 1; uint32_t *cell, *cells, phandle; @@ -361,7 +380,7 @@ arm_intr_establish_fdt_idx(int node, int idx, int level, int (*func)(void *), if (i == idx && ncells >= ic->ic_cells && ic->ic_establish) { val = ic->ic_establish(ic->ic_cookie, cell, level, - func, cookie, name); + ci, func, cookie, name); break; } @@ -385,6 +404,14 @@ void * arm_intr_establish_fdt_imap(int node, int *reg, int nreg, int level, int (*func)(void *), void *cookie, char *name) { + return arm_intr_establish_fdt_imap_cpu(node, reg, nreg, level, NULL, + func, cookie, name); +} + +void * +arm_intr_establish_fdt_imap_cpu(int node, int *reg, int nreg, int level, + struct cpu_info *ci, int (*func)(void *), void *cookie, char *name) +{ struct interrupt_controller *ic; struct arm_intr_handle *ih; uint32_t *cell; @@ -425,7 +452,7 @@ arm_intr_establish_fdt_imap(int node, int *reg, int nreg, int level, (reg[3] & map_mask[3]) == cell[3] && ic->ic_establish) { val = ic->ic_establish(ic->ic_cookie, &cell[5 + acells], - level, func, cookie, name); + level, ci, func, cookie, name); break; } @@ -450,6 +477,15 @@ void * arm_intr_establish_fdt_msi(int node, uint64_t *addr, uint64_t *data, int level, int (*func)(void *), void *cookie, char *name) { + return arm_intr_establish_fdt_msi_cpu(node, addr, data, level, NULL, + func, cookie, name); +} + +void * +arm_intr_establish_fdt_msi_cpu(int node, uint64_t *addr, uint64_t *data, + int level, struct cpu_info *ci, int (*func)(void *), void *cookie, + char *name) +{ struct interrupt_controller *ic; struct arm_intr_handle *ih; uint32_t phandle; @@ -465,7 +501,7 @@ arm_intr_establish_fdt_msi(int node, uint64_t *addr, uint64_t *data, return NULL; val = ic->ic_establish_msi(ic->ic_cookie, addr, data, - level, func, cookie, name); + level, ci, func, cookie, name); ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK); ih->ih_ic = ic; @@ -511,7 +547,7 @@ arm_intr_disable(void *cookie) */ void * arm_intr_parent_establish_fdt(void *cookie, int *cell, int level, - int (*func)(void *), void *arg, char *name) + struct cpu_info *ci, int (*func)(void *), void *arg, char *name) { struct interrupt_controller *ic = cookie; struct arm_intr_handle *ih; @@ -526,7 +562,7 @@ arm_intr_parent_establish_fdt(void *cookie, int *cell, int level, if (ic == NULL) return NULL; - val = ic->ic_establish(ic->ic_cookie, cell, level, func, arg, name); + val = ic->ic_establish(ic->ic_cookie, cell, level, ci, func, arg, name); if (val == NULL) return NULL; @@ -614,8 +650,8 @@ arm_dflt_setipl(int newcpl) ci->ci_cpl = newcpl; } -void *arm_dflt_intr_establish(int irqno, int level, int (*func)(void *), - void *cookie, char *name) +void *arm_dflt_intr_establish(int irqno, int level, struct cpu_info *ci, + int (*func)(void *), void *cookie, char *name) { panic("arm_dflt_intr_establish called"); } @@ -680,8 +716,8 @@ arm_do_pending_intr(int pcpl) void arm_set_intr_handler(int (*raise)(int), int (*lower)(int), void (*x)(int), void (*setipl)(int), - void *(*intr_establish)(int irqno, int level, int (*func)(void *), - void *cookie, char *name), + void *(*intr_establish)(int irqno, int level, struct cpu_info *ci, + int (*func)(void *), void *cookie, char *name), void (*intr_disestablish)(void *cookie), const char *(intr_string)(void *cookie), void (*intr_handle)(void *)) diff --git a/sys/arch/armv7/broadcom/bcm2836_intr.c b/sys/arch/armv7/broadcom/bcm2836_intr.c index f2bba3dc626..ec55af43f9a 100644 --- a/sys/arch/armv7/broadcom/bcm2836_intr.c +++ b/sys/arch/armv7/broadcom/bcm2836_intr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bcm2836_intr.c,v 1.4 2019/10/05 15:44:57 kettenis Exp $ */ +/* $OpenBSD: bcm2836_intr.c,v 1.5 2020/07/14 15:34:15 patrick Exp $ */ /* * Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org> * Copyright (c) 2015 Patrick Wildt <patrick@blueri.se> @@ -110,12 +110,12 @@ int bcm_intc_spllower(int new); int bcm_intc_splraise(int new); void bcm_intc_setipl(int new); void bcm_intc_calc_mask(void); -void *bcm_intc_intr_establish(int, int, int (*)(void *), - void *, char *); -void *bcm_intc_intr_establish_fdt(void *, int *, int, int (*)(void *), - void *, char *); -void *l1_intc_intr_establish_fdt(void *, int *, int, int (*)(void *), - void *, char *); +void *bcm_intc_intr_establish(int, int, struct cpu_info *, + int (*)(void *), void *, char *); +void *bcm_intc_intr_establish_fdt(void *, int *, int, struct cpu_info *, + int (*)(void *), void *, char *); +void *l1_intc_intr_establish_fdt(void *, int *, int, struct cpu_info *, + int (*)(void *), void *, char *); void bcm_intc_intr_disestablish(void *); const char *bcm_intc_intr_string(void *); void bcm_intc_irq_handler(void *); @@ -479,7 +479,7 @@ bcm_intc_irq_handler(void *frame) void * bcm_intc_intr_establish_fdt(void *cookie, int *cell, int level, - int (*func)(void *), void *arg, char *name) + struct cpu_info *ci, int (*func)(void *), void *arg, char *name) { struct bcm_intc_softc *sc = (struct bcm_intc_softc *)cookie; int irq; @@ -496,22 +496,22 @@ bcm_intc_intr_establish_fdt(void *cookie, int *cell, int level, else panic("%s: bogus interrupt type", sc->sc_dev.dv_xname); - return bcm_intc_intr_establish(irq, level, func, arg, name); + return bcm_intc_intr_establish(irq, level, ci, func, arg, name); } void * l1_intc_intr_establish_fdt(void *cookie, int *cell, int level, - int (*func)(void *), void *arg, char *name) + struct cpu_info *ci, int (*func)(void *), void *arg, char *name) { int irq; irq = cell[0] + LOCAL_START; - return bcm_intc_intr_establish(irq, level, func, arg, name); + return bcm_intc_intr_establish(irq, level, ci, func, arg, name); } void * -bcm_intc_intr_establish(int irqno, int level, int (*func)(void *), - void *arg, char *name) +bcm_intc_intr_establish(int irqno, int level, struct cpu_info *ci, + int (*func)(void *), void *arg, char *name) { struct bcm_intc_softc *sc = bcm_intc; struct intrhand *ih; @@ -520,6 +520,12 @@ bcm_intc_intr_establish(int irqno, int level, int (*func)(void *), if (irqno < 0 || irqno >= INTC_NIRQ) panic("bcm_intc_intr_establish: bogus irqnumber %d: %s", irqno, name); + + if (ci == NULL) + ci = &cpu_info_primary; + else if (!CPU_IS_PRIMARY(ci)) + return NULL; + psw = disable_interrupts(PSR_I); ih = malloc(sizeof *ih, M_DEVBUF, M_WAITOK); diff --git a/sys/arch/armv7/include/intr.h b/sys/arch/armv7/include/intr.h index e08b4942927..f61eff62f66 100644 --- a/sys/arch/armv7/include/intr.h +++ b/sys/arch/armv7/include/intr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: intr.h,v 1.12 2019/09/29 10:36:52 kettenis Exp $ */ +/* $OpenBSD: intr.h,v 1.13 2020/07/14 15:34:15 patrick Exp $ */ /* $NetBSD: intr.h,v 1.12 2003/06/16 20:00:59 thorpej Exp $ */ /* @@ -81,6 +81,8 @@ #include <sys/device.h> #include <sys/queue.h> +struct cpu_info; + int splraise(int); int spllower(int); void splx(int); @@ -88,8 +90,8 @@ void splx(int); void arm_do_pending_intr(int); void arm_set_intr_handler(int (*raise)(int), int (*lower)(int), void (*x)(int), void (*setipl)(int), - void *(*intr_establish)(int irqno, int level, int (*func)(void *), - void *cookie, char *name), + void *(*intr_establish)(int irqno, int level, struct cpu_info *ci, + int (*func)(void *), void *cookie, char *name), void (*intr_disestablish)(void *cookie), const char *(*intr_string)(void *cookie), void (*intr_handle)(void *)); @@ -99,8 +101,8 @@ struct arm_intr_func { int (*lower)(int); void (*x)(int); void (*setipl)(int); - void *(*intr_establish)(int irqno, int level, int (*func)(void *), - void *cookie, char *name); + void *(*intr_establish)(int irqno, int level, struct cpu_info *, + int (*func)(void *), void *cookie, char *name); void (*intr_disestablish)(void *cookie); const char *(*intr_string)(void *cookie); }; @@ -147,15 +149,13 @@ const char *arm_intr_string(void *cookie); void arm_clock_register(void (*)(void), void (*)(u_int), void (*)(int), void (*)(void)); -struct cpu_info; - struct interrupt_controller { int ic_node; void *ic_cookie; - void *(*ic_establish)(void *, int *, int, int (*)(void *), - void *, char *); - void *(*ic_establish_msi)(void *, uint64_t *, uint64_t *, int, + void *(*ic_establish)(void *, int *, int, struct cpu_info *, int (*)(void *), void *, char *); + void *(*ic_establish_msi)(void *, uint64_t *, uint64_t *, int, + struct cpu_info *, int (*)(void *), void *, char *); void (*ic_disestablish)(void *); void (*ic_enable)(void *); void (*ic_disable)(void *); @@ -171,12 +171,20 @@ void arm_intr_init_fdt(void); void arm_intr_register_fdt(struct interrupt_controller *); void *arm_intr_establish_fdt(int, int, int (*)(void *), void *, char *); +void *arm_intr_establish_fdt_cpu(int, int, struct cpu_info *, + int (*)(void *), void *, char *); void *arm_intr_establish_fdt_idx(int, int, int, int (*)(void *), void *, char *); +void *arm_intr_establish_fdt_idx_cpu(int, int, int, struct cpu_info *, + int (*)(void *), void *, char *); void *arm_intr_establish_fdt_imap(int, int *, int, int, int (*)(void *), void *, char *); -void *arm_intr_establish_fdt_msi(int, uint64_t *, uint64_t *, int , +void *arm_intr_establish_fdt_imap_cpu(int, int *, int, int, + struct cpu_info *, int (*)(void *), void *, char *); +void *arm_intr_establish_fdt_msi(int, uint64_t *, uint64_t *, int, int (*)(void *), void *, char *); +void *arm_intr_establish_fdt_msi_cpu(int, uint64_t *, uint64_t *, int, + struct cpu_info *, int (*)(void *), void *, char *); void arm_intr_disestablish_fdt(void *); void arm_intr_enable(void *); void arm_intr_disable(void *); @@ -184,7 +192,7 @@ void arm_intr_route(void *, int, struct cpu_info *); void arm_intr_cpu_enable(void); void *arm_intr_parent_establish_fdt(void *, int *, int, - int (*)(void *), void *, char *); + struct cpu_info *ci, int (*)(void *), void *, char *); void arm_intr_parent_disestablish_fdt(void *); void arm_send_ipi(struct cpu_info *, int); diff --git a/sys/arch/armv7/marvell/mvmpic.c b/sys/arch/armv7/marvell/mvmpic.c index 42f9712e6b3..477bd2851cf 100644 --- a/sys/arch/armv7/marvell/mvmpic.c +++ b/sys/arch/armv7/marvell/mvmpic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mvmpic.c,v 1.3 2018/12/07 21:33:28 patrick Exp $ */ +/* $OpenBSD: mvmpic.c,v 1.4 2020/07/14 15:34:15 patrick Exp $ */ /* * Copyright (c) 2007,2009,2011 Dale Rahn <drahn@openbsd.org> * Copyright (c) 2015 Patrick Wildt <patrick@blueri.se> @@ -73,7 +73,7 @@ struct intrhand { int mpic_match(struct device *, void *, void *); void mpic_attach(struct device *, struct device *, void *); void mpic_calc_mask(struct mpic_softc *); -void *mpic_intr_establish(void *, int *, int, +void *mpic_intr_establish(void *, int *, int, struct cpu_info *, int (*)(void *), void *, char *); void mpic_intr_disestablish(void *); int mpic_intr(void *); @@ -236,7 +236,7 @@ mpic_intr(void *cookie) void * mpic_intr_establish(void *cookie, int *cells, int level, - int (*func)(void *), void *arg, char *name) + struct cpu_info *ci, int (*func)(void *), void *arg, char *name) { struct mpic_softc *sc = cookie; struct intrhand *ih; @@ -251,6 +251,9 @@ mpic_intr_establish(void *cookie, int *cells, int level, panic("%s: irq %d already registered" , __func__, irqno); + if (ci != NULL && !CPU_IS_PRIMARY(ci)) + return NULL; + ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK); ih->ih_func = func; ih->ih_arg = arg; diff --git a/sys/arch/armv7/omap/intc.c b/sys/arch/armv7/omap/intc.c index 6ac04281d12..f937ae1cad1 100644 --- a/sys/arch/armv7/omap/intc.c +++ b/sys/arch/armv7/omap/intc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: intc.c,v 1.9 2019/10/05 15:44:57 kettenis Exp $ */ +/* $OpenBSD: intc.c,v 1.10 2020/07/14 15:34:15 patrick Exp $ */ /* * Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org> * @@ -108,8 +108,8 @@ int intc_spllower(int new); int intc_splraise(int new); void intc_setipl(int new); void intc_calc_mask(void); -void *intc_intr_establish_fdt(void *, int *, int, int (*)(void *), - void *, char *); +void *intc_intr_establish_fdt(void *, int *, int, struct cpu_info *, + int (*)(void *), void *, char *); struct cfattach intc_ca = { sizeof (struct device), intc_match, intc_attach @@ -353,8 +353,8 @@ intc_irq_handler(void *frame) } void * -intc_intr_establish(int irqno, int level, int (*func)(void *), - void *arg, char *name) +intc_intr_establish(int irqno, int level, struct cpu_info *ci, + int (*func)(void *), void *arg, char *name) { int psw; struct intrhand *ih; @@ -362,6 +362,12 @@ intc_intr_establish(int irqno, int level, int (*func)(void *), if (irqno < 0 || irqno >= INTC_NUM_IRQ) panic("intc_intr_establish: bogus irqnumber %d: %s", irqno, name); + + if (ci == NULL) + ci = &cpu_info_primary; + else if (!CPU_IS_PRIMARY(ci)) + return NULL; + psw = disable_interrupts(PSR_I); ih = malloc(sizeof(*ih), M_DEVBUF, M_WAITOK); @@ -388,9 +394,9 @@ intc_intr_establish(int irqno, int level, int (*func)(void *), void * intc_intr_establish_fdt(void *cookie, int *cell, int level, - int (*func)(void *), void *arg, char *name) + struct cpu_info *ci, int (*func)(void *), void *arg, char *name) { - return intc_intr_establish(cell[0], level, func, arg, name); + return intc_intr_establish(cell[0], level, ci, func, arg, name); } void diff --git a/sys/arch/armv7/omap/intc.h b/sys/arch/armv7/omap/intc.h index c4c7f691354..04b9f12016a 100644 --- a/sys/arch/armv7/omap/intc.h +++ b/sys/arch/armv7/omap/intc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: intc.h,v 1.3 2019/05/06 03:45:58 mlarkin Exp $ */ +/* $OpenBSD: intc.h,v 1.4 2020/07/14 15:34:15 patrick Exp $ */ /* * Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org> * @@ -63,8 +63,8 @@ find_first_bit( uint32_t bits ) void intc_intr_bootstrap(vaddr_t); void intc_irq_handler(void *); -void *intc_intr_establish(int irqno, int level, int (*func)(void *), - void *cookie, char *name); +void *intc_intr_establish(int irqno, int level, struct cpu_info *ci, + int (*func)(void *), void *cookie, char *name); void intc_intr_disestablish(void *cookie); const char *intc_intr_string(void *cookie); diff --git a/sys/arch/armv7/sunxi/sxiintc.c b/sys/arch/armv7/sunxi/sxiintc.c index 07363154104..0832958f400 100644 --- a/sys/arch/armv7/sunxi/sxiintc.c +++ b/sys/arch/armv7/sunxi/sxiintc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sxiintc.c,v 1.6 2019/10/05 15:44:57 kettenis Exp $ */ +/* $OpenBSD: sxiintc.c,v 1.7 2020/07/14 15:34:15 patrick Exp $ */ /* * Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org> * Copyright (c) 2013 Artturi Alm @@ -149,8 +149,8 @@ int sxiintc_spllower(int); int sxiintc_splraise(int); void sxiintc_setipl(int); void sxiintc_calc_masks(void); -void *sxiintc_intr_establish_fdt(void *, int *, int, int (*)(void *), - void *, char *); +void *sxiintc_intr_establish_fdt(void *, int *, int, struct cpu_info *, + int (*)(void *), void *, char *); struct cfattach sxiintc_ca = { sizeof (struct device), sxiintc_match, sxiintc_attach @@ -372,8 +372,8 @@ sxiintc_irq_handler(void *frame) } void * -sxiintc_intr_establish(int irq, int level, int (*func)(void *), - void *arg, char *name) +sxiintc_intr_establish(int irq, int level, struct cpu_info *ci, + int (*func)(void *), void *arg, char *name) { int psw; struct intrhand *ih; @@ -382,6 +382,11 @@ sxiintc_intr_establish(int irq, int level, int (*func)(void *), if (irq <= 0 || irq >= NIRQ) panic("intr_establish: bogus irq %d %s\n", irq, name); + if (ci == NULL) + ci = &cpu_info_primary; + else if (!CPU_IS_PRIMARY(ci)) + return NULL; + DPRINTF(("intr_establish: irq %d level %d [%s]\n", irq, level, name != NULL ? name : "NULL")); @@ -413,9 +418,9 @@ sxiintc_intr_establish(int irq, int level, int (*func)(void *), void * sxiintc_intr_establish_fdt(void *cookie, int *cell, int level, - int (*func)(void *), void *arg, char *name) + struct cpu_info *ci, int (*func)(void *), void *arg, char *name) { - return sxiintc_intr_establish(cell[0], level, func, arg, name); + return sxiintc_intr_establish(cell[0], level, ci, func, arg, name); } void diff --git a/sys/arch/armv7/sunxi/sxiintc.h b/sys/arch/armv7/sunxi/sxiintc.h index 849594d02f8..cec533d6597 100644 --- a/sys/arch/armv7/sunxi/sxiintc.h +++ b/sys/arch/armv7/sunxi/sxiintc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sxiintc.h,v 1.1 2016/08/05 20:38:17 kettenis Exp $ */ +/* $OpenBSD: sxiintc.h,v 1.2 2020/07/14 15:34:15 patrick Exp $ */ /* * Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org> * @@ -37,7 +37,8 @@ int sxiintc_spllower(int); void sxiintc_setsoftintr(int); void sxiintc_irq_handler(void *); -void *sxiintc_intr_establish(int, int, int (*)(void *), void *, char *); +void *sxiintc_intr_establish(int, int, struct cpu_info *, + int (*)(void *), void *, char *); void sxiintc_intr_disestablish(void *); const char *sxiintc_intr_string(void *); |