Add ddb "mach reset" command for Arm ports.

This commit is contained in:
jmcneill 2020-07-02 11:10:47 +00:00
parent 8c4f01a8e3
commit 336dbb3e65
3 changed files with 44 additions and 6 deletions

View File

@ -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 the trap frame.
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

View File

@ -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, db_expr_t, const char *);
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 *);
@ -113,6 +114,12 @@ const struct db_command db_machine_command_table[] = {
"address",
"\taddress:\tvirtual address of page")
},
{
DDB_ADD_CMD(
"reset", db_md_reset_cmd, 0,
"Reset the system",
NULL, NULL)
},
{
DDB_ADD_CMD(
"sysreg", db_md_sysreg_cmd, 0,
@ -452,6 +459,18 @@ db_md_pte_cmd(db_expr_t addr, bool have_addr, db_expr_t count,
pmap_db_pteinfo(addr, db_printf);
}
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)

View File

@ -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,v 1.31 2020/06/20 07:10:36 skrll Exp $"
#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_command_table[] = {
"[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 have_addr, db_expr_t count, const char *m
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)