1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) 2018, Bin Meng <bmeng.cn@gmail.com>
5 * Generic reset driver for x86 processor
12 #include <asm/processor.h>
13 #include <efi_loader.h>
15 static __efi_runtime int x86_sysreset_request(struct udevice *dev,
22 value = SYS_RST | RST_CPU;
25 value = SYS_RST | RST_CPU | FULL_RST;
31 outb(value, IO_PORT_RESET);
36 #ifdef CONFIG_EFI_LOADER
37 void __efi_runtime EFIAPI efi_reset_system(
38 enum efi_reset_type reset_type,
39 efi_status_t reset_status,
40 unsigned long data_size, void *reset_data)
42 if (reset_type == EFI_RESET_COLD ||
43 reset_type == EFI_RESET_PLATFORM_SPECIFIC)
44 x86_sysreset_request(NULL, SYSRESET_COLD);
45 else if (reset_type == EFI_RESET_WARM)
46 x86_sysreset_request(NULL, SYSRESET_WARM);
48 /* TODO EFI_RESET_SHUTDOWN */
55 static const struct udevice_id x86_sysreset_ids[] = {
56 { .compatible = "x86,reset" },
60 static struct sysreset_ops x86_sysreset_ops = {
61 .request = x86_sysreset_request,
64 U_BOOT_DRIVER(x86_sysreset) = {
65 .name = "x86-sysreset",
66 .id = UCLASS_SYSRESET,
67 .of_match = x86_sysreset_ids,
68 .ops = &x86_sysreset_ops,