ddb: have 'reset' command use normal reboot path
This conditionally gives all registered shutdown handlers a chance to perform the reboot, with cpu_reset() being the fallback. The '\s' modifier can be used with the command to get the previous behaviour. The motivation is that some platforms may not be able do anything meaningful via cpu_reset(), due to a lack of standardized reset mechanism and/or firmware shortcomings. However, they may have a separate device driver attached that normally performs the reboot. Such is the case for some versions of the Raspberry Pi, where reset via PSCI fails, but the BCM2835 watchdog driver has a shutdown hook. Reported by: bz Reviewed by: markj (slightly earlier version) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D37981
This commit is contained in:
parent
627ca221c3
commit
5644850620
@ -524,13 +524,23 @@ The optional
|
|||||||
argument limits the search.
|
argument limits the search.
|
||||||
.\"
|
.\"
|
||||||
.Pp
|
.Pp
|
||||||
.It Ic reboot Op Ar seconds
|
.It Xo
|
||||||
.It Ic reset Op Ar seconds
|
.Ic Ic reboot Ns Op Li / Ns Cm s
|
||||||
|
.Op Ar seconds
|
||||||
|
.Xc
|
||||||
|
.It Xo
|
||||||
|
.Ic Ic reset Ns Op Li / Ns Cm s
|
||||||
|
.Op Ar seconds
|
||||||
|
.Xc
|
||||||
Hard reset the system.
|
Hard reset the system.
|
||||||
If the optional argument
|
If the optional argument
|
||||||
.Ar seconds
|
.Ar seconds
|
||||||
is given, the debugger will wait for this long, at most a week,
|
is given, the debugger will wait for this long, at most a week,
|
||||||
before rebooting.
|
before rebooting.
|
||||||
|
When the
|
||||||
|
.Cm s
|
||||||
|
modifier is given, the command will skip running any registered shutdown
|
||||||
|
handlers and attempt the most basic reset.
|
||||||
.Pp
|
.Pp
|
||||||
.It Ic thread Ar addr | tid
|
.It Ic thread Ar addr | tid
|
||||||
Switch the debugger to the thread with ID
|
Switch the debugger to the thread with ID
|
||||||
|
@ -745,7 +745,7 @@ db_kill(db_expr_t dummy1, bool dummy2, db_expr_t dummy3, char *dummy4)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
db_reset(db_expr_t addr, bool have_addr, db_expr_t count __unused,
|
db_reset(db_expr_t addr, bool have_addr, db_expr_t count __unused,
|
||||||
char *modif __unused)
|
char *modif)
|
||||||
{
|
{
|
||||||
int delay, loop;
|
int delay, loop;
|
||||||
|
|
||||||
@ -770,6 +770,18 @@ db_reset(db_expr_t addr, bool have_addr, db_expr_t count __unused,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Conditionally try the standard reboot path, so any registered
|
||||||
|
* shutdown/reset handlers have a chance to run first. Some platforms
|
||||||
|
* may not support the machine-dependent mechanism used by cpu_reset()
|
||||||
|
* and rely on some other non-standard mechanism to perform the reset.
|
||||||
|
* For example, the BCM2835 watchdog driver or gpio-poweroff driver.
|
||||||
|
*/
|
||||||
|
if (modif[0] != 's') {
|
||||||
|
kern_reboot(RB_NOSYNC);
|
||||||
|
/* NOTREACHED */
|
||||||
|
}
|
||||||
|
|
||||||
cpu_reset();
|
cpu_reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user