[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 04/16] pci: Implement BusInfo.get_dev_path()
From: |
Alex Williamson |
Subject: |
[Qemu-devel] [PATCH v2 04/16] pci: Implement BusInfo.get_dev_path() |
Date: |
Fri, 25 Jun 2010 11:08:59 -0600 |
User-agent: |
StGIT/0.14.3 |
This works great for PCI since a <segment>:<bus>:<dev>.<fn> uniquely
describes a global address. No need to traverse up the qdev tree.
PCI segment support is a placeholder for compatibility once we
support multiple segments.
Signed-off-by: Alex Williamson <address@hidden>
---
hw/pci.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/hw/pci.c b/hw/pci.c
index 7787005..1e77ae6 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -58,11 +58,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),
@@ -1853,6 +1855,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),
- [Qemu-devel] [PATCH v2 14/16] qemu_ram_free: Implement it, (continued)
- [Qemu-devel] [PATCH v2 14/16] qemu_ram_free: Implement it, Alex Williamson, 2010/06/25
- [Qemu-devel] [PATCH v2 15/16] pci: Free the space allocated for the option rom on removal, Alex Williamson, 2010/06/25
- [Qemu-devel] [PATCH v2 13/16] savevm: Create a new continue flag to avoid resending block name, Alex Williamson, 2010/06/25
- [Qemu-devel] [PATCH v2 12/16] savevm: Use RAM blocks for basis of migration, Alex Williamson, 2010/06/25
- [Qemu-devel] [PATCH v2 10/16] ramblocks: Make use of DeviceState pointer and BusInfo.get_dev_path, Alex Williamson, 2010/06/25
- [Qemu-devel] [PATCH v2 11/16] savevm: Migrate RAM based on name/offset, Alex Williamson, 2010/06/25
- [Qemu-devel] [PATCH v2 07/16] eepro100: Add a dev field to eeprom new/free functions, Alex Williamson, 2010/06/25
- [Qemu-devel] [PATCH v2 08/16] virtio-net: Incorporate a DeviceState pointer and let savevm track instances, Alex Williamson, 2010/06/25
- [Qemu-devel] [PATCH v2 09/16] qemu_ram_alloc: Add DeviceState and name parameters, Alex Williamson, 2010/06/25
- [Qemu-devel] [PATCH v2 06/16] savevm: Make use of DeviceState, Alex Williamson, 2010/06/25
- [Qemu-devel] [PATCH v2 04/16] pci: Implement BusInfo.get_dev_path(),
Alex Williamson <=
- [Qemu-devel] [PATCH v2 02/16] pc: Allocate all ram in a single qemu_ram_alloc(), Alex Williamson, 2010/06/25
- [Qemu-devel] [PATCH v2 05/16] savevm: Add DeviceState param, Alex Williamson, 2010/06/25
- [Qemu-devel] [PATCH v2 01/16] Remove uses of ram.last_offset (aka last_ram_offset), Alex Williamson, 2010/06/25
- [Qemu-devel] [PATCH v2 03/16] qdev: Add a get_dev_path() function to BusInfo, Alex Williamson, 2010/06/25