[syslinux:firmware] efi: Return a sensible error code to the firmware...

syslinux-bot for Matt Fleming matt.fleming at intel.com
Mon Nov 12 07:00:04 PST 2012


Commit-ID:  0471f367e08e5a205ad8f61b7f17ba389cf74e33
Gitweb:     http://www.syslinux.org/commit/0471f367e08e5a205ad8f61b7f17ba389cf74e33
Author:     Matt Fleming <matt.fleming at intel.com>
AuthorDate: Mon, 12 Nov 2012 14:24:56 +0000
Committer:  Matt Fleming <matt.fleming at intel.com>
CommitDate: Mon, 12 Nov 2012 14:35:54 +0000

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 at intel.com>

---
 efi/main.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/efi/main.c b/efi/main.c
index 059ad59..176c423 100644
--- a/efi/main.c
+++ b/efi/main.c
@@ -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;
 }


More information about the Syslinux-commits mailing list