diff options
author | Patrick Wildt <patrick@cvs.openbsd.org> | 2020-07-14 15:42:20 +0000 |
---|---|---|
committer | Patrick Wildt <patrick@cvs.openbsd.org> | 2020-07-14 15:42:20 +0000 |
commit | c67ff7c5849eed1af4c6ae3ec3c5c86715242e9c (patch) | |
tree | 412ee54088a69dfc1e51251fc5be4c6b4008eec0 /sys/arch | |
parent | 0840bd11f40b2d645fadc2aad753fe79916db7da (diff) |
Implement pci_intr_establish_cpu() on arm64 and armv7. The function pointer
in the chipset tag for establishing interrupts now takes a struct cpu_info *.
The normal pci_intr_establish() macro passes NULL as ci, which indicates that
the primary CPU is to be used.
The PCI controller drivers can then simply pass the ci on to our arm64/armv7
interrupt establish "framework".
Prompted by dlg@
ok kettenis@
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/arm/include/pci_machdep.h | 11 | ||||
-rw-r--r-- | sys/arch/arm64/dev/acpipci.c | 10 | ||||
-rw-r--r-- | sys/arch/arm64/dev/pciecam.c | 15 | ||||
-rw-r--r-- | sys/arch/arm64/include/pci_machdep.h | 11 | ||||
-rw-r--r-- | sys/arch/armv7/marvell/mvpcie.c | 10 | ||||
-rw-r--r-- | sys/arch/armv7/vexpress/pciecam.c | 15 |
6 files changed, 43 insertions, 29 deletions
diff --git a/sys/arch/arm/include/pci_machdep.h b/sys/arch/arm/include/pci_machdep.h index 761a26f4813..cb8e39f3490 100644 --- a/sys/arch/arm/include/pci_machdep.h +++ b/sys/arch/arm/include/pci_machdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_machdep.h,v 1.15 2018/07/09 09:53:06 patrick Exp $ */ +/* $OpenBSD: pci_machdep.h,v 1.16 2020/07/14 15:42:19 patrick Exp $ */ /* * Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -57,7 +57,8 @@ struct arm32_pci_chipset { int, pci_intr_handle_t *); const char *(*pc_intr_string)(void *, pci_intr_handle_t); void *(*pc_intr_establish)(void *, pci_intr_handle_t, - int, int (*)(void *), void *, char *); + int, struct cpu_info *, int (*)(void *), void *, + char *); void (*pc_intr_disestablish)(void *, void *); }; @@ -87,7 +88,11 @@ struct arm32_pci_chipset { #define pci_intr_string(c, ih) \ (*(c)->pc_intr_string)((c)->pc_intr_v, (ih)) #define pci_intr_establish(c, ih, l, h, a, nm) \ - (*(c)->pc_intr_establish)((c)->pc_intr_v, (ih), (l), (h), (a), (nm)) + (*(c)->pc_intr_establish)((c)->pc_intr_v, (ih), (l), NULL, (h), (a),\ + (nm)) +#define pci_intr_establish_cpu(c, ih, l, ci, h, a, nm) \ + (*(c)->pc_intr_establish)((c)->pc_intr_v, (ih), (l), (ci), (h), (a),\ + (nm)) #define pci_intr_disestablish(c, iv) \ (*(c)->pc_intr_disestablish)((c)->pc_intr_v, (iv)) #define pci_probe_device_hook(c, a) (0) diff --git a/sys/arch/arm64/dev/acpipci.c b/sys/arch/arm64/dev/acpipci.c index f7f556e822d..ff5e43a0134 100644 --- a/sys/arch/arm64/dev/acpipci.c +++ b/sys/arch/arm64/dev/acpipci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpipci.c,v 1.16 2020/07/14 15:34:14 patrick Exp $ */ +/* $OpenBSD: acpipci.c,v 1.17 2020/07/14 15:42:19 patrick Exp $ */ /* * Copyright (c) 2018 Mark Kettenis * @@ -109,7 +109,7 @@ void acpipci_conf_write(void *, pcitag_t, int, pcireg_t); int acpipci_intr_map(struct pci_attach_args *, pci_intr_handle_t *); const char *acpipci_intr_string(void *, pci_intr_handle_t); void *acpipci_intr_establish(void *, pci_intr_handle_t, int, - int (*)(void *), void *, char *); + struct cpu_info *, int (*)(void *), void *, char *); void acpipci_intr_disestablish(void *, void *); uint32_t acpipci_iort_map_msi(pci_chipset_tag_t, pcitag_t); @@ -432,7 +432,7 @@ acpipci_intr_string(void *v, pci_intr_handle_t ih) void * acpipci_intr_establish(void *v, pci_intr_handle_t ih, int level, - int (*func)(void *), void *arg, char *name) + struct cpu_info *ci, int (*func)(void *), void *arg, char *name) { struct acpipci_softc *sc = v; struct interrupt_controller *ic; @@ -454,7 +454,7 @@ acpipci_intr_establish(void *v, pci_intr_handle_t ih, int level, /* Map Requester ID through IORT to get sideband data. */ data = acpipci_iort_map_msi(ih.ih_pc, ih.ih_tag); cookie = ic->ic_establish_msi(ic->ic_cookie, &addr, - &data, level, NULL, func, arg, name); + &data, level, ci, func, arg, name); if (cookie == NULL) return NULL; @@ -466,6 +466,8 @@ acpipci_intr_establish(void *v, pci_intr_handle_t ih, int level, } else pci_msi_enable(ih.ih_pc, ih.ih_tag, addr, data); } else { + if (ci != NULL && !CPU_IS_PRIMARY(ci)) + return NULL; cookie = acpi_intr_establish(ih.ih_intrpin, 0, level, func, arg, name); } diff --git a/sys/arch/arm64/dev/pciecam.c b/sys/arch/arm64/dev/pciecam.c index 2a9fde7415d..11958dd20b6 100644 --- a/sys/arch/arm64/dev/pciecam.c +++ b/sys/arch/arm64/dev/pciecam.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pciecam.c,v 1.9 2019/06/02 18:40:58 kettenis Exp $ */ +/* $OpenBSD: pciecam.c,v 1.10 2020/07/14 15:42:19 patrick Exp $ */ /* * Copyright (c) 2013,2017 Patrick Wildt <patrick@blueri.se> * @@ -102,7 +102,8 @@ pcireg_t pciecam_conf_read(void *, pcitag_t, int); void pciecam_conf_write(void *, pcitag_t, int, pcireg_t); int pciecam_intr_map(struct pci_attach_args *, pci_intr_handle_t *); const char *pciecam_intr_string(void *, pci_intr_handle_t); -void *pciecam_intr_establish(void *, pci_intr_handle_t, int, int (*func)(void *), void *, char *); +void *pciecam_intr_establish(void *, pci_intr_handle_t, int, + struct cpu_info *, int (*func)(void *), void *, char *); void pciecam_intr_disestablish(void *, void *); int pciecam_bs_map(bus_space_tag_t, bus_addr_t, bus_size_t, int, bus_space_handle_t *); @@ -342,7 +343,7 @@ pciecam_intr_string(void *sc, pci_intr_handle_t ih) void * pciecam_intr_establish(void *self, pci_intr_handle_t ih, int level, - int (*func)(void *), void *arg, char *name) + struct cpu_info *ci, int (*func)(void *), void *arg, char *name) { struct pciecam_softc *sc = (struct pciecam_softc *)self; void *cookie; @@ -354,8 +355,8 @@ pciecam_intr_establish(void *self, pci_intr_handle_t ih, int level, /* Assume hardware passes Requester ID as sideband data. */ data = pci_requester_id(ih.ih_pc, ih.ih_tag); - cookie = arm_intr_establish_fdt_msi(sc->sc_node, &addr, - &data, level, func, arg, (void *)name); + cookie = fdt_intr_establish_msi_cpu(sc->sc_node, &addr, + &data, level, ci, func, arg, (void *)name); if (cookie == NULL) return NULL; @@ -376,8 +377,8 @@ pciecam_intr_establish(void *self, pci_intr_handle_t ih, int level, reg[1] = reg[2] = 0; reg[3] = ih.ih_intrpin; - cookie = arm_intr_establish_fdt_imap(sc->sc_node, reg, - sizeof(reg), level, func, arg, name); + cookie = fdt_intr_establish_imap_cpu(sc->sc_node, reg, + sizeof(reg), level, ci, func, arg, name); } return cookie; diff --git a/sys/arch/arm64/include/pci_machdep.h b/sys/arch/arm64/include/pci_machdep.h index 24234175250..06259db8e9d 100644 --- a/sys/arch/arm64/include/pci_machdep.h +++ b/sys/arch/arm64/include/pci_machdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_machdep.h,v 1.6 2019/06/25 16:46:32 kettenis Exp $ */ +/* $OpenBSD: pci_machdep.h,v 1.7 2020/07/14 15:42:19 patrick Exp $ */ /* * Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -69,7 +69,8 @@ struct arm64_pci_chipset { int, pci_intr_handle_t *); const char *(*pc_intr_string)(void *, pci_intr_handle_t); void *(*pc_intr_establish)(void *, pci_intr_handle_t, - int, int (*)(void *), void *, char *); + int, struct cpu_info *, int (*)(void *), void *, + char *); void (*pc_intr_disestablish)(void *, void *); }; @@ -99,7 +100,11 @@ struct arm64_pci_chipset { #define pci_intr_string(c, ih) \ (*(c)->pc_intr_string)((c)->pc_intr_v, (ih)) #define pci_intr_establish(c, ih, l, h, a, nm) \ - (*(c)->pc_intr_establish)((c)->pc_intr_v, (ih), (l), (h), (a), (nm)) + (*(c)->pc_intr_establish)((c)->pc_intr_v, (ih), (l), NULL, (h), (a),\ + (nm)) +#define pci_intr_establish_cpu(c, ih, l, ci, h, a, nm) \ + (*(c)->pc_intr_establish)((c)->pc_intr_v, (ih), (l), (ci), (h), (a),\ + (nm)) #define pci_intr_disestablish(c, iv) \ (*(c)->pc_intr_disestablish)((c)->pc_intr_v, (iv)) #define pci_probe_device_hook(c, a) (0) diff --git a/sys/arch/armv7/marvell/mvpcie.c b/sys/arch/armv7/marvell/mvpcie.c index bf09211749d..d0734973f76 100644 --- a/sys/arch/armv7/marvell/mvpcie.c +++ b/sys/arch/armv7/marvell/mvpcie.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mvpcie.c,v 1.1 2018/07/09 09:58:40 patrick Exp $ */ +/* $OpenBSD: mvpcie.c,v 1.2 2020/07/14 15:42:19 patrick Exp $ */ /* * Copyright (c) 2018 Patrick Wildt <patrick@blueri.se> * Copyright (c) 2018 Mark Kettenis <kettenis@openbsd.org> @@ -201,7 +201,7 @@ int mvpcie_intr_map_msix(struct pci_attach_args *, int, pci_intr_handle_t *); const char *mvpcie_intr_string(void *, pci_intr_handle_t); void *mvpcie_intr_establish(void *, pci_intr_handle_t, int, - int (*)(void *), void *, char *); + struct cpu_info *ci, int (*)(void *), void *, char *); void mvpcie_intr_disestablish(void *, void *); void @@ -823,7 +823,7 @@ mvpcie_intr_string(void *v, pci_intr_handle_t ihp) void * mvpcie_intr_establish(void *v, pci_intr_handle_t ihp, int level, - int (*func)(void *), void *arg, char *name) + struct cpu_info *ci, int (*func)(void *), void *arg, char *name) { struct mvpcie_port *po = v; struct mvpcie_intr_handle *ih = (struct mvpcie_intr_handle *)ihp; @@ -837,8 +837,8 @@ mvpcie_intr_establish(void *v, pci_intr_handle_t ihp, int level, reg[1] = reg[2] = 0; reg[3] = ih->ih_intrpin; - cookie = arm_intr_establish_fdt_imap(po->po_node, reg, - sizeof(reg), level, func, arg, name); + cookie = arm_intr_establish_fdt_imap_cpu(po->po_node, reg, + sizeof(reg), level, ci, func, arg, name); free(ih, M_DEVBUF, sizeof(struct mvpcie_intr_handle)); return cookie; diff --git a/sys/arch/armv7/vexpress/pciecam.c b/sys/arch/armv7/vexpress/pciecam.c index 0847365190d..8ab86f6f14c 100644 --- a/sys/arch/armv7/vexpress/pciecam.c +++ b/sys/arch/armv7/vexpress/pciecam.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pciecam.c,v 1.1 2018/07/09 09:54:01 patrick Exp $ */ +/* $OpenBSD: pciecam.c,v 1.2 2020/07/14 15:42:19 patrick Exp $ */ /* * Copyright (c) 2013,2017 Patrick Wildt <patrick@blueri.se> * @@ -102,7 +102,8 @@ int pciecam_intr_map(struct pci_attach_args *, pci_intr_handle_t *); int pciecam_intr_map_msi(struct pci_attach_args *, pci_intr_handle_t *); int pciecam_intr_map_msix(struct pci_attach_args *, int, pci_intr_handle_t *); const char *pciecam_intr_string(void *, pci_intr_handle_t); -void *pciecam_intr_establish(void *, pci_intr_handle_t, int, int (*func)(void *), void *, char *); +void *pciecam_intr_establish(void *, pci_intr_handle_t, int, struct cpu_info *, + int (*func)(void *), void *, char *); void pciecam_intr_disestablish(void *, void *); int pciecam_bs_map(void *, uint64_t, bus_size_t, int, bus_space_handle_t *); @@ -368,7 +369,7 @@ pciecam_intr_string(void *sc, pci_intr_handle_t ihp) void * pciecam_intr_establish(void *self, pci_intr_handle_t ihp, int level, - int (*func)(void *), void *arg, char *name) + struct cpu_info *ci, int (*func)(void *), void *arg, char *name) { struct pciecam_softc *sc = (struct pciecam_softc *)self; struct pciecam_intr_handle *ih = (struct pciecam_intr_handle *)ihp; @@ -379,8 +380,8 @@ pciecam_intr_establish(void *self, pci_intr_handle_t ihp, int level, pcireg_t reg; int off; - cookie = arm_intr_establish_fdt_msi(sc->sc_node, &addr, - &data, level, func, arg, (void *)name); + cookie = arm_intr_establish_fdt_msi_cpu(sc->sc_node, &addr, + &data, level, ci, func, arg, (void *)name); if (cookie == NULL) return NULL; @@ -415,8 +416,8 @@ pciecam_intr_establish(void *self, pci_intr_handle_t ihp, int level, reg[1] = reg[2] = 0; reg[3] = ih->ih_intrpin; - cookie = arm_intr_establish_fdt_imap(sc->sc_node, reg, - sizeof(reg), level, func, arg, name); + cookie = arm_intr_establish_fdt_imap_cpu(sc->sc_node, reg, + sizeof(reg), level, ci, func, arg, name); } free(ih, M_DEVBUF, sizeof(struct pciecam_intr_handle)); |