From nobody Sun May 12 07:52:48 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+39735+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+39735+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1556515540; cv=none; d=zoho.com; s=zohoarc; b=e2K1ywESVkqjllA7TaYdwQYMVH+ApDIvqeNjunz/UNQm8u/frSOllD9JAfLMCA//tMjSbKyRCUnmACvytA64kL9RzEZ6u5v96HNnT1BnhiUUaCUHcNwcQrF/stpVdz8EytH8NP95CZb3dB+C2VepJt1TTHDod/CZoYBjVcsJOqQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556515540; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=lTgUiXzxxbFA3dF4PLE/j09Lg6ZCdqfq46GkNghsvbQ=; b=YN/Utgy9MX8XBAChN9YnZVnBh0LD96IRlIDHOfIWY+/0Aty5bglTTNALhnOEJbmG37eEJBDxzeGy/iZ5o9DSRg/YF0RJNPir50HInsaasFFIHwXodPa6RVUaQHq3oG7gmTzFryAlrySoiwLcYJ9i8BZYULkhLBRjtgrVE9seci4= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+39735+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1556515540371282.85613264153847; Sun, 28 Apr 2019 22:25:40 -0700 (PDT) Return-Path: X-Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by groups.io with SMTP; Sun, 28 Apr 2019 22:25:38 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Apr 2019 22:25:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,408,1549958400"; d="scan'208";a="341695423" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.157.133]) by fmsmga006.fm.intel.com with ESMTP; 28 Apr 2019 22:25:37 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Jordan Justen , Andrew Fish , Ray Ni Subject: [edk2-devel] [PATCH 1/2] EmulatorPkg: Make the shell be the first boot option Date: Mon, 29 Apr 2019 13:24:42 +0800 Message-Id: <20190429052443.2908-2-zhiguang.liu@intel.com> In-Reply-To: <20190429052443.2908-1-zhiguang.liu@intel.com> References: <20190429052443.2908-1-zhiguang.liu@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,zhiguang.liu@intel.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1556515538; bh=LY5ombPk3SoYctn3OTw7htrd8vYJ5ZtGt89xGiTFzfs=; h=Cc:Date:From:Reply-To:Subject:To; b=GWY6araoGOfAkbkCUbWoPgTByDpfwUXm2qpt60qiqvPO89RJrRq240vldw25EqE5qFH 1+CpCtK0fY6YwJTav7Gt/PXWddkwoy5D0vS8lLhiGzqWA8P24dBSdJc/8zH3R78ak3PIl bUQJkYHhPY1UyUW/lpn8SKmXNigXig5u4/w= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D1649 Make the shell be the first boot option by default, So it can boot into UEFI Internal Shell directly, when run the emulator if user don't change boot order. Signed-off-by: Zhiguang Liu Cc: Jordan Justen Cc: Andrew Fish Cc: Ray Ni --- EmulatorPkg/Library/PlatformBmLib/PlatformBm.c | 31 ++++++++++++++++++++++= ++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/EmulatorPkg/Library/PlatformBmLib/PlatformBm.c b/EmulatorPkg/L= ibrary/PlatformBmLib/PlatformBm.c index 2a97e385be..459ac5c4b5 100644 --- a/EmulatorPkg/Library/PlatformBmLib/PlatformBm.c +++ b/EmulatorPkg/Library/PlatformBmLib/PlatformBm.c @@ -388,6 +388,34 @@ PlatformBootManagerChangeDevicePath ( } } } +/** + Returns the priority number. + + @param BootOption +**/ +UINTN +BootOptionPriority ( + CONST EFI_BOOT_MANAGER_LOAD_OPTION *BootOption + ) +{ + // + // Make sure Shell is first + // + if (StrCmp (BootOption->Description, L"UEFI Shell") =3D=3D 0) { + return 0; + } + return 100; +} + +INTN +EFIAPI +CompareBootOption ( + CONST EFI_BOOT_MANAGER_LOAD_OPTION *Left, + CONST EFI_BOOT_MANAGER_LOAD_OPTION *Right + ) +{ + return BootOptionPriority (Left) - BootOptionPriority (Right); +} =20 /** Do the platform specific action after the console is connected. @@ -432,9 +460,10 @@ PlatformBootManagerAfterConsole ( default: PlatformBdsDiagnostics (IGNORE, TRUE); PlatformBootManagerChangeDevicePath(&FirstBoot); - PlatformBdsRegisterStaticBootOptions (); PlatformBdsConnectSequence (); EfiBootManagerRefreshAllBootOption (); + PlatformBdsRegisterStaticBootOptions (); + if(FirstBoot)EfiBootManagerSortLoadOptionVariable (LoadOptionTypeBoot,= (SORT_COMPARE) CompareBootOption); break; } } --=20 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#39735): https://edk2.groups.io/g/devel/message/39735 Mute This Topic: https://groups.io/mt/31380242/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Sun May 12 07:52:48 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+39736+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+39736+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1556515541; cv=none; d=zoho.com; s=zohoarc; b=oJd08MDyhw4Bl9N8HvqRJ1T62m337y4UGJ/DJ92bCtlJblfpQ9ETGCoJ0ncCbcI0K0omC9/meOfcA4OPFVXJmOq7O+3XiWX/wUWAZE6EvogxbgVBKzKX+tx7GY3IhVc84apyYrVmv8pzCjllcr7pOcKqAxqWbxj9a9mk41+1Vfg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556515541; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=aIQ5m917D8Z27JTWvzuqKjTfyASA+9A8jWti0H+gtEQ=; b=bE6AIq4TaO/BLPCmI/PIogYe2sPe1b0uk+4qahgxOJeUMO/GRkEmKmACUyqjZIGl1+fMYBwaKdMXIb1DIO/wf8au61N9uM488cV/gMtaS3GeFXC9DTU5TrC6lYYr3By8j3gK4R4GNj2Z2sZawSbryqx83q/ZUZday/L/wvAAhmw= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+39736+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1556515541869936.2903897545175; Sun, 28 Apr 2019 22:25:41 -0700 (PDT) Return-Path: X-Received: from mga11.intel.com (mga11.intel.com []) by groups.io with SMTP; Sun, 28 Apr 2019 22:25:40 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Apr 2019 22:25:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,408,1549958400"; d="scan'208";a="341695427" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.157.133]) by fmsmga006.fm.intel.com with ESMTP; 28 Apr 2019 22:25:39 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Jordan Justen , Andrew Fish , Ray Ni Subject: [edk2-devel] [PATCH 2/2] EmulatorPkg: Save the modified order after rebooting Date: Mon, 29 Apr 2019 13:24:43 +0800 Message-Id: <20190429052443.2908-3-zhiguang.liu@intel.com> In-Reply-To: <20190429052443.2908-1-zhiguang.liu@intel.com> References: <20190429052443.2908-1-zhiguang.liu@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,zhiguang.liu@intel.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1556515541; bh=gCdjQPsJoFkLMLOom82/k1vHq10nHYVVsNTrZXdfgJY=; h=Cc:Date:From:Reply-To:Subject:To; b=Oo+pb6kZwiCU3r/YexDnJ+5XNFlSEcd+jRozp9w5Rp6WUPnO98Om6nTGx2lrrtiriIq oRa61CO9sYdze1+M7i+2XmXuKJFSVUx+JF5+DMA71B9MbGBqsUKcdAuoqFPeO4i02adAW 3ZMgEVflc0rnjk5AluXwgguT0HOfl8arhkw= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D1650 The reason why boot order changed is that everytime Emulator restarts, the memory mapped address will change. This patch correct the device path to the right one. Signed-off-by: Zhiguang Liu Cc: Jordan Justen Cc: Andrew Fish Cc: Ray Ni --- EmulatorPkg/Library/PlatformBmLib/PlatformBm.c | 62 ++++++++++++++++++++++= ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 60 insertions(+), 2 deletions(-) diff --git a/EmulatorPkg/Library/PlatformBmLib/PlatformBm.c b/EmulatorPkg/L= ibrary/PlatformBmLib/PlatformBm.c index 191ce58cfb..28329e4f52 100644 --- a/EmulatorPkg/Library/PlatformBmLib/PlatformBm.c +++ b/EmulatorPkg/Library/PlatformBmLib/PlatformBm.c @@ -332,6 +332,63 @@ PlatformBdsRegisterStaticBootOptions ( PrintXY (10, 50, &White, &Black, L"Enter to boot directly."); } =20 +/** + Change the device path of the boot options to the correct one. + and return whether it is the first time to start up emulator since last = build. + @param FirstBoot Return 1 if it is the first time to start up emulat= or since last build. +**/ +VOID +EFIAPI +PlatformBootManagerChangeDevicePath ( + OUT UINTN *FirstBoot + ) +{ + UINTN BootOptionCount; + EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions; + UINTN Index,LastIndex; + UINTN Flag=3D0; + *FirstBoot=3D1; + BootOptions =3D EfiBootManagerGetLoadOptions (&BootOptionCount, LoadOpti= onTypeBoot); + for (Index =3D 0; Index < BootOptionCount; Index++) + { + if ((!StrCmp(L"UEFI Enter Setup", BootOptions[Index].Description)) || + (!StrCmp(L"UEFI BootManagerMenuApp", BootOptions[Index].Description)= ) || + (!StrCmp(L"UEFI Shell", BootOptions[Index].Description))) + { + EFI_DEVICE_PATH_PROTOCOL *mypath; + EFI_DEVICE_PATH_PROTOCOL *mynextnode; + EFI_LOADED_IMAGE_PROTOCOL *LoadedImage; + gBS->HandleProtocol( + gImageHandle, + &gEfiLoadedImageProtocolGuid, + (VOID **)&LoadedImage); + mynextnode =3D NextDevicePathNode(BootOptions[Index].FilePath); + mypath =3D DevicePathFromHandle(LoadedImage->DeviceHandle); + while (!IsDevicePathEndType(mynextnode)) + { + mypath =3D AppendDevicePathNode( + mypath, + mynextnode); + mynextnode =3D NextDevicePathNode(mynextnode); + } + BootOptions[Index].FilePath =3D DuplicateDevicePath(mypath); + FreePool(mypath); + EfiBootManagerLoadOptionToVariable(&BootOptions[Index]); + if(!StrCmp(L"UEFI Enter Setup", BootOptions[Index].Description)){ + if (Flag!=3D0){ + EfiBootManagerDeleteLoadOptionVariable(BootOptions[LastIndex].Op= tionNumber, LoadOptionTypeBoot); + } + Flag++; + LastIndex=3DIndex; + } + if(!StrCmp(L"UEFI Shell", BootOptions[Index].Description)){ + *FirstBoot=3D0; + } + + } + } +} + /** Do the platform specific action after the console is connected. =20 @@ -348,7 +405,7 @@ PlatformBootManagerAfterConsole ( VOID ) { - + UINTN FirstBoot=3D1; // // Go the different platform policy with different boot mode // Notes: this part code can be change with the table policy @@ -374,9 +431,10 @@ PlatformBootManagerAfterConsole ( case BOOT_WITH_DEFAULT_SETTINGS: default: PlatformBdsDiagnostics (IGNORE, TRUE); - PlatformBdsRegisterStaticBootOptions (); + PlatformBootManagerChangeDevicePath(&FirstBoot); PlatformBdsConnectSequence (); EfiBootManagerRefreshAllBootOption (); + PlatformBdsRegisterStaticBootOptions (); break; } } --=20 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#39736): https://edk2.groups.io/g/devel/message/39736 Mute This Topic: https://groups.io/mt/31380243/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-