Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/alpha/pci Remove the "first" argument from pci_kn8a...
details: https://anonhg.NetBSD.org/src/rev/14260ab5bc3d
branches: trunk
changeset: 379789:14260ab5bc3d
user: thorpej <thorpej%NetBSD.org@localhost>
date: Sat Jun 19 16:29:03 2021 +0000
description:
Remove the "first" argument from pci_kn8ae_pickintr(), instead using
a real once control in that function. Removes a needless divergence from
other "pickintr" routines.
diffstat:
sys/arch/alpha/pci/dwlpx.c | 18 ++++++------------
sys/arch/alpha/pci/pci_kn8ae.c | 38 +++++++++++++++++++++++---------------
sys/arch/alpha/pci/pci_kn8ae.h | 4 ++--
3 files changed, 31 insertions(+), 29 deletions(-)
diffs (136 lines):
diff -r c1edc8b9bc9f -r 14260ab5bc3d sys/arch/alpha/pci/dwlpx.c
--- a/sys/arch/alpha/pci/dwlpx.c Sat Jun 19 16:13:40 2021 +0000
+++ b/sys/arch/alpha/pci/dwlpx.c Sat Jun 19 16:29:03 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dwlpx.c,v 1.40 2021/04/24 23:36:23 thorpej Exp $ */
+/* $NetBSD: dwlpx.c,v 1.41 2021/06/19 16:29:03 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.40 2021/04/24 23:36:23 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwlpx.c,v 1.41 2021/06/19 16:29:03 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -106,7 +106,6 @@ dwlpxmatch(device_t parent, cfdata_t cf,
static void
dwlpxattach(device_t parent, device_t self, void *aux)
{
- static int once = 0;
struct dwlpx_softc *sc = device_private(self);
struct dwlpx_config *ccp = &sc->dwlpx_cc;
struct kft_dev_attach_args *ka = aux;
@@ -158,15 +157,10 @@ dwlpxattach(device_t parent, device_t se
}
#endif
- if (once == 0) {
- /*
- * Set up interrupts
- */
- pci_kn8ae_pickintr(&sc->dwlpx_cc, 1);
- once++;
- } else {
- pci_kn8ae_pickintr(&sc->dwlpx_cc, 0);
- }
+ /*
+ * Set up interrupts
+ */
+ pci_kn8ae_pickintr(&sc->dwlpx_cc);
/*
* Attach PCI bus
diff -r c1edc8b9bc9f -r 14260ab5bc3d sys/arch/alpha/pci/pci_kn8ae.c
--- a/sys/arch/alpha/pci/pci_kn8ae.c Sat Jun 19 16:13:40 2021 +0000
+++ b/sys/arch/alpha/pci/pci_kn8ae.c Sat Jun 19 16:29:03 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_kn8ae.c,v 1.31 2020/09/25 03:40:11 thorpej Exp $ */
+/* $NetBSD: pci_kn8ae.c,v 1.32 2021/06/19 16:29:03 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.31 2020/09/25 03:40:11 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_kn8ae.c,v 1.32 2021/06/19 16:29:03 thorpej Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -43,6 +43,7 @@
#include <sys/device.h>
#include <sys/cpu.h>
#include <sys/syslog.h>
+#include <sys/once.h>
#include <machine/autoconf.h>
@@ -87,10 +88,27 @@ kn8ae_intr_wrapper(void *arg, u_long vec
KERNEL_UNLOCK_ONE(NULL);
}
-void
-pci_kn8ae_pickintr(struct dwlpx_config *ccp, int first)
+static ONCE_DECL(pci_kn8ae_once);
+
+static int
+pci_kn8ae_init_imaskcache(void)
{
int io, hose, dev;
+
+ for (io = 0; io < DWLPX_NIONODE; io++) {
+ for (hose = 0; hose < DWLPX_NHOSE; hose++) {
+ for (dev = 0; dev < NHPC; dev++) {
+ imaskcache[io][hose][dev] = DWLPX_IMASK_DFLT;
+ }
+ }
+ }
+
+ return 0;
+}
+
+void
+pci_kn8ae_pickintr(struct dwlpx_config *ccp)
+{
pci_chipset_tag_t pc = &ccp->cc_pc;
pc->pc_intr_v = ccp;
@@ -103,17 +121,7 @@ pci_kn8ae_pickintr(struct dwlpx_config *
/* Not supported on KN8AE. */
pc->pc_pciide_compat_intr_establish = NULL;
- if (!first) {
- return;
- }
-
- for (io = 0; io < DWLPX_NIONODE; io++) {
- for (hose = 0; hose < DWLPX_NHOSE; hose++) {
- for (dev = 0; dev < NHPC; dev++) {
- imaskcache[io][hose][dev] = DWLPX_IMASK_DFLT;
- }
- }
- }
+ RUN_ONCE(&pci_kn8ae_once, pci_kn8ae_init_imaskcache);
}
#define IH_MAKE(vec, dev, pin) \
diff -r c1edc8b9bc9f -r 14260ab5bc3d sys/arch/alpha/pci/pci_kn8ae.h
--- a/sys/arch/alpha/pci/pci_kn8ae.h Sat Jun 19 16:13:40 2021 +0000
+++ b/sys/arch/alpha/pci/pci_kn8ae.h Sat Jun 19 16:29:03 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_kn8ae.h,v 1.5 2009/03/14 14:45:53 dsl Exp $ */
+/* $NetBSD: pci_kn8ae.h,v 1.6 2021/06/19 16:29:03 thorpej Exp $ */
/*
* Copyright (c) 1997 by Matthew Jacob
@@ -30,4 +30,4 @@
* SUCH DAMAGE.
*/
-void pci_kn8ae_pickintr(struct dwlpx_config *, int);
+void pci_kn8ae_pickintr(struct dwlpx_config *);
Home |
Main Index |
Thread Index |
Old Index