ArmVirtPkg, OvmfPkg: retire QemuFwCfgS3Enabled() from QemuFwCfgLib

At this point we're ready to retire QemuFwCfgS3Enabled() from the
QemuFwCfgLib class, together with its implementations in:

- ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
- OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c

Extend all modules that call the function with a new QemuFwCfgS3Lib class
dependency. Thanks to the previously added library class, instances, and
class resolutions, we can do this switch now as tightly as possible.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=394
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
This commit is contained in:
Laszlo Ersek 2017-02-22 03:47:18 +01:00
parent b7f2e82c03
commit 687f7521ea
14 changed files with 11 additions and 59 deletions

View File

@ -637,20 +637,3 @@ QemuFwCfgFindFile (
return RETURN_NOT_FOUND; 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 FALSE;
}

View File

@ -52,6 +52,7 @@
UefiDriverEntryPoint UefiDriverEntryPoint
HobLib HobLib
QemuFwCfgLib QemuFwCfgLib
QemuFwCfgS3Lib
MemoryAllocationLib MemoryAllocationLib
BaseLib BaseLib
DxeServicesTableLib DxeServicesTableLib

View File

@ -19,6 +19,7 @@
#include <Library/BaseMemoryLib.h> #include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h> #include <Library/MemoryAllocationLib.h>
#include <Library/QemuFwCfgLib.h> #include <Library/QemuFwCfgLib.h>
#include <Library/QemuFwCfgS3Lib.h>
#include <Library/DxeServicesTableLib.h> #include <Library/DxeServicesTableLib.h>
#include <Library/PcdLib.h> #include <Library/PcdLib.h>
#include <Library/OrderedCollectionLib.h> #include <Library/OrderedCollectionLib.h>

View File

@ -44,6 +44,7 @@
MemoryAllocationLib MemoryAllocationLib
OrderedCollectionLib OrderedCollectionLib
QemuFwCfgLib QemuFwCfgLib
QemuFwCfgS3Lib
UefiBootServicesTableLib UefiBootServicesTableLib
UefiDriverEntryPoint UefiDriverEntryPoint

View File

@ -179,19 +179,5 @@ QemuFwCfgFindFile (
OUT UINTN *Size OUT UINTN *Size
); );
/**
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 #endif

View File

@ -19,6 +19,7 @@
#include <Library/BaseMemoryLib.h> #include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h> #include <Library/DebugLib.h>
#include <Library/QemuFwCfgLib.h> #include <Library/QemuFwCfgLib.h>
#include <Library/QemuFwCfgS3Lib.h>
#include <Protocol/LockBox.h> #include <Protocol/LockBox.h>
#include <LockBoxLib.h> #include <LockBoxLib.h>

View File

@ -40,6 +40,7 @@
DebugLib DebugLib
UefiBootServicesTableLib UefiBootServicesTableLib
QemuFwCfgLib QemuFwCfgLib
QemuFwCfgS3Lib
[Protocols] [Protocols]
gEfiLockBoxProtocolGuid ## SOMETIMES_PRODUCES gEfiLockBoxProtocolGuid ## SOMETIMES_PRODUCES

View File

@ -48,6 +48,7 @@ Abstract:
#include <Library/IoLib.h> #include <Library/IoLib.h>
#include <Library/NvVarsFileLib.h> #include <Library/NvVarsFileLib.h>
#include <Library/QemuFwCfgLib.h> #include <Library/QemuFwCfgLib.h>
#include <Library/QemuFwCfgS3Lib.h>
#include <Library/QemuBootOrderLib.h> #include <Library/QemuBootOrderLib.h>
#include <Protocol/Decompress.h> #include <Protocol/Decompress.h>

View File

@ -52,6 +52,7 @@
PciLib PciLib
NvVarsFileLib NvVarsFileLib
QemuFwCfgLib QemuFwCfgLib
QemuFwCfgS3Lib
LoadLinuxLib LoadLinuxLib
QemuBootOrderLib QemuBootOrderLib
UefiLib UefiLib

View File

@ -368,31 +368,3 @@ QemuFwCfgFindFile (
return RETURN_NOT_FOUND; 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);
}

View File

@ -32,6 +32,7 @@
#include <Library/PeimEntryPoint.h> #include <Library/PeimEntryPoint.h>
#include <Library/PeiServicesLib.h> #include <Library/PeiServicesLib.h>
#include <Library/QemuFwCfgLib.h> #include <Library/QemuFwCfgLib.h>
#include <Library/QemuFwCfgS3Lib.h>
#include <Library/ResourcePublicationLib.h> #include <Library/ResourcePublicationLib.h>
#include <Guid/MemoryTypeInformation.h> #include <Guid/MemoryTypeInformation.h>
#include <Ppi/MasterBootMode.h> #include <Ppi/MasterBootMode.h>

View File

@ -58,6 +58,7 @@
PeiServicesTablePointerLib PeiServicesTablePointerLib
PeimEntryPoint PeimEntryPoint
QemuFwCfgLib QemuFwCfgLib
QemuFwCfgS3Lib
MtrrLib MtrrLib
PcdLib PcdLib

View File

@ -32,6 +32,7 @@
#include <Library/PcdLib.h> #include <Library/PcdLib.h>
#include <Library/PciLib.h> #include <Library/PciLib.h>
#include <Library/QemuFwCfgLib.h> #include <Library/QemuFwCfgLib.h>
#include <Library/QemuFwCfgS3Lib.h>
#include <Library/UefiBootServicesTableLib.h> #include <Library/UefiBootServicesTableLib.h>
#include <Protocol/S3SaveState.h> #include <Protocol/S3SaveState.h>
#include <Protocol/SmmControl2.h> #include <Protocol/SmmControl2.h>

View File

@ -56,6 +56,7 @@
PcdLib PcdLib
PciLib PciLib
QemuFwCfgLib QemuFwCfgLib
QemuFwCfgS3Lib
UefiBootServicesTableLib UefiBootServicesTableLib
UefiDriverEntryPoint UefiDriverEntryPoint