diff options
| author | Matt Fleming <matt.fleming@intel.com> | 2014-06-13 07:22:22 -0400 |
|---|---|---|
| committer | Matt Fleming <matt.fleming@intel.com> | 2014-07-18 16:23:51 -0400 |
| commit | 8562c99cdd30217dea3609e268572f8764f401a5 (patch) | |
| tree | 4a494dab6d089e0030255d2c5f6521b35321b97f /drivers/firmware | |
| parent | f4f75ad5741fe0331bbe1f5c42b906cda299f26b (diff) | |
efi/reboot: Add generic wrapper around EfiResetSystem()
Implement efi_reboot(), which is really just a wrapper around the
EfiResetSystem() EFI runtime service, but it does at least allow us to
funnel all callers through a single location.
It also simplifies the callsites since users no longer need to check to
see whether EFI_RUNTIME_SERVICES are enabled.
Cc: Tony Luck <tony.luck@intel.com>
Tested-by: Mark Salter <msalter@redhat.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Diffstat (limited to 'drivers/firmware')
| -rw-r--r-- | drivers/firmware/efi/Makefile | 2 | ||||
| -rw-r--r-- | drivers/firmware/efi/reboot.c | 26 |
2 files changed, 27 insertions, 1 deletions
diff --git a/drivers/firmware/efi/Makefile b/drivers/firmware/efi/Makefile index a204d1474cec..d8be608a9f3b 100644 --- a/drivers/firmware/efi/Makefile +++ b/drivers/firmware/efi/Makefile | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | # | 1 | # |
| 2 | # Makefile for linux kernel | 2 | # Makefile for linux kernel |
| 3 | # | 3 | # |
| 4 | obj-$(CONFIG_EFI) += efi.o vars.o | 4 | obj-$(CONFIG_EFI) += efi.o vars.o reboot.o |
| 5 | obj-$(CONFIG_EFI_VARS) += efivars.o | 5 | obj-$(CONFIG_EFI_VARS) += efivars.o |
| 6 | obj-$(CONFIG_EFI_VARS_PSTORE) += efi-pstore.o | 6 | obj-$(CONFIG_EFI_VARS_PSTORE) += efi-pstore.o |
| 7 | obj-$(CONFIG_UEFI_CPER) += cper.o | 7 | obj-$(CONFIG_UEFI_CPER) += cper.o |
diff --git a/drivers/firmware/efi/reboot.c b/drivers/firmware/efi/reboot.c new file mode 100644 index 000000000000..81bf925f70f5 --- /dev/null +++ b/drivers/firmware/efi/reboot.c | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2014 Intel Corporation; author Matt Fleming | ||
| 3 | * Copyright (c) 2014 Red Hat, Inc., Mark Salter <msalter@redhat.com> | ||
| 4 | */ | ||
| 5 | #include <linux/efi.h> | ||
| 6 | #include <linux/reboot.h> | ||
| 7 | |||
| 8 | void efi_reboot(enum reboot_mode reboot_mode, const char *__unused) | ||
| 9 | { | ||
| 10 | int efi_mode; | ||
| 11 | |||
| 12 | if (!efi_enabled(EFI_RUNTIME_SERVICES)) | ||
| 13 | return; | ||
| 14 | |||
| 15 | switch (reboot_mode) { | ||
| 16 | case REBOOT_WARM: | ||
| 17 | case REBOOT_SOFT: | ||
| 18 | efi_mode = EFI_RESET_WARM; | ||
| 19 | break; | ||
| 20 | default: | ||
| 21 | efi_mode = EFI_RESET_COLD; | ||
| 22 | break; | ||
| 23 | } | ||
| 24 | |||
| 25 | efi.reset_system(efi_mode, EFI_SUCCESS, 0, NULL); | ||
| 26 | } | ||
