mirror of https://github.com/acidanthera/audk.git
ArmVirtPkg: Refactor with PciHostBridgeUtilityLib
Eliminate currently duplicated code in ArmVirtPkg with the common utility class PciHostBridgeUtilityLib. BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3059 Cc: Laszlo Ersek <lersek@redhat.com> Cc: Ard Biesheuvel <ard.biesheuvel@arm.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Jiahui Cen <cenjiahui@huawei.com> Signed-off-by: Yubo Miao <miaoyubo@huawei.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20210119011302.10908-3-cenjiahui@huawei.com>
This commit is contained in:
parent
7a6172f88b
commit
166a32d09a
|
@ -58,6 +58,7 @@
|
|||
PciPcdProducerLib|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
|
||||
PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf
|
||||
PciHostBridgeLib|ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
|
||||
PciHostBridgeUtilityLib|OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
|
||||
|
||||
TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
|
||||
AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
|
||||
|
|
|
@ -78,6 +78,7 @@
|
|||
PciPcdProducerLib|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
|
||||
PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf
|
||||
PciHostBridgeLib|ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
|
||||
PciHostBridgeUtilityLib|OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
|
||||
|
||||
!if $(TPM2_ENABLE) == TRUE
|
||||
Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf
|
||||
|
|
|
@ -76,6 +76,7 @@
|
|||
PciPcdProducerLib|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
|
||||
PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf
|
||||
PciHostBridgeLib|ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
|
||||
PciHostBridgeUtilityLib|OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
|
||||
TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
|
||||
|
||||
[LibraryClasses.common.DXE_DRIVER]
|
||||
|
|
|
@ -7,12 +7,13 @@
|
|||
|
||||
**/
|
||||
#include <PiDxe.h>
|
||||
#include <Library/PciHostBridgeLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/DevicePathLib.h>
|
||||
#include <Library/DxeServicesTableLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/PcdLib.h>
|
||||
#include <Library/PciHostBridgeLib.h>
|
||||
#include <Library/PciHostBridgeUtilityLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
|
||||
#include <Protocol/FdtClient.h>
|
||||
|
@ -50,11 +51,6 @@ STATIC EFI_PCI_ROOT_BRIDGE_DEVICE_PATH mEfiPciRootBridgeDevicePath = {
|
|||
}
|
||||
};
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED
|
||||
CHAR16 *mPciHostBridgeLibAcpiAddressSpaceTypeStr[] = {
|
||||
L"Mem", L"I/O", L"Bus"
|
||||
};
|
||||
|
||||
//
|
||||
// We expect the "ranges" property of "pci-host-ecam-generic" to consist of
|
||||
// records like this.
|
||||
|
@ -435,39 +431,5 @@ PciHostBridgeResourceConflict (
|
|||
VOID *Configuration
|
||||
)
|
||||
{
|
||||
EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptor;
|
||||
UINTN RootBridgeIndex;
|
||||
DEBUG ((EFI_D_ERROR, "PciHostBridge: Resource conflict happens!\n"));
|
||||
|
||||
RootBridgeIndex = 0;
|
||||
Descriptor = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *) Configuration;
|
||||
while (Descriptor->Desc == ACPI_ADDRESS_SPACE_DESCRIPTOR) {
|
||||
DEBUG ((EFI_D_ERROR, "RootBridge[%d]:\n", RootBridgeIndex++));
|
||||
for (; Descriptor->Desc == ACPI_ADDRESS_SPACE_DESCRIPTOR; Descriptor++) {
|
||||
ASSERT (Descriptor->ResType <
|
||||
(sizeof (mPciHostBridgeLibAcpiAddressSpaceTypeStr) /
|
||||
sizeof (mPciHostBridgeLibAcpiAddressSpaceTypeStr[0])
|
||||
)
|
||||
);
|
||||
DEBUG ((EFI_D_ERROR, " %s: Length/Alignment = 0x%lx / 0x%lx\n",
|
||||
mPciHostBridgeLibAcpiAddressSpaceTypeStr[Descriptor->ResType],
|
||||
Descriptor->AddrLen, Descriptor->AddrRangeMax
|
||||
));
|
||||
if (Descriptor->ResType == ACPI_ADDRESS_SPACE_TYPE_MEM) {
|
||||
DEBUG ((EFI_D_ERROR, " Granularity/SpecificFlag = %ld / %02x%s\n",
|
||||
Descriptor->AddrSpaceGranularity, Descriptor->SpecificFlag,
|
||||
((Descriptor->SpecificFlag &
|
||||
EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE_PREFETCHABLE
|
||||
) != 0) ? L" (Prefetchable)" : L""
|
||||
));
|
||||
}
|
||||
}
|
||||
//
|
||||
// Skip the END descriptor for root bridge
|
||||
//
|
||||
ASSERT (Descriptor->Desc == ACPI_END_TAG_DESCRIPTOR);
|
||||
Descriptor = (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *)(
|
||||
(EFI_ACPI_END_TAG_DESCRIPTOR *)Descriptor + 1
|
||||
);
|
||||
}
|
||||
PciHostBridgeUtilityResourceConflict (Configuration);
|
||||
}
|
||||
|
|
|
@ -31,12 +31,14 @@
|
|||
ArmVirtPkg/ArmVirtPkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
MdePkg/MdePkg.dec
|
||||
OvmfPkg/OvmfPkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
DebugLib
|
||||
DevicePathLib
|
||||
DxeServicesTableLib
|
||||
MemoryAllocationLib
|
||||
PciHostBridgeUtilityLib
|
||||
PciPcdProducerLib
|
||||
|
||||
[FixedPcd]
|
||||
|
|
Loading…
Reference in New Issue