From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.120]) by mx.groups.io with SMTP id smtpd.web12.11795.1583142042361577172 for ; Mon, 02 Mar 2020 01:40:42 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dAdVCOWO; spf=pass (domain: redhat.com, ip: 205.139.110.120, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583142041; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kfnRTsDZHPTWlkX8+L2IaheyGZKrhl7v4vN00uEjVHk=; b=dAdVCOWObCGYddTPameECutQFCkIqcTrzKAql0sus6JV+TjsLTvzbgS38/xv6nJn9CDwdM jh8aAYXqGMjRvok3zCCP1C6f+TuFYF/9aTM+Ev5eoy9DvlbaV6NfJ4ybc5vcy2a3qPustd UMcH2ZYnld7abhQ1ryBIIUI1vKtcsmE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-284-s__SeJQDPcStugg0AY-A3w-1; Mon, 02 Mar 2020 04:40:39 -0500 X-MC-Unique: s__SeJQDPcStugg0AY-A3w-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B1D6C100550E; Mon, 2 Mar 2020 09:40:38 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-117-221.ams2.redhat.com [10.36.117.221]) by smtp.corp.redhat.com (Postfix) with ESMTP id D806F5E240; Mon, 2 Mar 2020 09:40:37 +0000 (UTC) Subject: Re: setting PcdPlatformBootTimeOut in PlatformBootManagerLib From: "Laszlo Ersek" To: Ray Ni Cc: Ard Biesheuvel , edk2-devel-groups-io References: Message-ID: <87400517-c541-f7e2-7187-798dbad001ca@redhat.com> Date: Mon, 2 Mar 2020 10:40:36 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On 03/02/20 00:13, Laszlo Ersek wrote: > Hi Ray, > > OvmfPkg and ArmVirtPkg platforms set PcdPlatformBootTimeOut in their > PlatformBootManagerLib instances, in BeforeConsole(). This generally > works, except for one aspect: in BdsEntry(), the Timeout UEFI variable > is set from the PCD before BeforeConsole() is called. > > The Timeout variable is in this case purely informative, but I'd still > like it to reflect the PCD's value. Given that I'd like to keep the > subject PcdSet16S() call in PlatformBootManagerLib, I see two options: > > (1) Modify BdsEntry(): re-check the value of the PCD a bit before > BdsWait() -- when the PCD is really needed --, and if it has changed > relative to the first seen value, store the new PCD value to the UEFI > variable *again*. > > This would keep platforms happy that expect Timeout to already carry the > PCDs value upon entering BeforeConsole(), and it would allow platforms > to re-set the PCD (and Timeout too) in either BeforeConsole() or > AfterConsole(). > > (2) Alternatively, add a CONSTRUCTOR function to the > PlatformBootManagerLib instances for setting the PCD before BdsEntry() > is invoked at all. I'm a bit concerned about this, as we'd have to > ensure that *all* the lib instances that participate in this PCD setting > (including the lib instances that let us calculate the value) have > CONSTRUCTOR functions (otherwise the topological sorting of CONSTRUCTOR > calls is not complete). (3) We could also just rewrite Timeout ourselves, in PlatformBootManagerLib, where we set the PCD. Thanks Laszlo