diff mbox

[00/25] pci: various pci clean up and pci express support. V2

Message ID 20091002193057.GB24813%yamahata@valinux.co.jp
State Superseded
Headers show

Commit Message

Isaku Yamahata Oct. 2, 2009, 7:30 p.m. UTC
Thank you for testing.
Does the following patch helps?

Comments

Gerd Hoffmann Oct. 5, 2009, 1:21 p.m. UTC | #1
On 10/02/09 21:30, Isaku Yamahata wrote:
> Thank you for testing.
> Does the following patch helps?

Partly.  ppc works again, sparc64 does still segfault.

cheers,
   Gerd
diff mbox

Patch

diff --git a/hw/pci.c b/hw/pci.c
index 24aaba0..d562410 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -812,10 +812,15 @@  static uint32_t pci_data_read_common(PCIDevice *pci_dev,
 
 static inline PCIDevice *pci_addr_to_dev(PCIBus *bus, uint32_t addr)
 {
-    int bus_num = (addr >> 16) & 0xff;
-    unsigned int devfn = (addr >> 8) & 0xff;
+    uint8_t bus_num = (addr >> 16) & 0xff;
+    uint8_t devfn = (addr >> 8) & 0xff;
+    PCIBus *s = pci_find_bus(bus, bus_num);
 
-    return pci_find_device(bus, bus_num, PCI_SLOT(devfn), PCI_FUNC(devfn));
+    if (!s) {
+        return NULL;
+    }
+
+    return pci_find_device(s, bus_num, PCI_SLOT(devfn), PCI_FUNC(devfn));
 }
 
 static inline uint32_t pci_addr_to_config(uint32_t addr)