#include "qemu/cutils.h"
#include "hw/qdev-properties.h"
#include "hw/clock.h"
+#include "hw/boards.h"
/*
* Aliases were a bad idea from the start. Let's keep them
[DEVICE_CATEGORY_SOUND] = "Sound",
[DEVICE_CATEGORY_MISC] = "Misc",
[DEVICE_CATEGORY_CPU] = "CPU",
+ [DEVICE_CATEGORY_WATCHDOG]= "Watchdog",
[DEVICE_CATEGORY_MAX] = "Uncategorized",
};
GSList *list, *elt;
return NULL;
}
+ if (object_class_dynamic_cast(oc, TYPE_SYS_BUS_DEVICE)) {
+ /* sysbus devices need to be allowed by the machine */
+ MachineClass *mc = MACHINE_CLASS(object_get_class(qdev_get_machine()));
+ if (!device_type_is_dynamic_sysbus(mc, *driver)) {
+ error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "driver",
+ "a dynamic sysbus device type for the machine");
+ return NULL;
+ }
+ }
+
return dc;
}
}
}
- if (qdict_haskey(opts, "failover_pair_id")) {
- if (!qdict_haskey(opts, "id")) {
- error_setg(errp, "Device with failover_pair_id don't have id");
- return NULL;
- }
- if (qdev_should_hide_device(opts, from_json, errp)) {
- if (bus && !qbus_is_hotpluggable(bus)) {
- error_setg(errp, QERR_BUS_NO_HOTPLUG, bus->name);
- }
- return NULL;
- } else if (*errp) {
- return NULL;
+ if (qdev_should_hide_device(opts, from_json, errp)) {
+ if (bus && !qbus_is_hotpluggable(bus)) {
+ error_setg(errp, QERR_BUS_NO_HOTPLUG, bus->name);
}
+ return NULL;
+ } else if (*errp) {
+ return NULL;
}
if (phase_check(PHASE_MACHINE_READY) && bus && !qbus_is_hotpluggable(bus)) {
static DeviceState *find_device_state(const char *id, Error **errp)
{
- Object *obj;
+ Object *obj = object_resolve_path_at(qdev_get_peripheral(), id);
DeviceState *dev;
- if (id[0] == '/') {
- obj = object_resolve_path(id, NULL);
- } else {
- obj = object_resolve_path_component(qdev_get_peripheral(), id);
- }
-
if (!obj) {
error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
"Device '%s' not found", id);