[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 10/14] isa: add name parameter to device creation
From: |
Anthony Liguori |
Subject: |
[Qemu-devel] [PATCH 10/14] isa: add name parameter to device creation |
Date: |
Fri, 16 Sep 2011 11:00:30 -0500 |
This is mostly mechanical minus the changes to isa_simple_create()
Signed-off-by: Anthony Liguori <address@hidden>
---
hw/cs4231a.c | 2 +-
hw/fdc.h | 2 +-
hw/gus.c | 2 +-
hw/ide/isa.c | 2 +-
hw/isa-bus.c | 30 ++++++++++++++++++++++++------
hw/isa.h | 9 ++++++---
hw/m48t59.c | 2 +-
hw/mc146818rtc.c | 2 +-
hw/mips_fulong2e.c | 2 +-
hw/mips_malta.c | 2 +-
hw/mips_r4k.c | 2 +-
hw/pc.c | 8 ++++----
hw/pc.h | 12 ++++++------
hw/ppc_prep.c | 2 +-
hw/sb16.c | 2 +-
hw/sun4u.c | 2 +-
16 files changed, 52 insertions(+), 31 deletions(-)
diff --git a/hw/cs4231a.c b/hw/cs4231a.c
index 598f032..802be0f 100644
--- a/hw/cs4231a.c
+++ b/hw/cs4231a.c
@@ -661,7 +661,7 @@ static int cs4231a_initfn (ISADevice *dev)
int cs4231a_init (qemu_irq *pic)
{
- isa_create_simple ("cs4231a");
+ isa_create_simple ("cs4231a", NULL);
return 0;
}
diff --git a/hw/fdc.h b/hw/fdc.h
index 09f73c6..98a12c0 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");
+ dev = isa_try_create("isa-fdc", NULL);
if (!dev) {
return;
}
diff --git a/hw/gus.c b/hw/gus.c
index 37e543a..c22659e 100644
--- a/hw/gus.c
+++ b/hw/gus.c
@@ -296,7 +296,7 @@ static int gus_initfn (ISADevice *dev)
int GUS_init (qemu_irq *pic)
{
- isa_create_simple ("gus");
+ isa_create_simple ("gus", NULL);
return 0;
}
diff --git a/hw/ide/isa.c b/hw/ide/isa.c
index 28b69d2..46cadde 100644
--- a/hw/ide/isa.c
+++ b/hw/ide/isa.c
@@ -81,7 +81,7 @@ ISADevice *isa_ide_init(int iobase, int iobase2, int isairq,
ISADevice *dev;
ISAIDEState *s;
- dev = isa_create("isa-ide");
+ dev = isa_create("isa-ide", NULL);
qdev_prop_set_uint32(&dev->qdev, "iobase", iobase);
qdev_prop_set_uint32(&dev->qdev, "iobase2", iobase2);
qdev_prop_set_uint32(&dev->qdev, "irq", isairq);
diff --git a/hw/isa-bus.c b/hw/isa-bus.c
index 31d4d01..fb81737 100644
--- a/hw/isa-bus.c
+++ b/hw/isa-bus.c
@@ -124,7 +124,7 @@ void isa_qdev_register(ISADeviceInfo *info)
qdev_register(&info->qdev);
}
-ISADevice *isa_create(const char *name)
+static ISADevice *isa_createv(const char *name, const char *id, va_list ap)
{
DeviceState *dev;
@@ -132,27 +132,45 @@ ISADevice *isa_create(const char *name)
hw_error("Tried to create isa device %s with no isa bus present.",
name);
}
- dev = qdev_create(&isabus->qbus, name, NULL);
+ dev = qdev_createv(&isabus->qbus, name, id, ap);
return DO_UPCAST(ISADevice, qdev, dev);
}
-ISADevice *isa_try_create(const char *name)
+ISADevice *isa_create(const char *name, const char *id, ...)
+{
+ ISADevice *dev;
+ va_list ap;
+
+ va_start(ap, id);
+ dev = isa_createv(name, id, ap);
+ va_end(ap);
+
+ return dev;
+}
+
+ISADevice *isa_try_create(const char *name, const char *id, ...)
{
DeviceState *dev;
+ va_list ap;
if (!isabus) {
hw_error("Tried to create isa device %s with no isa bus present.",
name);
}
- dev = qdev_try_create(&isabus->qbus, name, NULL);
+ va_start(ap, id);
+ dev = qdev_try_create(&isabus->qbus, name, id, ap);
+ va_end(ap);
return DO_UPCAST(ISADevice, qdev, dev);
}
-ISADevice *isa_create_simple(const char *name)
+ISADevice *isa_create_simple(const char *name, const char *id, ...)
{
ISADevice *dev;
+ va_list ap;
- dev = isa_create(name);
+ va_start(ap, id);
+ dev = isa_create(name, id, ap);
+ va_end(ap);
qdev_init_nofail(&dev->qdev);
return dev;
}
diff --git a/hw/isa.h b/hw/isa.h
index f344699..26264d6 100644
--- a/hw/isa.h
+++ b/hw/isa.h
@@ -33,9 +33,12 @@ void isa_init_ioport(ISADevice *dev, uint16_t ioport);
void isa_init_ioport_range(ISADevice *dev, uint16_t start, uint16_t length);
void isa_qdev_register(ISADeviceInfo *info);
MemoryRegion *isa_address_space(ISADevice *dev);
-ISADevice *isa_create(const char *name);
-ISADevice *isa_try_create(const char *name);
-ISADevice *isa_create_simple(const char *name);
+ISADevice *isa_create(const char *name, const char *id, ...)
+ GCC_FMT_ATTR(2, 3);
+ISADevice *isa_try_create(const char *name, const char *id, ...)
+ GCC_FMT_ATTR(2, 3);
+ISADevice *isa_create_simple(const char *name, const char *id, ...)
+ GCC_FMT_ATTR(2, 3);
extern target_phys_addr_t isa_mem_base;
diff --git a/hw/m48t59.c b/hw/m48t59.c
index 50927b7..d1950f7 100644
--- a/hw/m48t59.c
+++ b/hw/m48t59.c
@@ -661,7 +661,7 @@ M48t59State *m48t59_init_isa(uint32_t io_base, uint16_t
size, int type)
ISADevice *dev;
M48t59State *s;
- dev = isa_create("m48t59_isa");
+ dev = isa_create("m48t59_isa", NULL);
qdev_prop_set_uint32(&dev->qdev, "type", type);
qdev_prop_set_uint32(&dev->qdev, "size", size);
qdev_prop_set_uint32(&dev->qdev, "io_base", io_base);
diff --git a/hw/mc146818rtc.c b/hw/mc146818rtc.c
index feb3b25..cf46d6e 100644
--- a/hw/mc146818rtc.c
+++ b/hw/mc146818rtc.c
@@ -646,7 +646,7 @@ ISADevice *rtc_init(int base_year, qemu_irq intercept_irq)
ISADevice *dev;
RTCState *s;
- dev = isa_create("mc146818rtc");
+ dev = isa_create("mc146818rtc", NULL);
s = DO_UPCAST(RTCState, dev, dev);
qdev_prop_set_int32(&dev->qdev, "base_year", base_year);
qdev_init_nofail(&dev->qdev);
diff --git a/hw/mips_fulong2e.c b/hw/mips_fulong2e.c
index f52b8c5..55f7bfd 100644
--- a/hw/mips_fulong2e.c
+++ b/hw/mips_fulong2e.c
@@ -363,7 +363,7 @@ static void mips_fulong2e_init(ram_addr_t ram_size, const
char *boot_device,
DMA_init(0, cpu_exit_irq);
/* Super I/O */
- isa_create_simple("i8042");
+ isa_create_simple("i8042", NULL);
rtc_init(2000, NULL);
diff --git a/hw/mips_malta.c b/hw/mips_malta.c
index e7cdf20..81503ff 100644
--- a/hw/mips_malta.c
+++ b/hw/mips_malta.c
@@ -952,7 +952,7 @@ void mips_malta_init (ram_addr_t ram_size,
DMA_init(0, cpu_exit_irq);
/* Super I/O */
- isa_create_simple("i8042");
+ isa_create_simple("i8042", NULL);
rtc_init(2000, NULL);
serial_isa_init(0, serial_hds[0]);
diff --git a/hw/mips_r4k.c b/hw/mips_r4k.c
index 5d002c5..ac54d6b 100644
--- a/hw/mips_r4k.c
+++ b/hw/mips_r4k.c
@@ -294,7 +294,7 @@ void mips_r4k_init (ram_addr_t ram_size,
hd[MAX_IDE_DEVS * i],
hd[MAX_IDE_DEVS * i + 1]);
- isa_create_simple("i8042");
+ isa_create_simple("i8042", NULL);
}
static QEMUMachine mips_machine = {
diff --git a/hw/pc.c b/hw/pc.c
index db5d5f3..cc9f857 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");
+ isa_create_simple("sga", NULL);
}
}
@@ -1161,11 +1161,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");
+ i8042 = isa_create_simple("i8042", NULL);
i8042_setup_a20_line(i8042, &a20_line[0]);
if (!no_vmport) {
vmport_init();
- vmmouse = isa_try_create("vmmouse");
+ vmmouse = isa_try_create("vmmouse", NULL);
} else {
vmmouse = NULL;
}
@@ -1173,7 +1173,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");
+ port92 = isa_create_simple("port92", NULL);
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 dae736e..77ec26f 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");
+ dev = isa_try_create("isa-serial", NULL);
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");
+ dev = isa_try_create("isa-parallel", NULL);
if (!dev) {
return false;
}
@@ -88,7 +88,7 @@ static inline ISADevice *pit_init(int base, int irq)
{
ISADevice *dev;
- dev = isa_create("isa-pit");
+ dev = isa_create("isa-pit", NULL);
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");
+ isa_create_simple("vmport", NULL);
}
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");
+ dev = isa_try_create("isa-vga", NULL);
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");
+ dev = isa_try_create("ne2k_isa", NULL);
if (!dev) {
return false;
}
diff --git a/hw/ppc_prep.c b/hw/ppc_prep.c
index 515de42..b5f40c9 100644
--- a/hw/ppc_prep.c
+++ b/hw/ppc_prep.c
@@ -688,7 +688,7 @@ static void ppc_prep_init (ram_addr_t ram_size,
hd[2 * i],
hd[2 * i + 1]);
}
- isa_create_simple("i8042");
+ isa_create_simple("i8042", NULL);
cpu_exit_irq = qemu_allocate_irqs(cpu_request_exit, NULL, 1);
DMA_init(1, cpu_exit_irq);
diff --git a/hw/sb16.c b/hw/sb16.c
index a76df1b..a92a5d1 100644
--- a/hw/sb16.c
+++ b/hw/sb16.c
@@ -1393,7 +1393,7 @@ static int sb16_initfn (ISADevice *dev)
int SB16_init (qemu_irq *pic)
{
- isa_create_simple ("sb16");
+ isa_create_simple ("sb16", NULL);
return 0;
}
diff --git a/hw/sun4u.c b/hw/sun4u.c
index ab6020f..ff9088e 100644
--- a/hw/sun4u.c
+++ b/hw/sun4u.c
@@ -794,7 +794,7 @@ static void sun4uv_init(ram_addr_t RAM_size,
pci_cmd646_ide_init(pci_bus, hd, 1);
- isa_create_simple("i8042");
+ isa_create_simple("i8042", NULL);
for(i = 0; i < MAX_FD; i++) {
fd[i] = drive_get(IF_FLOPPY, 0, i);
}
--
1.7.4.1
- [Qemu-devel] [PATCH 08/14] sysbus: make create_varargs take an id, (continued)
- [Qemu-devel] [PATCH 08/14] sysbus: make create_varargs take an id, Anthony Liguori, 2011/09/16
- [Qemu-devel] [PATCH 14/14] pc: assign names to machine created devices, Anthony Liguori, 2011/09/16
- [Qemu-devel] [PATCH 04/14] qdev: take ownership of id pointer, Anthony Liguori, 2011/09/16
- Re: [Qemu-devel] [PATCH 04/14] qdev: take ownership of id pointer, Gerd Hoffmann, 2011/09/19
- Re: [Qemu-devel] [PATCH 04/14] qdev: take ownership of id pointer, Anthony Liguori, 2011/09/19
- Re: [Qemu-devel] [PATCH 04/14] qdev: take ownership of id pointer, Gerd Hoffmann, 2011/09/20
- Re: [Qemu-devel] [PATCH 04/14] qdev: take ownership of id pointer, Anthony Liguori, 2011/09/20
- Re: [Qemu-devel] [PATCH 04/14] qdev: take ownership of id pointer, Gerd Hoffmann, 2011/09/20
- Re: [Qemu-devel] [PATCH 04/14] qdev: take ownership of id pointer, Anthony Liguori, 2011/09/20
- Re: [Qemu-devel] [PATCH 04/14] qdev: take ownership of id pointer, Gerd Hoffmann, 2011/09/20
[Qemu-devel] [PATCH 10/14] isa: add name parameter to device creation,
Anthony Liguori <=
[Qemu-devel] [PATCH 06/14] qdev: add ability to do QOM-style derived naming, Anthony Liguori, 2011/09/16
[Qemu-devel] [PATCH 07/14] sysbus: add an id argument to sysbus_create_simple(), Anthony Liguori, 2011/09/16
[Qemu-devel] [PATCH 11/14] pci: obtain devfn before initializing the device, Anthony Liguori, 2011/09/16
Re: [Qemu-devel] [PATCH 00/14] qdev: assign unique names to all devices (part 1), Anthony Liguori, 2011/09/16
Re: [Qemu-devel] [PATCH 00/14] qdev: assign unique names to all devices (part 1), Jan Kiszka, 2011/09/16