diff options
| author | Peter Maydell <peter.maydell@linaro.org> | 2015-05-05 18:22:12 +0100 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2015-05-05 18:22:12 +0100 |
| commit | 233353ec93e4541fa7ab1c53a922a6d5c2bfce7a (patch) | |
| tree | 39ff570f5e091ca43323e7270f80bb9176a9907f /hw | |
| parent | 874e9aeeeb74c5459639a93439a502d262847e68 (diff) | |
| parent | ff55d72eaf9628e7d58e7b067b361cdbf789c9f4 (diff) | |
| download | focaccia-qemu-233353ec93e4541fa7ab1c53a922a6d5c2bfce7a.tar.gz focaccia-qemu-233353ec93e4541fa7ab1c53a922a6d5c2bfce7a.zip | |
Merge remote-tracking branch 'remotes/armbru/tags/pull-qmp-2015-05-05' into staging
drop qapi nested structs # gpg: Signature made Tue May 5 17:40:40 2015 BST using RSA key ID EB918653 # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" * remotes/armbru/tags/pull-qmp-2015-05-05: (40 commits) qapi: Check for member name conflicts with a base class qapi: Support (subset of) \u escapes in strings qapi: Tweak doc references to QMP when QGA is also meant qapi: Drop dead visitor code related to nested structs qapi: Drop support for inline nested types qapi: Drop inline nested structs in query-pci qapi: Drop inline nested struct in query-version qapi: Drop tests for inline nested structs qapi: Merge UserDefTwo and UserDefNested in tests qapi: Forbid 'type' in schema qapi: Use 'struct' instead of 'type' in schema qapi: Document 'struct' metatype qapi: Prefer 'struct' over 'type' in generator qapi: More rigorous checking for type safety bypass qapi: Whitelist commands that don't return dictionary qapi: Require valid names qapi: More rigourous checking of types qapi: Add some type check tests qapi: Unify type bypass and add tests qapi: Allow true, false and null in schema json ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw')
| -rw-r--r-- | hw/pci/pci.c | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/hw/pci/pci.c b/hw/pci/pci.c index b3d5100112..f5c7a99717 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -1456,24 +1456,26 @@ static PciBridgeInfo *qmp_query_pci_bridge(PCIDevice *dev, PCIBus *bus, int bus_num) { PciBridgeInfo *info; + PciMemoryRange *range; - info = g_malloc0(sizeof(*info)); + info = g_new0(PciBridgeInfo, 1); - info->bus.number = dev->config[PCI_PRIMARY_BUS]; - info->bus.secondary = dev->config[PCI_SECONDARY_BUS]; - info->bus.subordinate = dev->config[PCI_SUBORDINATE_BUS]; + info->bus = g_new0(PciBusInfo, 1); + info->bus->number = dev->config[PCI_PRIMARY_BUS]; + info->bus->secondary = dev->config[PCI_SECONDARY_BUS]; + info->bus->subordinate = dev->config[PCI_SUBORDINATE_BUS]; - info->bus.io_range = g_malloc0(sizeof(*info->bus.io_range)); - info->bus.io_range->base = pci_bridge_get_base(dev, PCI_BASE_ADDRESS_SPACE_IO); - info->bus.io_range->limit = pci_bridge_get_limit(dev, PCI_BASE_ADDRESS_SPACE_IO); + range = info->bus->io_range = g_new0(PciMemoryRange, 1); + range->base = pci_bridge_get_base(dev, PCI_BASE_ADDRESS_SPACE_IO); + range->limit = pci_bridge_get_limit(dev, PCI_BASE_ADDRESS_SPACE_IO); - info->bus.memory_range = g_malloc0(sizeof(*info->bus.memory_range)); - info->bus.memory_range->base = pci_bridge_get_base(dev, PCI_BASE_ADDRESS_SPACE_MEMORY); - info->bus.memory_range->limit = pci_bridge_get_limit(dev, PCI_BASE_ADDRESS_SPACE_MEMORY); + range = info->bus->memory_range = g_new0(PciMemoryRange, 1); + range->base = pci_bridge_get_base(dev, PCI_BASE_ADDRESS_SPACE_MEMORY); + range->limit = pci_bridge_get_limit(dev, PCI_BASE_ADDRESS_SPACE_MEMORY); - info->bus.prefetchable_range = g_malloc0(sizeof(*info->bus.prefetchable_range)); - info->bus.prefetchable_range->base = pci_bridge_get_base(dev, PCI_BASE_ADDRESS_MEM_PREFETCH); - info->bus.prefetchable_range->limit = pci_bridge_get_limit(dev, PCI_BASE_ADDRESS_MEM_PREFETCH); + range = info->bus->prefetchable_range = g_new0(PciMemoryRange, 1); + range->base = pci_bridge_get_base(dev, PCI_BASE_ADDRESS_MEM_PREFETCH); + range->limit = pci_bridge_get_limit(dev, PCI_BASE_ADDRESS_MEM_PREFETCH); if (dev->config[PCI_SECONDARY_BUS] != 0) { PCIBus *child_bus = pci_find_bus_nr(bus, dev->config[PCI_SECONDARY_BUS]); @@ -1494,21 +1496,23 @@ static PciDeviceInfo *qmp_query_pci_device(PCIDevice *dev, PCIBus *bus, uint8_t type; int class; - info = g_malloc0(sizeof(*info)); + info = g_new0(PciDeviceInfo, 1); info->bus = bus_num; info->slot = PCI_SLOT(dev->devfn); info->function = PCI_FUNC(dev->devfn); + info->class_info = g_new0(PciDeviceClass, 1); class = pci_get_word(dev->config + PCI_CLASS_DEVICE); - info->class_info.q_class = class; + info->class_info->q_class = class; desc = get_class_desc(class); if (desc->desc) { - info->class_info.has_desc = true; - info->class_info.desc = g_strdup(desc->desc); + info->class_info->has_desc = true; + info->class_info->desc = g_strdup(desc->desc); } - info->id.vendor = pci_get_word(dev->config + PCI_VENDOR_ID); - info->id.device = pci_get_word(dev->config + PCI_DEVICE_ID); + info->id = g_new0(PciDeviceId, 1); + info->id->vendor = pci_get_word(dev->config + PCI_VENDOR_ID); + info->id->device = pci_get_word(dev->config + PCI_DEVICE_ID); info->regions = qmp_query_pci_regions(dev); info->qdev_id = g_strdup(dev->qdev.id ? dev->qdev.id : ""); |