Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm Add a machdep.hwdiv_present sysctl (cortex A7 a...



details:   https://anonhg.NetBSD.org/src/rev/f72ac550c0d1
branches:  trunk
changeset: 789788:f72ac550c0d1
user:      matt <matt%NetBSD.org@localhost>
date:      Sat Sep 07 23:10:02 2013 +0000

description:
Add a machdep.hwdiv_present sysctl (cortex A7 and A15 have hwdiv instructions)

diffstat:

 sys/arch/arm/arm32/arm32_machdep.c |  10 ++++++++--
 sys/arch/arm/arm32/cpu.c           |   6 ++++--
 sys/arch/arm/include/locore.h      |   1 +
 3 files changed, 13 insertions(+), 4 deletions(-)

diffs (76 lines):

diff -r d55ee27264c9 -r f72ac550c0d1 sys/arch/arm/arm32/arm32_machdep.c
--- a/sys/arch/arm/arm32/arm32_machdep.c        Sat Sep 07 22:52:12 2013 +0000
+++ b/sys/arch/arm/arm32/arm32_machdep.c        Sat Sep 07 23:10:02 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: arm32_machdep.c,v 1.96 2013/08/18 06:28:18 matt Exp $  */
+/*     $NetBSD: arm32_machdep.c,v 1.97 2013/09/07 23:10:02 matt Exp $  */
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: arm32_machdep.c,v 1.96 2013/08/18 06:28:18 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arm32_machdep.c,v 1.97 2013/09/07 23:10:02 matt Exp $");
 
 #include "opt_modular.h"
 #include "opt_md.h"
@@ -100,6 +100,7 @@
 
 int kernel_debug = 0;
 int cpu_fpu_present;
+int cpu_hwdiv_present;
 int cpu_neon_present;
 int cpu_simd_present;
 int cpu_simdex_present;
@@ -433,6 +434,11 @@
                       CTL_MACHDEP, CTL_CREATE, CTL_EOL);
        sysctl_createv(clog, 0, NULL, NULL,
                       CTLFLAG_PERMANENT|CTLFLAG_READONLY,
+                      CTLTYPE_INT, "hwdiv_present", NULL,
+                      NULL, 0, &cpu_hwdiv_present, 0,
+                      CTL_MACHDEP, CTL_CREATE, CTL_EOL);
+       sysctl_createv(clog, 0, NULL, NULL,
+                      CTLFLAG_PERMANENT|CTLFLAG_READONLY,
                       CTLTYPE_INT, "neon_present", NULL,
                       NULL, 0, &cpu_neon_present, 0,
                       CTL_MACHDEP, CTL_CREATE, CTL_EOL);
diff -r d55ee27264c9 -r f72ac550c0d1 sys/arch/arm/arm32/cpu.c
--- a/sys/arch/arm/arm32/cpu.c  Sat Sep 07 22:52:12 2013 +0000
+++ b/sys/arch/arm/arm32/cpu.c  Sat Sep 07 23:10:02 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.c,v 1.98 2013/09/07 00:32:54 matt Exp $    */
+/*     $NetBSD: cpu.c,v 1.99 2013/09/07 23:10:02 matt Exp $    */
 
 /*
  * Copyright (c) 1995 Mark Brinicombe.
@@ -46,7 +46,7 @@
 
 #include <sys/param.h>
 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.98 2013/09/07 00:32:54 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.99 2013/09/07 23:10:02 matt Exp $");
 
 #include <sys/systm.h>
 #include <sys/conf.h>
@@ -772,6 +772,8 @@
        cpu_instruction_set_attributes[4] = armreg_isar4_read();
        cpu_instruction_set_attributes[5] = armreg_isar5_read();
 
+       cpu_hwdiv_present =
+           ((cpu_instruction_set_attributes[0] >> 24) & 0x0f) >= 2;
        cpu_simd_present =
            ((cpu_instruction_set_attributes[3] >> 4) & 0x0f) >= 3;
        cpu_simdex_present = cpu_simd_present
diff -r d55ee27264c9 -r f72ac550c0d1 sys/arch/arm/include/locore.h
--- a/sys/arch/arm/include/locore.h     Sat Sep 07 22:52:12 2013 +0000
+++ b/sys/arch/arm/include/locore.h     Sat Sep 07 23:10:02 2013 +0000
@@ -150,6 +150,7 @@
 /* 1 == use cpu_sleep(), 0 == don't */
 extern int cpu_do_powersave;
 extern int cpu_fpu_present;
+extern int cpu_hwdiv_present;
 
 #if !defined(CPU_ARMV7)
 #define        CPU_IS_ARMV7_P()                false



Home | Main Index | Thread Index | Old Index