summaryrefslogtreecommitdiffstats
path: root/hw
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2015-03-25 09:29:20 +0100
committerMarkus Armbruster <armbru@redhat.com>2015-04-02 15:30:28 +0200
commitd71b22bb6ae281e66dfa17733105468f830a8c6a (patch)
tree03c9ce46a81f9e8551d0466cf423476b83576e3e /hw
parentaf9e40aa8f36e30e89f16323b3d341ee59309b7e (diff)
downloadhqemu-d71b22bb6ae281e66dfa17733105468f830a8c6a.zip
hqemu-d71b22bb6ae281e66dfa17733105468f830a8c6a.tar.gz
hw: Mark devices picking up char backends actively FIXME
Character devices defined with -serial and -parallel are for board initialization to wire up. Board code examines serial_hds[] and parallel_hds[] to find them, and creates devices with their qdev chardev properties set accordingly. Except a few devices go on a fishing expedition for a suitable backend instead of exposing a chardev property for board code to set: they use serial_hds[] (often via qemu_char_get_next_serial()) or parallel_hds[] in their realize() or init() method to connect to a backend. Picking up backends that way works when the devices are created by board code. But it's inappropriate for -device or device_add. Not only is it inconsistent with how the other characrer device models work (they connect to a backend explicitly identified by a "chardev" property), it breaks when the backend has been picked up by the board or a previous -device / device_add already. Example: $ qemu-system-ppc64 -M bamboo -S -device i82378 -device pc87312 -device pc87312 qemu-system-ppc64: -device pc87312: Property 'isa-parallel.chardev' can't take value 'parallel0', it's in use Mark them with suitable FIXME comments. Cc: Li Guang <lig.fnst@cn.fujitsu.com> Cc: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Cc: Antony Pavlov <antonynpavlov@gmail.com> Cc: "Edgar E. Iglesias" <edgar.iglesias@gmail.com> Cc: Michael Walle <michael@walle.cc> Cc: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Cc: "Andreas Färber" <andreas.faerber@web.de> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/arm/allwinner-a10.c1
-rw-r--r--hw/char/cadence_uart.c1
-rw-r--r--hw/char/digic-uart.c1
-rw-r--r--hw/char/etraxfs_ser.c1
-rw-r--r--hw/char/lm32_juart.c1
-rw-r--r--hw/char/lm32_uart.c1
-rw-r--r--hw/char/milkymist-uart.c1
-rw-r--r--hw/char/pl011.c1
-rw-r--r--hw/char/stm32f2xx_usart.c1
-rw-r--r--hw/char/xilinx_uartlite.c1
-rw-r--r--hw/isa/pc87312.c2
11 files changed, 12 insertions, 0 deletions
diff --git a/hw/arm/allwinner-a10.c b/hw/arm/allwinner-a10.c
index 01206f2..86965a7 100644
--- a/hw/arm/allwinner-a10.c
+++ b/hw/arm/allwinner-a10.c
@@ -92,6 +92,7 @@ static void aw_a10_realize(DeviceState *dev, Error **errp)
sysbus_mmio_map(sysbusdev, 0, AW_A10_EMAC_BASE);
sysbus_connect_irq(sysbusdev, 0, s->irq[55]);
+ /* FIXME use a qdev chardev prop instead of serial_hds[] */
serial_mm_init(get_system_memory(), AW_A10_UART0_REG_BASE, 2, s->irq[1],
115200, serial_hds[0], DEVICE_NATIVE_ENDIAN);
}
diff --git a/hw/char/cadence_uart.c b/hw/char/cadence_uart.c
index a5dc2a4..4f38f0c 100644
--- a/hw/char/cadence_uart.c
+++ b/hw/char/cadence_uart.c
@@ -483,6 +483,7 @@ static void cadence_uart_realize(DeviceState *dev, Error **errp)
s->fifo_trigger_handle = timer_new_ns(QEMU_CLOCK_VIRTUAL,
fifo_trigger_update, s);
+ /* FIXME use a qdev chardev prop instead of qemu_char_get_next_serial() */
s->chr = qemu_char_get_next_serial();
if (s->chr) {
diff --git a/hw/char/digic-uart.c b/hw/char/digic-uart.c
index 8abe944..f272491 100644
--- a/hw/char/digic-uart.c
+++ b/hw/char/digic-uart.c
@@ -143,6 +143,7 @@ static void digic_uart_realize(DeviceState *dev, Error **errp)
{
DigicUartState *s = DIGIC_UART(dev);
+ /* FIXME use a qdev chardev prop instead of qemu_char_get_next_serial() */
s->chr = qemu_char_get_next_serial();
if (s->chr) {
qemu_chr_add_handlers(s->chr, uart_can_rx, uart_rx, uart_event, s);
diff --git a/hw/char/etraxfs_ser.c b/hw/char/etraxfs_ser.c
index 460094e..3381b86 100644
--- a/hw/char/etraxfs_ser.c
+++ b/hw/char/etraxfs_ser.c
@@ -219,6 +219,7 @@ static int etraxfs_ser_init(SysBusDevice *dev)
"etraxfs-serial", R_MAX * 4);
sysbus_init_mmio(dev, &s->mmio);
+ /* FIXME use a qdev chardev prop instead of qemu_char_get_next_serial() */
s->chr = qemu_char_get_next_serial();
if (s->chr) {
qemu_chr_add_handlers(s->chr,
diff --git a/hw/char/lm32_juart.c b/hw/char/lm32_juart.c
index 628a86f..03285da 100644
--- a/hw/char/lm32_juart.c
+++ b/hw/char/lm32_juart.c
@@ -117,6 +117,7 @@ static int lm32_juart_init(SysBusDevice *dev)
{
LM32JuartState *s = LM32_JUART(dev);
+ /* FIXME use a qdev chardev prop instead of qemu_char_get_next_serial() */
s->chr = qemu_char_get_next_serial();
if (s->chr) {
qemu_chr_add_handlers(s->chr, juart_can_rx, juart_rx, juart_event, s);
diff --git a/hw/char/lm32_uart.c b/hw/char/lm32_uart.c
index 4f20966..39cad49 100644
--- a/hw/char/lm32_uart.c
+++ b/hw/char/lm32_uart.c
@@ -258,6 +258,7 @@ static int lm32_uart_init(SysBusDevice *dev)
"uart", R_MAX * 4);
sysbus_init_mmio(dev, &s->iomem);
+ /* FIXME use a qdev chardev prop instead of qemu_char_get_next_serial() */
s->chr = qemu_char_get_next_serial();
if (s->chr) {
qemu_chr_add_handlers(s->chr, uart_can_rx, uart_rx, uart_event, s);
diff --git a/hw/char/milkymist-uart.c b/hw/char/milkymist-uart.c
index d05b825..b79ea09 100644
--- a/hw/char/milkymist-uart.c
+++ b/hw/char/milkymist-uart.c
@@ -199,6 +199,7 @@ static void milkymist_uart_realize(DeviceState *dev, Error **errp)
{
MilkymistUartState *s = MILKYMIST_UART(dev);
+ /* FIXME use a qdev chardev prop instead of qemu_char_get_next_serial() */
s->chr = qemu_char_get_next_serial();
if (s->chr) {
qemu_chr_add_handlers(s->chr, uart_can_rx, uart_rx, uart_event, s);
diff --git a/hw/char/pl011.c b/hw/char/pl011.c
index 0a45115..d1cf00f 100644
--- a/hw/char/pl011.c
+++ b/hw/char/pl011.c
@@ -293,6 +293,7 @@ static void pl011_realize(DeviceState *dev, Error **errp)
{
PL011State *s = PL011(dev);
+ /* FIXME use a qdev chardev prop instead of qemu_char_get_next_serial() */
s->chr = qemu_char_get_next_serial();
if (s->chr) {
diff --git a/hw/char/stm32f2xx_usart.c b/hw/char/stm32f2xx_usart.c
index 260b053..669c4e3 100644
--- a/hw/char/stm32f2xx_usart.c
+++ b/hw/char/stm32f2xx_usart.c
@@ -198,6 +198,7 @@ static void stm32f2xx_usart_init(Object *obj)
TYPE_STM32F2XX_USART, 0x2000);
sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mmio);
+ /* FIXME use a qdev chardev prop instead of qemu_char_get_next_serial() */
s->chr = qemu_char_get_next_serial();
if (s->chr) {
diff --git a/hw/char/xilinx_uartlite.c b/hw/char/xilinx_uartlite.c
index f7c3cae..cb54684 100644
--- a/hw/char/xilinx_uartlite.c
+++ b/hw/char/xilinx_uartlite.c
@@ -205,6 +205,7 @@ static void xilinx_uartlite_realize(DeviceState *dev, Error **errp)
{
XilinxUARTLite *s = XILINX_UARTLITE(dev);
+ /* FIXME use a qdev chardev prop instead of qemu_char_get_next_serial() */
s->chr = qemu_char_get_next_serial();
if (s->chr)
qemu_chr_add_handlers(s->chr, uart_can_rx, uart_rx, uart_event, s);
diff --git a/hw/isa/pc87312.c b/hw/isa/pc87312.c
index 2849e8d..3b1fcec 100644
--- a/hw/isa/pc87312.c
+++ b/hw/isa/pc87312.c
@@ -278,6 +278,7 @@ static void pc87312_realize(DeviceState *dev, Error **errp)
pc87312_hard_reset(s);
if (is_parallel_enabled(s)) {
+ /* FIXME use a qdev chardev prop instead of parallel_hds[] */
chr = parallel_hds[0];
if (chr == NULL) {
chr = qemu_chr_new("par0", "null", NULL);
@@ -296,6 +297,7 @@ static void pc87312_realize(DeviceState *dev, Error **errp)
for (i = 0; i < 2; i++) {
if (is_uart_enabled(s, i)) {
+ /* FIXME use a qdev chardev prop instead of serial_hds[] */
chr = serial_hds[i];
if (chr == NULL) {
snprintf(name, sizeof(name), "ser%d", i);
OpenPOWER on IntegriCloud