From: Laszlo Ersek <ler...@redhat.com> Such a packaged query function will come in handy in the following patches.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <ler...@redhat.com> Reviewed-by: Jordan Justen <jordan.l.jus...@intel.com> [jordan.l.jus...@intel.com: check for enabled rather than disabled] Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com> --- OvmfPkg/Include/Library/QemuFwCfgLib.h | 14 ++++++++++++++ OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/OvmfPkg/Include/Library/QemuFwCfgLib.h b/OvmfPkg/Include/Library/QemuFwCfgLib.h index 2519fc2..8d3b835 100644 --- a/OvmfPkg/Include/Library/QemuFwCfgLib.h +++ b/OvmfPkg/Include/Library/QemuFwCfgLib.h @@ -214,5 +214,19 @@ InternalQemuFwCfgIsAvailable ( VOID ); + +/** + Determine if S3 support is explicitly enabled. + + @retval TRUE if S3 support is explicitly enabled. + FALSE otherwise. This includes unavailability of the firmware + configuration interface. +**/ +BOOLEAN +EFIAPI +QemuFwCfgS3Enabled ( + VOID + ); + #endif diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c index 3c5963f..543c22c 100644 --- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c @@ -294,3 +294,31 @@ QemuFwCfgFindFile ( return RETURN_NOT_FOUND; } + + +/** + Determine if S3 support is explicitly enabled. + + @retval TRUE if S3 support is explicitly enabled. + FALSE otherwise. This includes unavailability of the firmware + configuration interface. +**/ +BOOLEAN +EFIAPI +QemuFwCfgS3Enabled ( + VOID + ) +{ + RETURN_STATUS Status; + FIRMWARE_CONFIG_ITEM FwCfgItem; + UINTN FwCfgSize; + UINT8 SystemStates[6]; + + Status = QemuFwCfgFindFile ("etc/system-states", &FwCfgItem, &FwCfgSize); + if (Status != RETURN_SUCCESS || FwCfgSize != sizeof SystemStates) { + return FALSE; + } + QemuFwCfgSelectItem (FwCfgItem); + QemuFwCfgReadBytes (sizeof SystemStates, SystemStates); + return (SystemStates[3] & BIT7) != 0 ? TRUE : FALSE; +} -- 1.9.rc1 ------------------------------------------------------------------------------ Managing the Performance of Cloud-Based Applications Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. Read the Whitepaper. http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk _______________________________________________ edk2-devel mailing list edk2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel