aboutsummaryrefslogtreecommitdiff
path: root/hw/char
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@linaro.org>2023-02-20 12:51:08 +0100
committerPeter Maydell <peter.maydell@linaro.org>2023-02-27 13:27:05 +0000
commit11f2ee1db6ed333a74a71fa38ce66fda926e230d (patch)
tree860dcff34e80949ce32b21c1f5e66521182aaf2a /hw/char
parentcb4c33f014925d860387ecef4d74a7f03cab6626 (diff)
downloadqemu-11f2ee1db6ed333a74a71fa38ce66fda926e230d.zip
qemu-11f2ee1db6ed333a74a71fa38ce66fda926e230d.tar.gz
qemu-11f2ee1db6ed333a74a71fa38ce66fda926e230d.tar.bz2
hw/char/pl011: Un-inline pl011_create()
pl011_create() is only used in DeviceRealize handlers, not a hot-path. Inlining is not justified. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20230220115114.25237-3-philmd@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/char')
-rw-r--r--hw/char/pl011.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/hw/char/pl011.c b/hw/char/pl011.c
index c15cb7a..77bbc2a 100644
--- a/hw/char/pl011.c
+++ b/hw/char/pl011.c
@@ -19,10 +19,12 @@
*/
#include "qemu/osdep.h"
+#include "qapi/error.h"
#include "hw/char/pl011.h"
#include "hw/irq.h"
#include "hw/sysbus.h"
#include "hw/qdev-clock.h"
+#include "hw/qdev-properties.h"
#include "hw/qdev-properties-system.h"
#include "migration/vmstate.h"
#include "chardev/char-fe.h"
@@ -31,6 +33,21 @@
#include "qemu/module.h"
#include "trace.h"
+DeviceState *pl011_create(hwaddr addr, qemu_irq irq, Chardev *chr)
+{
+ DeviceState *dev;
+ SysBusDevice *s;
+
+ dev = qdev_new("pl011");
+ s = SYS_BUS_DEVICE(dev);
+ qdev_prop_set_chr(dev, "chardev", chr);
+ sysbus_realize_and_unref(s, &error_fatal);
+ sysbus_mmio_map(s, 0, addr);
+ sysbus_connect_irq(s, 0, irq);
+
+ return dev;
+}
+
#define PL011_INT_TX 0x20
#define PL011_INT_RX 0x10