public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 1/2] x86: Add efi runtime reset
Date: Mon, 28 Jan 2019 16:42:40 +0100	[thread overview]
Message-ID: <20190128154241.52027-2-agraf@suse.de> (raw)
In-Reply-To: <20190128154241.52027-1-agraf@suse.de>

Our selftest will soon test the actual runtime reset function rather than
the boot time one. For this, we need to ensure that the runtime version
actually succeeds on x86 to keep our travis tests work.

So this patch implements an x86 runtime reset function. It is missing
shutdown functionality today, but OSs usually implement that via ACPI
and this function does more than the stub from before, so it's at least
an improvement.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 drivers/sysreset/sysreset_x86.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/drivers/sysreset/sysreset_x86.c b/drivers/sysreset/sysreset_x86.c
index 20b958cfd4..efed45ccb7 100644
--- a/drivers/sysreset/sysreset_x86.c
+++ b/drivers/sysreset/sysreset_x86.c
@@ -10,6 +10,29 @@
 #include <sysreset.h>
 #include <asm/io.h>
 #include <asm/processor.h>
+#include <efi_loader.h>
+
+#ifdef CONFIG_EFI_LOADER
+void __efi_runtime EFIAPI efi_reset_system(
+			enum efi_reset_type reset_type,
+			efi_status_t reset_status,
+			unsigned long data_size, void *reset_data)
+{
+	u32 value = 0;
+
+	if (reset_type == EFI_RESET_COLD)
+		value = SYS_RST | RST_CPU | FULL_RST;
+	else if (reset_type == EFI_RESET_WARM)
+		value = SYS_RST | RST_CPU;
+
+	/* TODO EFI_RESET_PLATFORM_SPECIFIC and EFI_RESET_SHUTDOWN */
+
+	if (value)
+		outb(value, IO_PORT_RESET);
+
+	while (1) { }
+}
+#endif
 
 static int x86_sysreset_request(struct udevice *dev, enum sysreset_t type)
 {
-- 
2.12.3

  reply	other threads:[~2019-01-28 15:42 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-28 15:42 [U-Boot] [PATCH v2 0/2] efi_loader: Patch RTS at ExitBootServices Alexander Graf
2019-01-28 15:42 ` Alexander Graf [this message]
2019-01-28 18:02   ` [U-Boot] [PATCH v2 1/2] x86: Add efi runtime reset Heinrich Schuchardt
2019-01-28 19:13   ` Simon Glass
2019-01-28 19:15     ` Alexander Graf
2019-01-28 19:24       ` Simon Glass
2019-01-28 19:27         ` Alexander Graf
2019-01-28 19:31           ` Simon Glass
2019-01-28 19:34             ` Alexander Graf
2019-01-28 19:36               ` Simon Glass
2019-01-28 19:39                 ` Alexander Graf
2019-01-28 19:47                   ` Simon Glass
2019-01-28 20:08                     ` Alexander Graf
2019-01-29  0:49                       ` Simon Glass
2019-01-29 16:23                         ` Alexander Graf
2019-01-29 23:08   ` Heinrich Schuchardt
2019-01-29 23:15     ` Alexander Graf
2019-01-29 23:48       ` Heinrich Schuchardt
2019-01-30 10:20         ` Alexander Graf
2019-01-28 15:42 ` [U-Boot] [PATCH v2 2/2] efi_loader: Patch non-runtime code out at ExitBootServices already Alexander Graf
2019-01-28 17:50 ` [U-Boot] [PATCH v2 0/2] efi_loader: Patch RTS at ExitBootServices Heinrich Schuchardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190128154241.52027-2-agraf@suse.de \
    --to=agraf@suse.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox