diff options
author | Matt Fleming <matt.fleming@intel.com> | 2012-11-12 14:24:56 +0000 |
---|---|---|
committer | Matt Fleming <matt.fleming@intel.com> | 2012-11-12 14:35:54 +0000 |
commit | 0471f367e08e5a205ad8f61b7f17ba389cf74e33 (patch) | |
tree | b698dc6de934f0f10b7a0b79733be2c7282c0722 | |
parent | 1cf1c0c827008cb1af7b06dc1a7496072756c518 (diff) | |
download | syslinux-0471f367e08e5a205ad8f61b7f17ba389cf74e33.tar.gz syslinux-0471f367e08e5a205ad8f61b7f17ba389cf74e33.tar.xz syslinux-0471f367e08e5a205ad8f61b7f17ba389cf74e33.zip |
efi: Return a sensible error code to the firmware...
... if we fail to load Syslinux properly (such as when ldlinux.c32 is
missing).
Also, check that we successfully cancelled the timer event and inform
the user if we didn't, as it provides some explanation to the user if
they see "issues" after returning to the firmware.
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
-rw-r--r-- | efi/main.c | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -614,9 +614,9 @@ static void free_addr(EFI_PHYSICAL_ADDRESS addr, size_t size) } /* cancel the established timer */ -static void cancel_timer(EFI_EVENT ev) +static EFI_STATUS cancel_timer(EFI_EVENT ev) { - uefi_call_wrapper(BS->SetTimer, 3, ev, TimerCancel, 0); + return uefi_call_wrapper(BS->SetTimer, 3, ev, TimerCancel, 0); } /* Check if timer went off and update default timer counter */ @@ -1111,9 +1111,16 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *table) priv.dev_handle = info->DeviceHandle; fs_init(ops, &priv); load_env32(); + /* load_env32() failed.. cancel timer and bailout */ - cancel_timer(timer_ev); + status = cancel_timer(timer_ev); + if (status != EFI_SUCCESS) + Print(L"Failed to cancel EFI timer: %x\n", status); + /* + * Tell the firmware that Syslinux failed to load. + */ + status = EFI_LOAD_ERROR; out: return status; } |