[edk2-devel] [PATCH v3 2/8] Ovmf/HardwareInfoLib: Create Pei lib to parse directly from fw-cfg

Gerd Hoffmann kraxel at redhat.com
Fri Jan 28 10:36:21 UTC 2022


On Tue, Jan 25, 2022 at 03:30:09PM +0100, Nicolas Ojeda Leon wrote:
> Define the HardwareInfoLib API and create the PeiHardwareInfoLib
> which implements it, specifically for Pei usage, supporting
> only static accesses to parse data directly from a fw-cfg file.
> All list-like APIs are implemented as unsupported and only a
> fw-cfg wrapper to read hardware info elements is provided.
> 
> The Hardware Info library is intended to describe non-discoverable
> hardware information and share that from the host to the guest in Ovmf
> platforms. The QEMU fw-cfg extension for this library provides a first
> variation to parse hardware info by reading it directly from a fw-cfg
> file. This library offers a wrapper function to the plain
> QmeuFwCfgReadBytes which, specifically, parses header-data pairs out
> of the binary values in the file. For this purpose, the approach is
> incremental, reading the file block by block and outputting the values
> only for a specific known hardware type (e.g. PCI host bridges). One
> element is returned in each call until the end of the file is reached.
> 
> Considering fw-cfg as the first means to transport hardware info from
> the host to the guest, this wrapping library offers the possibility
> to statically, and in steps, read a specific type of hardware info
> elements out of the file. This method reads one hardware element of a
> specific type at a time, without the need to pre-allocate memory and
> read the whole file or dynamically allocate memory for each new
> element found.
> 
> As a usage example, the static approach followed by this library
> enables early UEFI stages to use and read hardware information
> supplied by the host. For instance, in early times of the PEI stage,
> hardware information can be parsed out from a fw-cfg file prescinding
> from memory services, that may not yet be available, and avoiding
> dynamic memory allocations.
> 
> Cc: Alexander Graf <graf at amazon.de>
> Cc: Gerd Hoffmann <kraxel at redhat.com>
> 
> Signed-off-by: Nicolas Ojeda Leon <ncoleon at amazon.com>

Acked-by: Gerd Hoffmann <kraxel at redhat.com>



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#86152): https://edk2.groups.io/g/devel/message/86152
Mute This Topic: https://groups.io/mt/88672478/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list