/** @file

  Memory mapped config space base address table (MCFG)

  Copyright (c) 2017, Linaro Ltd. All rights reserved.<BR>
  Copyright (c) 2019, Marvell International Ltd. and its affiliates.<BR>

  This program and the accompanying materials
  are licensed and made available under the terms and conditions of the BSD License
  which accompanies this distribution.  The full text of the license may be found at
  http://opensource.org/licenses/bsd-license.php

  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

**/

#include <Library/AcpiLib.h>

#include "AcpiHeader.h"
#include "Armada80x0Db/Pcie.h"

#include <IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h>

#pragma pack(1)
typedef struct {
  EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TABLE_HEADER Header;
  EFI_ACPI_MEMORY_MAPPED_ENHANCED_CONFIGURATION_SPACE_BASE_ADDRESS_ALLOCATION_STRUCTURE Structure;
} ACPI_6_0_MCFG_STRUCTURE;
#pragma pack()

STATIC ACPI_6_0_MCFG_STRUCTURE Mcfg = {
  {
    __ACPI_HEADER (EFI_ACPI_5_0_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE,
                   ACPI_6_0_MCFG_STRUCTURE,
                   EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_TABLE_REVISION),
    EFI_ACPI_RESERVED_QWORD
  }, {
    PCI_ECAM_BASE,                   // BaseAddress
    0,                               // PciSegmentGroupNumber
    PCI_BUS_MIN,                     // StartBusNumber
    PCI_BUS_MAX,                     // EndBusNumber
    EFI_ACPI_RESERVED_DWORD          // Reserved
  }
};

VOID CONST * CONST ReferenceAcpiTable = &Mcfg;
