mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
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 <[email protected]> Tested-by: Mark Salter <[email protected]> Signed-off-by: Matt Fleming <[email protected]>
This commit is contained in:
parent
f4f75ad574
commit
8562c99cdd
5 changed files with 33 additions and 7 deletions
|
|
@ -1,7 +1,7 @@
|
|||
#
|
||||
# Makefile for linux kernel
|
||||
#
|
||||
obj-$(CONFIG_EFI) += efi.o vars.o
|
||||
obj-$(CONFIG_EFI) += efi.o vars.o reboot.o
|
||||
obj-$(CONFIG_EFI_VARS) += efivars.o
|
||||
obj-$(CONFIG_EFI_VARS_PSTORE) += efi-pstore.o
|
||||
obj-$(CONFIG_UEFI_CPER) += cper.o
|
||||
|
|
|
|||
26
drivers/firmware/efi/reboot.c
Normal file
26
drivers/firmware/efi/reboot.c
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* Copyright (C) 2014 Intel Corporation; author Matt Fleming
|
||||
* Copyright (c) 2014 Red Hat, Inc., Mark Salter <msalter@redhat.com>
|
||||
*/
|
||||
#include <linux/efi.h>
|
||||
#include <linux/reboot.h>
|
||||
|
||||
void efi_reboot(enum reboot_mode reboot_mode, const char *__unused)
|
||||
{
|
||||
int efi_mode;
|
||||
|
||||
if (!efi_enabled(EFI_RUNTIME_SERVICES))
|
||||
return;
|
||||
|
||||
switch (reboot_mode) {
|
||||
case REBOOT_WARM:
|
||||
case REBOOT_SOFT:
|
||||
efi_mode = EFI_RESET_WARM;
|
||||
break;
|
||||
default:
|
||||
efi_mode = EFI_RESET_COLD;
|
||||
break;
|
||||
}
|
||||
|
||||
efi.reset_system(efi_mode, EFI_SUCCESS, 0, NULL);
|
||||
}
|
||||
Loading…
Reference in a new issue