serial: add "baudbase" property
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
diff --git a/hw/char/serial-isa.c b/hw/char/serial-isa.c
index 9a5928b..2a4c8de 100644
--- a/hw/char/serial-isa.c
+++ b/hw/char/serial-isa.c
@@ -73,7 +73,6 @@
}
index++;
- s->baudbase = 115200;
isa_init_irq(isadev, &s->irq, isa->isairq);
serial_realize_core(s, errp);
qdev_set_legacy_instance_id(dev, isa->iobase, 3);
diff --git a/hw/char/serial-pci-multi.c b/hw/char/serial-pci-multi.c
index edfbfdc..4891f32 100644
--- a/hw/char/serial-pci-multi.c
+++ b/hw/char/serial-pci-multi.c
@@ -106,7 +106,6 @@
for (i = 0; i < nports; i++) {
s = pci->state + i;
- s->baudbase = 115200;
serial_realize_core(s, &err);
if (err != NULL) {
error_propagate(errp, err);
diff --git a/hw/char/serial-pci.c b/hw/char/serial-pci.c
index f99b6c1..db2c17a 100644
--- a/hw/char/serial-pci.c
+++ b/hw/char/serial-pci.c
@@ -49,7 +49,6 @@
SerialState *s = &pci->state;
Error *err = NULL;
- s->baudbase = 115200;
serial_realize_core(s, &err);
if (err != NULL) {
error_propagate(errp, err);
diff --git a/hw/char/serial.c b/hw/char/serial.c
index 1746dbc..a4f0566 100644
--- a/hw/char/serial.c
+++ b/hw/char/serial.c
@@ -988,7 +988,7 @@
SerialState *s = SERIAL(dev);
s->irq = irq;
- s->baudbase = baudbase;
+ qdev_prop_set_uint32(dev, "baudbase", baudbase);
qdev_prop_set_chr(dev, "chardev", chr);
serial_realize_core(s, &error_fatal);
qdev_set_legacy_instance_id(dev, base, 2);
@@ -1002,6 +1002,7 @@
static Property serial_properties[] = {
DEFINE_PROP_CHR("chardev", SerialState, chr),
+ DEFINE_PROP_UINT32("baudbase", SerialState, baudbase, 115200),
DEFINE_PROP_END_OF_LIST(),
};
@@ -1072,7 +1073,7 @@
s->it_shift = it_shift;
s->irq = irq;
- s->baudbase = baudbase;
+ qdev_prop_set_uint32(dev, "baudbase", baudbase);
qdev_prop_set_chr(dev, "chardev", chr);
serial_realize_core(s, &error_fatal);
diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h
index 180cc7c..3dc6185 100644
--- a/include/hw/char/serial.h
+++ b/include/hw/char/serial.h
@@ -58,7 +58,7 @@
CharBackend chr;
int last_break_enable;
int it_shift;
- int baudbase;
+ uint32_t baudbase;
uint32_t tsr_retry;
guint watch_tag;
uint32_t wakeup;