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 --- main.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index 1913b37..f092289 100644 --- a/main.c +++ b/main.c @@ -6,6 +6,7 @@ #include "segment.h" #include "fw_cfg.h" #include "pflash.h" +#include "pci.h" static void set_realmode_int(int vec, void *p) { @@ -30,6 +31,7 @@ static void setup_idt(void) /* Top of memory below 4GB. */ uint32_t lowmem; struct e820map *e820; +static bool have_mmconfig; static void extract_e820(void) { @@ -42,7 +44,7 @@ static void extract_e820(void) panic(); size = fw_cfg_file_size(id); - nr_map = size / sizeof(e820->map[0]) + 4; + nr_map = size / sizeof(e820->map[0]) + 5; e820 = malloc(offsetof(struct e820map, map[nr_map])); e820->nr_map = nr_map; @@ -54,8 +56,16 @@ static void extract_e820(void) { .addr = 0xd0000, .size = 128 * 1024, .type = E820_NVS }; /* ACPI tables */ e820->map[3] = (struct e820entry) { .addr = 0xf0000, .size = 64 * 1024, .type = E820_RESERVED }; /* firmware */ - fw_cfg_read_file(id, &e820->map[4], size); - for (i = 4; i < e820->nr_map; i++) + + i = 4; + if (have_mmconfig) + e820->map[i++] = (struct e820entry) + { .addr = PCIE_MMCONFIG_BASE, .size = PCIE_MMCONFIG_SIZE, .type = E820_RESERVED }; + else + nr_map--; + + fw_cfg_read_file(id, &e820->map[i], size); + for (; i < e820->nr_map; i++) if (e820->map[i].addr == 0) { lowmem = e820->map[i].size; e820->map[i].addr = 1024 * 1024; @@ -85,6 +95,7 @@ int __attribute__ ((section (".text.startup"))) main(void) // in order to probe CBFS! asm("ljmp $0x8, $1f; 1:"); + have_mmconfig = setup_mmconfig(); setup_pci(); setup_idt(); fw_cfg_setup(); -- cgit v1.1