From: Gerd Hoffmann Date: Wed, 28 Nov 2012 09:17:35 +0000 (+0100) Subject: acpi: add mcfg table for mmconfig X-Git-Tag: rel-1.7.2~24 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=7e269b47cb46a16baa03a184553f780b4eb3dc2b;p=seabios.git acpi: add mcfg table for mmconfig Signed-off-by: Gerd Hoffmann Signed-off-by: Kevin O'Connor --- diff --git a/src/acpi.c b/src/acpi.c index 72c8fe8..6267d7b 100644 --- a/src/acpi.c +++ b/src/acpi.c @@ -764,6 +764,27 @@ build_srat(void) return srat; } +static void * +build_mcfg_q35(void) +{ + struct acpi_table_mcfg *mcfg; + + int len = sizeof(*mcfg) + 1 * sizeof(mcfg->allocation[0]); + mcfg = malloc_high(len); + if (!mcfg) { + warn_noalloc(); + return NULL; + } + memset(mcfg, 0, len); + mcfg->allocation[0].address = Q35_HOST_BRIDGE_PCIEXBAR_ADDR; + mcfg->allocation[0].pci_segment = Q35_HOST_PCIE_PCI_SEGMENT; + mcfg->allocation[0].start_bus_number = Q35_HOST_PCIE_START_BUS_NUMBER; + mcfg->allocation[0].end_bus_number = Q35_HOST_PCIE_END_BUS_NUMBER; + + build_header((void *)mcfg, MCFG_SIGNATURE, len, 1); + return mcfg; +} + static const struct pci_device_id acpi_find_tbl[] = { /* PIIX4 Power Management device. */ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3, NULL), @@ -804,6 +825,8 @@ acpi_bios_init(void) ACPI_INIT_TABLE(build_madt()); ACPI_INIT_TABLE(build_hpet()); ACPI_INIT_TABLE(build_srat()); + if (pci->device == PCI_DEVICE_ID_INTEL_ICH9_LPC) + ACPI_INIT_TABLE(build_mcfg_q35()); u16 i, external_tables = qemu_cfg_acpi_additional_tables(); diff --git a/src/acpi.h b/src/acpi.h index cb21561..715d19d 100644 --- a/src/acpi.h +++ b/src/acpi.h @@ -107,4 +107,21 @@ struct bfld { u64 p1l; /* pci window 1 (above 4g) - length */ } PACKED; +/* PCI fw r3.0 MCFG table. */ +/* Subtable */ +struct acpi_mcfg_allocation { + u64 address; /* Base address, processor-relative */ + u16 pci_segment; /* PCI segment group number */ + u8 start_bus_number; /* Starting PCI Bus number */ + u8 end_bus_number; /* Final PCI Bus number */ + u32 reserved; +} PACKED; + +#define MCFG_SIGNATURE 0x4746434d // MCFG +struct acpi_table_mcfg { + ACPI_TABLE_HEADER_DEF; + u8 reserved[8]; + struct acpi_mcfg_allocation allocation[0]; +} PACKED; + #endif // acpi.h