Revision 9894c5d4

b/hw/spapr_pci.c
32 32

  
33 33
#include "hw/pci_internals.h"
34 34

  
35
static PCIDevice *find_dev(sPAPREnvironment *spapr,
36
                           uint64_t buid, uint32_t config_addr)
35
static sPAPRPHBState *find_phb(sPAPREnvironment *spapr, uint64_t buid)
37 36
{
38
    int devfn = (config_addr >> 8) & 0xFF;
39 37
    sPAPRPHBState *phb;
40 38

  
41 39
    QLIST_FOREACH(phb, &spapr->phbs, list) {
42
        BusChild *kid;
43

  
44 40
        if (phb->buid != buid) {
45 41
            continue;
46 42
        }
43
        return phb;
44
    }
45

  
46
    return NULL;
47
}
48

  
49
static PCIDevice *find_dev(sPAPREnvironment *spapr, uint64_t buid,
50
                           uint32_t config_addr)
51
{
52
    sPAPRPHBState *phb = find_phb(spapr, buid);
53
    BusChild *kid;
54
    int devfn = (config_addr >> 8) & 0xFF;
55

  
56
    if (!phb) {
57
        return NULL;
58
    }
47 59

  
48
        QTAILQ_FOREACH(kid, &phb->host_state.bus->qbus.children, sibling) {
49
            PCIDevice *dev = (PCIDevice *)kid->child;
50
            if (dev->devfn == devfn) {
51
                return dev;
52
            }
60
    QTAILQ_FOREACH(kid, &phb->host_state.bus->qbus.children, sibling) {
61
        PCIDevice *dev = (PCIDevice *)kid->child;
62
        if (dev->devfn == devfn) {
63
            return dev;
53 64
        }
54 65
    }
55 66

  

Also available in: Unified diff