Module Name:    src
Committed By:   matt
Date:           Sat Sep  7 23:10:03 UTC 2013

Modified Files:
        src/sys/arch/arm/arm32: arm32_machdep.c cpu.c
        src/sys/arch/arm/include: locore.h

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


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/arch/arm/arm32/arm32_machdep.c
cvs rdiff -u -r1.98 -r1.99 src/sys/arch/arm/arm32/cpu.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/include/locore.h

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/arm32/arm32_machdep.c
diff -u src/sys/arch/arm/arm32/arm32_machdep.c:1.96 src/sys/arch/arm/arm32/arm32_machdep.c:1.97
--- src/sys/arch/arm/arm32/arm32_machdep.c:1.96	Sun Aug 18 06:28:18 2013
+++ src/sys/arch/arm/arm32/arm32_machdep.c	Sat Sep  7 23:10:02 2013
@@ -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 @@ extern paddr_t msgbufphys;
 
 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 @@ SYSCTL_SETUP(sysctl_machdep_setup, "sysc
 		       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);

Index: src/sys/arch/arm/arm32/cpu.c
diff -u src/sys/arch/arm/arm32/cpu.c:1.98 src/sys/arch/arm/arm32/cpu.c:1.99
--- src/sys/arch/arm/arm32/cpu.c:1.98	Sat Sep  7 00:32:54 2013
+++ src/sys/arch/arm/arm32/cpu.c	Sat Sep  7 23:10:02 2013
@@ -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 @@ identify_features(device_t dv)
 	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

Index: src/sys/arch/arm/include/locore.h
diff -u src/sys/arch/arm/include/locore.h:1.4 src/sys/arch/arm/include/locore.h:1.5
--- src/sys/arch/arm/include/locore.h:1.4	Fri Aug 23 05:22:01 2013
+++ src/sys/arch/arm/include/locore.h	Sat Sep  7 23:10:02 2013
@@ -150,6 +150,7 @@ void	cpu_attach(device_t, cpuid_t);
 /* 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

Reply via email to