Module Name:    src
Committed By:   jmcneill
Date:           Thu Jul  2 11:10:48 UTC 2020

Modified Files:
        src/share/man/man4: ddb.4
        src/sys/arch/aarch64/aarch64: db_machdep.c
        src/sys/arch/arm/arm32: db_machdep.c

Log Message:
Add ddb "mach reset" command for Arm ports.


To generate a diff of this commit:
cvs rdiff -u -r1.189 -r1.190 src/share/man/man4/ddb.4
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/aarch64/aarch64/db_machdep.c
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/arm/arm32/db_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/man/man4/ddb.4
diff -u src/share/man/man4/ddb.4:1.189 src/share/man/man4/ddb.4:1.190
--- src/share/man/man4/ddb.4:1.189	Mon Mar 30 20:47:57 2020
+++ src/share/man/man4/ddb.4	Thu Jul  2 11:10:47 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ddb.4,v 1.189 2020/03/30 20:47:57 maya Exp $
+.\"	$NetBSD: ddb.4,v 1.190 2020/07/02 11:10:47 jmcneill Exp $
 .\"
 .\" Copyright (c) 1997 - 2019 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -56,7 +56,7 @@
 .\" any improvements or extensions that they make and grant Carnegie Mellon
 .\" the rights to redistribute these changes.
 .\"
-.Dd March 30, 2020
+.Dd July 2, 2020
 .Dt DDB 4
 .Os
 .Sh NAME
@@ -1018,6 +1018,8 @@ Given a trap frame address, print out th
 Print lwp information about the ``struct lwp''.
 .It Ic pte
 Print PTE information.
+.It Ic reset
+Reset the system.
 .It Ic sysreg
 Print system registers.
 .It Ic watch
@@ -1063,6 +1065,8 @@ Switch to another cpu.
 .Bl -tag -width "traptrace" -compact
 .It Ic frame
 Given a trap frame address, print out the trap frame.
+.It Ic reset
+Reset the system.
 .El
 .Ss HPPA
 .Bl -tag -width "traptrace" -compact

Index: src/sys/arch/aarch64/aarch64/db_machdep.c
diff -u src/sys/arch/aarch64/aarch64/db_machdep.c:1.24 src/sys/arch/aarch64/aarch64/db_machdep.c:1.25
--- src/sys/arch/aarch64/aarch64/db_machdep.c:1.24	Fri May 22 19:29:26 2020
+++ src/sys/arch/aarch64/aarch64/db_machdep.c	Thu Jul  2 11:10:48 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: db_machdep.c,v 1.24 2020/05/22 19:29:26 ryo Exp $ */
+/* $NetBSD: db_machdep.c,v 1.25 2020/07/02 11:10:48 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.24 2020/05/22 19:29:26 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.25 2020/07/02 11:10:48 jmcneill Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd32.h"
@@ -68,6 +68,7 @@ void db_md_cpuinfo_cmd(db_expr_t, bool, 
 void db_md_frame_cmd(db_expr_t, bool, db_expr_t, const char *);
 void db_md_lwp_cmd(db_expr_t, bool, db_expr_t, const char *);
 void db_md_pte_cmd(db_expr_t, bool, db_expr_t, const char *);
+void db_md_reset_cmd(db_expr_t, bool, db_expr_t, const char *);
 void db_md_tlbi_cmd(db_expr_t, bool, db_expr_t, const char *);
 void db_md_ttbr_cmd(db_expr_t, bool, db_expr_t, const char *);
 void db_md_sysreg_cmd(db_expr_t, bool, db_expr_t, const char *);
@@ -115,6 +116,12 @@ const struct db_command db_machine_comma
 	},
 	{
 		DDB_ADD_CMD(
+		    "reset", db_md_reset_cmd, 0,
+		    "Reset the system",
+		    NULL, NULL)
+	},
+	{
+		DDB_ADD_CMD(
 		    "sysreg", db_md_sysreg_cmd, 0,
 		    "Displays system registers",
 		    NULL, NULL)
@@ -453,6 +460,18 @@ db_md_pte_cmd(db_expr_t addr, bool have_
 }
 
 void
+db_md_reset_cmd(db_expr_t addr, bool have_addr, db_expr_t count,
+    const char *modif)
+{
+	if (cpu_reset_address == NULL) {
+		db_printf("cpu_reset_address is not set\n");
+		return;
+	}
+
+	cpu_reset_address();
+}
+
+void
 db_md_tlbi_cmd(db_expr_t addr, bool have_addr, db_expr_t count,
     const char *modif)
 {

Index: src/sys/arch/arm/arm32/db_machdep.c
diff -u src/sys/arch/arm/arm32/db_machdep.c:1.31 src/sys/arch/arm/arm32/db_machdep.c:1.32
--- src/sys/arch/arm/arm32/db_machdep.c:1.31	Sat Jun 20 07:10:36 2020
+++ src/sys/arch/arm/arm32/db_machdep.c	Thu Jul  2 11:10:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_machdep.c,v 1.31 2020/06/20 07:10:36 skrll Exp $	*/
+/*	$NetBSD: db_machdep.c,v 1.32 2020/07/02 11:10:48 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 1996 Mark Brinicombe
@@ -34,7 +34,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.31 2020/06/20 07:10:36 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.32 2020/07/02 11:10:48 jmcneill Exp $");
 
 #include <sys/param.h>
 
@@ -44,6 +44,7 @@ __KERNEL_RCSID(0, "$NetBSD: db_machdep.c
 #include <sys/systm.h>
 
 #include <arm/arm32/db_machdep.h>
+#include <arm/arm32/machdep.h>
 #include <arm/cpufunc.h>
 
 #include <ddb/db_access.h>
@@ -131,6 +132,9 @@ const struct db_command db_machine_comma
 			"[address]",
 			"   address:\taddress of trapfame to display")},
 #ifdef _KERNEL
+	{ DDB_ADD_CMD("reset",	db_reset_cmd,		0,
+			"Reset the system",
+			NULL,NULL) },
 #if defined(CPU_CORTEXA5) || defined(CPU_CORTEXA7)
 	{ DDB_ADD_CMD("tlb",	db_show_tlb_cmd,	0,
 			"Displays the TLB",
@@ -205,6 +209,17 @@ db_show_fault_cmd(db_expr_t addr, bool h
 	    armreg_ttbr_read());
 }
 
+void
+db_reset_cmd(db_expr_t addr, bool have_addr, db_expr_t count, const char *modif)
+{
+	if (cpu_reset_address == NULL) {
+		db_printf("cpu_reset_address is not set\n");
+		return;
+	}
+
+	cpu_reset_address();
+}
+
 #if defined(CPU_CORTEXA5) || defined(CPU_CORTEXA7)
 static void
 tlb_print_common_header(const char *str)

Reply via email to