OPAL_CALL(opal_console_write, OPAL_CONSOLE_WRITE)
OPAL_CALL(opal_console_flush, OPAL_CONSOLE_FLUSH)
OPAL_CALL(opal_reinit_cpus, OPAL_REINIT_CPUS)
+
+OPAL_CALL(opal_cec_power_down, OPAL_CEC_POWER_DOWN)
+OPAL_CALL(opal_cec_reboot, OPAL_CEC_REBOOT)
+OPAL_CALL(opal_poll_events, OPAL_POLL_EVENTS)
#include <xen/init.h>
#include <xen/lib.h>
#include <xen/mm.h>
+#include <xen/shutdown.h>
+
#include <public/version.h>
#include <asm/boot.h>
#include <asm/early_printk.h>
early_printk("Hello, ppc64le!\n");
- for ( ; ; )
- /* Set current hardware thread to very low priority */
- HMT_very_low();
-
- unreachable();
+ machine_halt();
}
void arch_get_xen_caps(xen_capabilities_info_t *info)
--- /dev/null
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+#include <xen/shutdown.h>
+
+#include <asm/opal-api.h>
+
+int64_t opal_cec_power_down(uint64_t request);
+int64_t opal_cec_reboot(void);
+int64_t opal_poll_events(uint64_t *outstanding_event_mask);
+
+void machine_halt(void)
+{
+ int rc;
+
+ /* TODO: mask any OPAL IRQs before shutting down */
+
+ do {
+ rc = opal_cec_power_down(0);
+
+ if ( rc == OPAL_BUSY_EVENT )
+ opal_poll_events(NULL);
+
+ } while ( rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT );
+
+ for ( ;; )
+ opal_poll_events(NULL);
+}
+
+void machine_restart(unsigned int delay_millisecs)
+{
+ int rc;
+
+ /*
+ * TODO: mask any OPAL IRQs before shutting down
+ * TODO: mdelay(delay_millisecs);
+ */
+
+ do {
+ rc = opal_cec_reboot();
+
+ if ( rc == OPAL_BUSY_EVENT )
+ opal_poll_events(NULL);
+
+ } while ( rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT );
+
+ for ( ;; )
+ opal_poll_events(NULL);
+}
+
BUG_ON("unimplemented");
}
-/* shutdown.c */
-
-void machine_restart(unsigned int delay_millisecs)
-{
- BUG_ON("unimplemented");
-}
-
-void machine_halt(void)
-{
- BUG_ON("unimplemented");
-}
-
/* vm_event.c */
void vm_event_fill_regs(vm_event_request_t *req)