From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.120]) by mx.groups.io with SMTP id smtpd.web10.12101.1583142362995475455 for ; Mon, 02 Mar 2020 01:46:03 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PQj+EJB2; spf=pass (domain: redhat.com, ip: 207.211.31.120, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583142362; 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=yGZOVrMqjSkcByPF9cg4W0Um1dhdSszc41Wt9dEoSEM=; b=PQj+EJB2lPQ6rdrhX9XlViIn/rIN7vvGfmAuB6Uup4f+CnyTaPh/9FC0fj/nr+gwYIA4H+ EeZ5K6HHcKLRMUVS3u+yAWo9iG0LFvbIr/vFdd9NJ7lNjJ8aLz//f0Ua+aiqA3QVBi3PvD LT9gviVvK6q7i8jTSorywXQyITfK0aQ= 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-13-E3jgbMZyOn-Y7OJj0qyiyA-1; Mon, 02 Mar 2020 04:46:00 -0500 X-MC-Unique: E3jgbMZyOn-Y7OJj0qyiyA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 610E3DB60; Mon, 2 Mar 2020 09:45:59 +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 819D760BF3; Mon, 2 Mar 2020 09:45:57 +0000 (UTC) Subject: Re: setting PcdPlatformBootTimeOut in PlatformBootManagerLib To: Ard Biesheuvel Cc: Ray Ni , edk2-devel-groups-io References: <87400517-c541-f7e2-7187-798dbad001ca@redhat.com> From: "Laszlo Ersek" Message-ID: Date: Mon, 2 Mar 2020 10:45:57 +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.12 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 10:43, Ard Biesheuvel wrote: > On Mon, 2 Mar 2020 at 10:40, Laszlo Ersek wrote: >> >> 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. >> > > 'Rewrite' as in access the global variable? Or access the HII guts of > the 'timeout' entry in the menus? Just call gRT->SetVariable(). Thanks Laszlo