From ac9488f26528394856b94bda0797f5bd9c69a26a Mon Sep 17 00:00:00 2001 From: Yang Zhong Date: Thu, 30 Mar 2017 18:32:53 +0800 Subject: qboot: enable mmconfig Need to enable mmconfig in qboot and also need to reserve mmconfig space in bios. Signed-off-by: Yang Zhong Message-Id: <1490869973-4562-1-git-send-email-yang.zhong@intel.com> [Do not affect e820 memory map on i440FX chipset. - Paolo] Signed-off-by: Paolo Bonzini --- hwsetup.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'hwsetup.c') diff --git a/hwsetup.c b/hwsetup.c index 0e186eb..e8a452e 100644 --- a/hwsetup.c +++ b/hwsetup.c @@ -127,3 +127,31 @@ void setup_hw(void) setup_pic(); } + +#define Q35_HOST_BRIDGE_PCIEXBAREN 1 +#define Q35_HOST_BRIDGE_PCIEXBAR 0x60 + +static void setup_q35_mmconfig(void) +{ + const int bdf = 0; + uint64_t addr = PCIE_MMCONFIG_BASE; + uint32_t upper = addr >> 32; + uint32_t lower = (addr & 0xffffffff) | Q35_HOST_BRIDGE_PCIEXBAREN; + + pci_config_writel(bdf, Q35_HOST_BRIDGE_PCIEXBAR, 0); + pci_config_writel(bdf, Q35_HOST_BRIDGE_PCIEXBAR + 4, upper); + pci_config_writel(bdf, Q35_HOST_BRIDGE_PCIEXBAR, lower); +} + +bool setup_mmconfig(void) +{ + const int bdf = 0; + uint32_t id = pci_config_readl(bdf, 0); + + if (id == (PCI_VENDOR_ID_INTEL | (PCI_DEVICE_ID_INTEL_Q35_MCH << 16))) { + setup_q35_mmconfig(); + return true; + } + + return false; +} -- cgit v1.1