mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-23 21:54:27 +02:00
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
|
PciPcdProducerLib|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
|
||||||
PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf
|
PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf
|
||||||
PciHostBridgeLib|ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
|
PciHostBridgeLib|ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
|
||||||
|
PciHostBridgeUtilityLib|OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
|
||||||
|
|
||||||
TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
|
TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
|
||||||
AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
|
AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
|
||||||
|
@ -78,6 +78,7 @@
|
|||||||
PciPcdProducerLib|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
|
PciPcdProducerLib|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
|
||||||
PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf
|
PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf
|
||||||
PciHostBridgeLib|ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
|
PciHostBridgeLib|ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
|
||||||
|
PciHostBridgeUtilityLib|OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
|
||||||
|
|
||||||
!if $(TPM2_ENABLE) == TRUE
|
!if $(TPM2_ENABLE) == TRUE
|
||||||
Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf
|
Tpm2CommandLib|SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf
|
||||||
|
@ -76,6 +76,7 @@
|
|||||||
PciPcdProducerLib|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
|
PciPcdProducerLib|ArmVirtPkg/Library/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf
|
||||||
PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf
|
PciSegmentLib|MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf
|
||||||
PciHostBridgeLib|ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
|
PciHostBridgeLib|ArmVirtPkg/Library/FdtPciHostBridgeLib/FdtPciHostBridgeLib.inf
|
||||||
|
PciHostBridgeUtilityLib|OvmfPkg/Library/PciHostBridgeUtilityLib/PciHostBridgeUtilityLib.inf
|
||||||
TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
|
TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
|
||||||
|
|
||||||
[LibraryClasses.common.DXE_DRIVER]
|
[LibraryClasses.common.DXE_DRIVER]
|
||||||
|
@ -7,12 +7,13 @@
|
|||||||
|
|
||||||
**/
|
**/
|
||||||
#include <PiDxe.h>
|
#include <PiDxe.h>
|
||||||
#include <Library/PciHostBridgeLib.h>
|
|
||||||
#include <Library/DebugLib.h>
|
#include <Library/DebugLib.h>
|
||||||
#include <Library/DevicePathLib.h>
|
#include <Library/DevicePathLib.h>
|
||||||
#include <Library/DxeServicesTableLib.h>
|
#include <Library/DxeServicesTableLib.h>
|
||||||
#include <Library/MemoryAllocationLib.h>
|
#include <Library/MemoryAllocationLib.h>
|
||||||
#include <Library/PcdLib.h>
|
#include <Library/PcdLib.h>
|
||||||
|
#include <Library/PciHostBridgeLib.h>
|
||||||
|
#include <Library/PciHostBridgeUtilityLib.h>
|
||||||
#include <Library/UefiBootServicesTableLib.h>
|
#include <Library/UefiBootServicesTableLib.h>
|
||||||
|
|
||||||
#include <Protocol/FdtClient.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
|
// We expect the "ranges" property of "pci-host-ecam-generic" to consist of
|
||||||
// records like this.
|
// records like this.
|
||||||
@ -435,39 +431,5 @@ PciHostBridgeResourceConflict (
|
|||||||
VOID *Configuration
|
VOID *Configuration
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptor;
|
PciHostBridgeUtilityResourceConflict (Configuration);
|
||||||
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
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -31,12 +31,14 @@
|
|||||||
ArmVirtPkg/ArmVirtPkg.dec
|
ArmVirtPkg/ArmVirtPkg.dec
|
||||||
MdeModulePkg/MdeModulePkg.dec
|
MdeModulePkg/MdeModulePkg.dec
|
||||||
MdePkg/MdePkg.dec
|
MdePkg/MdePkg.dec
|
||||||
|
OvmfPkg/OvmfPkg.dec
|
||||||
|
|
||||||
[LibraryClasses]
|
[LibraryClasses]
|
||||||
DebugLib
|
DebugLib
|
||||||
DevicePathLib
|
DevicePathLib
|
||||||
DxeServicesTableLib
|
DxeServicesTableLib
|
||||||
MemoryAllocationLib
|
MemoryAllocationLib
|
||||||
|
PciHostBridgeUtilityLib
|
||||||
PciPcdProducerLib
|
PciPcdProducerLib
|
||||||
|
|
||||||
[FixedPcd]
|
[FixedPcd]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user