Module Name:    src
Committed By:   jmcneill
Date:           Tue May  2 09:49:33 UTC 2023

Modified Files:
        src/sys/arch/arm/ep93xx: ep93xx_intr.c ep93xxvar.h
        src/sys/arch/evbarm/tsarm: tsarm_machdep.c

Log Message:
TS7200: Defer event counter registration until after evcnt is initialized

Patch from Lloyd Parkes <ll...@must-have-coffee.gen.nz> in PR# kern/57386


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/arm/ep93xx/ep93xx_intr.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/ep93xx/ep93xxvar.h
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/evbarm/tsarm/tsarm_machdep.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/arm/ep93xx/ep93xx_intr.c
diff -u src/sys/arch/arm/ep93xx/ep93xx_intr.c:1.27 src/sys/arch/arm/ep93xx/ep93xx_intr.c:1.28
--- src/sys/arch/arm/ep93xx/ep93xx_intr.c:1.27	Sun Nov 21 08:25:26 2021
+++ src/sys/arch/arm/ep93xx/ep93xx_intr.c	Tue May  2 09:49:33 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ep93xx_intr.c,v 1.27 2021/11/21 08:25:26 skrll Exp $ */
+/* $NetBSD: ep93xx_intr.c,v 1.28 2023/05/02 09:49:33 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ep93xx_intr.c,v 1.27 2021/11/21 08:25:26 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ep93xx_intr.c,v 1.28 2023/05/02 09:49:33 jmcneill Exp $");
 
 /*
  * Interrupt support for the Cirrus Logic EP93XX
@@ -257,9 +257,6 @@ ep93xx_intr_init(void)
 		TAILQ_INIT(&iq->iq_list);
 
 		snprintf(iq->iq_name, sizeof(iq->iq_name), "irq %d", i);
-		evcnt_attach_dynamic(&iq->iq_ev, EVCNT_TYPE_INTR,
-				     NULL, (i < VIC_NIRQ ? "vic1" : "vic2"),
-		                     iq->iq_name);
 	}
 	curcpu()->ci_intr_depth = 0;
 	set_curcpl(0);
@@ -275,6 +272,20 @@ ep93xx_intr_init(void)
 	enable_interrupts(I32_bit);
 }
 
+void
+ep93xx_intr_evcnt_attach(void)
+{
+	struct intrq *iq;
+	int i;
+
+	for (i = 0; i < NIRQ; i++) {
+		iq = &intrq[i];
+		evcnt_attach_dynamic(&iq->iq_ev, EVCNT_TYPE_INTR,
+				     NULL, (i < VIC_NIRQ ? "vic1" : "vic2"),
+				     iq->iq_name);
+	}
+}
+
 void *
 ep93xx_intr_establish(int irq, int ipl, int (*ih_func)(void *), void *arg)
 {

Index: src/sys/arch/arm/ep93xx/ep93xxvar.h
diff -u src/sys/arch/arm/ep93xx/ep93xxvar.h:1.6 src/sys/arch/arm/ep93xx/ep93xxvar.h:1.7
--- src/sys/arch/arm/ep93xx/ep93xxvar.h:1.6	Mon Nov 12 18:00:36 2012
+++ src/sys/arch/arm/ep93xx/ep93xxvar.h	Tue May  2 09:49:33 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: ep93xxvar.h,v 1.6 2012/11/12 18:00:36 skrll Exp $ */
+/*	$NetBSD: ep93xxvar.h,v 1.7 2023/05/02 09:49:33 jmcneill Exp $ */
 /*
  * Copyright (c) 2004 Jesse Off
  * All rights reserved.
@@ -69,6 +69,7 @@ extern struct arm32_bus_dma_tag ep93xx_b
 void	ep93xx_intr_init(void);
 void	*ep93xx_intr_establish(int irq, int ipl, int (*)(void *), void *);
 void	ep93xx_intr_disestablish(void *);
+void	ep93xx_intr_evcnt_attach(void);
 /* Platform needs to provide this */
 bus_dma_tag_t ep93xx_bus_dma_init(struct arm32_bus_dma_tag *);
 void	ep93xx_reset(void);

Index: src/sys/arch/evbarm/tsarm/tsarm_machdep.c
diff -u src/sys/arch/evbarm/tsarm/tsarm_machdep.c:1.35 src/sys/arch/evbarm/tsarm/tsarm_machdep.c:1.36
--- src/sys/arch/evbarm/tsarm/tsarm_machdep.c:1.35	Thu Apr 20 08:28:05 2023
+++ src/sys/arch/evbarm/tsarm/tsarm_machdep.c	Tue May  2 09:49:33 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: tsarm_machdep.c,v 1.35 2023/04/20 08:28:05 skrll Exp $ */
+/*	$NetBSD: tsarm_machdep.c,v 1.36 2023/05/02 09:49:33 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2001, 2002, 2003 Wasabi Systems, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tsarm_machdep.c,v 1.35 2023/04/20 08:28:05 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tsarm_machdep.c,v 1.36 2023/05/02 09:49:33 jmcneill Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_console.h"
@@ -843,3 +843,9 @@ ep93xx_bus_dma_init(struct arm32_bus_dma
 
 	return dmat;
 }
+
+void
+cpu_startup_hook(void)
+{
+	ep93xx_intr_evcnt_attach();
+}

Reply via email to