qdev: introduce reset call back for qbus level
and make it called via qbus_reset_all(). The qbus reset callback will be used by pci bus reset. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
ec990eb622
commit
b4694b7ce8
10
hw/qdev.c
10
hw/qdev.c
|
@ -314,9 +314,17 @@ BusState *sysbus_get_default(void)
|
||||||
return main_system_bus;
|
return main_system_bus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int qbus_reset_one(BusState *bus, void *opaque)
|
||||||
|
{
|
||||||
|
if (bus->info->reset) {
|
||||||
|
return bus->info->reset(bus);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void qbus_reset_all(BusState *bus)
|
void qbus_reset_all(BusState *bus)
|
||||||
{
|
{
|
||||||
qbus_walk_children(bus, qdev_reset_one, NULL, NULL);
|
qbus_walk_children(bus, qdev_reset_one, qbus_reset_one, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* can be used as ->unplug() callback for the simple cases */
|
/* can be used as ->unplug() callback for the simple cases */
|
||||||
|
|
|
@ -49,12 +49,14 @@ struct DeviceState {
|
||||||
|
|
||||||
typedef void (*bus_dev_printfn)(Monitor *mon, DeviceState *dev, int indent);
|
typedef void (*bus_dev_printfn)(Monitor *mon, DeviceState *dev, int indent);
|
||||||
typedef char *(*bus_get_dev_path)(DeviceState *dev);
|
typedef char *(*bus_get_dev_path)(DeviceState *dev);
|
||||||
|
typedef int (qbus_resetfn)(BusState *bus);
|
||||||
|
|
||||||
struct BusInfo {
|
struct BusInfo {
|
||||||
const char *name;
|
const char *name;
|
||||||
size_t size;
|
size_t size;
|
||||||
bus_dev_printfn print_dev;
|
bus_dev_printfn print_dev;
|
||||||
bus_get_dev_path get_dev_path;
|
bus_get_dev_path get_dev_path;
|
||||||
|
qbus_resetfn *reset;
|
||||||
Property *props;
|
Property *props;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue