From: Bin Meng Date: Thu, 19 Jul 2018 10:07:29 +0000 (-0700) Subject: efi: app: Add a sysreset driver X-Git-Tag: baikal/mips/sdk5.9~1902^2~7 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=4bb8a47e9abf08d782d6c35ed9fb39341e9d7150;p=uboot.git efi: app: Add a sysreset driver This adds the DM sysreset driver for EFI application support. Signed-off-by: Bin Meng Reviewed-by: Simon Glass --- diff --git a/lib/efi/efi_app.c b/lib/efi/efi_app.c index 3eb8eeb677..5879d40386 100644 --- a/lib/efi/efi_app.c +++ b/lib/efi/efi_app.c @@ -10,11 +10,13 @@ #include #include +#include #include #include #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -129,7 +131,7 @@ efi_status_t EFIAPI efi_main(efi_handle_t image, return EFI_SUCCESS; } -void reset_cpu(ulong addr) +static void efi_exit(void) { struct efi_priv *priv = global_priv; @@ -137,3 +139,27 @@ void reset_cpu(ulong addr) printf("U-Boot EFI exiting\n"); priv->boot->exit(priv->parent_image, EFI_SUCCESS, 0, NULL); } + +static int efi_sysreset_request(struct udevice *dev, enum sysreset_t type) +{ + efi_exit(); + + return -EINPROGRESS; +} + +static const struct udevice_id efi_sysreset_ids[] = { + { .compatible = "efi,reset" }, + { } +}; + +static struct sysreset_ops efi_sysreset_ops = { + .request = efi_sysreset_request, +}; + +U_BOOT_DRIVER(efi_sysreset) = { + .name = "efi-sysreset", + .id = UCLASS_SYSRESET, + .of_match = efi_sysreset_ids, + .ops = &efi_sysreset_ops, + .flags = DM_FLAG_PRE_RELOC, +};