Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit de18c850 authored by Huang, Ying's avatar Huang, Ying Committed by Ingo Molnar
Browse files

x86: EFI runtime service support: EFI runtime services



This patch adds support for several EFI runtime services for EFI x86_64
system.

The EFI support for emergency_restart is added.

Signed-off-by: default avatarChandramouli Narayanan <mouli@linux.intel.com>
Signed-off-by: default avatarHuang Ying <ying.huang@intel.com>
Cc: Andi Kleen <ak@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 5b83683f
Loading
Loading
Loading
Loading
+13 −7
Original line number Original line Diff line number Diff line
@@ -9,6 +9,7 @@
#include <linux/pm.h>
#include <linux/pm.h>
#include <linux/kdebug.h>
#include <linux/kdebug.h>
#include <linux/sched.h>
#include <linux/sched.h>
#include <linux/efi.h>
#include <acpi/reboot.h>
#include <acpi/reboot.h>
#include <asm/io.h>
#include <asm/io.h>
#include <asm/delay.h>
#include <asm/delay.h>
@@ -28,20 +29,17 @@ void (*pm_power_off)(void);
EXPORT_SYMBOL(pm_power_off);
EXPORT_SYMBOL(pm_power_off);


static long no_idt[3];
static long no_idt[3];
static enum { 
enum reboot_type reboot_type = BOOT_KBD;
	BOOT_TRIPLE = 't',
	BOOT_KBD = 'k',
	BOOT_ACPI = 'a'
} reboot_type = BOOT_KBD;
static int reboot_mode = 0;
static int reboot_mode = 0;
int reboot_force;
int reboot_force;


/* reboot=t[riple] | k[bd] [, [w]arm | [c]old]
/* reboot=t[riple] | k[bd] | e[fi] [, [w]arm | [c]old]
   warm   Don't set the cold reboot flag
   warm   Don't set the cold reboot flag
   cold   Set the cold reboot flag
   cold   Set the cold reboot flag
   triple Force a triple fault (init)
   triple Force a triple fault (init)
   kbd    Use the keyboard controller. cold reset (default)
   kbd    Use the keyboard controller. cold reset (default)
   acpi   Use the RESET_REG in the FADT
   acpi   Use the RESET_REG in the FADT
   efi    Use efi reset_system runtime service
   force  Avoid anything that could hang.
   force  Avoid anything that could hang.
 */ 
 */ 
static int __init reboot_setup(char *str)
static int __init reboot_setup(char *str)
@@ -60,6 +58,7 @@ static int __init reboot_setup(char *str)
		case 'a':
		case 'a':
		case 'b':
		case 'b':
		case 'k':
		case 'k':
		case 'e':
			reboot_type = *str;
			reboot_type = *str;
			break;
			break;
		case 'f':
		case 'f':
@@ -155,6 +154,13 @@ void machine_emergency_restart(void)
			acpi_reboot();
			acpi_reboot();
			reboot_type = BOOT_KBD;
			reboot_type = BOOT_KBD;
			break;
			break;

		case BOOT_EFI:
			if (efi_enabled)
				efi.reset_system(reboot_mode ? EFI_RESET_WARM : EFI_RESET_COLD,
						 EFI_SUCCESS, 0, NULL);
			reboot_type = BOOT_KBD;
			break;
		}
		}
	}      
	}      
}
}
+9 −0
Original line number Original line Diff line number Diff line
#ifndef _ASM_EMERGENCY_RESTART_H
#ifndef _ASM_EMERGENCY_RESTART_H
#define _ASM_EMERGENCY_RESTART_H
#define _ASM_EMERGENCY_RESTART_H


enum reboot_type {
	BOOT_TRIPLE = 't',
	BOOT_KBD = 'k',
	BOOT_ACPI = 'a',
	BOOT_EFI = 'e'
};

extern enum reboot_type reboot_type;

extern void machine_emergency_restart(void);
extern void machine_emergency_restart(void);


#endif /* _ASM_EMERGENCY_RESTART_H */
#endif /* _ASM_EMERGENCY_RESTART_H */