From: Laszlo Ersek <lersek@redhat.com>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: "edk2-devel@lists.01.org" <edk2-devel@lists.01.org>,
Anthony Perard <anthony.perard@citrix.com>,
Jordan Justen <jordan.l.justen@intel.com>,
Julien Grall <julien.grall@linaro.org>, Ray Ni <ray.ni@intel.com>
Subject: Re: [PATCH v2 2/5] OvmfPkg: add library to track boot option loading/starting on the console
Date: Wed, 20 Feb 2019 13:01:13 +0100 [thread overview]
Message-ID: <4cfefdaa-885a-1810-b3b8-1eecab74d849@redhat.com> (raw)
In-Reply-To: <CAKv+Gu-Snp-RwC0Y-LfpDMhdLcT+qAPFdfHjMYgng_0=_vb_VA@mail.gmail.com>
On 02/20/19 10:21, Ard Biesheuvel wrote:
> On Wed, 20 Feb 2019 at 09:16, Laszlo Ersek <lersek@redhat.com> wrote:
>>
>> Introduce the Platform Boot Manager Print Status Code Library (for short,
>> PlatformBmPrintScLib) class for catching and printing the LoadImage() /
>> StartImage() preparations, and return statuses, that are reported by
>> UefiBootManagerLib.
>>
>> In the primary library instance, catch only such status codes that
>> UefiBootManagerLib reports from the same module that contains
>> PlatformBmPrintScLib. The intent is to establish a reporting-printing
>> channel within BdsDxe, between UefiBootManagerLib and
>> PlatformBmPrintScLib. Ignore status codes originating elsewhence, e.g.
>> from UiApp's copy of UefiBootManagerLib.
>>
>> Cc: Anthony Perard <anthony.perard@citrix.com>
>> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>> Cc: Jordan Justen <jordan.l.justen@intel.com>
>> Cc: Julien Grall <julien.grall@linaro.org>
>> Cc: Ray Ni <ray.ni@intel.com>
>> Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1515418
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
>> ---
>>
>> Notes:
>> v2:
>>
>> - Split the status code handling to a separate library, so that it's
>> easy to reuse in ArmVirtPkg.
>>
>> - Rework the logic based on
>> <https://bugzilla.tianocore.org/show_bug.cgi?id=1398> and
>> <https://mantis.uefi.org/mantis/view.php?id=1885>, and follow Ray's
>> advice in
>> <http://mid.mail-archive.com/734D49CCEBEEF84792F5B80ED585239D5BACE29B@SHSMSX104.ccr.corp.intel.com>:
>>
>> - The boot option details are fetched via BootCurrent.
>>
>> - For reporting LoadImage() and StartImage() preparations, replace the
>> originally proposed PcdDebugCodeOsLoaderDetail status code with the
>> existent (edk2-specific) PcdProgressCodeOsLoaderLoad and
>> PcdProgressCodeOsLoaderStart status codes.
>>
>> - For reporting LoadImage() and StartImage() return values, replace
>> the originally proposed PcdDebugCodeOsLoaderDetail status code with
>> the standard EFI_SW_DXE_BS_EC_BOOT_OPTION_LOAD_ERROR and
>> EFI_SW_DXE_BS_EC_BOOT_OPTION_FAILED status codes.
>>
>> - For all four kinds of reports, replace the originally proposed "OS
>> Loader Detail" structure (and GUID) with the recently standardized
>> EFI_RETURN_STATUS_EXTENDED_DATA structure.
>>
>> OvmfPkg/OvmfPkg.dec | 5 +
>> OvmfPkg/OvmfPkgIa32.dsc | 1 +
>> OvmfPkg/OvmfPkgIa32X64.dsc | 1 +
>> OvmfPkg/OvmfPkgX64.dsc | 1 +
>> OvmfPkg/Include/Library/PlatformBmPrintScLib.h | 41 +++
>> OvmfPkg/Library/PlatformBmPrintScLib/PlatformBmPrintScLib.inf | 66 +++++
>> OvmfPkg/Library/PlatformBmPrintScLib/StatusCodeHandler.c | 310 ++++++++++++++++++++
>> 7 files changed, 425 insertions(+)
>>
[...]
>> + //
>> + // Set the EFI_STATUS_CODE_VALUE convenience variables.
>> + //
>> + mLoadPrep = PcdGet32 (PcdProgressCodeOsLoaderLoad);
>> + mLoadFail = (EFI_SOFTWARE_DXE_BS_DRIVER |
>> + EFI_SW_DXE_BS_EC_BOOT_OPTION_LOAD_ERROR);
>> + mStartPrep = PcdGet32 (PcdProgressCodeOsLoaderStart);
>> + mStartFail = (EFI_SOFTWARE_DXE_BS_DRIVER |
>> + EFI_SW_DXE_BS_EC_BOOT_OPTION_FAILED);
>> +
>
> This bit looks somewhat dodgy to me, but I suppose the asymmetry is
> 'prior art' from EDK2, no?
Yes, that's the case. All four status code values are taken verbatim
from EfiBootManagerBoot()
[MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c], where they are
reported / produced.
I use module-global variables here because (a) I need no generality wrt.
status codes values in this module (I really only care for these four),
and (b) the original expressions are simply unbearably long; considering
the frequent use of these status code values in the patch.
Regarding the reporting in EfiBootManagerBoot(): the status code values
- (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_EC_BOOT_OPTION_LOAD_ERROR)
- (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_EC_BOOT_OPTION_FAILED)
are from the PI spec. If we expand the macros a bit, we get,
respectively:
- EFI_SOFTWARE | 0x00050000 | EFI_SUBCLASS_SPECIFIC | 0x00000002
- EFI_SOFTWARE | 0x00050000 | EFI_SUBCLASS_SPECIFIC | 0x00000003
So we are in the "software class", the "DXE Boot Service Driver"
subclass, and we report values 2 and 3, which are meant to be unique
only within that subclass.
Conversely, the "prep" status code values are edk2 extensions. The PCDs
allow a platform, in theory anyway, to tweak the exact values. But in
practice, that should never be necessary. Let's check their default
values, in "MdeModulePkg/MdeModulePkg.dec":
> ## Progress Code for OS Loader LoadImage start.<BR><BR>
> # PROGRESS_CODE_OS_LOADER_LOAD = (EFI_SOFTWARE_DXE_BS_DRIVER | (EFI_OEM_SPECIFIC | 0x00000000)) = 0x03058000<BR>
> # @Prompt Progress Code for OS Loader LoadImage start.
> # @ValidList 0x80000003 | 0x03058000
> gEfiMdeModulePkgTokenSpaceGuid.PcdProgressCodeOsLoaderLoad|0x03058000|UINT32|0x30001030
>
> ## Progress Code for OS Loader StartImage start.<BR><BR>
> # PROGRESS_CODE_OS_LOADER_START = (EFI_SOFTWARE_DXE_BS_DRIVER | (EFI_OEM_SPECIFIC | 0x00000001)) = 0x03058001<BR>
> # @Prompt Progress Code for OS Loader StartImage start.
> # @ValidList 0x80000003 | 0x03058001
> gEfiMdeModulePkgTokenSpaceGuid.PcdProgressCodeOsLoaderStart|0x03058001|UINT32|0x30001031
Meaning
- EFI_SOFTWARE | 0x00050000 | EFI_OEM_SPECIFIC | 0x00000000
- EFI_SOFTWARE | 0x00050000 | EFI_OEM_SPECIFIC | 0x00000001
We stay within the same class & subclass, but use OEM-specific values 0
and 1, rather than standard values 2 and 3 that are specific to the
subclass.
I'd prefer if these weren't even PCDs, and the
PROGRESS_CODE_OS_LOADER_LOAD and PROGRESS_CODE_OS_LOADER_START macros
actually existed in some header file. That would be similarly clear
about the values being edk2 extensions, but without muddying the picture
with (academic?) platform overrides.
> In any case, this looks good to me otherwise, so for the series
>
> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Thank you!
Laszlo
next prev parent reply other threads:[~2019-02-20 12:01 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-20 8:16 [PATCH v2 0/5] MdeModulePkg, OvmfPkg, ArmVirtPkg: more visible boot progress reporting Laszlo Ersek
2019-02-20 8:16 ` [PATCH v2 1/5] MdeModulePkg/UefiBootManagerLib: fix LoadImage/StartImage status code rep Laszlo Ersek
2019-02-20 13:17 ` Ni, Ray
2019-02-21 8:36 ` Laszlo Ersek
2019-02-20 8:16 ` [PATCH v2 2/5] OvmfPkg: add library to track boot option loading/starting on the console Laszlo Ersek
2019-02-20 9:21 ` Ard Biesheuvel
2019-02-20 12:01 ` Laszlo Ersek [this message]
2019-02-20 10:04 ` Laszlo Ersek
2019-02-20 10:06 ` Ard Biesheuvel
2019-02-20 8:16 ` [PATCH v2 3/5] OvmfPkg/PlatformBootManagerLib: display boot option loading/starting Laszlo Ersek
2019-02-20 8:16 ` [PATCH v2 4/5] ArmVirtPkg/ArmVirtQemu*: enable minimal Status Code Routing in DXE Laszlo Ersek
2019-02-20 8:16 ` [PATCH v2 5/5] ArmVirtPkg/PlatformBootManagerLib: display boot option loading/starting Laszlo Ersek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4cfefdaa-885a-1810-b3b8-1eecab74d849@redhat.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox