+// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (c) 2015 Google, Inc
*
- * SPDX-License-Identifier: GPL-2.0+
- *
* EFI information obtained here:
* http://wiki.phoenix.com/wiki/index.php/EFI_BOOT_SERVICES
*
*/
#include <common.h>
+#include <cpu_func.h>
#include <debug_uart.h>
+#include <dm.h>
#include <errno.h>
+#include <init.h>
+#include <malloc.h>
#include <linux/err.h>
#include <linux/types.h>
#include <efi.h>
#include <efi_api.h>
+#include <sysreset.h>
DECLARE_GLOBAL_DATA_PTR;
* U-Boot. If it returns, EFI will continue. Another way to get back to EFI
* is via reset_cpu().
*/
-efi_status_t efi_main(efi_handle_t image, struct efi_system_table *sys_table)
+efi_status_t EFIAPI efi_main(efi_handle_t image,
+ struct efi_system_table *sys_table)
{
struct efi_priv local_priv, *priv = &local_priv;
efi_status_t ret;
return EFI_SUCCESS;
}
-void reset_cpu(ulong addr)
+static void efi_exit(void)
{
struct efi_priv *priv = global_priv;
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,
+};