1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
5 #include <linux/kernel.h>
6 #include <linux/acpi.h>
8 #include <linux/export.h>
10 #include <linux/types.h>
11 #include <linux/reboot.h>
12 #include <linux/delay.h>
13 #include <linux/console.h>
15 #include <acpi/reboot.h>
17 #include <asm/loongarch.h>
18 #include <asm/loongson.h>
20 void (*pm_power_off)(void);
21 EXPORT_SYMBOL(pm_power_off);
23 void machine_halt(void)
30 clear_csr_ecfg(ECFG0_IM);
32 pr_notice("\n\n** You can safely turn off the power now **\n\n");
33 console_flush_on_panic(CONSOLE_FLUSH_PENDING);
40 void machine_power_off(void)
50 do_kernel_power_off();
52 efi.reset_system(EFI_RESET_SHUTDOWN, EFI_SUCCESS, 0, NULL);
60 void machine_restart(char *command)
66 do_kernel_restart(command);
68 if (efi_capsule_pending(NULL))
69 efi_reboot(REBOOT_WARM, NULL);
71 efi_reboot(REBOOT_COLD, NULL);