aboutsummaryrefslogtreecommitdiff
path: root/drivers/sysreset
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2019-05-02 10:52:13 -0600
committerBin Meng <bmeng.cn@gmail.com>2019-05-08 13:02:15 +0800
commit40476f4afc08ccb6f1f95d7790b6a29159e8b30a (patch)
tree25feac5a92d114d0bf0b58d1ad9717b5e258f9b5 /drivers/sysreset
parent2b36eabd8aec5107f4753715c2fb4e30cb0d6136 (diff)
downloadu-boot-40476f4afc08ccb6f1f95d7790b6a29159e8b30a.zip
u-boot-40476f4afc08ccb6f1f95d7790b6a29159e8b30a.tar.gz
u-boot-40476f4afc08ccb6f1f95d7790b6a29159e8b30a.tar.bz2
x86: sysreset: Separate out the EFI code
The EFI implementation of reset sits inside the driver and is called directly from outside the driver, breaking the normal driver-model conventions. Worse, it passed NULL as the device pointer, hoping that the called function won't use it, which breaks as soon as code is added to use it. Separate out the implementation to improve the situation enough to allow a future patch to add new sysreset features. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'drivers/sysreset')
-rw-r--r--drivers/sysreset/sysreset_x86.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/sysreset/sysreset_x86.c b/drivers/sysreset/sysreset_x86.c
index 009f376..d484ec5 100644
--- a/drivers/sysreset/sysreset_x86.c
+++ b/drivers/sysreset/sysreset_x86.c
@@ -12,8 +12,7 @@
#include <asm/processor.h>
#include <efi_loader.h>
-static __efi_runtime int x86_sysreset_request(struct udevice *dev,
- enum sysreset_t type)
+static int x86_sysreset_request(struct udevice *dev, enum sysreset_t type)
{
int value;
@@ -39,11 +38,18 @@ void __efi_runtime EFIAPI efi_reset_system(
efi_status_t reset_status,
unsigned long data_size, void *reset_data)
{
+ int value;
+
+ /*
+ * inline this code since we are not caused in the context of a
+ * udevice and passing NULL to x86_sysreset_request() is too horrible.
+ */
if (reset_type == EFI_RESET_COLD ||
reset_type == EFI_RESET_PLATFORM_SPECIFIC)
- x86_sysreset_request(NULL, SYSRESET_COLD);
- else if (reset_type == EFI_RESET_WARM)
- x86_sysreset_request(NULL, SYSRESET_WARM);
+ value = SYS_RST | RST_CPU | FULL_RST;
+ else /* assume EFI_RESET_WARM since we cannot return an error */
+ value = SYS_RST | RST_CPU;
+ outb(value, IO_PORT_RESET);
/* TODO EFI_RESET_SHUTDOWN */