Skip to content

Commit ec27329

Browse files
committed
powerpc/powernv: Hookup reboot and poweroff functions
This calls the respective HAL functions, and spin on hal_poll_event() to ensure the HAL has a chance to communicate with the FSP to trigger the reboot or shutdown operation Signed-off-by: Benjamin Herrenschmidt <[email protected]>
1 parent daea117 commit ec27329

File tree

1 file changed

+26
-6
lines changed
  • arch/powerpc/platforms/powernv

1 file changed

+26
-6
lines changed

arch/powerpc/platforms/powernv/setup.c

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,19 +83,39 @@ static void pnv_show_cpuinfo(struct seq_file *m)
8383
of_node_put(root);
8484
}
8585

86-
static void pnv_restart(char *cmd)
86+
static void __noreturn pnv_restart(char *cmd)
8787
{
88-
for (;;);
88+
long rc = OPAL_BUSY;
89+
90+
while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) {
91+
rc = opal_cec_reboot();
92+
if (rc == OPAL_BUSY_EVENT)
93+
opal_poll_events(NULL);
94+
else
95+
mdelay(10);
96+
}
97+
for (;;)
98+
opal_poll_events(NULL);
8999
}
90100

91-
static void pnv_power_off(void)
101+
static void __noreturn pnv_power_off(void)
92102
{
93-
for (;;);
103+
long rc = OPAL_BUSY;
104+
105+
while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) {
106+
rc = opal_cec_power_down(0);
107+
if (rc == OPAL_BUSY_EVENT)
108+
opal_poll_events(NULL);
109+
else
110+
mdelay(10);
111+
}
112+
for (;;)
113+
opal_poll_events(NULL);
94114
}
95115

96-
static void pnv_halt(void)
116+
static void __noreturn pnv_halt(void)
97117
{
98-
for (;;);
118+
pnv_power_off();
99119
}
100120

101121
static unsigned long __init pnv_get_boot_time(void)

0 commit comments

Comments
 (0)