From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 295F31A1E45 for ; Thu, 29 Sep 2016 18:24:36 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP; 29 Sep 2016 18:24:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,417,1473145200"; d="scan'208";a="1064236868" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga002.fm.intel.com with ESMTP; 29 Sep 2016 18:24:35 -0700 Received: from fmsmsx116.amr.corp.intel.com (10.18.116.20) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 29 Sep 2016 18:24:35 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx116.amr.corp.intel.com (10.18.116.20) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 29 Sep 2016 18:23:33 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.118]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.234]) with mapi id 14.03.0248.002; Fri, 30 Sep 2016 09:23:31 +0800 From: "Tian, Feng" To: Saqib Khan , "edk2-devel@lists.01.org" CC: "Tian, Feng" Thread-Topic: [edk2] stuck on LoadImage while loading image from usb Thread-Index: AQHSGkZoO6n0yS/06UOwmVzy42pD66CRPEpA Date: Fri, 30 Sep 2016 01:23:31 +0000 Message-ID: <7F1BAD85ADEA444D97065A60D2E97EE566E248A8@SHSMSX101.ccr.corp.intel.com> References: In-Reply-To: Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: stuck on LoadImage while loading image from usb X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Sep 2016 01:24:36 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable In your code, there are several problems. 1. For your case, you couldn't simply locate all BlockIo instances. It's be= cause some of these BlockIo instances may belong to other removable devices= , some may point to physical partition rather than logical partition. 2. The logic below is incorrect. It means TRUE if(!BlkIo->Media->RemovableMedia || BlkIo->Media->RemovableMedia) 3. Why don't you directly locate all SimpleFileSystem protocol instances an= d then find out Hello.efi? It's more simple. 4. The hang you found should be due to a wrong device path pass down to Loa= dImage(). Thanks Feng -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Saqi= b Khan Sent: Thursday, September 29, 2016 7:41 PM To: edk2-devel@lists.01.org Subject: [edk2] stuck on LoadImage while loading image from usb Hi , I am trying to load an EFI from another EFI, it stuck when LoadImage is cal= led both EFI are located on USB . Here is code snippet " UINTN NumberFileSystemHandles; EFI_HANDLE *FileSystemHandles; UINTN Index; EFI_BLOCK_IO* BlkIo; EFI_DEVICE_PATH_PROTOCOL *FilePath; EFI_HANDLE NewHandle; UINTN ExitDataSizePtr; EFI_BOOT_LOGO_PROTOCOL *BootLogo; EFI_STATUS Status; gBS->LocateHandleBuffer(ByProtocol, &gEfiBlockIoProtocolGuid, NULL, &NumberFileSystemHandles, &FileSystemHandles); for(Index =3D 0; Index HandleProtocol(FileSystemHandles[Index], &gEfiBlockIoProtocolGuid, (VOID**) &BlkIo); Print(L"after HandleProtocol %x - %r\n",FileSystemHandles[Index], S= tatus); if(!EFI_ERROR(Status)) { //check if it is usb if(!BlkIo->Media->RemovableMedia || BlkIo->Media->RemovableMedia) { FilePath =3D FileDevicePath(FileSystemHandles[Index], L"Hello.efi"); Status =3D gBS->LoadImage( FALSE, gImageHandle, FilePath, NULL, 0, &NewHandle); if (EFI_ERROR(Status)) { if (NewHandle !=3D NULL) { gBS->UnloadImage(NewHandle); } //return (Status); } } " can any one help me what I am doing wrong here? -- Regards Saqib _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel