|
|
f2fa6b |
From 2f09d0ab290d9b0d8aa14c3243f1d85a20bc34e6 Mon Sep 17 00:00:00 2001
|
|
|
f2fa6b |
From: Andrew Boie <andrew.p.boie@intel.com>
|
|
|
f2fa6b |
Date: Mon, 11 Nov 2013 17:29:06 -0800
|
|
|
f2fa6b |
Subject: [PATCH 09/19] shim: improve error messages
|
|
|
f2fa6b |
|
|
|
f2fa6b |
%r when used in Print() will show a string representation of
|
|
|
f2fa6b |
an EFI_STATUS code.
|
|
|
f2fa6b |
|
|
|
f2fa6b |
Change-Id: I6db47f5213454603bd66177aca378ad01e9f0bd4
|
|
|
f2fa6b |
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
|
|
|
f2fa6b |
---
|
|
|
f2fa6b |
shim.c | 38 +++++++++++++++++++-------------------
|
|
|
f2fa6b |
1 file changed, 19 insertions(+), 19 deletions(-)
|
|
|
f2fa6b |
|
|
|
f2fa6b |
diff --git a/shim.c b/shim.c
|
|
|
f2fa6b |
index a043779..9ae1936 100644
|
|
|
f2fa6b |
--- a/shim.c
|
|
|
f2fa6b |
+++ b/shim.c
|
|
|
f2fa6b |
@@ -914,7 +914,7 @@ static EFI_STATUS handle_image (void *data, unsigned int datasize,
|
|
|
f2fa6b |
*/
|
|
|
f2fa6b |
efi_status = read_header(data, datasize, &context);
|
|
|
f2fa6b |
if (efi_status != EFI_SUCCESS) {
|
|
|
f2fa6b |
- Print(L"Failed to read header\n");
|
|
|
f2fa6b |
+ Print(L"Failed to read header: %r\n", efi_status);
|
|
|
f2fa6b |
return efi_status;
|
|
|
f2fa6b |
}
|
|
|
f2fa6b |
|
|
|
f2fa6b |
@@ -981,7 +981,7 @@ static EFI_STATUS handle_image (void *data, unsigned int datasize,
|
|
|
f2fa6b |
efi_status = relocate_coff(&context, buffer);
|
|
|
f2fa6b |
|
|
|
f2fa6b |
if (efi_status != EFI_SUCCESS) {
|
|
|
f2fa6b |
- Print(L"Relocation failed\n");
|
|
|
f2fa6b |
+ Print(L"Relocation failed: %r\n", efi_status);
|
|
|
f2fa6b |
FreePool(buffer);
|
|
|
f2fa6b |
return efi_status;
|
|
|
f2fa6b |
}
|
|
|
f2fa6b |
@@ -1022,7 +1022,7 @@ should_use_fallback(EFI_HANDLE image_handle)
|
|
|
f2fa6b |
rc = uefi_call_wrapper(BS->HandleProtocol, 3, image_handle,
|
|
|
f2fa6b |
&loaded_image_protocol, (void **)&li;;
|
|
|
f2fa6b |
if (EFI_ERROR(rc)) {
|
|
|
f2fa6b |
- Print(L"Could not get image for bootx64.efi: %d\n", rc);
|
|
|
f2fa6b |
+ Print(L"Could not get image for bootx64.efi: %r\n", rc);
|
|
|
f2fa6b |
return 0;
|
|
|
f2fa6b |
}
|
|
|
f2fa6b |
|
|
|
f2fa6b |
@@ -1044,13 +1044,13 @@ should_use_fallback(EFI_HANDLE image_handle)
|
|
|
f2fa6b |
rc = uefi_call_wrapper(BS->HandleProtocol, 3, li->DeviceHandle,
|
|
|
f2fa6b |
&FileSystemProtocol, (void **)&fio;;
|
|
|
f2fa6b |
if (EFI_ERROR(rc)) {
|
|
|
f2fa6b |
- Print(L"Could not get fio for li->DeviceHandle: %d\n", rc);
|
|
|
f2fa6b |
+ Print(L"Could not get fio for li->DeviceHandle: %r\n", rc);
|
|
|
f2fa6b |
return 0;
|
|
|
f2fa6b |
}
|
|
|
f2fa6b |
|
|
|
f2fa6b |
rc = uefi_call_wrapper(fio->OpenVolume, 2, fio, &vh;;
|
|
|
f2fa6b |
if (EFI_ERROR(rc)) {
|
|
|
f2fa6b |
- Print(L"Could not open fio volume: %d\n", rc);
|
|
|
f2fa6b |
+ Print(L"Could not open fio volume: %r\n", rc);
|
|
|
f2fa6b |
return 0;
|
|
|
f2fa6b |
}
|
|
|
f2fa6b |
|
|
|
f2fa6b |
@@ -1172,14 +1172,14 @@ static EFI_STATUS load_image (EFI_LOADED_IMAGE *li, void **data,
|
|
|
f2fa6b |
(void **)&drive);
|
|
|
f2fa6b |
|
|
|
f2fa6b |
if (efi_status != EFI_SUCCESS) {
|
|
|
f2fa6b |
- Print(L"Failed to find fs\n");
|
|
|
f2fa6b |
+ Print(L"Failed to find fs: %r\n", efi_status);
|
|
|
f2fa6b |
goto error;
|
|
|
f2fa6b |
}
|
|
|
f2fa6b |
|
|
|
f2fa6b |
efi_status = uefi_call_wrapper(drive->OpenVolume, 2, drive, &root);
|
|
|
f2fa6b |
|
|
|
f2fa6b |
if (efi_status != EFI_SUCCESS) {
|
|
|
f2fa6b |
- Print(L"Failed to open fs\n");
|
|
|
f2fa6b |
+ Print(L"Failed to open fs: %r\n", efi_status);
|
|
|
f2fa6b |
goto error;
|
|
|
f2fa6b |
}
|
|
|
f2fa6b |
|
|
|
f2fa6b |
@@ -1190,7 +1190,7 @@ static EFI_STATUS load_image (EFI_LOADED_IMAGE *li, void **data,
|
|
|
f2fa6b |
EFI_FILE_MODE_READ, 0);
|
|
|
f2fa6b |
|
|
|
f2fa6b |
if (efi_status != EFI_SUCCESS) {
|
|
|
f2fa6b |
- Print(L"Failed to open %s - %lx\n", PathName, efi_status);
|
|
|
f2fa6b |
+ Print(L"Failed to open %s - %r\n", PathName, efi_status);
|
|
|
f2fa6b |
goto error;
|
|
|
f2fa6b |
}
|
|
|
f2fa6b |
|
|
|
f2fa6b |
@@ -1223,7 +1223,7 @@ static EFI_STATUS load_image (EFI_LOADED_IMAGE *li, void **data,
|
|
|
f2fa6b |
}
|
|
|
f2fa6b |
|
|
|
f2fa6b |
if (efi_status != EFI_SUCCESS) {
|
|
|
f2fa6b |
- Print(L"Unable to get file info\n");
|
|
|
f2fa6b |
+ Print(L"Unable to get file info: %r\n", efi_status);
|
|
|
f2fa6b |
goto error;
|
|
|
f2fa6b |
}
|
|
|
f2fa6b |
|
|
|
f2fa6b |
@@ -1251,7 +1251,7 @@ static EFI_STATUS load_image (EFI_LOADED_IMAGE *li, void **data,
|
|
|
f2fa6b |
}
|
|
|
f2fa6b |
|
|
|
f2fa6b |
if (efi_status != EFI_SUCCESS) {
|
|
|
f2fa6b |
- Print(L"Unexpected return from initial read: %x, buffersize %x\n", efi_status, buffersize);
|
|
|
f2fa6b |
+ Print(L"Unexpected return from initial read: %r, buffersize %x\n", efi_status, buffersize);
|
|
|
f2fa6b |
goto error;
|
|
|
f2fa6b |
}
|
|
|
f2fa6b |
|
|
|
f2fa6b |
@@ -1328,20 +1328,20 @@ EFI_STATUS start_image(EFI_HANDLE image_handle, CHAR16 *ImagePath)
|
|
|
f2fa6b |
efi_status = generate_path(li, ImagePath, &path, &PathName);
|
|
|
f2fa6b |
|
|
|
f2fa6b |
if (efi_status != EFI_SUCCESS) {
|
|
|
f2fa6b |
- Print(L"Unable to generate path: %s\n", ImagePath);
|
|
|
f2fa6b |
+ Print(L"Unable to generate path %s: %r\n", ImagePath, efi_status);
|
|
|
f2fa6b |
goto done;
|
|
|
f2fa6b |
}
|
|
|
f2fa6b |
|
|
|
f2fa6b |
if (findNetboot(image_handle)) {
|
|
|
f2fa6b |
efi_status = parseNetbootinfo(image_handle);
|
|
|
f2fa6b |
if (efi_status != EFI_SUCCESS) {
|
|
|
f2fa6b |
- Print(L"Netboot parsing failed: %d\n", efi_status);
|
|
|
f2fa6b |
+ Print(L"Netboot parsing failed: %r\n", efi_status);
|
|
|
f2fa6b |
return EFI_PROTOCOL_ERROR;
|
|
|
f2fa6b |
}
|
|
|
f2fa6b |
efi_status = FetchNetbootimage(image_handle, &sourcebuffer,
|
|
|
f2fa6b |
&sourcesize);
|
|
|
f2fa6b |
if (efi_status != EFI_SUCCESS) {
|
|
|
f2fa6b |
- Print(L"Unable to fetch TFTP image\n");
|
|
|
f2fa6b |
+ Print(L"Unable to fetch TFTP image: %r\n", efi_status);
|
|
|
f2fa6b |
return efi_status;
|
|
|
f2fa6b |
}
|
|
|
f2fa6b |
data = sourcebuffer;
|
|
|
f2fa6b |
@@ -1353,7 +1353,7 @@ EFI_STATUS start_image(EFI_HANDLE image_handle, CHAR16 *ImagePath)
|
|
|
f2fa6b |
efi_status = load_image(li, &data, &datasize, PathName);
|
|
|
f2fa6b |
|
|
|
f2fa6b |
if (efi_status != EFI_SUCCESS) {
|
|
|
f2fa6b |
- Print(L"Failed to load image\n");
|
|
|
f2fa6b |
+ Print(L"Failed to load image %s: %r\n", PathName, efi_status);
|
|
|
f2fa6b |
goto done;
|
|
|
f2fa6b |
}
|
|
|
f2fa6b |
}
|
|
|
f2fa6b |
@@ -1370,7 +1370,7 @@ EFI_STATUS start_image(EFI_HANDLE image_handle, CHAR16 *ImagePath)
|
|
|
f2fa6b |
efi_status = handle_image(data, datasize, li);
|
|
|
f2fa6b |
|
|
|
f2fa6b |
if (efi_status != EFI_SUCCESS) {
|
|
|
f2fa6b |
- Print(L"Failed to load image\n");
|
|
|
f2fa6b |
+ Print(L"Failed to load image: %r\n", efi_status);
|
|
|
f2fa6b |
CopyMem(li, &li_bak, sizeof(li_bak));
|
|
|
f2fa6b |
goto done;
|
|
|
f2fa6b |
}
|
|
|
f2fa6b |
@@ -1473,7 +1473,7 @@ EFI_STATUS mirror_mok_list()
|
|
|
f2fa6b |
| EFI_VARIABLE_RUNTIME_ACCESS,
|
|
|
f2fa6b |
FullDataSize, FullData);
|
|
|
f2fa6b |
if (efi_status != EFI_SUCCESS) {
|
|
|
f2fa6b |
- Print(L"Failed to set MokListRT %d\n", efi_status);
|
|
|
f2fa6b |
+ Print(L"Failed to set MokListRT: %r\n", efi_status);
|
|
|
f2fa6b |
}
|
|
|
f2fa6b |
|
|
|
f2fa6b |
return efi_status;
|
|
|
f2fa6b |
@@ -1514,7 +1514,7 @@ EFI_STATUS check_mok_request(EFI_HANDLE image_handle)
|
|
|
f2fa6b |
efi_status = start_image(image_handle, MOK_MANAGER);
|
|
|
f2fa6b |
|
|
|
f2fa6b |
if (efi_status != EFI_SUCCESS) {
|
|
|
f2fa6b |
- Print(L"Failed to start MokManager\n");
|
|
|
f2fa6b |
+ Print(L"Failed to start MokManager: %r\n", efi_status);
|
|
|
f2fa6b |
return efi_status;
|
|
|
f2fa6b |
}
|
|
|
f2fa6b |
}
|
|
|
f2fa6b |
@@ -1621,7 +1621,7 @@ static EFI_STATUS mok_ignore_db()
|
|
|
f2fa6b |
| EFI_VARIABLE_RUNTIME_ACCESS,
|
|
|
f2fa6b |
DataSize, (void *)&Data);
|
|
|
f2fa6b |
if (efi_status != EFI_SUCCESS) {
|
|
|
f2fa6b |
- Print(L"Failed to set MokIgnoreDB %d\n", efi_status);
|
|
|
f2fa6b |
+ Print(L"Failed to set MokIgnoreDB: %r\n", efi_status);
|
|
|
f2fa6b |
}
|
|
|
f2fa6b |
}
|
|
|
f2fa6b |
|
|
|
f2fa6b |
@@ -1648,7 +1648,7 @@ EFI_STATUS set_second_stage (EFI_HANDLE image_handle)
|
|
|
f2fa6b |
status = uefi_call_wrapper(BS->HandleProtocol, 3, image_handle,
|
|
|
f2fa6b |
&LoadedImageProtocol, (void **) &li;;
|
|
|
f2fa6b |
if (status != EFI_SUCCESS) {
|
|
|
f2fa6b |
- Print (L"Failed to get load options\n");
|
|
|
f2fa6b |
+ Print (L"Failed to get load options: %r\n", status);
|
|
|
f2fa6b |
return status;
|
|
|
f2fa6b |
}
|
|
|
f2fa6b |
|
|
|
f2fa6b |
--
|
|
|
f2fa6b |
1.8.5.3
|
|
|
f2fa6b |
|