This gives names to all of the devices created by the PC machine. This need to be unique to the pc, but not necessarily unique to the device.
Signed-off-by: Anthony Liguori <aligu...@us.ibm.com> --- hw/fdc.h | 2 +- hw/kvmclock.c | 2 +- hw/pc.c | 11 ++++++----- hw/pc.h | 12 ++++++------ hw/pc_piix.c | 2 +- hw/piix_pci.c | 2 +- hw/smbus_eeprom.c | 3 ++- 7 files changed, 18 insertions(+), 16 deletions(-) diff --git a/hw/fdc.h b/hw/fdc.h index 98a12c0..6545540 100644 --- a/hw/fdc.h +++ b/hw/fdc.h @@ -11,7 +11,7 @@ static inline void fdctrl_init_isa(DriveInfo **fds) { ISADevice *dev; - dev = isa_try_create("isa-fdc", NULL); + dev = isa_try_create("isa-fdc", "::fdc"); if (!dev) { return; } diff --git a/hw/kvmclock.c b/hw/kvmclock.c index f920b10..193430d 100644 --- a/hw/kvmclock.c +++ b/hw/kvmclock.c @@ -103,7 +103,7 @@ void kvmclock_create(void) if (kvm_enabled() && first_cpu->cpuid_kvm_features & ((1ULL << KVM_FEATURE_CLOCKSOURCE) | (1ULL << KVM_FEATURE_CLOCKSOURCE2))) { - sysbus_create_simple("kvmclock", -1, NULL, NULL); + sysbus_create_simple("kvmclock", -1, NULL, "::kvmclock"); } } diff --git a/hw/pc.c b/hw/pc.c index cc9f857..7d112b1 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -1103,7 +1103,7 @@ void pc_vga_init(PCIBus *pci_bus) * For nographic case, sga is enabled at all times */ if (display_type == DT_NOGRAPHIC) { - isa_create_simple("sga", NULL); + isa_create_simple("sga", "::sga"); } } @@ -1132,7 +1132,8 @@ void pc_basic_device_init(qemu_irq *isa_irq, register_ioport_write(0xf0, 1, 1, ioportF0_write, NULL); if (!no_hpet) { - DeviceState *hpet = sysbus_try_create_simple("hpet", HPET_BASE, NULL, NULL); + DeviceState *hpet = sysbus_try_create_simple("hpet", HPET_BASE, NULL, + "::hpet"); if (hpet) { for (i = 0; i < 24; i++) { @@ -1161,11 +1162,11 @@ void pc_basic_device_init(qemu_irq *isa_irq, } a20_line = qemu_allocate_irqs(handle_a20_line_change, first_cpu, 2); - i8042 = isa_create_simple("i8042", NULL); + i8042 = isa_create_simple("i8042", "::i8042"); i8042_setup_a20_line(i8042, &a20_line[0]); if (!no_vmport) { vmport_init(); - vmmouse = isa_try_create("vmmouse", NULL); + vmmouse = isa_try_create("vmmouse", "::vmmouse"); } else { vmmouse = NULL; } @@ -1173,7 +1174,7 @@ void pc_basic_device_init(qemu_irq *isa_irq, qdev_prop_set_ptr(&vmmouse->qdev, "ps2_mouse", i8042); qdev_init_nofail(&vmmouse->qdev); } - port92 = isa_create_simple("port92", NULL); + port92 = isa_create_simple("port92", "::port92"); port92_init(port92, &a20_line[1]); cpu_exit_irq = qemu_allocate_irqs(cpu_request_exit, NULL, 1); diff --git a/hw/pc.h b/hw/pc.h index 77ec26f..e103aa2 100644 --- a/hw/pc.h +++ b/hw/pc.h @@ -23,7 +23,7 @@ static inline bool serial_isa_init(int index, CharDriverState *chr) { ISADevice *dev; - dev = isa_try_create("isa-serial", NULL); + dev = isa_try_create("isa-serial", "::ttyS%d", index); if (!dev) { return false; } @@ -42,7 +42,7 @@ static inline bool parallel_init(int index, CharDriverState *chr) { ISADevice *dev; - dev = isa_try_create("isa-parallel", NULL); + dev = isa_try_create("isa-parallel", "::ppt%d", index); if (!dev) { return false; } @@ -88,7 +88,7 @@ static inline ISADevice *pit_init(int base, int irq) { ISADevice *dev; - dev = isa_create("isa-pit", NULL); + dev = isa_create("isa-pit", "::pit"); qdev_prop_set_uint32(&dev->qdev, "iobase", base); qdev_prop_set_uint32(&dev->qdev, "irq", irq); qdev_init_nofail(&dev->qdev); @@ -108,7 +108,7 @@ void hpet_pit_enable(void); /* vmport.c */ static inline void vmport_init(void) { - isa_create_simple("vmport", NULL); + isa_create_simple("vmport", "::vmport"); } void vmport_register(unsigned char command, IOPortReadFunc *func, void *opaque); void vmmouse_get_data(uint32_t *data); @@ -208,7 +208,7 @@ static inline int isa_vga_init(void) { ISADevice *dev; - dev = isa_try_create("isa-vga", NULL); + dev = isa_try_create("isa-vga", "::vga"); if (!dev) { fprintf(stderr, "Warning: isa-vga not available\n"); return 0; @@ -233,7 +233,7 @@ static inline bool isa_ne2000_init(int base, int irq, NICInfo *nd) qemu_check_nic_model(nd, "ne2k_isa"); - dev = isa_try_create("ne2k_isa", NULL); + dev = isa_try_create("ne2k_isa", "::ne2k@0x%x", base); if (!dev) { return false; } diff --git a/hw/pc_piix.c b/hw/pc_piix.c index 8f0ebd6..91ed44d 100644 --- a/hw/pc_piix.c +++ b/hw/pc_piix.c @@ -59,7 +59,7 @@ static void ioapic_init(IsaIrqState *isa_irq_state) SysBusDevice *d; unsigned int i; - dev = qdev_create(NULL, "ioapic", NULL); + dev = qdev_create(NULL, "ioapic", "::ioapic"); qdev_init_nofail(dev); d = sysbus_from_qdev(dev); sysbus_mmio_map(d, 0, 0xfec00000); diff --git a/hw/piix_pci.c b/hw/piix_pci.c index 14ebcee..5b4b889 100644 --- a/hw/piix_pci.c +++ b/hw/piix_pci.c @@ -281,7 +281,7 @@ static PCIBus *i440fx_common_init(const char *device_name, PIIX3State *piix3; PCII440FXState *f; - dev = qdev_create(NULL, "i440FX-pcihost", NULL); + dev = qdev_create(NULL, "i440FX-pcihost", "::i440fx"); s = FROM_SYSBUS(I440FXState, sysbus_from_qdev(dev)); s->address_space = address_space_mem; b = pci_bus_new(&s->busdev.qdev, NULL, pci_address_space, diff --git a/hw/smbus_eeprom.c b/hw/smbus_eeprom.c index ea7c123..3c3d619 100644 --- a/hw/smbus_eeprom.c +++ b/hw/smbus_eeprom.c @@ -137,7 +137,8 @@ void smbus_eeprom_init(i2c_bus *smbus, int nb_eeprom, for (i = 0; i < nb_eeprom; i++) { DeviceState *eeprom; - eeprom = qdev_create((BusState *)smbus, "smbus-eeprom", NULL); + eeprom = qdev_create((BusState *)smbus, "smbus-eeprom", + "::eeprom[%d]", i); qdev_prop_set_uint8(eeprom, "address", 0x50 + i); qdev_prop_set_ptr(eeprom, "data", eeprom_buf + (i * 256)); qdev_init_nofail(eeprom); -- 1.7.4.1