From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-it0-x22b.google.com (mail-it0-x22b.google.com [IPv6:2607:f8b0:4001:c0b::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 8D85F1A1E1F for ; Wed, 5 Oct 2016 05:37:03 -0700 (PDT) Received: by mail-it0-x22b.google.com with SMTP id j69so192232443itb.0 for ; Wed, 05 Oct 2016 05:37:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=ln6turX28Bj1QSMP4oEQhi2tFVlTRtzYS5/l+jHI628=; b=OiDAylspNVsx7SULNZozG2mcL/herf25GwTixtBi+nU1dgo9JIz8WiiohRHMtBmtBd LfmMIVcs+qoHFESrVStq/aBDzOTWVtPVyqS04n7q9aDEYXVxb6PJAS7eOpXeLh9ltqHC Etiua7iAtv1vs5wTSLsS/nq3ibYwbC5Hhq2K9yF7D9vaqbi1ByB84b7W3nIqDMWNMkti vxEiD49Xe+clsRd6eIholYjZyKUXQlS+vEKWLedaKRH7OCe4fvyTiXQJZxcVWDtyiva8 zQzN0di1GKfqs9X7KOwCK1LvFrog6zNokNKZleB2Lv90oh/zjPY8KpMug+sxKCdYA2Bm VwCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=ln6turX28Bj1QSMP4oEQhi2tFVlTRtzYS5/l+jHI628=; b=U14Ec2oxMe2/hJl/BpObmumL7I3AvRXeEL8d4vZ91v9pPR4zKAWNI12Wp5wWwAvcMR 86xW5Jjoc09mavAee0ki/xn77npQh1aXfqCyDnIJurZ97TyxcCKK/fY504yvWO+8ld2s t86Iqq1TxphmB6Zmm2tEl0m96KA70+y+W/Cf5tZ7P8a9LHb+hySiXvzJR+qOGZqseIUR ZUlgvU0BfYHqDoJMdNuP9sgWipJtOjfBQBVr1+iHNPMWU0lXPbrLZp4pFVLienv+NQ1f Dy4IvvYPYXtowrlzvjzdd0Pq1FY1Wl12dpEVmUpd10LiPCQqo/bXbH8Q0AqBTxVGINDP +lXA== X-Gm-Message-State: AA6/9RkA5DERK0jiGEaUqmmBN8j4CbsCm+ewXQYYTkQYoGmzJ8xkuHJ/0+6tc0SZTu1wxJLdeNFNnCUZXkLMuw== X-Received: by 10.36.14.68 with SMTP id 65mr8660662ite.99.1475671013680; Wed, 05 Oct 2016 05:36:53 -0700 (PDT) MIME-Version: 1.0 Received: by 10.36.196.214 with HTTP; Wed, 5 Oct 2016 05:36:53 -0700 (PDT) In-Reply-To: References: From: Saqib Khan Date: Wed, 5 Oct 2016 17:36:53 +0500 Message-ID: To: edk2-devel@lists.01.org X-Content-Filtered-By: Mailman/MimeDel 2.1.21 Subject: Re: EFI hanging at EfiBootManagerRefreshAllBootOption 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: Wed, 05 Oct 2016 12:37:03 -0000 Content-Type: text/plain; charset=UTF-8 [Packages] MdePkg/MdePkg.dec MdeModulePkg/MdeModulePkg.dec IntelFrameworkPkg/IntelFrameworkPkg.dec IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec ShellPkg/ShellPkg.dec [LibraryClasses] HiiLib DebugLib UefiLib MemoryAllocationLib UefiBootServicesTableLib UefiApplicationEntryPoint UefiBootManagerLib LegacyBootManagerLib I have figured out that if I add LegacyBootManagerLib it hangs at EfiBootManagerRefreshAllBootOption() . any idea why this behaviour? I want to boot legacy so i need legacyBootManagerLib... On Wed, Oct 5, 2016 at 4:35 PM, Saqib Khan wrote: > Hi , > I am working on a Boot manager > I have following set-up > in USB i have directory EFI->BOOT->Bootx64.efi(my EFI) > > > My EFI does load an image, before that I am trying to > EfiBootManagerRefreshAllBootOption () I am trying to refresh all but > option .but it hangs on EfiBootManagerRefreshAllBootOption () . > > I have shared code I have bold and underlined where it is hanging, any > idea what might be the reason? > > > Here is Code : > > EFI_STATUS > EFIAPI > BootManagerMenuEntry ( > IN EFI_HANDLE ImageHandle, > IN EFI_SYSTEM_TABLE *SystemTable > ) > { > > EFI_BOOT_MANAGER_LOAD_OPTION *BootOption; > UINTN BootOptionCount; > EFI_LEGACY_BIOS_PROTOCOL *LegacyBios; > EFI_BOOT_LOGO_PROTOCOL *BootLogo; > EFI_STATUS Status; > UINTN BootVariableSize; > > CHAR16 *Name; > UINTN NewNameSize; > UINTN NameSize; > UINTN i; > > EFI_GUID VarGuid; > VOID* Value; > UINTN Index; > > EFI_DEVICE_PATH_PROTOCOL *DevicePathProtocol; > > EFI_LOADED_IMAGE_PROTOCOL* LoadedImageProtocol; > > > > BootLogo = NULL; > Status = gBS->LocateProtocol (&gEfiBootLogoProtocolGuid, NULL, (VOID **) > &BootLogo); > if (!EFI_ERROR (Status) && (BootLogo != NULL)) { > Status = BootLogo->SetBootLogo (BootLogo, NULL, 0, 0, 0, 0); > ASSERT_EFI_ERROR (Status); > } > > gBS->SetWatchdogTimer (0x0000, 0x0000, 0x0000, NULL); > > gStringPackHandle = HiiAddPackages ( > &gEfiCallerIdGuid, > gImageHandle, > BootManagerMenuAppStrings, > NULL > ); > ASSERT (gStringPackHandle != NULL); > > > > Print(L"ConnectBootManager\n"); > EfiBootManagerConnectAll (); > Print(L"Connected BootManager\n"); > > *----->EfiBootManagerRefreshAllBootOption (); *//Here it gets hang > Print(L"All option refreshed\n"); > > BootOption = EfiBootManagerGetLoadOptions (&BootOptionCount, > LoadOptionTypeBoot); > Print(L"Alloption refreshed fdfdf\n"); > //legacybootoptionrefresh(); > //LegacyBootManager(BootOption); > //EfiBootManagerRegisterLegacyBootSupport(legacybootoptionrefresh, > LegacyBootManager > > > > Status = gBS->LocateProtocol (&gEfiLegacyBiosProtocolGuid, NULL, (VOID > **) &LegacyBios); > if (EFI_ERROR (Status)) { > // > // If no LegacyBios protocol we do not support legacy boot > // > Print(L"Boot not suported [%X]\n",Status); > //BootOption->Status = EFI_UNSUPPORTED; > // return; > } > > > > > > > > > //UINTN ExitDataSizePtr; > //UINTN HandleCount; > //UINTN ScratchBufferSize = 0; > //EFI_HANDLE *HandleBuffer; > > //EFI_BOOT_LOGO_PROTOCOL *BootLogo; > > Status=gBS->HandleProtocol( > ImageHandle, > &gEfiLoadedImageProtocolGuid, > (VOID**)&LoadedImageProtocol > ); > > > Status=gBS->HandleProtocol( > LoadedImageProtocol->DeviceHandle, > &gEfiDevicePathProtocolGuid, > (VOID**)&DevicePathProtocol > ); > Print (L"Image device : %s\n",ConvertDevicePathToText > (DevicePathProtocol,TRUE,TRUE)); > Print (L"Image file: %s\n",ConvertDevicePathToText > (LoadedImageProtocol->FilePath,TRUE,TRUE)); > Print (L"Image Base: %X\n",LoadedImageProtocol->ImageBase); > Print (L"Image Size: %X\n",LoadedImageProtocol->ImageSize); > > Value =NULL ; > /*Print All Boot option*/ > > //Print all BOOT#### Load Options > NameSize = sizeof(CHAR16); > Name = AllocateZeroPool(NameSize); > for (i=0; ;i++ ){ > NewNameSize = NameSize; > //search all EFI variables > Status = gRT->GetNextVariableName (&NewNameSize, Name, &VarGuid); > if (Status == EFI_BUFFER_TOO_SMALL) { > Name = ReallocatePool (NameSize, NewNameSize, Name); > Status = gRT->GetNextVariableName (&NewNameSize, Name, &VarGuid); > NameSize = NewNameSize; > } > // > if (Status == EFI_NOT_FOUND) { > break; > } > //skip if not Global variable > if (!CompareGuid(&VarGuid, &gEfiGlobalVariableGuid)) > continue; > //check BOOT#### variable > if(!StrnCmp(Name, L"Boot", 4) && > isitDigit(Name[4]) && isitDigit(Name[5]) && > isitDigit(Name[6]) && isitDigit(Name[7])) > { > Print(L"%s:", Name); > //get BOOT#### > // Status = gRT->GetVariable((CHAR16 *)Name, > &gEfiGlobalVariableGuid, &BootVariableSize, NULL); > Status = gRT->GetVariable ((CHAR16 *)Name, > &gEfiGlobalVariableGuid, NULL, &BootVariableSize, Value); > //print attribute > > //print EFI_LOAD_OPTION description > Print(L" %s",(CHAR16 *)(Name+3)); > Print(L"\n"); > > } > } > > > LoadImageFromFile (L"\\Hello.efi"); > > SystemTable->ConOut->OutputString ( > SystemTable->ConOut, > L"\n\r\n\r\n\rHit any key to exit\n\r"); > SystemTable->BootServices->WaitForEvent ( > 1, > &(SystemTable->ConIn->WaitForKey), > &Index); > > > > > return Status; > > } > > > -- > Regards > Saqib Ahmed Khanzada > -- Regards Saqib Ahmed Khanzada