// SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2020 Loongson Technology Co., Ltd. */ #include #include #include #include #include #include #include #include #include #include #include #include static void machine_hang(void) { local_irq_disable(); clear_csr_ecfg(ECFG0_IM); pr_notice("\n\n** You can safely turn off the power now **\n\n"); console_flush_on_panic(CONSOLE_FLUSH_PENDING); while (true) { __arch_cpu_idle(); local_irq_disable(); } } void (*pm_restart)(void) = machine_hang; void (*pm_power_off)(void) = machine_hang; EXPORT_SYMBOL(pm_power_off); void machine_halt(void) { #ifdef CONFIG_SMP preempt_disable(); smp_send_stop(); #endif machine_hang(); } void machine_power_off(void) { #ifdef CONFIG_SMP preempt_disable(); smp_send_stop(); #endif enable_pci_wakeup(); pm_power_off(); } void machine_restart(char *command) { #ifdef CONFIG_SMP preempt_disable(); smp_send_stop(); #endif do_kernel_restart(command); pm_restart(); }