From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH] x86/EFI: improve boot time diagnostics Date: Fri, 6 Jun 2014 10:47:30 +0100 Message-ID: <53918E32.90007@citrix.com> References: <53917AF0020000780001889A@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8992572057738610477==" Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WsqkK-0003Zo-5F for xen-devel@lists.xenproject.org; Fri, 06 Jun 2014 09:47:36 +0000 In-Reply-To: <53917AF0020000780001889A@mail.emea.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: xen-devel List-Id: xen-devel@lists.xenproject.org --===============8992572057738610477== Content-Type: multipart/alternative; boundary="------------030105030601090905000202" --------------030105030601090905000202 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit On 06/06/14 07:25, Jan Beulich wrote: > To aid analysis of eventual errors, print EFI status codes with error > messages where available. > > Signed-off-by: Jan Beulich Reviewed-by: Andrew Cooper > > --- a/xen/arch/x86/efi/boot.c > +++ b/xen/arch/x86/efi/boot.c > @@ -344,11 +344,12 @@ static EFI_FILE_HANDLE __init get_parent > ret = efi_bs->HandleProtocol(loaded_image->DeviceHandle, > &fs_protocol, (void **)&fio); > if ( EFI_ERROR(ret) ) > - blexit(L"Couldn't obtain the File System Protocol Interface"); > + PrintErrMesg(L"Couldn't obtain the File System Protocol Interface", > + ret); > ret = fio->OpenVolume(fio, &dir_handle); > } while ( ret == EFI_MEDIA_CHANGED ); > if ( ret != EFI_SUCCESS ) > - blexit(L"OpenVolume failure"); > + PrintErrMesg(L"OpenVolume failure", ret); > > #define buffer ((CHAR16 *)keyhandler_scratch) > #define BUFFERSIZE sizeof(keyhandler_scratch) > @@ -967,8 +968,8 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY > > if ( !EFI_ERROR(efi_bs->LocateProtocol(&shim_lock_guid, NULL, > (void **)&shim_lock)) && > - shim_lock->Verify(kernel.ptr, kernel.size) != EFI_SUCCESS ) > - blexit(L"Dom0 kernel image could not be verified."); > + (status = shim_lock->Verify(kernel.ptr, kernel.size)) != EFI_SUCCESS ) > + PrintErrMesg(L"Dom0 kernel image could not be verified", status); > > name.s = get_value(&cfg, section.s, "ramdisk"); > if ( name.s ) > @@ -1381,6 +1382,8 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY > > status = efi_bs->GetMemoryMap(&efi_memmap_size, NULL, &map_key, > &efi_mdesc_size, &mdesc_ver); > + if ( EFI_ERROR(status) ) > + PrintErrMesg(L"Cannot size memory map", status); > mbi.mem_upper -= efi_memmap_size; > mbi.mem_upper &= -__alignof__(EFI_MEMORY_DESCRIPTOR); > if ( mbi.mem_upper < xen_phys_start ) > @@ -1389,7 +1392,7 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY > status = efi_bs->GetMemoryMap(&efi_memmap_size, efi_memmap, &map_key, > &efi_mdesc_size, &mdesc_ver); > if ( EFI_ERROR(status) ) > - blexit(L"Cannot obtain memory map"); > + PrintErrMesg(L"Cannot obtain memory map", status); > > /* Populate E820 table and check trampoline area availability. */ > e = e820map - 1; > > > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel --------------030105030601090905000202 Content-Type: text/html; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit
On 06/06/14 07:25, Jan Beulich wrote:
To aid analysis of eventual errors, print EFI status codes with error
messages where available.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>


--- a/xen/arch/x86/efi/boot.c
+++ b/xen/arch/x86/efi/boot.c
@@ -344,11 +344,12 @@ static EFI_FILE_HANDLE __init get_parent
         ret = efi_bs->HandleProtocol(loaded_image->DeviceHandle,
                                      &fs_protocol, (void **)&fio);
         if ( EFI_ERROR(ret) )
-            blexit(L"Couldn't obtain the File System Protocol Interface");
+            PrintErrMesg(L"Couldn't obtain the File System Protocol Interface",
+                         ret);
         ret = fio->OpenVolume(fio, &dir_handle);
     } while ( ret == EFI_MEDIA_CHANGED );
     if ( ret != EFI_SUCCESS )
-        blexit(L"OpenVolume failure");
+        PrintErrMesg(L"OpenVolume failure", ret);
 
 #define buffer ((CHAR16 *)keyhandler_scratch)
 #define BUFFERSIZE sizeof(keyhandler_scratch)
@@ -967,8 +968,8 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY
 
     if ( !EFI_ERROR(efi_bs->LocateProtocol(&shim_lock_guid, NULL,
                     (void **)&shim_lock)) &&
-         shim_lock->Verify(kernel.ptr, kernel.size) != EFI_SUCCESS )
-        blexit(L"Dom0 kernel image could not be verified.");
+         (status = shim_lock->Verify(kernel.ptr, kernel.size)) != EFI_SUCCESS )
+        PrintErrMesg(L"Dom0 kernel image could not be verified", status);
 
     name.s = get_value(&cfg, section.s, "ramdisk");
     if ( name.s )
@@ -1381,6 +1382,8 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY
 
     status = efi_bs->GetMemoryMap(&efi_memmap_size, NULL, &map_key,
                                   &efi_mdesc_size, &mdesc_ver);
+    if ( EFI_ERROR(status) )
+        PrintErrMesg(L"Cannot size memory map", status);
     mbi.mem_upper -= efi_memmap_size;
     mbi.mem_upper &= -__alignof__(EFI_MEMORY_DESCRIPTOR);
     if ( mbi.mem_upper < xen_phys_start )
@@ -1389,7 +1392,7 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY
     status = efi_bs->GetMemoryMap(&efi_memmap_size, efi_memmap, &map_key,
                                   &efi_mdesc_size, &mdesc_ver);
     if ( EFI_ERROR(status) )
-        blexit(L"Cannot obtain memory map");
+        PrintErrMesg(L"Cannot obtain memory map", status);
 
     /* Populate E820 table and check trampoline area availability. */
     e = e820map - 1;




_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

--------------030105030601090905000202-- --===============8992572057738610477== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --===============8992572057738610477==--