parallel-isa.c 982 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * QEMU Parallel PORT (ISA bus helpers)
  3. *
  4. * These functions reside in a separate file since they also might be
  5. * required for linking when compiling QEMU without CONFIG_PARALLEL.
  6. *
  7. * Copyright (c) 2003 Fabrice Bellard
  8. *
  9. * SPDX-License-Identifier: MIT
  10. */
  11. #include "qemu/osdep.h"
  12. #include "sysemu/sysemu.h"
  13. #include "hw/isa/isa.h"
  14. #include "hw/qdev-properties.h"
  15. #include "hw/char/parallel.h"
  16. #include "qapi/error.h"
  17. static void parallel_init(ISABus *bus, int index, Chardev *chr)
  18. {
  19. DeviceState *dev;
  20. ISADevice *isadev;
  21. isadev = isa_new("isa-parallel");
  22. dev = DEVICE(isadev);
  23. qdev_prop_set_uint32(dev, "index", index);
  24. qdev_prop_set_chr(dev, "chardev", chr);
  25. isa_realize_and_unref(isadev, bus, &error_fatal);
  26. }
  27. void parallel_hds_isa_init(ISABus *bus, int n)
  28. {
  29. int i;
  30. assert(n <= MAX_PARALLEL_PORTS);
  31. for (i = 0; i < n; i++) {
  32. if (parallel_hds[i]) {
  33. parallel_init(bus, i, parallel_hds[i]);
  34. }
  35. }
  36. }