From 687f7521ea03b6c05ec03a8d37f4d7370cfd1016 Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Wed, 22 Feb 2017 03:47:18 +0100 Subject: [PATCH] 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 Cc: Jordan Justen Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=394 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek Reviewed-by: Jordan Justen Reviewed-by: Ard Biesheuvel --- .../Library/QemuFwCfgLib/QemuFwCfgLib.c | 17 ----------- OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf | 1 + OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c | 1 + .../QemuFwCfgAcpiPlatformDxe.inf | 1 + OvmfPkg/Include/Library/QemuFwCfgLib.h | 14 ---------- OvmfPkg/Library/LockBoxLib/LockBoxDxe.c | 1 + OvmfPkg/Library/LockBoxLib/LockBoxDxeLib.inf | 1 + .../PlatformBootManagerLib/BdsPlatform.h | 1 + .../PlatformBootManagerLib.inf | 1 + OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c | 28 ------------------- OvmfPkg/PlatformPei/Platform.c | 1 + OvmfPkg/PlatformPei/PlatformPei.inf | 1 + OvmfPkg/SmmControl2Dxe/SmmControl2Dxe.c | 1 + OvmfPkg/SmmControl2Dxe/SmmControl2Dxe.inf | 1 + 14 files changed, 11 insertions(+), 59 deletions(-) diff --git a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c b/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c index 9dd5c911fc..fba1684af2 100644 --- a/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c +++ b/ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c @@ -637,20 +637,3 @@ 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 FALSE; -} diff --git a/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf b/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf index bb5f14e0fc..42edc97b3d 100644 --- a/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf +++ b/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf @@ -52,6 +52,7 @@ UefiDriverEntryPoint HobLib QemuFwCfgLib + QemuFwCfgS3Lib MemoryAllocationLib BaseLib DxeServicesTableLib diff --git a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c index 6a0ecd1ad9..76512534f5 100644 --- a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c +++ b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include diff --git a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf index e550ff5a47..a935054021 100644 --- a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf +++ b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf @@ -44,6 +44,7 @@ MemoryAllocationLib OrderedCollectionLib QemuFwCfgLib + QemuFwCfgS3Lib UefiBootServicesTableLib UefiDriverEntryPoint diff --git a/OvmfPkg/Include/Library/QemuFwCfgLib.h b/OvmfPkg/Include/Library/QemuFwCfgLib.h index 2a1261327b..596e3f25d5 100644 --- a/OvmfPkg/Include/Library/QemuFwCfgLib.h +++ b/OvmfPkg/Include/Library/QemuFwCfgLib.h @@ -179,19 +179,5 @@ QemuFwCfgFindFile ( 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 diff --git a/OvmfPkg/Library/LockBoxLib/LockBoxDxe.c b/OvmfPkg/Library/LockBoxLib/LockBoxDxe.c index 818646a275..3da9cd21e5 100644 --- a/OvmfPkg/Library/LockBoxLib/LockBoxDxe.c +++ b/OvmfPkg/Library/LockBoxLib/LockBoxDxe.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include diff --git a/OvmfPkg/Library/LockBoxLib/LockBoxDxeLib.inf b/OvmfPkg/Library/LockBoxLib/LockBoxDxeLib.inf index bedf1811e0..eb03f4f546 100644 --- a/OvmfPkg/Library/LockBoxLib/LockBoxDxeLib.inf +++ b/OvmfPkg/Library/LockBoxLib/LockBoxDxeLib.inf @@ -40,6 +40,7 @@ DebugLib UefiBootServicesTableLib QemuFwCfgLib + QemuFwCfgS3Lib [Protocols] gEfiLockBoxProtocolGuid ## SOMETIMES_PRODUCES diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h index ec58efa5ef..97ffbb5148 100644 --- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h +++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h @@ -48,6 +48,7 @@ Abstract: #include #include #include +#include #include #include diff --git a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf index f9e35c955d..27789b7377 100644 --- a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf +++ b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf @@ -52,6 +52,7 @@ PciLib NvVarsFileLib QemuFwCfgLib + QemuFwCfgS3Lib LoadLinuxLib QemuBootOrderLib UefiLib diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c index 3dd55ba504..1bf725d8b7 100644 --- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c @@ -368,31 +368,3 @@ 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); -} diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c index 0be86722e5..77a8a16c15 100644 --- a/OvmfPkg/PlatformPei/Platform.c +++ b/OvmfPkg/PlatformPei/Platform.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include diff --git a/OvmfPkg/PlatformPei/PlatformPei.inf b/OvmfPkg/PlatformPei/PlatformPei.inf index fbaed3182d..53c6dd445a 100644 --- a/OvmfPkg/PlatformPei/PlatformPei.inf +++ b/OvmfPkg/PlatformPei/PlatformPei.inf @@ -58,6 +58,7 @@ PeiServicesTablePointerLib PeimEntryPoint QemuFwCfgLib + QemuFwCfgS3Lib MtrrLib PcdLib diff --git a/OvmfPkg/SmmControl2Dxe/SmmControl2Dxe.c b/OvmfPkg/SmmControl2Dxe/SmmControl2Dxe.c index f31646d734..bb79fce085 100644 --- a/OvmfPkg/SmmControl2Dxe/SmmControl2Dxe.c +++ b/OvmfPkg/SmmControl2Dxe/SmmControl2Dxe.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include diff --git a/OvmfPkg/SmmControl2Dxe/SmmControl2Dxe.inf b/OvmfPkg/SmmControl2Dxe/SmmControl2Dxe.inf index 31c80bd444..04b1ed0e4e 100644 --- a/OvmfPkg/SmmControl2Dxe/SmmControl2Dxe.inf +++ b/OvmfPkg/SmmControl2Dxe/SmmControl2Dxe.inf @@ -56,6 +56,7 @@ PcdLib PciLib QemuFwCfgLib + QemuFwCfgS3Lib UefiBootServicesTableLib UefiDriverEntryPoint -- 2.39.2