On 01/12/15 21:53, Jordan Justen wrote:
> On 2015-01-07 03:42:47, Laszlo Ersek wrote:
>> The command line option
>>
>>   -boot menu=on,splash-time=N
>>
>> of QEMU causes SeaBIOS to wait N milliseconds for the user to enter the
>> boot menu. During the wait, the user can opt to enter the boot menu, or
>> interrupt the wait and proceed to booting at once. If the wait interval
>> elapses, SeaBIOS boots as it normally would.
>>
>> We can approximate this behavior quite well for edk2's virtual platforms
>> because the Intel BDS front page already supports a progress bar, with
>> semantics similar to the above. Let's distill the fw_cfg bits underlying
>> "-boot menu=on,splash-time=N" for the BDS policies, in the form of a
>> timeout value they can pass to Intel's PlatformBdsEnterFrontPage().
>>
>> If the boot menu is not requested, we return
>> "gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPlatformBootTimeOut", which
>> is what the virtual platforms use right now.
>>
>> RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1170507
>>
>> Contributed-under: TianoCore Contribution Agreement 1.0
>> Signed-off-by: Laszlo Ersek <[email protected]>
>> ---
>>  OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.inf |  3 +++
>>  OvmfPkg/Include/Library/QemuBootOrderLib.h            | 12 ++++++++++++
>>  OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c   | 53 
>> +++++++++++++++++++++++++++++++++++++++++++++++++++++
>>  3 files changed, 68 insertions(+)
>>
>> diff --git a/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.inf 
>> b/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.inf
>> index 6289e6a..e7be0f3 100644
>> --- a/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.inf
>> +++ b/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.inf
>> @@ -57,3 +57,6 @@
>>  [FeaturePcd]
>>    gUefiOvmfPkgTokenSpaceGuid.PcdQemuBootOrderPciTranslation
>>    gUefiOvmfPkgTokenSpaceGuid.PcdQemuBootOrderMmioTranslation
>> +
>> +[Pcd]
>> +  gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPlatformBootTimeOut
>> diff --git a/OvmfPkg/Include/Library/QemuBootOrderLib.h 
>> b/OvmfPkg/Include/Library/QemuBootOrderLib.h
>> index 12cda6a..80d02c8 100644
>> --- a/OvmfPkg/Include/Library/QemuBootOrderLib.h
>> +++ b/OvmfPkg/Include/Library/QemuBootOrderLib.h
>> @@ -54,4 +54,16 @@ SetBootOrderFromQemu (
>>    IN  CONST LIST_ENTRY *BootOptionList
>>    );
>>  
>> +
>> +/**
>> +  Calculate the number of seconds we should be showing the FrontPage 
>> progress
>> +  bar for.
>> +
>> +  @return  The TimeoutDefault argument for PlatformBdsEnterFrontPage().
>> +**/
>> +UINT16
>> +GetFrontPageTimeoutFromQemu (
>> +  VOID
>> +  );
>> +
>>  #endif
>> diff --git a/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c 
>> b/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c
>> index bc2fb56..4155240 100644
>> --- a/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c
>> +++ b/OvmfPkg/Library/QemuBootOrderLib/QemuBootOrderLib.c
>> @@ -1571,3 +1571,56 @@ ErrorFreeFwCfg:
>>  
>>    return Status;
>>  }
>> +
>> +
>> +/**
>> +  Calculate the number of seconds we should be showing the FrontPage 
>> progress
>> +  bar for.
>> +
>> +  @return  The TimeoutDefault argument for PlatformBdsEnterFrontPage().
>> +**/
>> +UINT16
>> +GetFrontPageTimeoutFromQemu (
>> +  VOID
>> +  )
>> +{
>> +  UINT16 Timeout;
>> +
>> +  //
>> +  // Set default.
>> +  //
>> +  Timeout = PcdGet16 (PcdPlatformBootTimeOut);
>> +
>> +  //
>> +  // See if the user requested a boot menu.
>> +  //
>> +  QemuFwCfgSelectItem (QemuFwCfgItemBootMenu);
>> +  if (QemuFwCfgRead16 () != 0) {
>> +    FIRMWARE_CONFIG_ITEM BootMenuWaitItem;
>> +    UINTN                BootMenuWaitSize;
>> +    UINT16               TimeoutMs;
>> +
>> +    if (!RETURN_ERROR (QemuFwCfgFindFile ("etc/boot-menu-wait",
>> +                         &BootMenuWaitItem, &BootMenuWaitSize)) &&
>> +        BootMenuWaitSize == sizeof TimeoutMs) {
>> +      //
>> +      // The user specified the timeout for entering the boot menu.
>> +      //
>> +      QemuFwCfgSelectItem (BootMenuWaitItem);
>> +      QemuFwCfgReadBytes (sizeof TimeoutMs, &TimeoutMs);
>> +    } else {
>> +      //
>> +      // SeaBIOS default if the user didn't state a timeout.
>> +      //
>> +      TimeoutMs = 2500;
> 
> I think we should return PcdPlatformBootTimeOut in this case.

Just so I understand you correctly:
* '-boot menu=off' or (equivalently) no '-boot menu=ZZZ' option at all:
  return PcdPlatformBootTimeOut (which is currently 0 for OVMF, after
  earlier discussions)
* '-boot menu=on,splash-time=N': wait for N msecs, rounder up to seconds
* '-boot menu=on', *without* 'splash-time=N': patch currently uses
  SeaBIOS default (2500 msecs rounded up to 3 seconds), but you're
  saying we should return PcdPlatformBootTimeOut instead.

Re #3, since that PCD is 0 in OVMF (based on earlier agreement), this
suggestion boils down to '-boot menu=off' and '-boot menu=on' being
indistinguishable. Slightly rephrased, '-boot menu=on' without
'splash-time=N' would have no visible effect.

Is that your intent? (I can certainly comply with it in the patchset,
but then I'd have to patch it back with a small downstream-only
one-liner, because "-boot menu=on" not doing anything in itself would
certainly not match our QE's expectations -- this small request for
enhancement was filed by them.)

Thank you!
Laszlo


> 
> With that change, 1 & 2
> Reviewed-by: Jordan Justen <[email protected]>
> 
>> +    }
>> +
>> +    //
>> +    // The Intel BDS Front Page progress bar only supports whole seconds. 
>> Round
>> +    // up the timeout from milliseconds.
>> +    //
>> +    Timeout = (UINT16)((TimeoutMs + 999) / 1000);
>> +  }
>> +
>> +  return Timeout;
>> +}
>> -- 
>> 1.8.3.1
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Dive into the World of Parallel Programming! The Go Parallel Website,
>> sponsored by Intel and developed in partnership with Slashdot Media, is your
>> hub for all things parallel software development, from weekly thought
>> leadership blogs to news, videos, case studies, tutorials and more. Take a
>> look and join the conversation now. http://goparallel.sourceforge.net
>> _______________________________________________
>> edk2-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/edk2-devel


------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
www.gigenet.com
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to