Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/broadcom Use a bit per IPI type in local mailbo...



details:   https://anonhg.NetBSD.org/src/rev/49fe5393d6f2
branches:  trunk
changeset: 337355:49fe5393d6f2
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sun Apr 12 23:25:57 2015 +0000

description:
Use a bit per IPI type in local mailbox 0 registers. Ok matt@

diffstat:

 sys/arch/arm/broadcom/bcm2835_intr.c |  59 ++++++++++++++++++-----------------
 1 files changed, 31 insertions(+), 28 deletions(-)

diffs (92 lines):

diff -r 66e82f52b846 -r 49fe5393d6f2 sys/arch/arm/broadcom/bcm2835_intr.c
--- a/sys/arch/arm/broadcom/bcm2835_intr.c      Sun Apr 12 22:51:23 2015 +0000
+++ b/sys/arch/arm/broadcom/bcm2835_intr.c      Sun Apr 12 23:25:57 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bcm2835_intr.c,v 1.8 2015/04/12 17:32:39 skrll Exp $   */
+/*     $NetBSD: bcm2835_intr.c,v 1.9 2015/04/12 23:25:57 jmcneill Exp $        */
 
 /*-
  * Copyright (c) 2012, 2015 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_intr.c,v 1.8 2015/04/12 17:32:39 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_intr.c,v 1.9 2015/04/12 23:25:57 jmcneill Exp $");
 
 #define _INTR_PRIVATE
 
@@ -467,7 +467,7 @@
        const cpuid_t cpuid = pic - &bcm2836mp_pic[0];
 
        bus_space_write_4(al_iot, al_ioh,
-           BCM2836_LOCAL_MAILBOX0_SETN(cpuid), ipi);
+           BCM2836_LOCAL_MAILBOX0_SETN(cpuid), __BIT(ipi));
 }
 
 int
@@ -475,36 +475,39 @@
 {
        const struct cpu_info *ci = curcpu();
        const cpuid_t cpuid = ci->ci_cpuid;
-       const uint32_t ipi = bus_space_read_4(al_iot, al_ioh,
-           BCM2836_LOCAL_MAILBOX0_CLRN(cpuid));
+       uint32_t ipimask, bit;
 
+       ipimask = bus_space_read_4(al_iot, al_ioh,
+           BCM2836_LOCAL_MAILBOX0_CLRN(cpuid));
        bus_space_write_4(al_iot, al_ioh, BCM2836_LOCAL_MAILBOX0_CLRN(cpuid),
-           ipi);
+           ipimask);
 
-       switch (ipi) {
-       case IPI_AST:
-       case IPI_NOP:
-               pic_ipi_nop(priv);
-               break;
-       case IPI_XCALL:
-               pic_ipi_xcall(priv);
-               break;
-       case IPI_GENERIC:
-               pic_ipi_generic(priv);
-               break;
-       case IPI_SHOOTDOWN:
-               pic_ipi_shootdown(priv);
-               break;
+       while ((bit = ffs(ipimask)) > 0) {
+               const u_int ipi = bit - 1;
+               switch (ipi) {
+               case IPI_AST:
+               case IPI_NOP:
+#ifdef __HAVE_PREEMPTION
+               case IPI_KPREEMPT:
+#endif
+                       pic_ipi_nop(priv);
+                       break;
+               case IPI_XCALL:
+                       pic_ipi_xcall(priv);
+                       break;
+               case IPI_GENERIC:
+                       pic_ipi_generic(priv);
+                       break;
+               case IPI_SHOOTDOWN:
+                       pic_ipi_shootdown(priv);
+                       break;
 #ifdef DDB
-       case IPI_DDB:
-               pic_ipi_ddb(priv);
-               break;
+               case IPI_DDB:
+                       pic_ipi_ddb(priv);
+                       break;
 #endif
-#ifdef __HAVE_PREEMPTION
-       case IPI_KPREEMPT:
-               pic_ipi_nop(priv);
-               break;
-#endif
+               }
+               ipimask &= ~__BIT(ipi);
        }
 
        return 1;



Home | Main Index | Thread Index | Old Index