From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-it0-x22d.google.com (mail-it0-x22d.google.com [IPv6:2607:f8b0:4001:c0b::22d]) (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 838B61A1ED6 for ; Wed, 5 Oct 2016 04:35:17 -0700 (PDT) Received: by mail-it0-x22d.google.com with SMTP id r192so181032171ita.0 for ; Wed, 05 Oct 2016 04:35:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to; bh=xwITkXkO8s+H85w8A5MWXa67BruMUBHWrNzmdbJFHYw=; b=Gq7jgT9rnni2KPKBL79F3vdThQVDmZvCueDcnMkBm94Jb9U9z5A2VkMhu5MkGeEOsc VntJcS4bvgj+NXKcQfOQrk6+9w8fzL72IS1SHnhNBphNJGZUqumNz20dD4NImi0Y86m6 FiM44Kt8eVvr8t9BCq2q7vz5u4HO1tSARWJ8f9RGitstT31uva2G4N334C5M5vVrEtzo fQeOgo7mEeSDrm8uI15m61ss46bQzJ8iJng/k6nX1PZpWHOXss0HAzRa3jvptQCj3Oft 4yChm+jh8Wpi6KEHdWDqOy8WcRK54S/VgqOZ4cQlxqYfU1BJi5QEb+3AbpRTmTldnlFl wiJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=xwITkXkO8s+H85w8A5MWXa67BruMUBHWrNzmdbJFHYw=; b=kSBvngE3F+fqmq/cvBNtMx8xtDGKOCR9EjJ8dYZNUwtyIteXKZgsma1Ev8ERsxQlkp qGmIh4PXkKwl3wK0ewtSfUaodWxDhl4YSqgS7/bco57IrNpkR69zWBPLyFGrC1+Y+hm9 6rfiQIKuubdts5u7BJc5g//hbuL42s6zVvU9hHf4N9tUotChWyIa8ZPYQlU578oeIayB WHSFdZMb3PserfNctKyDGFL11icBo4R0bNgmzjvfIETpBk9680YoCpyCeJ1KQHNN5XvS fmE+ZH3zIK5S097okHogY9Z/DJaCaJ8ulIHFZ/dB3N6k4yk345M3+1NqE4Dz28JZt6JE 6CoQ== X-Gm-Message-State: AA6/9Rk1iezvPRh8K4FJR7NkugkgvkBmlm+c/8L+yyQn0KX2NTnTJRAO6og15T/OXtMKqXTtExOofMBAJo1t6Q== X-Received: by 10.107.143.79 with SMTP id r76mr9405595iod.227.1475667316296; Wed, 05 Oct 2016 04:35:16 -0700 (PDT) MIME-Version: 1.0 Received: by 10.36.196.214 with HTTP; Wed, 5 Oct 2016 04:35:15 -0700 (PDT) From: Saqib Khan Date: Wed, 5 Oct 2016 16:35:15 +0500 Message-ID: To: edk2-devel@lists.01.org X-Content-Filtered-By: Mailman/MimeDel 2.1.21 Subject: 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 11:35:17 -0000 Content-Type: text/plain; charset=UTF-8 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