OvmfPkg QemuFwCfgLib: determine if S3 support is explicitly enabled

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 <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
[jordan.l.justen@intel.com: check for enabled rather than disabled]
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15292 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Laszlo Ersek 2014-03-04 08:01:49 +00:00 committed by jljusten
parent 979420df98
commit 14eb7a5be2
2 changed files with 42 additions and 0 deletions

View File

@ -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

View File

@ -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 (BOOLEAN) (SystemStates[3] & BIT7);
}