aboutsummaryrefslogtreecommitdiff
path: root/hw/char
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2015-02-04 18:33:07 +0100
committerAndreas Färber <afaerber@suse.de>2015-02-24 00:19:06 +0100
commit07dc788054d714a07df08e2eacc8c2e1c47b9a58 (patch)
tree5a5436a35e76190b98b7c6ac23a293792376b3f2 /hw/char
parentc6f10a5876a81f7a016714df06730c48210ee419 (diff)
parallel: Factor out common parallel_hds_isa_init()
Maintainers of affected machines cc'ed. Cc: Anthony Liguori <aliguori@amazon.com> Cc: "Michael S. Tsirkin" <mst@redhat.com> Cc: Aurelien Jarno <aurelien@aurel32.net> Cc: Leon Alrae <leon.alrae@imgtec.com> Cc: Blue Swirl <blauwirbel@gmail.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'hw/char')
-rw-r--r--hw/char/parallel.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/hw/char/parallel.c b/hw/char/parallel.c
index c2b553f0d1..710cefcd94 100644
--- a/hw/char/parallel.c
+++ b/hw/char/parallel.c
@@ -641,3 +641,34 @@ static void parallel_register_types(void)
}
type_init(parallel_register_types)
+
+static bool parallel_init(ISABus *bus, int index, CharDriverState *chr)
+{
+ DeviceState *dev;
+ ISADevice *isadev;
+
+ isadev = isa_try_create(bus, "isa-parallel");
+ if (!isadev) {
+ return false;
+ }
+ dev = DEVICE(isadev);
+ qdev_prop_set_uint32(dev, "index", index);
+ qdev_prop_set_chr(dev, "chardev", chr);
+ if (qdev_init(dev) < 0) {
+ return false;
+ }
+ return true;
+}
+
+void parallel_hds_isa_init(ISABus *bus, int n)
+{
+ int i;
+
+ assert(n <= MAX_PARALLEL_PORTS);
+
+ for (i = 0; i < n; i++) {
+ if (parallel_hds[i]) {
+ parallel_init(bus, i, parallel_hds[i]);
+ }
+ }
+}