Lines Matching full:bus

26 void qbus_set_hotplug_handler(BusState *bus, Object *handler)  in qbus_set_hotplug_handler()  argument
28 object_property_set_link(OBJECT(bus), QDEV_HOTPLUG_HANDLER_PROPERTY, in qbus_set_hotplug_handler()
32 void qbus_set_bus_hotplug_handler(BusState *bus) in qbus_set_bus_hotplug_handler() argument
34 qbus_set_hotplug_handler(bus, OBJECT(bus)); in qbus_set_bus_hotplug_handler()
37 int qbus_walk_children(BusState *bus, in qbus_walk_children() argument
46 err = pre_busfn(bus, opaque); in qbus_walk_children()
53 QTAILQ_FOREACH_RCU(kid, &bus->children, sibling) { in qbus_walk_children()
64 err = post_busfn(bus, opaque); in qbus_walk_children()
73 void bus_cold_reset(BusState *bus) in bus_cold_reset() argument
75 resettable_reset(OBJECT(bus), RESET_TYPE_COLD); in bus_cold_reset()
78 bool bus_is_in_reset(BusState *bus) in bus_is_in_reset() argument
80 return resettable_is_in_reset(OBJECT(bus)); in bus_is_in_reset()
85 BusState *bus = BUS(obj); in bus_get_reset_state() local
86 return &bus->reset; in bus_get_reset_state()
92 BusState *bus = BUS(obj); in bus_reset_child_foreach() local
96 QTAILQ_FOREACH_RCU(kid, &bus->children, sibling) { in bus_reset_child_foreach()
102 static void qbus_init_internal(BusState *bus, DeviceState *parent, in qbus_init_internal() argument
105 const char *typename = object_get_typename(OBJECT(bus)); in qbus_init_internal()
109 bus->parent = parent; in qbus_init_internal()
112 bus->name = g_strdup(name); in qbus_init_internal()
113 } else if (bus->parent && bus->parent->id) { in qbus_init_internal()
114 /* parent device has id -> use it plus parent-bus-id for bus name */ in qbus_init_internal()
115 bus_id = bus->parent->num_child_bus; in qbus_init_internal()
116 bus->name = g_strdup_printf("%s.%d", bus->parent->id, bus_id); in qbus_init_internal()
118 /* no id -> use lowercase bus type plus global bus-id for bus name */ in qbus_init_internal()
119 bc = BUS_GET_CLASS(bus); in qbus_init_internal()
121 bus->name = g_strdup_printf("%s.%d", typename, bus_id); in qbus_init_internal()
122 for (i = 0; bus->name[i]; i++) { in qbus_init_internal()
123 bus->name[i] = qemu_tolower(bus->name[i]); in qbus_init_internal()
127 if (bus->parent) { in qbus_init_internal()
128 QLIST_INSERT_HEAD(&bus->parent->child_bus, bus, sibling); in qbus_init_internal()
129 bus->parent->num_child_bus++; in qbus_init_internal()
130 object_property_add_child(OBJECT(bus->parent), bus->name, OBJECT(bus)); in qbus_init_internal()
131 object_unref(OBJECT(bus)); in qbus_init_internal()
133 /* The only bus without a parent is the main system bus */ in qbus_init_internal()
134 assert(bus == sysbus_get_default()); in qbus_init_internal()
140 BusState *bus = BUS(obj); in bus_unparent() local
143 /* Only the main system bus has no parent, and that bus is never freed */ in bus_unparent()
144 assert(bus->parent); in bus_unparent()
146 while ((kid = QTAILQ_FIRST(&bus->children)) != NULL) { in bus_unparent()
150 QLIST_REMOVE(bus, sibling); in bus_unparent()
151 bus->parent->num_child_bus--; in bus_unparent()
152 bus->parent = NULL; in bus_unparent()
155 void qbus_init(void *bus, size_t size, const char *typename, in qbus_init() argument
158 object_initialize(bus, size, typename); in qbus_init()
159 qbus_init_internal(bus, parent, name); in qbus_init()
164 BusState *bus; in qbus_new() local
166 bus = BUS(object_new(typename)); in qbus_new()
167 qbus_init_internal(bus, parent, name); in qbus_new()
169 return bus; in qbus_new()
172 bool qbus_realize(BusState *bus, Error **errp) in qbus_realize() argument
174 return object_property_set_bool(OBJECT(bus), "realized", true, errp); in qbus_realize()
177 void qbus_unrealize(BusState *bus) in qbus_unrealize() argument
179 object_property_set_bool(OBJECT(bus), "realized", false, &error_abort); in qbus_unrealize()
184 BusState *bus = BUS(obj); in bus_get_realized() local
186 return bus->realized; in bus_get_realized()
191 BusState *bus = BUS(obj); in bus_set_realized() local
192 BusClass *bc = BUS_GET_CLASS(bus); in bus_set_realized()
195 if (value && !bus->realized) { in bus_set_realized()
197 bc->realize(bus, errp); in bus_set_realized()
201 } else if (!value && bus->realized) { in bus_set_realized()
203 QTAILQ_FOREACH_RCU(kid, &bus->children, sibling) { in bus_set_realized()
209 bc->unrealize(bus); in bus_set_realized()
213 bus->realized = value; in bus_set_realized()
218 BusState *bus = BUS(obj); in qbus_initfn() local
220 QTAILQ_INIT(&bus->children); in qbus_initfn()
223 (Object **)&bus->hotplug_handler, in qbus_initfn()
249 BusState *bus = BUS(obj); in qbus_finalize() local
251 g_free(bus->name); in qbus_finalize()