ArmVirtualizationPkg/PciHostBridgeDxe: handle 0 in GetProposedResources()

When there are no devices connected to the root bridge, no resources are
needed. GetProposedResources() currently considers this an invalid
condition (the PI spec doesn't regulate it).

Emitting an empty set of EFI_ACPI_ADDRESS_SPACE_DESCRIPTORs, followed by
the required EFI_ACPI_END_TAG_DESCRIPTOR, allows
PciHostBridgeResourceAllocator() [MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c]
to advance.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Olivier Martin <Olivier.martin@arm.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16908 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Laszlo Ersek 2015-02-23 16:04:00 +00:00 committed by lersek
parent 1a1d637695
commit e5ceb6c9d3
1 changed files with 9 additions and 1 deletions

View File

@ -1079,7 +1079,15 @@ GetProposedResources(
} }
if (Number == 0) { if (Number == 0) {
return EFI_INVALID_PARAMETER; EFI_ACPI_END_TAG_DESCRIPTOR *End;
End = AllocateZeroPool (sizeof *End);
if (End == NULL) {
return EFI_OUT_OF_RESOURCES;
}
End->Desc = ACPI_END_TAG_DESCRIPTOR;
*Configuration = End;
return EFI_SUCCESS;
} }
Buffer = AllocateZeroPool (Number * sizeof(EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) + sizeof(EFI_ACPI_END_TAG_DESCRIPTOR)); Buffer = AllocateZeroPool (Number * sizeof(EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) + sizeof(EFI_ACPI_END_TAG_DESCRIPTOR));