summaryrefslogtreecommitdiffstats
path: root/hw/pci.c
diff options
context:
space:
mode:
authorIsaku Yamahata <yamahata@valinux.co.jp>2010-06-23 16:15:26 +0900
committerBlue Swirl <blauwirbel@gmail.com>2010-07-11 20:00:53 +0300
commit6fa84913eccec4266a27c81ae88465f6790742b9 (patch)
tree3a599d136b179f7ef25b54f18533385601e37c32 /hw/pci.c
parent520128bde824d208c0309bcfcdd6ffc4eb450099 (diff)
downloadhqemu-6fa84913eccec4266a27c81ae88465f6790742b9.zip
hqemu-6fa84913eccec4266a27c81ae88465f6790742b9.tar.gz
pci: insert assert that auto-assigned-address function is single function device.
Auto-assigned-address pci function (passing devfn = -1) is always single function. This patch adds assert() to guarantee that auto-assigned-address function is always single function device at function = 0. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'hw/pci.c')
-rw-r--r--hw/pci.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/hw/pci.c b/hw/pci.c
index a7ff566..11d9b70 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -227,6 +227,7 @@ void pci_bus_new_inplace(PCIBus *bus, DeviceState *parent,
const char *name, int devfn_min)
{
qbus_create_inplace(&bus->qbus, &pci_bus_info, parent, name);
+ assert(PCI_FUNC(devfn_min) == 0);
bus->devfn_min = devfn_min;
/* host bridge */
@@ -608,7 +609,7 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
{
if (devfn < 0) {
for(devfn = bus->devfn_min ; devfn < ARRAY_SIZE(bus->devices);
- devfn += 8) {
+ devfn += PCI_FUNC_MAX) {
if (!bus->devices[devfn])
goto found;
}
OpenPOWER on IntegriCloud