From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) by mx.groups.io with SMTP id smtpd.web11.11979.1583142465617268310 for ; Mon, 02 Mar 2020 01:47:46 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=HVXDvp6B; spf=pass (domain: linaro.org, ip: 209.85.221.51, mailfrom: ard.biesheuvel@linaro.org) Received: by mail-wr1-f51.google.com with SMTP id z11so2906696wro.9 for ; Mon, 02 Mar 2020 01:47:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=MYHUXE8S3OJn0z8AD1puK03o7KJLtz9XLkzvV6xhhUU=; b=HVXDvp6BPDOWVt+RVpMW3dDFl/ne+/tLp3T68Vs1qB1aOhCk9PjSFNm9FOlaA5ynzG Ih4Rk+lXar/k1x2aV9m47E3o5T4ayPvIGOrm7Pt7kxUAFYHZjvWQ2BAgNaC0SHSMOmR+ j59IKxF5YSlOR0UcpIuH9dRO90UqLVlTjDkanV2uwiURuQpXyD1ZbTcc0xm2i+uQBqDe cDCKRx164s3MwQKRxxX+jdwX4EsjYAa5f+hDUSnPTGeV0uzccChshOi5CYYeVl2wOc/s SW4Y84Ma3FCGIuKATcnvuAGHWTT7Qxqae9fYOULVMVyz7GgEvCkOXoduEb2hXi5W7Fro aH/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=MYHUXE8S3OJn0z8AD1puK03o7KJLtz9XLkzvV6xhhUU=; b=j8XE4A2WlyFHJQ0f6fPYbEKIvWUKgH/lVw3QNU1XFPIU+3VZ330K1lRsheRpgj/WL4 lSsEfuZeR4lcaiWdmEr3QKf+qHjP5FcVOE/S7e5rtjIe7112YInYI/4pSvYQteiOVaMW px11dUKevX56dQQdKsQljzRXU02Korji4nKfyvkTqRU0xQT21r693Yj/aKwc3+G1gu/3 ff8ImVq3GSViKMNW4FkaJt8kUojIjDvWXzOgxvl01+lriTh5P05jyILKP/lXLauWF27d 2qSZQfyY57+yHVIHNJRyYf9YMUhvzRHjJ98iS3IMDBDNU3q1cJz/9KKTvsMbK7WMylg0 nEMA== X-Gm-Message-State: ANhLgQ3F24SmvW0R2Vmc2Ff1h7cjjPUllVETe1oTtYzyjWBdAk6fEuUY IOkUu2d9+r5BxyEc7E7bHHeKUFOyxuivagyhCqty2ec8jmE= X-Google-Smtp-Source: ADFU+vs0Pv+ntNF7qDEmDkauNRToMcU+28z/+PZZdfYyqmSjYm01YdpxdFWUaXoEBMTaNykHIwp3DSGndBsCb2x3D6Q= X-Received: by 2002:a5d:6051:: with SMTP id j17mr1506428wrt.151.1583142463698; Mon, 02 Mar 2020 01:47:43 -0800 (PST) MIME-Version: 1.0 References: <87400517-c541-f7e2-7187-798dbad001ca@redhat.com> In-Reply-To: From: "Ard Biesheuvel" Date: Mon, 2 Mar 2020 10:47:32 +0100 Message-ID: Subject: Re: [edk2-devel] setting PcdPlatformBootTimeOut in PlatformBootManagerLib To: edk2-devel-groups-io , Laszlo Ersek Cc: Ray Ni Content-Type: text/plain; charset="UTF-8" On Mon, 2 Mar 2020 at 10:46, Laszlo Ersek wrote: > > 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(). > Ah, ok - the *EFI* variable. I missed that detail :-)