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 When dealing with the PMR register, only...



details:   https://anonhg.NetBSD.org/src/rev/11c4527c9a08
branches:  trunk
changeset: 328993:11c4527c9a08
user:      matt <matt%NetBSD.org@localhost>
date:      Sun Apr 27 16:22:13 2014 +0000

description:
When dealing with the PMR register, only use non-secure priority values.

diffstat:

 sys/arch/arm/cortex/gic.c     |  11 +++++++----
 sys/arch/arm/cortex/gic_reg.h |   4 +++-
 2 files changed, 10 insertions(+), 5 deletions(-)

diffs (60 lines):

diff -r 1bbe3addfb5b -r 11c4527c9a08 sys/arch/arm/cortex/gic.c
--- a/sys/arch/arm/cortex/gic.c Sun Apr 27 15:26:05 2014 +0000
+++ b/sys/arch/arm/cortex/gic.c Sun Apr 27 16:22:13 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gic.c,v 1.8 2014/04/13 02:21:47 matt Exp $     */
+/*     $NetBSD: gic.c,v 1.9 2014/04/27 16:22:13 matt Exp $     */
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -33,7 +33,7 @@
 #define _INTR_PRIVATE
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gic.c,v 1.8 2014/04/13 02:21:47 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gic.c,v 1.9 2014/04/27 16:22:13 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -139,18 +139,21 @@
 
 /*
  * In the GIC prioritization scheme, lower numbers have higher priority.
+ * Only write priorities that could be non-secure.
  */
 static inline uint32_t
 armgic_ipl_to_priority(int ipl)
 {
-       return (IPL_HIGH - ipl) * GICC_PMR_PRIORITIES / NIPL;
+       return GICC_PMR_NONSECURE
+           | ((IPL_HIGH - ipl) * GICC_PMR_NS_PRIORITIES / NIPL);
 }
 
 #if 0
 static inline int
 armgic_priority_to_ipl(uint32_t priority)
 {
-       return IPL_HIGH - priority * NIPL / GICC_PMR_PRIORITIES;
+       return IPL_HIGH
+           - (priority & ~GICC_PMR_NONSECURE) * NIPL / GICC_PMR_NS_PRIORITIES;
 }
 #endif
 
diff -r 1bbe3addfb5b -r 11c4527c9a08 sys/arch/arm/cortex/gic_reg.h
--- a/sys/arch/arm/cortex/gic_reg.h     Sun Apr 27 15:26:05 2014 +0000
+++ b/sys/arch/arm/cortex/gic_reg.h     Sun Apr 27 16:22:13 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gic_reg.h,v 1.2 2014/03/28 21:39:09 matt Exp $ */
+/*     $NetBSD: gic_reg.h,v 1.3 2014/04/27 16:22:13 matt Exp $ */
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -90,6 +90,8 @@
 
 #define        GICC_PMR_PRIORITY               __BITS(7,0)
 #define        GICC_PMR_PRIORITIES             256
+#define        GICC_PMR_NS_PRIORITIES          128
+#define        GICC_PMR_NONSECURE              0x80
 #define        GICC_PMR_8_LEVELS               0x1f
 #define        GICC_PMR_16_LEVELS              0x0f
 #define        GICC_PMR_32_LEVELS              0x07



Home | Main Index | Thread Index | Old Index