public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Saqib Khan <saqib.khan2011@gmail.com>
To: edk2-devel@lists.01.org
Subject: stuck on LoadImage while loading image from usb
Date: Thu, 29 Sep 2016 16:41:13 +0500	[thread overview]
Message-ID: <CAF=YJJ_eojJygAq7F1KXLd--vo2JVNqwiBgfyxrhBPtsCxWt3g@mail.gmail.com> (raw)

Hi ,

I am trying to load an EFI from another EFI, it stuck when LoadImage is
called
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 = 0; Index<NumberFileSystemHandles; ++Index) {

        Status = gBS -> HandleProtocol(FileSystemHandles[Index],
                                        &gEfiBlockIoProtocolGuid,
                                        (VOID**) &BlkIo);

        Print(L"after HandleProtocol %x - %r\n",FileSystemHandles[Index],
Status);
        if(!EFI_ERROR(Status)) {


            //check if it is usb
            if(!BlkIo->Media->RemovableMedia ||
BlkIo->Media->RemovableMedia)
            {



                    FilePath = FileDevicePath(FileSystemHandles[Index],
                                            L"Hello.efi");

                    Status = gBS->LoadImage(
                        FALSE,
                        gImageHandle,
                        FilePath,
                        NULL,
                        0,
                        &NewHandle);
                    if (EFI_ERROR(Status)) {
                        if (NewHandle != NULL) {
                            gBS->UnloadImage(NewHandle);
                        }


                        //return (Status);
            }


    }
"

can any one help me what I am doing wrong here?

-- 
Regards
Saqib


             reply	other threads:[~2016-09-29 11:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-29 11:41 Saqib Khan [this message]
2016-09-30  1:23 ` stuck on LoadImage while loading image from usb Tian, Feng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAF=YJJ_eojJygAq7F1KXLd--vo2JVNqwiBgfyxrhBPtsCxWt3g@mail.gmail.com' \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox