Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/cortex ICC_PMR_EL1 has different encoding than ...



details:   https://anonhg.NetBSD.org/src/rev/9a1fa42928cd
branches:  trunk
changeset: 445607:9a1fa42928cd
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Mon Nov 05 11:50:15 2018 +0000

description:
ICC_PMR_EL1 has different encoding than IPRIORITYR. Not 100% sure that this is correct yet, but it works with both RK3399 and QEMU.

diffstat:

 sys/arch/arm/cortex/gicv3.c |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (54 lines):

diff -r 565ccf2ba4f1 -r 9a1fa42928cd sys/arch/arm/cortex/gicv3.c
--- a/sys/arch/arm/cortex/gicv3.c       Mon Nov 05 10:27:06 2018 +0000
+++ b/sys/arch/arm/cortex/gicv3.c       Mon Nov 05 11:50:15 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gicv3.c,v 1.3 2018/09/30 13:53:26 jmcneill Exp $ */
+/* $NetBSD: gicv3.c,v 1.4 2018/11/05 11:50:15 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -31,7 +31,7 @@
 #define        _INTR_PRIVATE
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gicv3.c,v 1.3 2018/09/30 13:53:26 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gicv3.c,v 1.4 2018/11/05 11:50:15 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -50,7 +50,7 @@
 #define        PICTOSOFTC(pic) \
        ((void *)((uintptr_t)(pic) - offsetof(struct gicv3_softc, sc_pic)))
 
-#define        IPL_TO_PRIORITY(ipl)    (0x80 | ((IPL_HIGH - (ipl)) << 4))
+#define        IPL_TO_PRIORITY(ipl)    ((IPL_HIGH - (ipl)) << 4)
 
 static struct gicv3_softc *gicv3_softc;
 
@@ -147,7 +147,7 @@
        uint64_t irouter;
        u_int n;
 
-       const u_int ipriority_val = IPL_TO_PRIORITY(is->is_ipl);
+       const u_int ipriority_val = 0x80 | IPL_TO_PRIORITY(is->is_ipl);
        const u_int ipriority_shift = (is->is_irq & 0x3) * 8;
        const u_int icfg_shift = (is->is_irq & 0xf) * 2;
 
@@ -198,7 +198,7 @@
 static void
 gicv3_set_priority(struct pic_softc *pic, int ipl)
 {
-       icc_pmr_write(IPL_TO_PRIORITY(ipl));
+       icc_pmr_write(IPL_TO_PRIORITY(ipl) << 1);
 }
 
 static void
@@ -389,7 +389,7 @@
                ;
 
        /* Set initial priority mask */
-       icc_pmr_write(IPL_TO_PRIORITY(IPL_HIGH));
+       gicv3_set_priority(pic, IPL_HIGH);
 
        /* Disable preemption */
        const uint32_t icc_bpr = __SHIFTIN(0x7, ICC_BPR_EL1_BinaryPoint);



Home | Main Index | Thread Index | Old Index