16dba56 ArmVirtualizationPkg/PciHostBridgeDxe: skip 0 AddrLen in SubmitResources()

Authored and Committed by lersek 9 years ago
    ArmVirtualizationPkg/PciHostBridgeDxe: skip 0 AddrLen in SubmitResources()
    
    According to Volume 5 of the PI spec, 10.8.2 PCI Host Bridge Resource
    Allocation Protocol, SubmitResources(),
    
      It is considered an error if no resource requests are submitted for a
      PCI root bridge. If a PCI root bridge does not require any resources, a
      zero-length resource request must explicitly be submitted.
    
    Under MdeModulePkg/Bus/Pci/PciBusDxe/, we have:
    
      PciHostBridgeResourceAllocator()                   [PciLib.c]
        ConstructAcpiResourceRequestor(..., &AcpiConfig) [PciEnumerator.c]
        PciResAlloc->SubmitResources(..., &AcpiConfig)
        ASSERT_EFI_ERROR ()
    
    If ConstructAcpiResourceRequestor() finds no resources to request (for
    example because no PCI devices are on the root bridge), it places a
    zero-length EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR followed by an
    EFI_ACPI_END_TAG_DESCRIPTOR in "AcpiConfig"; satisfying the PI spec.
    
    However, PciHostBridgeDxe's SubmitResources() function does not expect
    such input; the following part of the code rejects it:
    
            switch (Ptr->ResType) {
    
            case 0:
    
              //
              // Check invalid Address Sapce Granularity
              //
              if (Ptr->AddrSpaceGranularity != 32) {
                return EFI_INVALID_PARAMETER;
              }
    
    Skip EFI_ACPI_ADDRESS_SPACE_DESCRIPTORs with zero AddrLen early. Also,
    allow PciHostBridgeResourceAllocator() to proceed to the AllocateResources
    phase by setting "ResourceSubmited" to TRUE.
    
    Contributed-under: TianoCore Contribution Agreement 1.0
    Signed-off-by: Laszlo Ersek <lersek@redhat.com>