[edk2-devel] [PATCH 10/43] OvmfPkg/AcpiPlatformDxe: consolidate #includes and [LibraryClasses]
Laszlo Ersek
lersek at redhat.com
Wed May 26 20:14:13 UTC 2021
- #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 <ardb+tianocore at kernel.org>
Cc: Jordan Justen <jordan.l.justen at intel.com>
Cc: Philippe Mathieu-Daudé <philmd at redhat.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek at redhat.com>
---
OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf | 1 -
OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf | 2 ++
OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h | 12 ++----------
OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c | 5 +++++
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/Xen.c | 4 +++-
10 files changed, 41 insertions(+), 33 deletions(-)
diff --git a/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf b/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
index 3daeb2ee42d2..77607298cbea 100644
--- a/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
+++ b/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
@@ -45,13 +45,12 @@ [LibraryClasses]
OrderedCollectionLib
PcdLib
QemuFwCfgLib
QemuFwCfgS3Lib
UefiBootServicesTableLib
UefiDriverEntryPoint
- UefiLib
XenPlatformLib
[Protocols]
gEfiAcpiTableProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiFirmwareVolume2ProtocolGuid # PROTOCOL SOMETIMES_CONSUMED
gEfiPciIoProtocolGuid # PROTOCOL SOMETIMES_CONSUMED
diff --git a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf
index 48c8269a8b6f..dac25d1505be 100644
--- a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf
+++ b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf
@@ -32,15 +32,17 @@ [Packages]
MdeModulePkg/MdeModulePkg.dec
MdePkg/MdePkg.dec
OvmfPkg/OvmfPkg.dec
[LibraryClasses]
BaseLib
+ BaseMemoryLib
DebugLib
MemoryAllocationLib
OrderedCollectionLib
+ PcdLib
QemuFwCfgLib
QemuFwCfgS3Lib
UefiBootServicesTableLib
UefiDriverEntryPoint
[Protocols]
diff --git a/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h b/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h
index 511a30782f6d..d98b79baab40 100644
--- a/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h
+++ b/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h
@@ -6,22 +6,14 @@
**/
#ifndef ACPI_PLATFORM_H_
#define ACPI_PLATFORM_H_
-#include <IndustryStandard/Acpi.h>
-#include <Library/BaseLib.h>
-#include <Library/DebugLib.h>
-#include <Library/PcdLib.h>
-#include <Library/UefiBootServicesTableLib.h>
-#include <Library/XenPlatformLib.h>
-#include <PiDxe.h>
-#include <Protocol/AcpiTable.h>
-#include <Protocol/FirmwareVolume2.h>
-#include <Protocol/PciIo.h>
+#include <Protocol/AcpiTable.h> // EFI_ACPI_TABLE_PROTOCOL
+#include <Protocol/PciIo.h> // EFI_PCI_IO_PROTOCOL
typedef struct {
EFI_PCI_IO_PROTOCOL *PciIo;
UINT64 PciAttributes;
} ORIGINAL_ATTRIBUTES;
diff --git a/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c b/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c
index f872d91aea72..efbbfab89d2b 100644
--- a/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c
+++ b/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c
@@ -3,12 +3,17 @@
Copyright (c) 2008 - 2012, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
+#include <Library/DebugLib.h> // ASSERT_EFI_ERROR()
+#include <Library/UefiBootServicesTableLib.h> // gBS
+#include <Library/XenPlatformLib.h> // XenDetected()
+#include <Protocol/FirmwareVolume2.h> // gEfiFirmwareVolume2Protocol...
+
#include "AcpiPlatform.h"
EFI_STATUS
EFIAPI
InstallAcpiTable (
IN EFI_ACPI_TABLE_PROTOCOL *AcpiProtocol,
diff --git a/OvmfPkg/AcpiPlatformDxe/BootScript.c b/OvmfPkg/AcpiPlatformDxe/BootScript.c
index 7b1b9586da41..f2d1089e91ce 100644
--- a/OvmfPkg/AcpiPlatformDxe/BootScript.c
+++ b/OvmfPkg/AcpiPlatformDxe/BootScript.c
@@ -4,15 +4,16 @@
Copyright (C) 2017, Red Hat, Inc.
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
-#include <Library/MemoryAllocationLib.h>
-#include <Library/QemuFwCfgLib.h>
-#include <Library/QemuFwCfgS3Lib.h>
+#include <Library/BaseLib.h> // CpuDeadLoop()
+#include <Library/DebugLib.h> // DEBUG()
+#include <Library/MemoryAllocationLib.h> // AllocatePool()
+#include <Library/QemuFwCfgS3Lib.h> // QemuFwCfgS3ScriptSkipBytes()
#include "AcpiPlatform.h"
//
// Condensed structure for capturing the fw_cfg operations -- select, skip,
diff --git a/OvmfPkg/AcpiPlatformDxe/EntryPoint.c b/OvmfPkg/AcpiPlatformDxe/EntryPoint.c
index fb07ed85373d..bb5fe82c18d4 100644
--- a/OvmfPkg/AcpiPlatformDxe/EntryPoint.c
+++ b/OvmfPkg/AcpiPlatformDxe/EntryPoint.c
@@ -4,13 +4,17 @@
Copyright (C) 2015, Red Hat, Inc.
Copyright (c) 2008 - 2015, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
-#include <Guid/RootBridgesConnectedEventGroup.h>
+#include <Guid/RootBridgesConnectedEventGroup.h> // gRootBridgesConnectedEve...
+#include <Library/DebugLib.h> // DEBUG()
+#include <Library/PcdLib.h> // PcdGetBool()
+#include <Library/UefiBootServicesTableLib.h> // gBS
+#include <Protocol/AcpiTable.h> // EFI_ACPI_TABLE_PROTOCOL
#include "AcpiPlatform.h"
STATIC
EFI_ACPI_TABLE_PROTOCOL *
FindAcpiTableProtocol (
diff --git a/OvmfPkg/AcpiPlatformDxe/PciDecoding.c b/OvmfPkg/AcpiPlatformDxe/PciDecoding.c
index 73894106c9ec..6ba4c936ad8e 100644
--- a/OvmfPkg/AcpiPlatformDxe/PciDecoding.c
+++ b/OvmfPkg/AcpiPlatformDxe/PciDecoding.c
@@ -4,13 +4,15 @@
Copyright (C) 2016, Red Hat, Inc.
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
-#include <Library/MemoryAllocationLib.h>
+#include <Library/DebugLib.h> // DEBUG()
+#include <Library/MemoryAllocationLib.h> // AllocatePool()
+#include <Library/UefiBootServicesTableLib.h> // gBS
#include "AcpiPlatform.h"
/**
Collect all PciIo protocol instances in the system. Save their original
diff --git a/OvmfPkg/AcpiPlatformDxe/Qemu.c b/OvmfPkg/AcpiPlatformDxe/Qemu.c
index bed3b16159a6..bdcc46b7186a 100644
--- a/OvmfPkg/AcpiPlatformDxe/Qemu.c
+++ b/OvmfPkg/AcpiPlatformDxe/Qemu.c
@@ -6,19 +6,19 @@
Copyright (C) 2012-2014, Red Hat, Inc.
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
-#include <IndustryStandard/Acpi.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/DxeServicesTableLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/OrderedCollectionLib.h>
-#include <Library/PcdLib.h>
-#include <Library/QemuFwCfgLib.h>
+#include <IndustryStandard/Acpi.h> // EFI_ACPI_1_0_IO_APIC_STRUCTURE
+#include <Library/BaseMemoryLib.h> // CopyMem()
+#include <Library/DebugLib.h> // DEBUG()
+#include <Library/DxeServicesTableLib.h> // gDS
+#include <Library/MemoryAllocationLib.h> // AllocatePool()
+#include <Library/PcdLib.h> // PcdGet16()
+#include <Library/QemuFwCfgLib.h> // QemuFwCfgIsAvailable()
#include "AcpiPlatform.h"
BOOLEAN
QemuDetected (
VOID
diff --git a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c
index 621e69410da9..df800b149275 100644
--- a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c
+++ b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c
@@ -5,21 +5,22 @@
Copyright (C) 2012-2014, Red Hat, Inc.
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
-#include <IndustryStandard/Acpi.h>
-#include <IndustryStandard/QemuLoader.h>
-#include <Library/BaseMemoryLib.h>
-#include <Library/DxeServicesTableLib.h>
-#include <Library/MemoryAllocationLib.h>
-#include <Library/OrderedCollectionLib.h>
-#include <Library/PcdLib.h>
-#include <Library/QemuFwCfgLib.h>
-#include <Library/QemuFwCfgS3Lib.h>
+#include <IndustryStandard/Acpi.h> // EFI_ACPI_DESCRIPTION_HEADER
+#include <IndustryStandard/QemuLoader.h> // QEMU_LOADER_FNAME_SIZE
+#include <Library/BaseLib.h> // AsciiStrCmp()
+#include <Library/BaseMemoryLib.h> // CopyMem()
+#include <Library/DebugLib.h> // DEBUG()
+#include <Library/MemoryAllocationLib.h> // AllocatePool()
+#include <Library/OrderedCollectionLib.h> // OrderedCollectionMin()
+#include <Library/QemuFwCfgLib.h> // QemuFwCfgFindFile()
+#include <Library/QemuFwCfgS3Lib.h> // QemuFwCfgS3Enabled()
+#include <Library/UefiBootServicesTableLib.h> // gBS
#include "AcpiPlatform.h"
//
// The user structure for the ordered collection that will track the fw_cfg
// blobs under processing.
diff --git a/OvmfPkg/AcpiPlatformDxe/Xen.c b/OvmfPkg/AcpiPlatformDxe/Xen.c
index 1d69989042c6..be2c5d695846 100644
--- a/OvmfPkg/AcpiPlatformDxe/Xen.c
+++ b/OvmfPkg/AcpiPlatformDxe/Xen.c
@@ -5,13 +5,15 @@
Copyright (c) 2012, Bei Guan <gbtju85 at gmail.com>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
-#include <Library/BaseLib.h>
+#include <Library/BaseLib.h> // CpuDeadLoop()
+#include <Library/DebugLib.h> // DEBUG()
+#include <Library/XenPlatformLib.h> // XenGetInfoHOB()
#include "AcpiPlatform.h"
#define XEN_ACPI_PHYSICAL_ADDRESS 0x000EA020
#define XEN_BIOS_PHYSICAL_END 0x000FFFFF
--
2.19.1.3.g30247aa5d201
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#75679): https://edk2.groups.io/g/devel/message/75679
Mute This Topic: https://groups.io/mt/83110470/1813853
Mute #includes:https://edk2.groups.io/g/devel/mutehashtag/includes
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-
More information about the edk2-devel-archive
mailing list