diff options
author | Marcelo Tosatti <mtosatti@redhat.com> | 2010-07-13 19:55:50 -0300 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2010-07-13 19:55:50 -0300 |
commit | 9237b68be75a7e8036975c9a91c54ddc496ec7ae (patch) | |
tree | dbd706c62b10ca909715d9201accb8b2682819e4 /hw/pci.c | |
parent | 6b440ef2a97e45f6839413f7609fa16090c5d5ff (diff) | |
parent | 0be71e324f774a77243f1a1487f468232d69542b (diff) |
Merge commit '0be71e324f774a77243f1a1487f468232d69542b' into upstream-merge
* commit '0be71e324f774a77243f1a1487f468232d69542b':
savevm: Add DeviceState param
pci: Implement BusInfo.get_dev_path()
qdev: Add a get_dev_path() function to BusInfo
pc: Allocate all ram in a single qemu_ram_alloc()
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'hw/pci.c')
-rw-r--r-- | hw/pci.c | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -61,11 +61,13 @@ struct PCIBus { }; static void pcibus_dev_print(Monitor *mon, DeviceState *dev, int indent); +static char *pcibus_get_dev_path(DeviceState *dev); static struct BusInfo pci_bus_info = { .name = "PCI", .size = sizeof(PCIBus), .print_dev = pcibus_dev_print, + .get_dev_path = pcibus_get_dev_path, .props = (Property[]) { DEFINE_PROP_PCI_DEVFN("addr", PCIDevice, devfn, -1), DEFINE_PROP_STRING("romfile", PCIDevice, romfile), @@ -233,7 +235,7 @@ void pci_bus_new_inplace(PCIBus *bus, DeviceState *parent, QLIST_INIT(&bus->child); pci_host_bus_register(0, bus); /* for now only pci domain 0 is supported */ - vmstate_register(-1, &vmstate_pcibus, bus); + vmstate_register(NULL, -1, &vmstate_pcibus, bus); qemu_register_reset(pci_bus_reset, bus); } @@ -2029,6 +2031,18 @@ static void pcibus_dev_print(Monitor *mon, DeviceState *dev, int indent) } } +static char *pcibus_get_dev_path(DeviceState *dev) +{ + PCIDevice *d = (PCIDevice *)dev; + char path[16]; + + snprintf(path, sizeof(path), "%04x:%02x:%02x.%x", + pci_find_domain(d->bus), d->config[PCI_SECONDARY_BUS], + PCI_SLOT(d->devfn), PCI_FUNC(d->devfn)); + + return strdup(path); +} + static PCIDeviceInfo bridge_info = { .qdev.name = "pci-bridge", .qdev.size = sizeof(PCIBridge), |