Module Name:    src
Committed By:   thorpej
Date:           Sat Jun 19 16:59:07 UTC 2021

Modified Files:
        src/sys/arch/alpha/include: pci_machdep.h
        src/sys/arch/alpha/pci: apecs.c cia.c dwlpx.c irongate.c lca.c mcpcia.c
            pci_1000.c pci_1000a.c pci_2100_a50.c pci_2100_a500.c
            pci_2100_a500.h pci_550.c pci_6600.c pci_alphabook1.c
            pci_axppci_33.c pci_eb164.c pci_eb64plus.c pci_eb66.c pci_kn20aa.c
            pci_kn300.c pci_kn8ae.c pci_machdep.c pci_up1000.c tsc.c ttwoga.c
Removed Files:
        src/sys/arch/alpha/pci: pci_1000.h pci_1000a.h pci_2100_a50.h pci_550.h
            pci_6600.h pci_alphabook1.h pci_axppci_33.h pci_eb164.h
            pci_eb64plus.h pci_eb66.h pci_kn20aa.h pci_kn300.h pci_kn8ae.h
            pci_up1000.h

Log Message:
Don't use a bunch of switch() statements in the core logic drivers to select
the PCI interrupt initialization routine.  Instead, register said routines
by systype in a link set, and look them up and invoke them in a new function
alpha_pci_intr_init().


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/alpha/include/pci_machdep.h
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/alpha/pci/apecs.c
cvs rdiff -u -r1.76 -r1.77 src/sys/arch/alpha/pci/cia.c
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/alpha/pci/dwlpx.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/alpha/pci/irongate.c \
    src/sys/arch/alpha/pci/pci_alphabook1.c
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/alpha/pci/lca.c
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/alpha/pci/mcpcia.c
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/alpha/pci/pci_1000.c
cvs rdiff -u -r1.3 -r0 src/sys/arch/alpha/pci/pci_1000.h \
    src/sys/arch/alpha/pci/pci_eb64plus.h src/sys/arch/alpha/pci/pci_up1000.h
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/alpha/pci/pci_1000a.c \
    src/sys/arch/alpha/pci/pci_6600.c
cvs rdiff -u -r1.4 -r0 src/sys/arch/alpha/pci/pci_1000a.h \
    src/sys/arch/alpha/pci/pci_eb164.h src/sys/arch/alpha/pci/pci_kn300.h
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/alpha/pci/pci_2100_a50.c
cvs rdiff -u -r1.5 -r0 src/sys/arch/alpha/pci/pci_2100_a50.h \
    src/sys/arch/alpha/pci/pci_550.h src/sys/arch/alpha/pci/pci_axppci_33.h \
    src/sys/arch/alpha/pci/pci_kn20aa.h
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/alpha/pci/pci_2100_a500.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/alpha/pci/pci_2100_a500.h
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/alpha/pci/pci_550.c
cvs rdiff -u -r1.2 -r0 src/sys/arch/alpha/pci/pci_6600.h \
    src/sys/arch/alpha/pci/pci_alphabook1.h src/sys/arch/alpha/pci/pci_eb66.h
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/alpha/pci/pci_axppci_33.c \
    src/sys/arch/alpha/pci/pci_kn300.c
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/alpha/pci/pci_eb164.c
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/alpha/pci/pci_eb64plus.c \
    src/sys/arch/alpha/pci/pci_eb66.c
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/alpha/pci/pci_kn20aa.c
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/alpha/pci/pci_kn8ae.c
cvs rdiff -u -r1.6 -r0 src/sys/arch/alpha/pci/pci_kn8ae.h
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/alpha/pci/pci_machdep.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/alpha/pci/pci_up1000.c
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/alpha/pci/tsc.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/alpha/pci/ttwoga.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/alpha/include/pci_machdep.h
diff -u src/sys/arch/alpha/include/pci_machdep.h:1.22 src/sys/arch/alpha/include/pci_machdep.h:1.23
--- src/sys/arch/alpha/include/pci_machdep.h:1.22	Thu May 27 22:11:31 2021
+++ src/sys/arch/alpha/include/pci_machdep.h	Sat Jun 19 16:59:07 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_machdep.h,v 1.22 2021/05/27 22:11:31 thorpej Exp $ */
+/* $NetBSD: pci_machdep.h,v 1.23 2021/06/19 16:59:07 thorpej Exp $ */
 
 /*
  * Copyright (c) 1996 Carnegie-Mellon University.
@@ -96,6 +96,18 @@ struct alpha_pci_chipset {
 			    struct cpu_info *);
 };
 
+struct alpha_pci_intr_impl {
+	uint64_t	systype;
+	void		(*intr_init)(void *, bus_space_tag_t, bus_space_tag_t,
+			    pci_chipset_tag_t);
+};
+
+#define	ALPHA_PCI_INTR_INIT(_st_, _fn_)					\
+static const struct alpha_pci_intr_impl __CONCAT(intr_impl_st_,_st_) = {\
+	.systype = (_st_), .intr_init = (_fn_),				\
+};									\
+__link_set_add_rodata(alpha_pci_intr_impls, __CONCAT(intr_impl_st_,_st_));
+
 /*
  * Functions provided to machine-independent PCI code.
  */
@@ -122,6 +134,9 @@ void	pci_display_console(bus_space_tag_t
 	    pci_chipset_tag_t, int, int, int);
 void	device_pci_register(device_t, void *);
 
+void	alpha_pci_intr_init(void *, bus_space_tag_t, bus_space_tag_t,
+	    pci_chipset_tag_t);
+
 int	alpha_pci_generic_intr_map(const struct pci_attach_args *,
 	    pci_intr_handle_t *);
 const char *alpha_pci_generic_intr_string(pci_chipset_tag_t,

Index: src/sys/arch/alpha/pci/apecs.c
diff -u src/sys/arch/alpha/pci/apecs.c:1.56 src/sys/arch/alpha/pci/apecs.c:1.57
--- src/sys/arch/alpha/pci/apecs.c:1.56	Fri Jun 18 22:17:53 2021
+++ src/sys/arch/alpha/pci/apecs.c	Sat Jun 19 16:59:07 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: apecs.c,v 1.56 2021/06/18 22:17:53 thorpej Exp $ */
+/* $NetBSD: apecs.c,v 1.57 2021/06/19 16:59:07 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -56,14 +56,9 @@
  * rights to redistribute these changes.
  */
 
-#include "opt_dec_2100_a50.h"
-#include "opt_dec_eb64plus.h"
-#include "opt_dec_1000a.h"
-#include "opt_dec_1000.h"
-
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: apecs.c,v 1.56 2021/06/18 22:17:53 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: apecs.c,v 1.57 2021/06/19 16:59:07 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -82,18 +77,6 @@ __KERNEL_RCSID(0, "$NetBSD: apecs.c,v 1.
 #include <dev/pci/pcivar.h>
 #include <alpha/pci/apecsreg.h>
 #include <alpha/pci/apecsvar.h>
-#ifdef DEC_2100_A50
-#include <alpha/pci/pci_2100_a50.h>
-#endif
-#ifdef DEC_EB64PLUS
-#include <alpha/pci/pci_eb64plus.h>
-#endif
-#ifdef DEC_1000A
-#include <alpha/pci/pci_1000a.h>
-#endif
-#ifdef DEC_1000
-#include <alpha/pci/pci_1000.h>
-#endif
 
 static int apecsmatch(device_t, cfdata_t, void *);
 static void apecsattach(device_t, device_t, void *);
@@ -189,36 +172,7 @@ apecsattach(device_t parent, device_t se
 	if (!acp->ac_epic_pass2)
 		printf("WARNING: 21071-DA NOT PASS2... NO BETS...\n");
 
-	switch (cputype) {
-#ifdef DEC_2100_A50
-	case ST_DEC_2100_A50:
-		pci_2100_a50_pickintr(acp);
-		break;
-#endif
-
-#ifdef DEC_EB64PLUS
-	case ST_EB64P:
-		pci_eb64plus_pickintr(acp);
-		break;
-#endif
-
-#ifdef DEC_1000A
-	case ST_DEC_1000A:
-		pci_1000a_pickintr(acp, &acp->ac_iot, &acp->ac_memt,
-			&acp->ac_pc);
-		break;
-#endif
-
-#ifdef DEC_1000
-	case ST_DEC_1000:
-		pci_1000_pickintr(acp, &acp->ac_iot, &acp->ac_memt,
-			&acp->ac_pc);
-		break;
-#endif
-
-	default:
-		panic("apecsattach: shouldn't be here, really...");
-	}
+	alpha_pci_intr_init(acp, &acp->ac_iot, &acp->ac_memt, &acp->ac_pc);
 
 	pba.pba_iot = &acp->ac_iot;
 	pba.pba_memt = &acp->ac_memt;

Index: src/sys/arch/alpha/pci/cia.c
diff -u src/sys/arch/alpha/pci/cia.c:1.76 src/sys/arch/alpha/pci/cia.c:1.77
--- src/sys/arch/alpha/pci/cia.c:1.76	Fri Jun 18 22:17:53 2021
+++ src/sys/arch/alpha/pci/cia.c	Sat Jun 19 16:59:07 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: cia.c,v 1.76 2021/06/18 22:17:53 thorpej Exp $ */
+/* $NetBSD: cia.c,v 1.77 2021/06/19 16:59:07 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -57,15 +57,11 @@
  * rights to redistribute these changes.
  */
 
-#include "opt_dec_eb164.h"
-#include "opt_dec_kn20aa.h"
 #include "opt_dec_550.h"
-#include "opt_dec_1000a.h"
-#include "opt_dec_1000.h"
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: cia.c,v 1.76 2021/06/18 22:17:53 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cia.c,v 1.77 2021/06/19 16:59:07 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -86,22 +82,6 @@ __KERNEL_RCSID(0, "$NetBSD: cia.c,v 1.76
 #include <alpha/pci/ciareg.h>
 #include <alpha/pci/ciavar.h>
 
-#ifdef DEC_KN20AA
-#include <alpha/pci/pci_kn20aa.h>
-#endif
-#ifdef DEC_EB164
-#include <alpha/pci/pci_eb164.h>
-#endif
-#ifdef DEC_550
-#include <alpha/pci/pci_550.h>
-#endif
-#ifdef DEC_1000A
-#include <alpha/pci/pci_1000a.h>
-#endif
-#ifdef DEC_1000
-#include <alpha/pci/pci_1000.h>
-#endif
-
 static int	ciamatch(device_t, cfdata_t, void *);
 static void	ciaattach(device_t, device_t, void *);
 
@@ -353,42 +333,7 @@ ciaattach(device_t parent, device_t self
 
 	cia_dma_init(ccp);
 
-	switch (cputype) {
-#ifdef DEC_KN20AA
-	case ST_DEC_KN20AA:
-		pci_kn20aa_pickintr(ccp);
-		break;
-#endif
-
-#ifdef DEC_EB164
-	case ST_EB164:
-		pci_eb164_pickintr(ccp);
-		break;
-#endif
-
-#ifdef DEC_550
-	case ST_DEC_550:
-		pci_550_pickintr(ccp);
-		break;
-#endif
-
-#ifdef DEC_1000A
-	case ST_DEC_1000A:
-		pci_1000a_pickintr(ccp, &ccp->cc_iot, &ccp->cc_memt,
-			&ccp->cc_pc);
-		break;
-#endif
-
-#ifdef DEC_1000
-	case ST_DEC_1000:
-		pci_1000_pickintr(ccp, &ccp->cc_iot, &ccp->cc_memt,
-			&ccp->cc_pc);
-		break;
-#endif
-
-	default:
-		panic("ciaattach: shouldn't be here, really...");
-	}
+	alpha_pci_intr_init(ccp, &ccp->cc_iot, &ccp->cc_memt, &ccp->cc_pc);
 
 	pba.pba_iot = &ccp->cc_iot;
 	pba.pba_memt = &ccp->cc_memt;

Index: src/sys/arch/alpha/pci/dwlpx.c
diff -u src/sys/arch/alpha/pci/dwlpx.c:1.41 src/sys/arch/alpha/pci/dwlpx.c:1.42
--- src/sys/arch/alpha/pci/dwlpx.c:1.41	Sat Jun 19 16:29:03 2021
+++ src/sys/arch/alpha/pci/dwlpx.c	Sat Jun 19 16:59:07 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: dwlpx.c,v 1.41 2021/06/19 16:29:03 thorpej Exp $ */
+/* $NetBSD: dwlpx.c,v 1.42 2021/06/19 16:59:07 thorpej Exp $ */
 
 /*
  * Copyright (c) 1997 by Matthew Jacob
@@ -32,7 +32,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: dwlpx.c,v 1.41 2021/06/19 16:29:03 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwlpx.c,v 1.42 2021/06/19 16:59:07 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -50,7 +50,6 @@ __KERNEL_RCSID(0, "$NetBSD: dwlpx.c,v 1.
 #include <alpha/tlsb/kftxxreg.h>
 #include <alpha/pci/dwlpxreg.h>
 #include <alpha/pci/dwlpxvar.h>
-#include <alpha/pci/pci_kn8ae.h>
 
 #define	KV(_addr)	((void *)ALPHA_PHYS_TO_K0SEG((_addr)))
 #define	DWLPX_SYSBASE(sc)	\
@@ -160,7 +159,8 @@ dwlpxattach(device_t parent, device_t se
 	/*
 	 * Set up interrupts
 	 */
-	pci_kn8ae_pickintr(&sc->dwlpx_cc);
+	alpha_pci_intr_init(&sc->dwlpx_cc, &sc->dwlpx_cc.cc_iot,
+	    &sc->dwlpx_cc.cc_memt, &sc->dwlpx_cc.cc_pc);
 
 	/*
 	 * Attach PCI bus

Index: src/sys/arch/alpha/pci/irongate.c
diff -u src/sys/arch/alpha/pci/irongate.c:1.18 src/sys/arch/alpha/pci/irongate.c:1.19
--- src/sys/arch/alpha/pci/irongate.c:1.18	Fri Jun 18 22:17:53 2021
+++ src/sys/arch/alpha/pci/irongate.c	Sat Jun 19 16:59:07 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: irongate.c,v 1.18 2021/06/18 22:17:53 thorpej Exp $ */
+/* $NetBSD: irongate.c,v 1.19 2021/06/19 16:59:07 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -29,11 +29,9 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include "opt_api_up1000.h"
-
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: irongate.c,v 1.18 2021/06/18 22:17:53 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: irongate.c,v 1.19 2021/06/19 16:59:07 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -53,10 +51,6 @@ __KERNEL_RCSID(0, "$NetBSD: irongate.c,v
 #include <alpha/pci/irongatereg.h>
 #include <alpha/pci/irongatevar.h>
 
-#ifdef API_UP1000
-#include <alpha/pci/pci_up1000.h>
-#endif
-
 static int	irongate_match(device_t, cfdata_t, void *);
 static void	irongate_attach(device_t, device_t, void *);
 
@@ -157,16 +151,7 @@ irongate_attach(device_t parent, device_
 	 */
 	irongate_bus_mem_init2(&icp->ic_memt, icp);
 
-	switch (cputype) {
-#ifdef API_UP1000
-	case ST_API_NAUTILUS:
-		pci_up1000_pickintr(icp);
-		break;
-#endif
-
-	default:
-		panic("irongate_attach: shouldn't be here, really...");
-	}
+	alpha_pci_intr_init(icp, &icp->ic_iot, &icp->ic_memt, &icp->ic_pc);
 
 	tag = pci_make_tag(&icp->ic_pc, 0, IRONGATE_PCIHOST_DEV, 0);
 
Index: src/sys/arch/alpha/pci/pci_alphabook1.c
diff -u src/sys/arch/alpha/pci/pci_alphabook1.c:1.18 src/sys/arch/alpha/pci/pci_alphabook1.c:1.19
--- src/sys/arch/alpha/pci/pci_alphabook1.c:1.18	Tue Sep 22 15:24:02 2020
+++ src/sys/arch/alpha/pci/pci_alphabook1.c	Sat Jun 19 16:59:07 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_alphabook1.c,v 1.18 2020/09/22 15:24:02 thorpej Exp $ */
+/* $NetBSD: pci_alphabook1.c,v 1.19 2021/06/19 16:59:07 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: pci_alphabook1.c,v 1.18 2020/09/22 15:24:02 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_alphabook1.c,v 1.19 2021/06/19 16:59:07 thorpej Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -69,6 +69,7 @@ __KERNEL_RCSID(0, "$NetBSD: pci_alphaboo
 #include <sys/device.h>
 
 #include <machine/intr.h>
+#include <machine/rpb.h>
 
 #include <dev/isa/isavar.h>
 #include <dev/pci/pcireg.h>
@@ -76,7 +77,6 @@ __KERNEL_RCSID(0, "$NetBSD: pci_alphaboo
 
 #include <alpha/pci/lcavar.h>
 
-#include <alpha/pci/pci_alphabook1.h>
 #include <alpha/pci/siovar.h>
 #include <alpha/pci/sioreg.h>
 
@@ -87,11 +87,10 @@ static int	dec_alphabook1_intr_map(const
 
 #define	LCA_SIO_DEVICE	7	/* XXX */
 
-void
-pci_alphabook1_pickintr(struct lca_config *lcp)
+static void
+pci_alphabook1_pickintr(void *core, bus_space_tag_t iot, bus_space_tag_t memt,
+    pci_chipset_tag_t pc)
 {
-	bus_space_tag_t iot = &lcp->lc_iot;
-	pci_chipset_tag_t pc = &lcp->lc_pc;
 	pcireg_t sioclass;
 	int sioII;
 
@@ -103,7 +102,7 @@ pci_alphabook1_pickintr(struct lca_confi
 	if (!sioII)
 		printf("WARNING: SIO NOT SIO II... NO BETS...\n");
 
-	pc->pc_intr_v = lcp;
+	pc->pc_intr_v = core;
 	pc->pc_intr_map = dec_alphabook1_intr_map;
 	pc->pc_intr_string = sio_pci_intr_string;
 	pc->pc_intr_evcnt = sio_pci_intr_evcnt;
@@ -119,6 +118,7 @@ pci_alphabook1_pickintr(struct lca_confi
 	panic("pci_alphabook1_pickintr: no I/O interrupt handler (no sio)");
 #endif
 }
+ALPHA_PCI_INTR_INIT(ST_ALPHABOOK1, pci_alphabook1_pickintr)
 
 int
 dec_alphabook1_intr_map(const struct pci_attach_args *pa,

Index: src/sys/arch/alpha/pci/lca.c
diff -u src/sys/arch/alpha/pci/lca.c:1.53 src/sys/arch/alpha/pci/lca.c:1.54
--- src/sys/arch/alpha/pci/lca.c:1.53	Fri Jun 18 22:17:53 2021
+++ src/sys/arch/alpha/pci/lca.c	Sat Jun 19 16:59:07 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: lca.c,v 1.53 2021/06/18 22:17:53 thorpej Exp $ */
+/* $NetBSD: lca.c,v 1.54 2021/06/19 16:59:07 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -56,13 +56,9 @@
  * rights to redistribute these changes.
  */
 
-#include "opt_dec_axppci_33.h"
-#include "opt_dec_alphabook1.h"
-#include "opt_dec_eb66.h"
-
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: lca.c,v 1.53 2021/06/18 22:17:53 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lca.c,v 1.54 2021/06/19 16:59:07 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -81,15 +77,6 @@ __KERNEL_RCSID(0, "$NetBSD: lca.c,v 1.53
 #include <dev/pci/pcivar.h>
 #include <alpha/pci/lcareg.h>
 #include <alpha/pci/lcavar.h>
-#ifdef DEC_AXPPCI_33
-#include <alpha/pci/pci_axppci_33.h>
-#endif
-#ifdef DEC_ALPHABOOK1
-#include <alpha/pci/pci_alphabook1.h>
-#endif
-#ifdef DEC_EB66
-#include <alpha/pci/pci_eb66.h>
-#endif
 
 static int	lcamatch(device_t, cfdata_t, void *);
 static void	lcaattach(device_t, device_t, void *);
@@ -205,26 +192,7 @@ lcaattach(device_t parent, device_t self
 
 	lca_dma_init(lcp);
 
-	switch (cputype) {
-#ifdef DEC_AXPPCI_33
-	case ST_DEC_AXPPCI_33:
-		pci_axppci_33_pickintr(lcp);
-		break;
-#endif
-#ifdef DEC_ALPHABOOK1
-	case ST_ALPHABOOK1:
-		pci_alphabook1_pickintr(lcp);
-		break;
-#endif
-#ifdef DEC_EB66
-	case ST_EB66:
-		pci_eb66_pickintr(lcp);
-		break;
-#endif
-
-	default:
-		panic("lcaattach: shouldn't be here, really...");
-	}
+	alpha_pci_intr_init(lcp, &lcp->lc_iot, &lcp->lc_memt, &lcp->lc_pc);
 
 	pba.pba_iot = &lcp->lc_iot;
 	pba.pba_memt = &lcp->lc_memt;

Index: src/sys/arch/alpha/pci/mcpcia.c
diff -u src/sys/arch/alpha/pci/mcpcia.c:1.33 src/sys/arch/alpha/pci/mcpcia.c:1.34
--- src/sys/arch/alpha/pci/mcpcia.c:1.33	Sat Jun 19 16:13:40 2021
+++ src/sys/arch/alpha/pci/mcpcia.c	Sat Jun 19 16:59:07 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: mcpcia.c,v 1.33 2021/06/19 16:13:40 thorpej Exp $ */
+/* $NetBSD: mcpcia.c,v 1.34 2021/06/19 16:59:07 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: mcpcia.c,v 1.33 2021/06/19 16:13:40 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mcpcia.c,v 1.34 2021/06/19 16:59:07 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -82,7 +82,6 @@ __KERNEL_RCSID(0, "$NetBSD: mcpcia.c,v 1
 #include <alpha/mcbus/mcbusvar.h>
 #include <alpha/pci/mcpciareg.h>
 #include <alpha/pci/mcpciavar.h>
-#include <alpha/pci/pci_kn300.h>
 
 #define KV(_addr)	((void *)ALPHA_PHYS_TO_K0SEG((_addr)))
 #define	MCPCIA_SYSBASE(mc)	\
@@ -173,7 +172,7 @@ mcpciaattach(device_t parent, device_t s
 	/*
 	 * Set up interrupts
 	 */
-	pci_kn300_pickintr(ccp);
+	alpha_pci_intr_init(ccp, &ccp->cc_iot, &ccp->cc_memt, &ccp->cc_pc);
 
 	/*
 	 * Attach PCI bus

Index: src/sys/arch/alpha/pci/pci_1000.c
diff -u src/sys/arch/alpha/pci/pci_1000.c:1.27 src/sys/arch/alpha/pci/pci_1000.c:1.28
--- src/sys/arch/alpha/pci/pci_1000.c:1.27	Tue Sep 22 15:24:02 2020
+++ src/sys/arch/alpha/pci/pci_1000.c	Sat Jun 19 16:59:07 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_1000.c,v 1.27 2020/09/22 15:24:02 thorpej Exp $ */
+/* $NetBSD: pci_1000.c,v 1.28 2021/06/19 16:59:07 thorpej Exp $ */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: pci_1000.c,v 1.27 2020/09/22 15:24:02 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_1000.c,v 1.28 2021/06/19 16:59:07 thorpej Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -72,12 +72,11 @@ __KERNEL_RCSID(0, "$NetBSD: pci_1000.c,v
 #include <sys/syslog.h>
 
 #include <machine/autoconf.h>
+#include <machine/rpb.h>
 
 #include <dev/pci/pcireg.h>
 #include <dev/pci/pcivar.h>
 
-#include <alpha/pci/pci_1000.h>
-
 #include "sio.h"
 #if NSIO > 0 || NPCEB > 0
 #include <alpha/pci/siovar.h>
@@ -96,8 +95,9 @@ static void	dec_1000_enable_intr(pci_chi
 static void	dec_1000_disable_intr(pci_chipset_tag_t, int irq);
 static void	pci_1000_imi(void);
 
-void
-pci_1000_pickintr(void *core, bus_space_tag_t iot, bus_space_tag_t memt, pci_chipset_tag_t pc)
+static void
+pci_1000_pickintr(void *core, bus_space_tag_t iot, bus_space_tag_t memt,
+    pci_chipset_tag_t pc)
 {
 	char *cp;
 	int i;
@@ -142,6 +142,7 @@ pci_1000_pickintr(void *core, bus_space_
 	sio_intr_setup(pc, iot);
 #endif
 }
+ALPHA_PCI_INTR_INIT(ST_DEC_1000, pci_1000_pickintr)
 
 static int
 dec_1000_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)

Index: src/sys/arch/alpha/pci/pci_1000a.c
diff -u src/sys/arch/alpha/pci/pci_1000a.c:1.29 src/sys/arch/alpha/pci/pci_1000a.c:1.30
--- src/sys/arch/alpha/pci/pci_1000a.c:1.29	Tue Sep 22 15:24:02 2020
+++ src/sys/arch/alpha/pci/pci_1000a.c	Sat Jun 19 16:59:07 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_1000a.c,v 1.29 2020/09/22 15:24:02 thorpej Exp $ */
+/* $NetBSD: pci_1000a.c,v 1.30 2021/06/19 16:59:07 thorpej Exp $ */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: pci_1000a.c,v 1.29 2020/09/22 15:24:02 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_1000a.c,v 1.30 2021/06/19 16:59:07 thorpej Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -72,12 +72,11 @@ __KERNEL_RCSID(0, "$NetBSD: pci_1000a.c,
 #include <sys/syslog.h>
 
 #include <machine/autoconf.h>
+#include <machine/rpb.h>
 
 #include <dev/pci/pcireg.h>
 #include <dev/pci/pcivar.h>
 
-#include <alpha/pci/pci_1000a.h>
-
 #include "sio.h"
 #if NSIO > 0 || NPCEB > 0
 #include <alpha/pci/siovar.h>
@@ -99,8 +98,9 @@ static void	dec_1000a_enable_intr(pci_ch
 static void	dec_1000a_disable_intr(pci_chipset_tag_t, int irq);
 static void	pci_1000a_imi(void);
 
-void
-pci_1000a_pickintr(void *core, bus_space_tag_t iot, bus_space_tag_t memt, pci_chipset_tag_t pc)
+static void
+pci_1000a_pickintr(void *core, bus_space_tag_t iot, bus_space_tag_t memt,
+    pci_chipset_tag_t pc)
 {
 	char *cp;
 	int i;
@@ -146,6 +146,7 @@ pci_1000a_pickintr(void *core, bus_space
 	sio_intr_setup(pc, iot);
 #endif
 }
+ALPHA_PCI_INTR_INIT(ST_DEC_1000A, pci_1000a_pickintr)
 
 int
 dec_1000a_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)
Index: src/sys/arch/alpha/pci/pci_6600.c
diff -u src/sys/arch/alpha/pci/pci_6600.c:1.29 src/sys/arch/alpha/pci/pci_6600.c:1.30
--- src/sys/arch/alpha/pci/pci_6600.c:1.29	Sat Sep 26 21:07:48 2020
+++ src/sys/arch/alpha/pci/pci_6600.c	Sat Jun 19 16:59:07 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_6600.c,v 1.29 2020/09/26 21:07:48 thorpej Exp $ */
+/* $NetBSD: pci_6600.c,v 1.30 2021/06/19 16:59:07 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1999 by Ross Harvey.  All rights reserved.
@@ -33,7 +33,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: pci_6600.c,v 1.29 2020/09/26 21:07:48 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_6600.c,v 1.30 2021/06/19 16:59:07 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -55,7 +55,6 @@ __KERNEL_RCSID(0, "$NetBSD: pci_6600.c,v
 
 #include <alpha/pci/tsreg.h>
 #include <alpha/pci/tsvar.h>
-#include <alpha/pci/pci_6600.h>
 
 #define pci_6600() { Generate ctags(1) key. }
 
@@ -107,17 +106,16 @@ static void	dec_6600_intr_redistribute(v
 static uint64_t	dec_6600_intr_enables __read_mostly;
 static uint64_t dec_6600_cpu_intr_enables[4] __read_mostly;
 
-void
-pci_6600_pickintr(struct tsp_config *pcp)
+static void
+pci_6600_pickintr(void *core, bus_space_tag_t iot, bus_space_tag_t memt,
+    pci_chipset_tag_t pc)
 {
-	bus_space_tag_t iot = &pcp->pc_iot;
-	pci_chipset_tag_t pc = &pcp->pc_pc;
 	char *cp;
 	int i;
 	struct cpu_info *ci;
 	CPU_INFO_ITERATOR cii;
 
-	pc->pc_intr_v = pcp;
+	pc->pc_intr_v = core;
 	pc->pc_intr_map = dec_6600_intr_map;
 	pc->pc_intr_string = dec_6600_intr_string;
 	pc->pc_intr_evcnt = dec_6600_intr_evcnt;
@@ -146,7 +144,7 @@ pci_6600_pickintr(struct tsp_config *pcp
 	 * System-wide and Pchip-0-only logic...
 	 */
 	if (sioprimary == NULL) {
-		sioprimary = pcp;
+		sioprimary = core;
 		/*
 		 * Unless explicitly routed, all interrupts go to the
 		 * primary CPU.
@@ -181,6 +179,8 @@ pci_6600_pickintr(struct tsp_config *pcp
 		pc->pc_shared_intrs = sioprimary->pc_pc.pc_shared_intrs;
 	}
 }
+ALPHA_PCI_INTR_INIT(ST_DEC_6600, pci_6600_pickintr)
+ALPHA_PCI_INTR_INIT(ST_DEC_TITAN, pci_6600_pickintr)
 
 static int
 dec_6600_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)

Index: src/sys/arch/alpha/pci/pci_2100_a50.c
diff -u src/sys/arch/alpha/pci/pci_2100_a50.c:1.42 src/sys/arch/alpha/pci/pci_2100_a50.c:1.43
--- src/sys/arch/alpha/pci/pci_2100_a50.c:1.42	Tue Sep 22 15:24:02 2020
+++ src/sys/arch/alpha/pci/pci_2100_a50.c	Sat Jun 19 16:59:07 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_2100_a50.c,v 1.42 2020/09/22 15:24:02 thorpej Exp $ */
+/* $NetBSD: pci_2100_a50.c,v 1.43 2021/06/19 16:59:07 thorpej Exp $ */
 
 /*
  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
@@ -29,7 +29,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: pci_2100_a50.c,v 1.42 2020/09/22 15:24:02 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_2100_a50.c,v 1.43 2021/06/19 16:59:07 thorpej Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -39,6 +39,7 @@ __KERNEL_RCSID(0, "$NetBSD: pci_2100_a50
 #include <sys/device.h>
 
 #include <machine/autoconf.h>
+#include <machine/rpb.h>
 #include <sys/bus.h>
 #include <machine/intr.h>
 
@@ -48,7 +49,6 @@ __KERNEL_RCSID(0, "$NetBSD: pci_2100_a50
 
 #include <alpha/pci/apecsvar.h>
 
-#include <alpha/pci/pci_2100_a50.h>
 #include <alpha/pci/siovar.h>
 #include <alpha/pci/sioreg.h>
 
@@ -59,11 +59,10 @@ static int	dec_2100_a50_intr_map(const s
 
 #define	APECS_SIO_DEVICE	7	/* XXX */
 
-void
-pci_2100_a50_pickintr(struct apecs_config *acp)
+static void
+pci_2100_a50_pickintr(void *core, bus_space_tag_t iot, bus_space_tag_t memt,
+    pci_chipset_tag_t pc)
 {
-	bus_space_tag_t iot = &acp->ac_iot;
-	pci_chipset_tag_t pc = &acp->ac_pc;
 	pcireg_t sioclass;
 	int sioII;
 
@@ -74,7 +73,7 @@ pci_2100_a50_pickintr(struct apecs_confi
 	if (!sioII)
 		printf("WARNING: SIO NOT SIO II... NO BETS...\n");
 
-	pc->pc_intr_v = acp;
+	pc->pc_intr_v = core;
 	pc->pc_intr_map = dec_2100_a50_intr_map;
 	pc->pc_intr_string = sio_pci_intr_string;
 	pc->pc_intr_evcnt = sio_pci_intr_evcnt;
@@ -90,6 +89,7 @@ pci_2100_a50_pickintr(struct apecs_confi
 	panic("pci_2100_a50_pickintr: no I/O interrupt handler (no sio)");
 #endif
 }
+ALPHA_PCI_INTR_INIT(ST_DEC_2100_A50, pci_2100_a50_pickintr)
 
 int
 dec_2100_a50_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)

Index: src/sys/arch/alpha/pci/pci_2100_a500.c
diff -u src/sys/arch/alpha/pci/pci_2100_a500.c:1.14 src/sys/arch/alpha/pci/pci_2100_a500.c:1.15
--- src/sys/arch/alpha/pci/pci_2100_a500.c:1.14	Fri Sep 25 03:40:11 2020
+++ src/sys/arch/alpha/pci/pci_2100_a500.c	Sat Jun 19 16:59:07 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_2100_a500.c,v 1.14 2020/09/25 03:40:11 thorpej Exp $ */
+/* $NetBSD: pci_2100_a500.c,v 1.15 2021/06/19 16:59:07 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: pci_2100_a500.c,v 1.14 2020/09/25 03:40:11 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_2100_a500.c,v 1.15 2021/06/19 16:59:07 thorpej Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -44,6 +44,7 @@ __KERNEL_RCSID(0, "$NetBSD: pci_2100_a50
 #include <sys/syslog.h>
 
 #include <machine/autoconf.h>
+#include <machine/rpb.h>
 
 #include <dev/eisa/eisavar.h>
 
@@ -182,16 +183,17 @@ static const int dec_2100_a500_intr_deft
 	IST_LEVEL,
 };
 
-void
-pci_2100_a500_pickintr(struct ttwoga_config *tcp)
+static void
+pci_2100_a500_pickintr(void *core, bus_space_tag_t iot, bus_space_tag_t memt,
+    pci_chipset_tag_t pc)
 {
-	pci_chipset_tag_t pc = &tcp->tc_pc;
+	struct ttwoga_config *tcp = core;
 	char *cp;
 	int i;
 
-	pic_iot = &tcp->tc_iot;
+	pic_iot = iot;
 
-	pc->pc_intr_v = tcp;
+	pc->pc_intr_v = core;
 	pc->pc_intr_string = alpha_pci_generic_intr_string;
 	pc->pc_intr_evcnt = alpha_pci_generic_intr_evcnt;
 	pc->pc_intr_establish = dec_2100_a500_intr_establish;
@@ -246,6 +248,8 @@ pci_2100_a500_pickintr(struct ttwoga_con
 		dec_2100_a500_icic_init_intr(tcp);
 	}
 }
+ALPHA_PCI_INTR_INIT(ST_DEC_2100_A500, pci_2100_a500_pickintr)
+ALPHA_PCI_INTR_INIT(ST_DEC_2100A_A500, pci_2100_a500_pickintr)
 
 void
 pci_2100_a500_eisa_pickintr(pci_chipset_tag_t pc, eisa_chipset_tag_t ec)

Index: src/sys/arch/alpha/pci/pci_2100_a500.h
diff -u src/sys/arch/alpha/pci/pci_2100_a500.h:1.2 src/sys/arch/alpha/pci/pci_2100_a500.h:1.3
--- src/sys/arch/alpha/pci/pci_2100_a500.h:1.2	Mon Apr 28 20:23:11 2008
+++ src/sys/arch/alpha/pci/pci_2100_a500.h	Sat Jun 19 16:59:07 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_2100_a500.h,v 1.2 2008/04/28 20:23:11 martin Exp $ */
+/* $NetBSD: pci_2100_a500.h,v 1.3 2021/06/19 16:59:07 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,6 @@
  */
 
 struct ttwoga_config;
-void	pci_2100_a500_pickintr(struct ttwoga_config *);
 
 void	pci_2100_a500_eisa_pickintr(pci_chipset_tag_t, eisa_chipset_tag_t);
 void	pci_2100_a500_isa_pickintr(pci_chipset_tag_t, isa_chipset_tag_t);

Index: src/sys/arch/alpha/pci/pci_550.c
diff -u src/sys/arch/alpha/pci/pci_550.c:1.38 src/sys/arch/alpha/pci/pci_550.c:1.39
--- src/sys/arch/alpha/pci/pci_550.c:1.38	Tue Sep 22 15:24:02 2020
+++ src/sys/arch/alpha/pci/pci_550.c	Sat Jun 19 16:59:07 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_550.c,v 1.38 2020/09/22 15:24:02 thorpej Exp $ */
+/* $NetBSD: pci_550.c,v 1.39 2021/06/19 16:59:07 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: pci_550.c,v 1.38 2020/09/22 15:24:02 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_550.c,v 1.39 2021/06/19 16:59:07 thorpej Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -81,8 +81,6 @@ __KERNEL_RCSID(0, "$NetBSD: pci_550.c,v 
 #include <alpha/pci/ciareg.h>
 #include <alpha/pci/ciavar.h>
 
-#include <alpha/pci/pci_550.h>
-
 #include "sio.h"
 #if NSIO
 #include <alpha/pci/siovar.h>
@@ -119,15 +117,14 @@ static void	dec_550_intr_disestablish(pc
 static void	dec_550_intr_enable(pci_chipset_tag_t, int irq);
 static void	dec_550_intr_disable(pci_chipset_tag_t, int irq);
 
-void
-pci_550_pickintr(struct cia_config *ccp)
+static void
+pci_550_pickintr(void *core, bus_space_tag_t iot, bus_space_tag_t memt,
+    pci_chipset_tag_t pc)
 {
-	bus_space_tag_t iot = &ccp->cc_iot;
-	pci_chipset_tag_t pc = &ccp->cc_pc;
 	char *cp;
 	int i;
 
-	pc->pc_intr_v = ccp;
+	pc->pc_intr_v = core;
 	pc->pc_intr_map = dec_550_intr_map;
 	pc->pc_intr_string = dec_550_intr_string;
 	pc->pc_intr_evcnt = dec_550_intr_evcnt;
@@ -158,7 +155,7 @@ pci_550_pickintr(struct cia_config *ccp)
 	for (i = 0; i < DEC_550_MAX_IRQ; i++) {
 		alpha_shared_intr_set_maxstrays(pc->pc_shared_intrs, i,
 		    PCI_STRAY_MAX);
-		alpha_shared_intr_set_private(pc->pc_shared_intrs, i, ccp);
+		alpha_shared_intr_set_private(pc->pc_shared_intrs, i, core);
 		
 		cp = alpha_shared_intr_string(pc->pc_shared_intrs, i);
 		snprintf(cp, PCI_550_IRQ_STR, "irq %d", i);
@@ -171,6 +168,7 @@ pci_550_pickintr(struct cia_config *ccp)
 	sio_intr_setup(pc, iot);
 #endif
 }
+ALPHA_PCI_INTR_INIT(ST_DEC_550, pci_550_pickintr)
 
 static int
 dec_550_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)

Index: src/sys/arch/alpha/pci/pci_axppci_33.c
diff -u src/sys/arch/alpha/pci/pci_axppci_33.c:1.39 src/sys/arch/alpha/pci/pci_axppci_33.c:1.40
--- src/sys/arch/alpha/pci/pci_axppci_33.c:1.39	Tue Sep 22 15:24:02 2020
+++ src/sys/arch/alpha/pci/pci_axppci_33.c	Sat Jun 19 16:59:07 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_axppci_33.c,v 1.39 2020/09/22 15:24:02 thorpej Exp $ */
+/* $NetBSD: pci_axppci_33.c,v 1.40 2021/06/19 16:59:07 thorpej Exp $ */
 
 /*
  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
@@ -29,7 +29,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: pci_axppci_33.c,v 1.39 2020/09/22 15:24:02 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_axppci_33.c,v 1.40 2021/06/19 16:59:07 thorpej Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -39,6 +39,7 @@ __KERNEL_RCSID(0, "$NetBSD: pci_axppci_3
 #include <sys/device.h>
 
 #include <machine/autoconf.h>
+#include <machine/rpb.h>
 #include <sys/bus.h>
 #include <machine/intr.h>
 
@@ -48,7 +49,6 @@ __KERNEL_RCSID(0, "$NetBSD: pci_axppci_3
 
 #include <alpha/pci/lcavar.h>
 
-#include <alpha/pci/pci_axppci_33.h>
 #include <alpha/pci/siovar.h>
 #include <alpha/pci/sioreg.h>
 
@@ -59,11 +59,10 @@ static int	dec_axppci_33_intr_map(const 
 
 #define	LCA_SIO_DEVICE	7	/* XXX */
 
-void
-pci_axppci_33_pickintr(struct lca_config *lcp)
+static void
+pci_axppci_33_pickintr(void *core, bus_space_tag_t iot, bus_space_tag_t memt,
+    pci_chipset_tag_t pc)
 {
-	bus_space_tag_t iot = &lcp->lc_iot;
-	pci_chipset_tag_t pc = &lcp->lc_pc;
 	pcireg_t sioclass;
 	int sioII;
 
@@ -75,7 +74,7 @@ pci_axppci_33_pickintr(struct lca_config
 	if (!sioII)
 		printf("WARNING: SIO NOT SIO II... NO BETS...\n");
 
-	pc->pc_intr_v = lcp;
+	pc->pc_intr_v = core;
 	pc->pc_intr_map = dec_axppci_33_intr_map;
 	pc->pc_intr_string = sio_pci_intr_string;
 	pc->pc_intr_evcnt = sio_pci_intr_evcnt;
@@ -91,6 +90,7 @@ pci_axppci_33_pickintr(struct lca_config
 	panic("pci_axppci_33_pickintr: no I/O interrupt handler (no sio)");
 #endif
 }
+ALPHA_PCI_INTR_INIT(ST_DEC_AXPPCI_33, pci_axppci_33_pickintr)
 
 int
 dec_axppci_33_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)
Index: src/sys/arch/alpha/pci/pci_kn300.c
diff -u src/sys/arch/alpha/pci/pci_kn300.c:1.39 src/sys/arch/alpha/pci/pci_kn300.c:1.40
--- src/sys/arch/alpha/pci/pci_kn300.c:1.39	Sat Jun 19 16:13:40 2021
+++ src/sys/arch/alpha/pci/pci_kn300.c	Sat Jun 19 16:59:07 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_kn300.c,v 1.39 2021/06/19 16:13:40 thorpej Exp $ */
+/* $NetBSD: pci_kn300.c,v 1.40 2021/06/19 16:59:07 thorpej Exp $ */
 
 /*
  * Copyright (c) 1998 by Matthew Jacob
@@ -32,7 +32,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: pci_kn300.c,v 1.39 2021/06/19 16:13:40 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_kn300.c,v 1.40 2021/06/19 16:59:07 thorpej Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -45,6 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: pci_kn300.c,
 #include <sys/syslog.h>
 
 #include <machine/autoconf.h>
+#include <machine/rpb.h>
 
 #include <dev/pci/pcireg.h>
 #include <dev/pci/pcivar.h>
@@ -53,7 +54,6 @@ __KERNEL_RCSID(0, "$NetBSD: pci_kn300.c,
 #include <alpha/mcbus/mcbusreg.h>
 #include <alpha/pci/mcpciareg.h>
 #include <alpha/pci/mcpciavar.h>
-#include <alpha/pci/pci_kn300.h>
 
 #include "sio.h"
 #if NSIO > 0 || NPCEB > 0
@@ -84,11 +84,12 @@ static void	kn300_iointr(void *, unsigne
 static void	kn300_enable_intr(struct mcpcia_config *, int);
 static void	kn300_disable_intr(struct mcpcia_config *, int);
 
-void
-pci_kn300_pickintr(struct mcpcia_config *ccp)
+static void
+pci_kn300_pickintr(void *core, bus_space_tag_t iot, bus_space_tag_t memt,
+    pci_chipset_tag_t pc)
 {
+	struct mcpcia_config *ccp = core;
 	char *cp;
-	pci_chipset_tag_t pc = &ccp->cc_pc;
 
 	if (kn300_pci_intr == NULL) {
 		int g;
@@ -107,7 +108,7 @@ pci_kn300_pickintr(struct mcpcia_config 
 		}
 	}
 
-	pc->pc_intr_v = ccp;
+	pc->pc_intr_v = core;
 	pc->pc_intr_map = dec_kn300_intr_map;
 	pc->pc_intr_string = dec_kn300_intr_string;
 	pc->pc_intr_evcnt = dec_kn300_intr_evcnt;
@@ -125,6 +126,7 @@ pci_kn300_pickintr(struct mcpcia_config 
 #endif
 	}
 }
+ALPHA_PCI_INTR_INIT(ST_DEC_4100, pci_kn300_pickintr)
 
 static int
 dec_kn300_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)

Index: src/sys/arch/alpha/pci/pci_eb164.c
diff -u src/sys/arch/alpha/pci/pci_eb164.c:1.46 src/sys/arch/alpha/pci/pci_eb164.c:1.47
--- src/sys/arch/alpha/pci/pci_eb164.c:1.46	Tue Sep 22 15:24:02 2020
+++ src/sys/arch/alpha/pci/pci_eb164.c	Sat Jun 19 16:59:07 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_eb164.c,v 1.46 2020/09/22 15:24:02 thorpej Exp $ */
+/* $NetBSD: pci_eb164.c,v 1.47 2021/06/19 16:59:07 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: pci_eb164.c,v 1.46 2020/09/22 15:24:02 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_eb164.c,v 1.47 2021/06/19 16:59:07 thorpej Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -81,8 +81,6 @@ __KERNEL_RCSID(0, "$NetBSD: pci_eb164.c,
 #include <alpha/pci/ciareg.h>
 #include <alpha/pci/ciavar.h>
 
-#include <alpha/pci/pci_eb164.h>
-
 #include "sio.h"
 #if NSIO
 #include <alpha/pci/siovar.h>
@@ -102,15 +100,15 @@ static bus_space_handle_t eb164_intrgate
 extern void	eb164_intr_enable(pci_chipset_tag_t, int irq);
 extern void	eb164_intr_disable(pci_chipset_tag_t, int irq);
 
-void
-pci_eb164_pickintr(struct cia_config *ccp)
+static void
+pci_eb164_pickintr(void *core, bus_space_tag_t iot, bus_space_tag_t memt,
+    pci_chipset_tag_t pc)
 {
-	bus_space_tag_t iot = &ccp->cc_iot;
-	pci_chipset_tag_t pc = &ccp->cc_pc;
+	struct cia_config *ccp = core;
 	char *cp;
 	int i;
 
-	pc->pc_intr_v = ccp;
+	pc->pc_intr_v = core;
 	pc->pc_intr_map = dec_eb164_intr_map;
 	pc->pc_intr_string = alpha_pci_generic_intr_string;
 	pc->pc_intr_evcnt = alpha_pci_generic_intr_evcnt;
@@ -158,6 +156,7 @@ pci_eb164_pickintr(struct cia_config *cc
 	eb164_intr_enable(pc, EB164_SIO_IRQ);
 #endif
 }
+ALPHA_PCI_INTR_INIT(ST_EB164, pci_eb164_pickintr)
 
 static int
 dec_eb164_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)

Index: src/sys/arch/alpha/pci/pci_eb64plus.c
diff -u src/sys/arch/alpha/pci/pci_eb64plus.c:1.25 src/sys/arch/alpha/pci/pci_eb64plus.c:1.26
--- src/sys/arch/alpha/pci/pci_eb64plus.c:1.25	Tue Sep 22 15:24:02 2020
+++ src/sys/arch/alpha/pci/pci_eb64plus.c	Sat Jun 19 16:59:07 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_eb64plus.c,v 1.25 2020/09/22 15:24:02 thorpej Exp $ */
+/* $NetBSD: pci_eb64plus.c,v 1.26 2021/06/19 16:59:07 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: pci_eb64plus.c,v 1.25 2020/09/22 15:24:02 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_eb64plus.c,v 1.26 2021/06/19 16:59:07 thorpej Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -71,6 +71,7 @@ __KERNEL_RCSID(0, "$NetBSD: pci_eb64plus
 #include <sys/syslog.h>
 
 #include <machine/autoconf.h>
+#include <machine/rpb.h>
 
 #include <dev/pci/pcireg.h>
 #include <dev/pci/pcivar.h>
@@ -78,8 +79,6 @@ __KERNEL_RCSID(0, "$NetBSD: pci_eb64plus
 #include <alpha/pci/apecsreg.h>
 #include <alpha/pci/apecsvar.h>
 
-#include <alpha/pci/pci_eb64plus.h>
-
 #include "sio.h"
 #if NSIO
 #include <alpha/pci/siovar.h>
@@ -95,15 +94,14 @@ static bus_space_handle_t eb64plus_intrg
 extern void	eb64plus_intr_enable(pci_chipset_tag_t, int irq);
 extern void	eb64plus_intr_disable(pci_chipset_tag_t, int irq);
 
-void
-pci_eb64plus_pickintr(struct apecs_config *acp)
+static void
+pci_eb64plus_pickintr(void *core, bus_space_tag_t iot, bus_space_tag_t memt,
+    pci_chipset_tag_t pc)
 {
-	bus_space_tag_t iot = &acp->ac_iot;
-	pci_chipset_tag_t pc = &acp->ac_pc;
 	char *cp;
 	int i;
 
-	pc->pc_intr_v = acp;
+	pc->pc_intr_v = core;
 	pc->pc_intr_map = alpha_pci_generic_intr_map;
 	pc->pc_intr_string = alpha_pci_generic_intr_string;
 	pc->pc_intr_evcnt = alpha_pci_generic_intr_evcnt;
@@ -145,6 +143,7 @@ pci_eb64plus_pickintr(struct apecs_confi
 	sio_intr_setup(pc, iot);
 #endif
 }
+ALPHA_PCI_INTR_INIT(ST_EB64P, pci_eb64plus_pickintr)
 
 #if 0		/* THIS DOES NOT WORK!  see pci_eb64plus_intr.S. */
 uint8_t eb64plus_intr_mask[3] = { 0xff, 0xff, 0xff };
Index: src/sys/arch/alpha/pci/pci_eb66.c
diff -u src/sys/arch/alpha/pci/pci_eb66.c:1.25 src/sys/arch/alpha/pci/pci_eb66.c:1.26
--- src/sys/arch/alpha/pci/pci_eb66.c:1.25	Tue Sep 22 15:24:02 2020
+++ src/sys/arch/alpha/pci/pci_eb66.c	Sat Jun 19 16:59:07 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_eb66.c,v 1.25 2020/09/22 15:24:02 thorpej Exp $ */
+/* $NetBSD: pci_eb66.c,v 1.26 2021/06/19 16:59:07 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: pci_eb66.c,v 1.25 2020/09/22 15:24:02 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_eb66.c,v 1.26 2021/06/19 16:59:07 thorpej Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -71,6 +71,7 @@ __KERNEL_RCSID(0, "$NetBSD: pci_eb66.c,v
 #include <sys/syslog.h>
 
 #include <machine/autoconf.h>
+#include <machine/rpb.h>
 
 #include <dev/pci/pcireg.h>
 #include <dev/pci/pcivar.h>
@@ -78,8 +79,6 @@ __KERNEL_RCSID(0, "$NetBSD: pci_eb66.c,v
 #include <alpha/pci/lcareg.h>
 #include <alpha/pci/lcavar.h>
 
-#include <alpha/pci/pci_eb66.h>
-
 #include "sio.h"
 #if NSIO
 #include <alpha/pci/siovar.h>
@@ -95,15 +94,14 @@ static bus_space_handle_t eb66_intrgate_
 extern void	eb66_intr_enable(pci_chipset_tag_t pc, int irq);
 extern void	eb66_intr_disable(pci_chipset_tag_t pc, int irq);
 
-void
-pci_eb66_pickintr(struct lca_config *lcp)
+static void
+pci_eb66_pickintr(void *core, bus_space_tag_t iot, bus_space_tag_t memt,
+    pci_chipset_tag_t pc)
 {
-	bus_space_tag_t iot = &lcp->lc_iot;
-	pci_chipset_tag_t pc = &lcp->lc_pc;
 	char *cp;
 	int i;
 
-	pc->pc_intr_v = lcp;
+	pc->pc_intr_v = core;
 	pc->pc_intr_map = alpha_pci_generic_intr_map;
 	pc->pc_intr_string = alpha_pci_generic_intr_string;
 	pc->pc_intr_evcnt = alpha_pci_generic_intr_evcnt;
@@ -145,6 +143,7 @@ pci_eb66_pickintr(struct lca_config *lcp
 	sio_intr_setup(pc, iot);
 #endif
 }
+ALPHA_PCI_INTR_INIT(ST_EB66, pci_eb66_pickintr)
 
 #if 0		/* THIS DOES NOT WORK!  see pci_eb66_intr.S. */
 uint8_t eb66_intr_mask[3] = { 0xff, 0xff, 0xff };

Index: src/sys/arch/alpha/pci/pci_kn20aa.c
diff -u src/sys/arch/alpha/pci/pci_kn20aa.c:1.55 src/sys/arch/alpha/pci/pci_kn20aa.c:1.56
--- src/sys/arch/alpha/pci/pci_kn20aa.c:1.55	Tue Sep 22 15:24:02 2020
+++ src/sys/arch/alpha/pci/pci_kn20aa.c	Sat Jun 19 16:59:07 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_kn20aa.c,v 1.55 2020/09/22 15:24:02 thorpej Exp $ */
+/* $NetBSD: pci_kn20aa.c,v 1.56 2021/06/19 16:59:07 thorpej Exp $ */
 
 /*
  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
@@ -29,7 +29,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: pci_kn20aa.c,v 1.55 2020/09/22 15:24:02 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_kn20aa.c,v 1.56 2021/06/19 16:59:07 thorpej Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -41,6 +41,7 @@ __KERNEL_RCSID(0, "$NetBSD: pci_kn20aa.c
 #include <sys/syslog.h>
 
 #include <machine/autoconf.h>
+#include <machine/rpb.h>
 
 #include <dev/pci/pcireg.h>
 #include <dev/pci/pcivar.h>
@@ -48,8 +49,6 @@ __KERNEL_RCSID(0, "$NetBSD: pci_kn20aa.c
 #include <alpha/pci/ciareg.h>
 #include <alpha/pci/ciavar.h>
 
-#include <alpha/pci/pci_kn20aa.h>
-
 #include "sio.h"
 #if NSIO > 0 || NPCEB > 0
 #include <alpha/pci/siovar.h>
@@ -65,17 +64,14 @@ static int	dec_kn20aa_intr_map(const str
 static void	kn20aa_enable_intr(pci_chipset_tag_t pc, int irq);
 static void	kn20aa_disable_intr(pci_chipset_tag_t pc, int irq);
 
-void
-pci_kn20aa_pickintr(struct cia_config *ccp)
+static void
+pci_kn20aa_pickintr(void *core, bus_space_tag_t iot, bus_space_tag_t memt,
+    pci_chipset_tag_t pc)
 {
 	int i;
-#if NSIO > 0 || NPCEB > 0
-	bus_space_tag_t iot = &ccp->cc_iot;
-#endif
-	pci_chipset_tag_t pc = &ccp->cc_pc;
 	char *cp;
 
-	pc->pc_intr_v = ccp;
+	pc->pc_intr_v = core;
 	pc->pc_intr_map = dec_kn20aa_intr_map;
 	pc->pc_intr_string = alpha_pci_generic_intr_string;
 	pc->pc_intr_evcnt = alpha_pci_generic_intr_evcnt;
@@ -111,6 +107,7 @@ pci_kn20aa_pickintr(struct cia_config *c
 	kn20aa_enable_intr(pc, KN20AA_PCEB_IRQ);
 #endif
 }
+ALPHA_PCI_INTR_INIT(ST_DEC_KN20AA, pci_kn20aa_pickintr)
 
 static int
 dec_kn20aa_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)

Index: src/sys/arch/alpha/pci/pci_kn8ae.c
diff -u src/sys/arch/alpha/pci/pci_kn8ae.c:1.32 src/sys/arch/alpha/pci/pci_kn8ae.c:1.33
--- src/sys/arch/alpha/pci/pci_kn8ae.c:1.32	Sat Jun 19 16:29:03 2021
+++ src/sys/arch/alpha/pci/pci_kn8ae.c	Sat Jun 19 16:59:07 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_kn8ae.c,v 1.32 2021/06/19 16:29:03 thorpej Exp $ */
+/* $NetBSD: pci_kn8ae.c,v 1.33 2021/06/19 16:59:07 thorpej Exp $ */
 
 /*
  * Copyright (c) 1997 by Matthew Jacob
@@ -32,7 +32,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: pci_kn8ae.c,v 1.32 2021/06/19 16:29:03 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_kn8ae.c,v 1.33 2021/06/19 16:59:07 thorpej Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -46,13 +46,13 @@ __KERNEL_RCSID(0, "$NetBSD: pci_kn8ae.c,
 #include <sys/once.h>
 
 #include <machine/autoconf.h>
+#include <machine/rpb.h>
 
 #include <dev/pci/pcireg.h>
 #include <dev/pci/pcivar.h>
 
 #include <alpha/pci/dwlpxreg.h>
 #include <alpha/pci/dwlpxvar.h>
-#include <alpha/pci/pci_kn8ae.h>
 
 static int	dec_kn8ae_intr_map(const struct pci_attach_args *,
 		    pci_intr_handle_t *);
@@ -106,12 +106,12 @@ pci_kn8ae_init_imaskcache(void)
 	return 0;
 }
 
-void
-pci_kn8ae_pickintr(struct dwlpx_config *ccp)
+static void
+pci_kn8ae_pickintr(void *core, bus_space_tag_t iot, bus_space_tag_t memt,
+    pci_chipset_tag_t pc)
 {
-	pci_chipset_tag_t pc = &ccp->cc_pc;
 
-	pc->pc_intr_v = ccp;
+	pc->pc_intr_v = core;
 	pc->pc_intr_map = dec_kn8ae_intr_map;
 	pc->pc_intr_string = dec_kn8ae_intr_string;
 	pc->pc_intr_evcnt = dec_kn8ae_intr_evcnt;
@@ -123,6 +123,7 @@ pci_kn8ae_pickintr(struct dwlpx_config *
 
 	RUN_ONCE(&pci_kn8ae_once, pci_kn8ae_init_imaskcache);
 }
+ALPHA_PCI_INTR_INIT(ST_DEC_21000, pci_kn8ae_pickintr)
 
 #define	IH_MAKE(vec, dev, pin)						\
 	((vec) | ((dev) << 16) | ((pin) << 24))

Index: src/sys/arch/alpha/pci/pci_machdep.c
diff -u src/sys/arch/alpha/pci/pci_machdep.c:1.28 src/sys/arch/alpha/pci/pci_machdep.c:1.29
--- src/sys/arch/alpha/pci/pci_machdep.c:1.28	Sat Sep 26 21:07:48 2020
+++ src/sys/arch/alpha/pci/pci_machdep.c	Sat Jun 19 16:59:07 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_machdep.c,v 1.28 2020/09/26 21:07:48 thorpej Exp $ */
+/* $NetBSD: pci_machdep.c,v 1.29 2021/06/19 16:59:07 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.28 2020/09/26 21:07:48 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.29 2021/06/19 16:59:07 thorpej Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -160,6 +160,22 @@ device_pci_register(device_t dev, void *
 	}
 }
 
+void
+alpha_pci_intr_init(void *core, bus_space_tag_t iot, bus_space_tag_t memt,
+    pci_chipset_tag_t pc)
+{
+	__link_set_decl(alpha_pci_intr_impls, struct alpha_pci_intr_impl);
+	struct alpha_pci_intr_impl * const *impl;
+
+	__link_set_foreach(impl, alpha_pci_intr_impls) {
+		if ((*impl)->systype == cputype) {
+			(*impl)->intr_init(core, iot, memt, pc);
+			return;
+		}
+	}
+	panic("%s: unknown systype %d", __func__, cputype);
+}
+
 int
 alpha_pci_generic_intr_map(const struct pci_attach_args * const pa,
     pci_intr_handle_t * const ihp)

Index: src/sys/arch/alpha/pci/pci_up1000.c
diff -u src/sys/arch/alpha/pci/pci_up1000.c:1.16 src/sys/arch/alpha/pci/pci_up1000.c:1.17
--- src/sys/arch/alpha/pci/pci_up1000.c:1.16	Tue Sep 22 15:24:02 2020
+++ src/sys/arch/alpha/pci/pci_up1000.c	Sat Jun 19 16:59:07 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_up1000.c,v 1.16 2020/09/22 15:24:02 thorpej Exp $ */
+/* $NetBSD: pci_up1000.c,v 1.17 2021/06/19 16:59:07 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: pci_up1000.c,v 1.16 2020/09/22 15:24:02 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_up1000.c,v 1.17 2021/06/19 16:59:07 thorpej Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -41,6 +41,7 @@ __KERNEL_RCSID(0, "$NetBSD: pci_up1000.c
 #include <sys/device.h>
 
 #include <machine/autoconf.h>
+#include <machine/rpb.h>
 #include <sys/bus.h>
 #include <machine/intr.h>
 
@@ -53,7 +54,6 @@ __KERNEL_RCSID(0, "$NetBSD: pci_up1000.c
 
 #include <alpha/pci/irongatevar.h>
 
-#include <alpha/pci/pci_up1000.h>
 #include <alpha/pci/siovar.h>
 #include <alpha/pci/sioreg.h>
 
@@ -62,14 +62,12 @@ __KERNEL_RCSID(0, "$NetBSD: pci_up1000.c
 static int	api_up1000_intr_map(const struct pci_attach_args *,
 		    pci_intr_handle_t *);
 
-void
-pci_up1000_pickintr(struct irongate_config *icp)
+static void
+pci_up1000_pickintr(void *core, bus_space_tag_t iot, bus_space_tag_t memt,
+    pci_chipset_tag_t pc)
 {
 #if NSIO
-	bus_space_tag_t iot = &icp->ic_iot;
-	pci_chipset_tag_t pc = &icp->ic_pc;
-
-	pc->pc_intr_v = icp;
+	pc->pc_intr_v = core;
 	pc->pc_intr_map = api_up1000_intr_map;
 	pc->pc_intr_string = sio_pci_intr_string;
 	pc->pc_intr_evcnt = sio_pci_intr_evcnt;
@@ -84,6 +82,7 @@ pci_up1000_pickintr(struct irongate_conf
 	panic("pci_up1000_pickintr: no I/O interrupt handler (no sio)");
 #endif
 }
+ALPHA_PCI_INTR_INIT(ST_API_NAUTILUS, pci_up1000_pickintr)
 
 static int
 api_up1000_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ihp)

Index: src/sys/arch/alpha/pci/tsc.c
diff -u src/sys/arch/alpha/pci/tsc.c:1.26 src/sys/arch/alpha/pci/tsc.c:1.27
--- src/sys/arch/alpha/pci/tsc.c:1.26	Thu May 27 22:11:31 2021
+++ src/sys/arch/alpha/pci/tsc.c	Sat Jun 19 16:59:07 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: tsc.c,v 1.26 2021/05/27 22:11:31 thorpej Exp $ */
+/* $NetBSD: tsc.c,v 1.27 2021/06/19 16:59:07 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1999 by Ross Harvey.  All rights reserved.
@@ -31,11 +31,9 @@
  *
  */
 
-#include "opt_dec_6600.h"
-
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: tsc.c,v 1.26 2021/05/27 22:11:31 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tsc.c,v 1.27 2021/06/19 16:59:07 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -55,10 +53,6 @@ __KERNEL_RCSID(0, "$NetBSD: tsc.c,v 1.26
 
 #include "tsciic.h"
 
-#ifdef DEC_6600
-#include <alpha/pci/pci_6600.h>
-#endif
-
 #define tsc() { Generate ctags(1) key. }
 
 static int tscmatch(device_t, cfdata_t, void *);
@@ -225,7 +219,7 @@ tspattach(device_t parent, device_t self
 	 */
 	tsp_bus_mem_init2(&pcp->pc_memt, pcp);
 
-	pci_6600_pickintr(pcp);
+	alpha_pci_intr_init(pcp, &pcp->pc_iot, &pcp->pc_memt, &pcp->pc_pc);
 
 	pba.pba_iot = &pcp->pc_iot;
 	pba.pba_memt = &pcp->pc_memt;

Index: src/sys/arch/alpha/pci/ttwoga.c
diff -u src/sys/arch/alpha/pci/ttwoga.c:1.17 src/sys/arch/alpha/pci/ttwoga.c:1.18
--- src/sys/arch/alpha/pci/ttwoga.c:1.17	Sat May  8 00:08:43 2021
+++ src/sys/arch/alpha/pci/ttwoga.c	Sat Jun 19 16:59:07 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ttwoga.c,v 1.17 2021/05/08 00:08:43 thorpej Exp $ */
+/* $NetBSD: ttwoga.c,v 1.18 2021/06/19 16:59:07 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: ttwoga.c,v 1.17 2021/05/08 00:08:43 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ttwoga.c,v 1.18 2021/06/19 16:59:07 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -235,19 +235,10 @@ ttwopciattach(device_t parent, device_t 
 	    tcp->tc_rev);
 
 	if (tcp->tc_rev < 1)
-		aprint_normal_dev(self, "WARNING: T2 NOT PASS2... NO BETS...\n");
+		aprint_normal_dev(self,
+		    "WARNING: T2 NOT PASS2... NO BETS...\n");
 
-	switch (cputype) {
-#if defined(DEC_2100_A500) || defined(DEC_2100A_A500)
-	case ST_DEC_2100_A500:
-	case ST_DEC_2100A_A500:
-		pci_2100_a500_pickintr(tcp);
-		break;
-#endif
-	
-	default:
-		panic("ttwogaattach: shouldn't be here, really...");
-	}
+	alpha_pci_intr_init(tcp, &tcp->tc_iot, &tcp->tc_memt, &tcp->tc_pc);
 
 	npba.pba_iot = &tcp->tc_iot;
 	npba.pba_memt = &tcp->tc_memt;

Reply via email to