From cc302b799e06d2ef4879f93472344a5e27e95bd0 Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Wed, 26 May 2021 22:14:13 +0200 Subject: OvmfPkg/AcpiPlatformDxe: consolidate #includes and [LibraryClasses] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - #include only such public headers in "AcpiPlatform.h" that are required by the function declarations and type definitions introduced in "AcpiPlatform.h". Don't use "AcpiPlatform.h" as a convenience #include file. - In every file, list every necessary public #include individually, with an example identifier that's actually consumed. - Remove unnecessary lib classes, add unlisted lib classes. - Remove unnecessary #include directives, add unlisted #include directives. Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Philippe Mathieu-Daudé Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122 Signed-off-by: Laszlo Ersek Message-Id: <20210526201446.12554-11-lersek@redhat.com> Reviewed-by: Ard Biesheuvel Reviewed-by: Philippe Mathieu-Daudé --- OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c | 5 +++++ OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h | 12 ++---------- OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf | 1 - OvmfPkg/AcpiPlatformDxe/BootScript.c | 7 ++++--- OvmfPkg/AcpiPlatformDxe/EntryPoint.c | 6 +++++- OvmfPkg/AcpiPlatformDxe/PciDecoding.c | 4 +++- OvmfPkg/AcpiPlatformDxe/Qemu.c | 14 +++++++------- OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c | 19 ++++++++++--------- OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf | 2 ++ OvmfPkg/AcpiPlatformDxe/Xen.c | 4 +++- 10 files changed, 41 insertions(+), 33 deletions(-) diff --git a/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c b/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c index f872d91aea..efbbfab89d 100644 --- a/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c +++ b/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c @@ -6,6 +6,11 @@ **/ +#include // ASSERT_EFI_ERROR() +#include // gBS +#include // XenDetected() +#include // gEfiFirmwareVolume2Protocol... + #include "AcpiPlatform.h" EFI_STATUS diff --git a/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h b/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h index 511a30782f..d98b79baab 100644 --- a/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h +++ b/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h @@ -9,16 +9,8 @@ #ifndef ACPI_PLATFORM_H_ #define ACPI_PLATFORM_H_ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include // EFI_ACPI_TABLE_PROTOCOL +#include // EFI_PCI_IO_PROTOCOL typedef struct { EFI_PCI_IO_PROTOCOL *PciIo; diff --git a/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf b/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf index 3daeb2ee42..77607298cb 100644 --- a/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf +++ b/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf @@ -48,7 +48,6 @@ QemuFwCfgS3Lib UefiBootServicesTableLib UefiDriverEntryPoint - UefiLib XenPlatformLib [Protocols] diff --git a/OvmfPkg/AcpiPlatformDxe/BootScript.c b/OvmfPkg/AcpiPlatformDxe/BootScript.c index 7b1b9586da..f2d1089e91 100644 --- a/OvmfPkg/AcpiPlatformDxe/BootScript.c +++ b/OvmfPkg/AcpiPlatformDxe/BootScript.c @@ -7,9 +7,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ -#include -#include -#include +#include // CpuDeadLoop() +#include // DEBUG() +#include // AllocatePool() +#include // QemuFwCfgS3ScriptSkipBytes() #include "AcpiPlatform.h" diff --git a/OvmfPkg/AcpiPlatformDxe/EntryPoint.c b/OvmfPkg/AcpiPlatformDxe/EntryPoint.c index fb07ed8537..bb5fe82c18 100644 --- a/OvmfPkg/AcpiPlatformDxe/EntryPoint.c +++ b/OvmfPkg/AcpiPlatformDxe/EntryPoint.c @@ -7,7 +7,11 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ -#include +#include // gRootBridgesConnectedEve... +#include // DEBUG() +#include // PcdGetBool() +#include // gBS +#include // EFI_ACPI_TABLE_PROTOCOL #include "AcpiPlatform.h" diff --git a/OvmfPkg/AcpiPlatformDxe/PciDecoding.c b/OvmfPkg/AcpiPlatformDxe/PciDecoding.c index 73894106c9..6ba4c936ad 100644 --- a/OvmfPkg/AcpiPlatformDxe/PciDecoding.c +++ b/OvmfPkg/AcpiPlatformDxe/PciDecoding.c @@ -7,7 +7,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ -#include +#include // DEBUG() +#include // AllocatePool() +#include // gBS #include "AcpiPlatform.h" diff --git a/OvmfPkg/AcpiPlatformDxe/Qemu.c b/OvmfPkg/AcpiPlatformDxe/Qemu.c index bed3b16159..bdcc46b718 100644 --- a/OvmfPkg/AcpiPlatformDxe/Qemu.c +++ b/OvmfPkg/AcpiPlatformDxe/Qemu.c @@ -9,13 +9,13 @@ **/ -#include -#include -#include -#include -#include -#include -#include +#include // EFI_ACPI_1_0_IO_APIC_STRUCTURE +#include // CopyMem() +#include // DEBUG() +#include // gDS +#include // AllocatePool() +#include // PcdGet16() +#include // QemuFwCfgIsAvailable() #include "AcpiPlatform.h" diff --git a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c index 621e69410d..df800b1492 100644 --- a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c +++ b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c @@ -8,15 +8,16 @@ **/ -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include // EFI_ACPI_DESCRIPTION_HEADER +#include // QEMU_LOADER_FNAME_SIZE +#include // AsciiStrCmp() +#include // CopyMem() +#include // DEBUG() +#include // AllocatePool() +#include // OrderedCollectionMin() +#include // QemuFwCfgFindFile() +#include // QemuFwCfgS3Enabled() +#include // gBS #include "AcpiPlatform.h" diff --git a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf index 48c8269a8b..dac25d1505 100644 --- a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf +++ b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf @@ -35,9 +35,11 @@ [LibraryClasses] BaseLib + BaseMemoryLib DebugLib MemoryAllocationLib OrderedCollectionLib + PcdLib QemuFwCfgLib QemuFwCfgS3Lib UefiBootServicesTableLib diff --git a/OvmfPkg/AcpiPlatformDxe/Xen.c b/OvmfPkg/AcpiPlatformDxe/Xen.c index 1d69989042..be2c5d6958 100644 --- a/OvmfPkg/AcpiPlatformDxe/Xen.c +++ b/OvmfPkg/AcpiPlatformDxe/Xen.c @@ -8,7 +8,9 @@ **/ -#include +#include // CpuDeadLoop() +#include // DEBUG() +#include // XenGetInfoHOB() #include "AcpiPlatform.h" -- cgit v1.2.3