]> git.proxmox.com Git - mirror_qemu.git/blame - hw/char/parallel-isa.c
Merge tag 'pull-maintainer-may24-160524-2' of https://gitlab.com/stsquad/qemu into...
[mirror_qemu.git] / hw / char / parallel-isa.c
CommitLineData
bb3d5ea8
PMD
1/*
2 * QEMU Parallel PORT (ISA bus helpers)
3 *
3e3fdad6
TH
4 * These functions reside in a separate file since they also might be
5 * required for linking when compiling QEMU without CONFIG_PARALLEL.
6 *
bb3d5ea8
PMD
7 * Copyright (c) 2003 Fabrice Bellard
8 *
9 * SPDX-License-Identifier: MIT
10 */
a27bd6c7 11
bb3d5ea8
PMD
12#include "qemu/osdep.h"
13#include "sysemu/sysemu.h"
14#include "hw/isa/isa.h"
a27bd6c7 15#include "hw/qdev-properties.h"
9cc44d9b 16#include "hw/char/parallel-isa.h"
bb3d5ea8 17#include "hw/char/parallel.h"
96927c74 18#include "qapi/error.h"
bb3d5ea8
PMD
19
20static void parallel_init(ISABus *bus, int index, Chardev *chr)
21{
22 DeviceState *dev;
23 ISADevice *isadev;
24
963e94a9 25 isadev = isa_new(TYPE_ISA_PARALLEL);
bb3d5ea8
PMD
26 dev = DEVICE(isadev);
27 qdev_prop_set_uint32(dev, "index", index);
28 qdev_prop_set_chr(dev, "chardev", chr);
96927c74 29 isa_realize_and_unref(isadev, bus, &error_fatal);
bb3d5ea8
PMD
30}
31
32void parallel_hds_isa_init(ISABus *bus, int n)
33{
34 int i;
35
36 assert(n <= MAX_PARALLEL_PORTS);
37
38 for (i = 0; i < n; i++) {
39 if (parallel_hds[i]) {
40 parallel_init(bus, i, parallel_hds[i]);
41 }
42 }
43}
1d1afd9f
BB
44
45void isa_parallel_set_iobase(ISADevice *parallel, hwaddr iobase)
46{
47 ISAParallelState *s = ISA_PARALLEL(parallel);
48
49 parallel->ioport_id = iobase;
50 s->iobase = iobase;
51 portio_list_set_address(&s->portio_list, s->iobase);
52}
53
54void isa_parallel_set_enabled(ISADevice *parallel, bool enabled)
55{
56 portio_list_set_enabled(&ISA_PARALLEL(parallel)->portio_list, enabled);
57}