From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=66.187.233.73; helo=mx1.redhat.com; envelope-from=lersek@redhat.com; receiver=edk2-devel@lists.01.org Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id C3D67202E53DC for ; Thu, 28 Jun 2018 08:04:08 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 34D33A1BCC; Thu, 28 Jun 2018 15:04:07 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-10.rdu2.redhat.com [10.10.120.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 226811C727; Thu, 28 Jun 2018 15:04:05 +0000 (UTC) To: "Wang, Sunny (HPS SW)" , Ruiyu Ni , "edk2-devel@lists.01.org" Cc: Michael Turner References: <20180628074020.53444-1-ruiyu.ni@intel.com> From: Laszlo Ersek Message-ID: <01641a9a-d151-283f-28e0-5db34527b558@redhat.com> Date: Thu, 28 Jun 2018 17:04:05 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Thu, 28 Jun 2018 15:04:07 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Thu, 28 Jun 2018 15:04:07 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'lersek@redhat.com' RCPT:'' Subject: Re: [PATCH] MdeModulePkg/UefiBootManagerLib: handle ultimate boot failure X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jun 2018 15:04:09 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 06/28/18 11:02, Wang, Sunny (HPS SW) wrote: > Hi Ray, > > Does the ultimate boot failure include the case where the system > doesn't have "BootManagerMenu" application? If so, I think we should > move EfiBootManagerUnableBoot() call out of BdsBootManagerMenuLoop(). > The BdsBootManagerMenuLoop() is only called when system has > BootManagerMenu application. Therefore, if the system doesn't have > BootManagerMenu application, the EfiBootManagerUnableBoot() will have > no chance to be called for handling the ultimate boot failure case. Personally I'd be very happy with the current version of the patch as well, but I agree Sunny's request makes sense. How about this, for BdsDxe: > diff --git a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c > index 3191a986304b..cb4196a56c87 100644 > --- a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c > +++ b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c > @@ -1088,11 +1088,26 @@ BdsEntry ( > EfiBootManagerFreeLoadOptions (LoadOptions, LoadOptionCount); > } > > - // > - // If BootManagerMenu is available, fall back to it indefinitely. > - // > - if (BootManagerMenuStatus != EFI_NOT_FOUND) { > - BdsBootManagerMenuLoop (&BootManagerMenu); > + if (BootManagerMenuStatus == EFI_NOT_FOUND) { > + // > + // Inform the platform that we're unable to boot, and that there's no > + // BootManagerMenu. > + // > + EfiBootManagerUnableToBoot (NULL); > + } else { > + // > + // Inform the platform that we're unable to boot. The platform may enter > + // BootManagerMenu with the public EfiBootManagerBoot() interface, if so > + // desired. > + // > + Status = EfiBootManagerUnableToBoot (&BootManagerMenu); > + if (EFI_ERROR (Status)) { > + // > + // The platform didn't register a callback; fall back to BootManagerMenu > + // internally, indefinitely. > + // > + BdsBootManagerMenuLoop (&BootManagerMenu); > + } > } > > DEBUG ((EFI_D_ERROR, "[Bds] Unable to boot!\n")); Note that this requires changing the declaration of EfiBootManagerUnableBoot(), so that it takes the parameter IN EFI_BOOT_MANAGER_LOAD_OPTION *BootManagerMenu OPTIONAL The structure EFI_BOOT_MANAGER_LOAD_OPTION is from "MdeModulePkg/Include/Library/UefiBootManagerLib.h", so it is OK to expose to platforms. Just an idea, of course. --*-- Anyway, for a v2, I have some superficial reuqests / questions for Ray: * Please replace "UNABLE_BOOT" with "UNABLE_TO_BOOT". Same for "UnableBoot" and "UnableToBoot". (Compare: READY_TO_BOOT, ReadyToBoot.) Note that this affects the commit message too. * Should we split the BdsDxe modification to a separate patch? * Can you please reference in the commit message? Thank you very much Ray for doing this! Laszlo