Skip to content

Commit

Permalink
hw/pci: inform bios if the system has extra pci root buses
Browse files Browse the repository at this point in the history
The bios looks for 'etc/extra-pci-roots' to decide if
is going to scan further buses after bus 0 tree.

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 Apfelbaum authored and mstsirkin committed Jun 3, 2015
1 parent 40d14be commit 2118196
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions hw/i386/pc.c
Expand Up @@ -30,6 +30,7 @@
#include "hw/block/fdc.h"
#include "hw/ide.h"
#include "hw/pci/pci.h"
#include "hw/pci/pci_bus.h"
#include "monitor/monitor.h"
#include "hw/nvram/fw_cfg.h"
#include "hw/timer/hpet.h"
Expand Down Expand Up @@ -1119,6 +1120,25 @@ void pc_guest_info_machine_done(Notifier *notifier, void *data)
PcGuestInfoState *guest_info_state = container_of(notifier,
PcGuestInfoState,
machine_done);
PCIBus *bus = find_i440fx();

if (bus) {
int extra_hosts = 0;

QLIST_FOREACH(bus, &bus->child, sibling) {
/* look for expander root buses */
if (pci_bus_is_root(bus)) {
extra_hosts++;
}
}
if (extra_hosts && guest_info_state->info.fw_cfg) {
uint64_t *val = g_malloc(sizeof(*val));
*val = cpu_to_le64(extra_hosts);
fw_cfg_add_file(guest_info_state->info.fw_cfg,
"etc/extra-pci-roots", val, sizeof(*val));
}
}

acpi_setup(&guest_info_state->info);
}

Expand Down

0 comments on commit 2118196

Please sign in to comment.