aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2018-07-20 19:31:30 -0400
committerTom Rini <trini@konsulko.com>2018-07-20 19:31:30 -0400
commite0ed8332fa2fe684b4c8ba1caab991663730cbf0 (patch)
tree7bde5ed3ba674f63b670b76db60299dace3cc832 /lib
parent0dd1fc09bb16869fd8adaaad082cd554c60b2c1a (diff)
parent05855fd31a3f7483534aabe69a7030ff38978510 (diff)
downloadu-boot-e0ed8332fa2fe684b4c8ba1caab991663730cbf0.zip
u-boot-e0ed8332fa2fe684b4c8ba1caab991663730cbf0.tar.gz
u-boot-e0ed8332fa2fe684b4c8ba1caab991663730cbf0.tar.bz2
Merge git://git.denx.de/u-boot-x86
Diffstat (limited to 'lib')
-rw-r--r--lib/efi/efi_app.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/lib/efi/efi_app.c b/lib/efi/efi_app.c
index 3eb8eeb..5879d40 100644
--- a/lib/efi/efi_app.c
+++ b/lib/efi/efi_app.c
@@ -10,11 +10,13 @@
#include <common.h>
#include <debug_uart.h>
+#include <dm.h>
#include <errno.h>
#include <linux/err.h>
#include <linux/types.h>
#include <efi.h>
#include <efi_api.h>
+#include <sysreset.h>
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,
+};