mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-21 14:41:31 +00:00
efi: app: Add a sysreset driver
This adds the DM sysreset driver for EFI application support. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
fabb2b4c7f
commit
c81a8f5455
1 changed files with 27 additions and 1 deletions
|
@ -10,11 +10,13 @@
|
||||||
|
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <debug_uart.h>
|
#include <debug_uart.h>
|
||||||
|
#include <dm.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <linux/err.h>
|
#include <linux/err.h>
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
#include <efi.h>
|
#include <efi.h>
|
||||||
#include <efi_api.h>
|
#include <efi_api.h>
|
||||||
|
#include <sysreset.h>
|
||||||
|
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
|
||||||
|
@ -129,7 +131,7 @@ efi_status_t EFIAPI efi_main(efi_handle_t image,
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset_cpu(ulong addr)
|
static void efi_exit(void)
|
||||||
{
|
{
|
||||||
struct efi_priv *priv = global_priv;
|
struct efi_priv *priv = global_priv;
|
||||||
|
|
||||||
|
@ -137,3 +139,27 @@ void reset_cpu(ulong addr)
|
||||||
printf("U-Boot EFI exiting\n");
|
printf("U-Boot EFI exiting\n");
|
||||||
priv->boot->exit(priv->parent_image, EFI_SUCCESS, 0, NULL);
|
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,
|
||||||
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue