Revision 9bb33586 hw/pci.c

b/hw/pci.c
43 43

  
44 44
static void pcibus_dev_print(Monitor *mon, DeviceState *dev, int indent);
45 45
static char *pcibus_get_dev_path(DeviceState *dev);
46
static int pcibus_reset(BusState *qbus);
46 47

  
47 48
struct BusInfo pci_bus_info = {
48 49
    .name       = "PCI",
49 50
    .size       = sizeof(PCIBus),
50 51
    .print_dev  = pcibus_dev_print,
51 52
    .get_dev_path = pcibus_get_dev_path,
53
    .reset      = pcibus_reset,
52 54
    .props      = (Property[]) {
53 55
        DEFINE_PROP_PCI_DEVFN("addr", PCIDevice, devfn, -1),
54 56
        DEFINE_PROP_STRING("romfile", PCIDevice, romfile),
......
136 138
static void pci_device_reset(PCIDevice *dev)
137 139
{
138 140
    int r;
141
    /* TODO: call the below unconditionally once all pci devices
142
     * are qdevified */
143
    if (dev->qdev.info) {
144
        qdev_reset_all(&dev->qdev);
145
    }
139 146

  
140 147
    dev->irq_state = 0;
141 148
    pci_update_irq_status(dev);
......
164 171
    pci_update_mappings(dev);
165 172
}
166 173

  
167
static void pci_bus_reset(void *opaque)
174
/*
175
 * Trigger pci bus reset under a given bus.
176
 * To be called on RST# assert.
177
 */
178
void pci_bus_reset(PCIBus *bus)
168 179
{
169
    PCIBus *bus = opaque;
170 180
    int i;
171 181

  
172 182
    for (i = 0; i < bus->nirq; i++) {
......
179 189
    }
180 190
}
181 191

  
192
static int pcibus_reset(BusState *qbus)
193
{
194
    pci_bus_reset(DO_UPCAST(PCIBus, qbus, qbus));
195

  
196
    /* topology traverse is done by pci_bus_reset().
197
       Tell qbus/qdev walker not to traverse the tree */
198
    return 1;
199
}
200

  
182 201
static void pci_host_bus_register(int domain, PCIBus *bus)
183 202
{
184 203
    struct PCIHostBus *host;
......
233 252
    pci_host_bus_register(0, bus); /* for now only pci domain 0 is supported */
234 253

  
235 254
    vmstate_register(NULL, -1, &vmstate_pcibus, bus);
236
    qemu_register_reset(pci_bus_reset, bus);
237 255
}
238 256

  
239 257
PCIBus *pci_bus_new(DeviceState *parent, const char *name, int devfn_min)

Also available in: Unified diff