Revision cae4956e hw/qdev.c
b/hw/qdev.c | ||
---|---|---|
29 | 29 |
#include "net.h" |
30 | 30 |
#include "qdev.h" |
31 | 31 |
#include "sysemu.h" |
32 |
#include "monitor.h" |
|
32 | 33 |
|
33 | 34 |
struct DeviceProperty { |
34 | 35 |
const char *name; |
... | ... | |
337 | 338 |
} |
338 | 339 |
return bus; |
339 | 340 |
} |
341 |
|
|
342 |
static const char *bus_type_names[] = { |
|
343 |
"System", |
|
344 |
"PCI", |
|
345 |
"SCSI", |
|
346 |
"I2C", |
|
347 |
"SSI" |
|
348 |
}; |
|
349 |
|
|
350 |
#define qdev_printf(fmt, ...) monitor_printf(mon, "%*s" fmt, indent, "", ## __VA_ARGS__) |
|
351 |
static void qbus_print(Monitor *mon, BusState *bus, int indent); |
|
352 |
|
|
353 |
static void qdev_print(Monitor *mon, DeviceState *dev, int indent) |
|
354 |
{ |
|
355 |
DeviceProperty *prop; |
|
356 |
BusState *child; |
|
357 |
qdev_printf("dev: %s\n", dev->type->name); |
|
358 |
indent += 2; |
|
359 |
if (dev->num_gpio_in) { |
|
360 |
qdev_printf("gpio-in %d\n", dev->num_gpio_in); |
|
361 |
} |
|
362 |
if (dev->num_gpio_out) { |
|
363 |
qdev_printf("gpio-out %d\n", dev->num_gpio_out); |
|
364 |
} |
|
365 |
for (prop = dev->props; prop; prop = prop->next) { |
|
366 |
switch (prop->type) { |
|
367 |
case PROP_TYPE_INT: |
|
368 |
qdev_printf("prop-int %s 0x%" PRIx64 "\n", prop->name, |
|
369 |
prop->value.i); |
|
370 |
break; |
|
371 |
case PROP_TYPE_PTR: |
|
372 |
qdev_printf("prop-ptr %s\n", prop->name); |
|
373 |
break; |
|
374 |
case PROP_TYPE_DEV: |
|
375 |
qdev_printf("prop-dev %s %s\n", prop->name, |
|
376 |
((DeviceState *)prop->value.ptr)->type->name); |
|
377 |
break; |
|
378 |
default: |
|
379 |
qdev_printf("prop-unknown%d %s\n", prop->type, prop->name); |
|
380 |
break; |
|
381 |
} |
|
382 |
} |
|
383 |
switch (dev->parent_bus->type) { |
|
384 |
case BUS_TYPE_SYSTEM: |
|
385 |
sysbus_dev_print(mon, dev, indent); |
|
386 |
break; |
|
387 |
default: |
|
388 |
break; |
|
389 |
} |
|
390 |
LIST_FOREACH(child, &dev->child_bus, sibling) { |
|
391 |
qbus_print(mon, child, indent); |
|
392 |
} |
|
393 |
} |
|
394 |
|
|
395 |
static void qbus_print(Monitor *mon, BusState *bus, int indent) |
|
396 |
{ |
|
397 |
struct DeviceState *dev; |
|
398 |
|
|
399 |
qdev_printf("bus: %s\n", bus->name); |
|
400 |
indent += 2; |
|
401 |
qdev_printf("type %s\n", bus_type_names[bus->type]); |
|
402 |
LIST_FOREACH(dev, &bus->children, sibling) { |
|
403 |
qdev_print(mon, dev, indent); |
|
404 |
} |
|
405 |
} |
|
406 |
#undef qdev_printf |
|
407 |
|
|
408 |
void do_info_qtree(Monitor *mon) |
|
409 |
{ |
|
410 |
if (main_system_bus) |
|
411 |
qbus_print(mon, main_system_bus, 0); |
|
412 |
} |
Also available in: Unified diff