xref: /openbmc/qemu/hw/char/parallel-isa.c (revision 09a274d8)
1 /*
2  * QEMU Parallel PORT (ISA bus helpers)
3  *
4  * Copyright (c) 2003 Fabrice Bellard
5  *
6  * SPDX-License-Identifier: MIT
7  */
8 #include "qemu/osdep.h"
9 #include "sysemu/sysemu.h"
10 #include "hw/isa/isa.h"
11 #include "hw/char/parallel.h"
12 
13 static void parallel_init(ISABus *bus, int index, Chardev *chr)
14 {
15     DeviceState *dev;
16     ISADevice *isadev;
17 
18     isadev = isa_create(bus, "isa-parallel");
19     dev = DEVICE(isadev);
20     qdev_prop_set_uint32(dev, "index", index);
21     qdev_prop_set_chr(dev, "chardev", chr);
22     qdev_init_nofail(dev);
23 }
24 
25 void parallel_hds_isa_init(ISABus *bus, int n)
26 {
27     int i;
28 
29     assert(n <= MAX_PARALLEL_PORTS);
30 
31     for (i = 0; i < n; i++) {
32         if (parallel_hds[i]) {
33             parallel_init(bus, i, parallel_hds[i]);
34         }
35     }
36 }
37