It seems to me that this is a lot clearer and less prone to error.
Signed-off-by: Simon Horman <horms@xxxxxxxxxxxx>
Index: ioemu-remote/hw/apb_pci.c
===================================================================
--- ioemu-remote.orig/hw/apb_pci.c 2009-02-17 17:28:23.000000000 +0900
+++ ioemu-remote/hw/apb_pci.c 2009-02-17 17:29:05.000000000 +0900
@@ -255,9 +255,10 @@ PCIBus *pci_apb_init(target_phys_addr_t
d->config[0x0E] = 0x00; // header_type
/* APB secondary busses */
- secondary = pci_bridge_init(s->bus, 8, 0x108e5000, pci_apb_map_irq,
+ secondary = pci_bridge_init(s->bus, PCI_DEVFN(1, 0), 0x108e5000,
+ pci_apb_map_irq,
"Advanced PCI Bus secondary bridge 1");
- pci_bridge_init(s->bus, 9, 0x108e5000, pci_apb_map_irq,
+ pci_bridge_init(s->bus, PCI_DEVFN(1, 1), 0x108e5000, pci_apb_map_irq,
"Advanced PCI Bus secondary bridge 2");
return secondary;
}
Index: ioemu-remote/hw/mips_malta.c
===================================================================
--- ioemu-remote.orig/hw/mips_malta.c 2009-02-17 17:28:23.000000000 +0900
+++ ioemu-remote/hw/mips_malta.c 2009-02-17 17:29:05.000000000 +0900
@@ -495,7 +495,7 @@ static void network_init (PCIBus *pci_bu
}
if (i == 0 && strcmp(nd->model, "pcnet") == 0) {
/* The malta board has a PCNet card using PCI SLOT 11 */
- pci_nic_init(pci_bus, nd, 88);
+ pci_nic_init(pci_bus, nd, PCI_DEVFN(11, 0));
} else {
pci_nic_init(pci_bus, nd, PCI_DEVFN_AUTO);
}
@@ -901,7 +901,7 @@ void mips_malta_init (ram_addr_t ram_siz
hd[i] = NULL;
}
- piix4_devfn = piix4_init(pci_bus, 80);
+ piix4_devfn = piix4_init(pci_bus, PCI_DEVFN(10, 0));
pci_piix4_ide_init(pci_bus, hd, piix4_devfn + 1, i8259);
usb_uhci_piix4_init(pci_bus, piix4_devfn + 2);
smbus = piix4_pm_init(pci_bus, piix4_devfn + 3, 0x1100, i8259[9]);
Index: ioemu-remote/hw/unin_pci.c
===================================================================
--- ioemu-remote.orig/hw/unin_pci.c 2009-02-17 17:28:23.000000000 +0900
+++ ioemu-remote/hw/unin_pci.c 2009-02-17 17:29:05.000000000 +0900
@@ -173,7 +173,7 @@ PCIBus *pci_pmac_init(qemu_irq *pic)
cpu_register_physical_memory(0xf2800000, 0x1000, pci_mem_config);
cpu_register_physical_memory(0xf2c00000, 0x1000, pci_mem_data);
d = pci_register_device(s->bus, "Uni-north main", sizeof(PCIDevice),
- 11 << 3, NULL, NULL);
+ PCI_DEVFN(11, 0), NULL, NULL);
d->config[0x00] = 0x6b; // vendor_id : Apple
d->config[0x01] = 0x10;
d->config[0x02] = 0x1F; // device_id
@@ -188,8 +188,8 @@ PCIBus *pci_pmac_init(qemu_irq *pic)
#if 0 // XXX: not activated as PPC BIOS doesn't handle multiple buses properly
/* pci-to-pci bridge */
- d = pci_register_device("Uni-north bridge", sizeof(PCIDevice), 0, 13 << 3,
- NULL, NULL);
+ d = pci_register_device("Uni-north bridge", sizeof(PCIDevice), 0,
+ PCI_DEVFN(13, 0), NULL, NULL);
d->config[0x00] = 0x11; // vendor_id : TI
d->config[0x01] = 0x10;
d->config[0x02] = 0x26; // device_id
@@ -227,8 +227,8 @@ PCIBus *pci_pmac_init(qemu_irq *pic)
cpu_register_physical_memory(0xf0800000, 0x1000, pci_mem_config);
cpu_register_physical_memory(0xf0c00000, 0x1000, pci_mem_data);
- d = pci_register_device("Uni-north AGP", sizeof(PCIDevice), 0, 11 << 3,
- NULL, NULL);
+ d = pci_register_device("Uni-north AGP", sizeof(PCIDevice), 0,
+ PCI_DEVFN(11, 0), NULL, NULL);
d->config[0x00] = 0x6b; // vendor_id : Apple
d->config[0x01] = 0x10;
d->config[0x02] = 0x20; // device_id
@@ -253,7 +253,7 @@ PCIBus *pci_pmac_init(qemu_irq *pic)
cpu_register_physical_memory(0xf4c00000, 0x1000, pci_mem_data);
d = pci_register_device("Uni-north internal", sizeof(PCIDevice),
- 3, 11 << 3, NULL, NULL);
+ 3, PCI_DEVFN(11, 0), NULL, NULL);
d->config[0x00] = 0x6b; // vendor_id : Apple
d->config[0x01] = 0x10;
d->config[0x02] = 0x1E; // device_id
Index: ioemu-remote/hw/pass-through.c
===================================================================
--- ioemu-remote.orig/hw/pass-through.c 2009-02-17 17:28:23.000000000 +0900
+++ ioemu-remote/hw/pass-through.c 2009-02-17 17:29:05.000000000 +0900
@@ -3333,7 +3333,7 @@ int power_on_php_slot(int php_slot)
pt_dev =
register_real_device(dpci_infos.e_bus,
"DIRECT PCI",
- pci_slot << 3,
+ PCI_DEVFN(pci_slot, 0),
php_dev->r_bus,
php_dev->r_dev,
php_dev->r_func,
--
--
Simon Horman
VA Linux Systems Japan K.K., Sydney, Australia Satellite Office
H: www.vergenet.net/~horms/ W: www.valinux.co.jp/en
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|