mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 15:14:43 +00:00
x86: Add efi runtime reset
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. Eventually we will want to have full DM functionality in runtime services. But this fixes a travis failure and doesn't clutter the code too heavily, so we should pull it in without the amazing new RTS DM framework. Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
parent
dd1a1ec2af
commit
3eeb09b4c0
1 changed files with 22 additions and 1 deletions
|
@ -10,8 +10,10 @@
|
|||
#include <sysreset.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/processor.h>
|
||||
#include <efi_loader.h>
|
||||
|
||||
static int x86_sysreset_request(struct udevice *dev, enum sysreset_t type)
|
||||
static __efi_runtime int x86_sysreset_request(struct udevice *dev,
|
||||
enum sysreset_t type)
|
||||
{
|
||||
int value;
|
||||
|
||||
|
@ -31,6 +33,25 @@ static int x86_sysreset_request(struct udevice *dev, enum sysreset_t type)
|
|||
return -EINPROGRESS;
|
||||
}
|
||||
|
||||
#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)
|
||||
{
|
||||
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);
|
||||
|
||||
/* TODO EFI_RESET_SHUTDOWN */
|
||||
|
||||
while (1) { }
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static const struct udevice_id x86_sysreset_ids[] = {
|
||||
{ .compatible = "x86,reset" },
|
||||
{ }
|
||||
|
|
Loading…
Reference in a new issue