powerpc: better handling of shutdown flags

RB_HALT does not mean poweroff, RB_POWEROFF does.

Reviewed by:	jhibbits
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D42339
This commit is contained in:
Mitchell Horne 2023-11-23 11:25:05 -04:00
parent 428ebb7cd9
commit 41e26e8288
5 changed files with 21 additions and 9 deletions

View file

@ -748,7 +748,13 @@ cuda_shutdown(void *xsc, int howto)
struct cuda_softc *sc = xsc;
uint8_t cmd[] = {CUDA_PSEUDO, 0};
cmd[1] = (howto & RB_HALT) ? CMD_POWEROFF : CMD_RESET;
if ((howto & RB_POWEROFF) != 0)
cmd[1] = CMD_POWEROFF;
else if ((howto & RB_HALT) == 0)
cmd[1] = CMD_RESET;
else
return;
cuda_poll(sc->sc_dev);
cuda_send(sc, 1, 2, cmd);

View file

@ -812,10 +812,12 @@ pmu_shutdown(void *xsc, int howto)
struct pmu_softc *sc = xsc;
uint8_t cmd[] = {'M', 'A', 'T', 'T'};
if (howto & RB_HALT)
if ((howto & RB_POWEROFF) != 0)
pmu_send(sc, PMU_POWER_OFF, 4, cmd, 0, NULL);
else
else if ((howto & RB_HALT) == 0)
pmu_send(sc, PMU_RESET_CPU, 0, NULL, 0, NULL);
else
return;
for (;;);
}

View file

@ -1317,10 +1317,12 @@ smu_shutdown(void *xdev, int howto)
struct smu_cmd cmd;
cmd.cmd = SMU_POWER;
if (howto & RB_HALT)
if ((howto & RB_POWEROFF) != 0)
strcpy(cmd.data, "SHUTDOWN");
else
else if ((howto & RB_HALT) == 0)
strcpy(cmd.data, "RESTART");
else
return;
cmd.len = strlen(cmd.data);

View file

@ -344,10 +344,12 @@ static void
opal_shutdown(void *arg, int howto)
{
if (howto & RB_HALT)
if ((howto & RB_POWEROFF) != 0)
opal_call(OPAL_CEC_POWER_DOWN, 0 /* Normal power off */);
else
else if ((howto & RB_HALT) == 0)
opal_call(OPAL_CEC_REBOOT);
else
return;
opal_call(OPAL_RETURN_CPU);
}

View file

@ -155,13 +155,13 @@ rtas_shutdown(void *arg, int howto)
{
cell_t token, status;
if (howto & RB_HALT) {
if ((howto & RB_POWEROFF) != 0) {
token = rtas_token_lookup("power-off");
if (token == -1)
return;
rtas_call_method(token, 2, 1, 0, 0, &status);
} else {
} else if ((howto & RB_HALT) == 0) {
token = rtas_token_lookup("system-reboot");
if (token == -1)
return;