From: "Jan Beulich" Subject: [PATCH] x86/EFI: improve boot time diagnostics (try 2) Date: Tue, 10 Jun 2014 17:11:47 +0100 Message-ID: <53974A630200007800019A93@mail.emea.novell.com> References: <53917AF0020000780001889A@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__PartD1E31853.0__=" Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WuOeP-0004Yf-Lk for xen-devel@lists.xenproject.org; Tue, 10 Jun 2014 16:11:53 +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: xen-devel List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__PartD1E31853.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline To aid analysis of eventual errors, print EFI status codes with error messages where available. Also remove a case where the status gets stored into a local variable without being used examined (which mis- guided me to add an error check there in try 1 of this patch). Signed-off-by: Jan Beulich --- 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 =3D 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 =3D fio->OpenVolume(fio, &dir_handle); } while ( ret =3D=3D EFI_MEDIA_CHANGED ); if ( ret !=3D EFI_SUCCESS ) - blexit(L"OpenVolume failure"); + PrintErrMesg(L"OpenVolume failure", ret); =20 #define buffer ((CHAR16 *)keyhandler_scratch) #define BUFFERSIZE sizeof(keyhandler_scratch) @@ -967,8 +968,8 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY =20 if ( !EFI_ERROR(efi_bs->LocateProtocol(&shim_lock_guid, NULL, (void **)&shim_lock)) && - shim_lock->Verify(kernel.ptr, kernel.size) !=3D EFI_SUCCESS ) - blexit(L"Dom0 kernel image could not be verified."); + (status =3D shim_lock->Verify(kernel.ptr, kernel.size)) !=3D = EFI_SUCCESS ) + PrintErrMesg(L"Dom0 kernel image could not be verified", status); =20 name.s =3D get_value(&cfg, section.s, "ramdisk"); if ( name.s ) @@ -1379,8 +1380,8 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY } } =20 - status =3D efi_bs->GetMemoryMap(&efi_memmap_size, NULL, &map_key, - &efi_mdesc_size, &mdesc_ver); + efi_bs->GetMemoryMap(&efi_memmap_size, NULL, &map_key, + &efi_mdesc_size, &mdesc_ver); mbi.mem_upper -=3D efi_memmap_size; mbi.mem_upper &=3D -__alignof__(EFI_MEMORY_DESCRIPTOR); if ( mbi.mem_upper < xen_phys_start ) @@ -1389,7 +1390,7 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SY status =3D 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); =20 /* Populate E820 table and check trampoline area availability. */ e =3D e820map - 1; --=__PartD1E31853.0__= Content-Type: text/plain; name="x86-EFI-boot-diagnostics.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-EFI-boot-diagnostics.patch" x86/EFI: improve boot time diagnostics (try 2)=0A=0ATo aid analysis of = eventual errors, print EFI status codes with error=0Amessages where = available. Also remove a case where the status gets=0Astored into a local = variable without being used examined (which mis-=0Aguided me to add an = error check there in try 1 of this patch).=0A=0ASigned-off-by: Jan Beulich = =0A=0A--- a/xen/arch/x86/efi/boot.c=0A+++ b/xen/arch/x86= /efi/boot.c=0A@@ -344,11 +344,12 @@ static EFI_FILE_HANDLE __init = get_parent=0A ret =3D efi_bs->HandleProtocol(loaded_image->DeviceHa= ndle,=0A &fs_protocol, (void = **)&fio);=0A if ( EFI_ERROR(ret) )=0A- blexit(L"Couldn't= obtain the File System Protocol Interface");=0A+ PrintErrMesg(L= "Couldn't obtain the File System Protocol Interface",=0A+ = ret);=0A ret =3D fio->OpenVolume(fio, &dir_handle);=0A = } while ( ret =3D=3D EFI_MEDIA_CHANGED );=0A if ( ret !=3D EFI_SUCCESS = )=0A- blexit(L"OpenVolume failure");=0A+ PrintErrMesg(L"OpenV= olume failure", ret);=0A =0A #define buffer ((CHAR16 *)keyhandler_scratch)= =0A #define BUFFERSIZE sizeof(keyhandler_scratch)=0A@@ -967,8 +968,8 @@ = efi_start(EFI_HANDLE ImageHandle, EFI_SY=0A =0A if ( !EFI_ERROR(efi_bs-= >LocateProtocol(&shim_lock_guid, NULL,=0A (void = **)&shim_lock)) &&=0A- shim_lock->Verify(kernel.ptr, kernel.size) = !=3D EFI_SUCCESS )=0A- blexit(L"Dom0 kernel image could not be = verified.");=0A+ (status =3D shim_lock->Verify(kernel.ptr, = kernel.size)) !=3D EFI_SUCCESS )=0A+ PrintErrMesg(L"Dom0 kernel = image could not be verified", status);=0A =0A name.s =3D get_value(&cfg= , section.s, "ramdisk");=0A if ( name.s )=0A@@ -1379,8 +1380,8 @@ = efi_start(EFI_HANDLE ImageHandle, EFI_SY=0A }=0A }=0A =0A- = status =3D efi_bs->GetMemoryMap(&efi_memmap_size, NULL, &map_key,=0A- = &efi_mdesc_size, &mdesc_ver);=0A+ efi_bs->Ge= tMemoryMap(&efi_memmap_size, NULL, &map_key,=0A+ = &efi_mdesc_size, &mdesc_ver);=0A mbi.mem_upper -=3D efi_memmap_size;=0A= mbi.mem_upper &=3D -__alignof__(EFI_MEMORY_DESCRIPTOR);=0A if ( = mbi.mem_upper < xen_phys_start )=0A@@ -1389,7 +1390,7 @@ efi_start(EFI_HAND= LE ImageHandle, EFI_SY=0A status =3D efi_bs->GetMemoryMap(&efi_memmap_s= ize, efi_memmap, &map_key,=0A &efi_mdesc_= size, &mdesc_ver);=0A if ( EFI_ERROR(status) )=0A- blexit(L"Cann= ot obtain memory map");=0A+ PrintErrMesg(L"Cannot obtain memory = map", status);=0A =0A /* Populate E820 table and check trampoline area = availability. */=0A e =3D e820map - 1;=0A --=__PartD1E31853.0__= 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 --=__PartD1E31853.0__=--