On 04/16/20 01:09, Rebecca Cran wrote:
> Add a null PEI implementation of QemuFwCfgLib for bhyve.
> 
> Signed-off-by: Rebecca Cran <rebe...@bsdio.com>
> ---
>  .../QemuFwCfgLibNull/QemuFwCfgPeiLibNull.inf  |  36 ++++++
>  .../QemuFwCfgLibNull/QemuFwCfgPeiNull.c       | 107 ++++++++++++++++++
>  2 files changed, 143 insertions(+)
>  create mode 100644 OvmfPkg/Library/QemuFwCfgLibNull/QemuFwCfgPeiLibNull.inf
>  create mode 100644 OvmfPkg/Library/QemuFwCfgLibNull/QemuFwCfgPeiNull.c

The Null instance is usually not specific to any firmware phase, such as
the PEI phase. The Null instance does nothing, and doing nothing is
possible in any phase.

Please introduce the following files:

- QemuFwCfgLibNull.inf
- QemuFwCfgNull.c

In the INF file, set LIBRARY_CLASS to bare "QemuFwCfgLib"; there is no
need for a module type restriction (such as "|PEIM").

In the C file, implement the APIs listed in the lib class header,
"OvmfPkg/Include/Library/QemuFwCfgLib.h":

- QemuFwCfgIsAvailable -> return constant FALSE directly

- QemuFwCfgSelectItem  -> ASSERT (FALSE)
- QemuFwCfgReadBytes   -> ditto
- QemuFwCfgWriteBytes  -> ditto
- QemuFwCfgSkipBytes   -> ditto

- QemuFwCfgRead8       -> ASSERT (FALSE); return 0
- QemuFwCfgRead16      -> ditto
- QemuFwCfgRead32      -> ditto
- QemuFwCfgRead64      -> ditto

- QemuFwCfgFindFile    -> return RETURN_UNSUPPORTED

Implement no other functions. (Helper functions are not needed.)

(If any of the ASSERTs is tripped in your testing, then we have a bug in
an fw-cfg consumer module, and we should fix that. Basically, an fw-cfg
consumer module is allowed to call QemuFwCfgIsAvailable or
QemuFwCfgFindFile first, and the rest of the functions only if one of
the former succeeds).

Thanks
Laszlo


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#57534): https://edk2.groups.io/g/devel/message/57534
Mute This Topic: https://groups.io/mt/73045135/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to