Skip to content

Commit

Permalink
hw/acpi: add support for i440fx 'snooping' root busses
Browse files Browse the repository at this point in the history
If the machine has extra root busses that are snooping to
the i440fx host bridge, we need to add them to
acpi in order to be properly detected by guests.

Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
  • Loading branch information
marcel-apf authored and mstsirkin committed Jun 3, 2015
1 parent 09e5b81 commit a489420
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions hw/i386/acpi-build.c
Expand Up @@ -626,6 +626,7 @@ build_ssdt(GArray *table_data, GArray *linker,
uint32_t nr_mem = machine->ram_slots;
unsigned acpi_cpus = guest_info->apic_id_limit;
Aml *ssdt, *sb_scope, *scope, *pkg, *dev, *method, *crs, *field, *ifctx;
PCIBus *bus = NULL;
int i;

ssdt = init_aml_allocator();
Expand All @@ -637,6 +638,28 @@ build_ssdt(GArray *table_data, GArray *linker,
/* Reserve space for header */
acpi_data_push(ssdt->buf, sizeof(AcpiTableHeader));

/* Extra PCI root buses are implemented only for i440fx */
bus = find_i440fx();
if (bus) {
QLIST_FOREACH(bus, &bus->child, sibling) {
uint8_t bus_num = pci_bus_num(bus);

/* look only for expander root buses */
if (!pci_bus_is_root(bus)) {
continue;
}

scope = aml_scope("\\_SB");
dev = aml_device("PC%.02X", bus_num);
aml_append(dev,
aml_name_decl("_UID", aml_string("PC%.02X", bus_num)));
aml_append(dev, aml_name_decl("_HID", aml_string("PNP0A03")));
aml_append(dev, aml_name_decl("_BBN", aml_int(bus_num)));
aml_append(scope, dev);
aml_append(ssdt, scope);
}
}

scope = aml_scope("\\_SB.PCI0");
/* build PCI0._CRS */
crs = aml_resource_template();
Expand Down

0 comments on commit a489420

Please sign in to comment.