aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
Diffstat (limited to 'hw')
-rw-r--r--hw/char/parallel.c31
-rw-r--r--hw/i386/pc.c7
-rw-r--r--hw/mips/mips_fulong2e.c5
-rw-r--r--hw/mips/mips_malta.c4
-rw-r--r--hw/sparc64/sun4u.c7
5 files changed, 36 insertions, 18 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]);
+ }
+ }
+}
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 18ed2634f3..ed623e1090 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1420,12 +1420,7 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
}
serial_hds_isa_init(isa_bus, MAX_SERIAL_PORTS);
-
- for(i = 0; i < MAX_PARALLEL_PORTS; i++) {
- if (parallel_hds[i]) {
- parallel_init(isa_bus, i, parallel_hds[i]);
- }
- }
+ parallel_hds_isa_init(isa_bus, MAX_PARALLEL_PORTS);
a20_line = qemu_allocate_irqs(handle_a20_line_change, first_cpu, 2);
i8042 = isa_create_simple(isa_bus, "i8042");
diff --git a/hw/mips/mips_fulong2e.c b/hw/mips/mips_fulong2e.c
index bebf7defbe..ea73585a92 100644
--- a/hw/mips/mips_fulong2e.c
+++ b/hw/mips/mips_fulong2e.c
@@ -384,10 +384,7 @@ static void mips_fulong2e_init(MachineState *machine)
rtc_init(isa_bus, 2000, NULL);
serial_hds_isa_init(isa_bus, MAX_SERIAL_PORTS);
-
- if (parallel_hds[0]) {
- parallel_init(isa_bus, 0, parallel_hds[0]);
- }
+ parallel_hds_isa_init(isa_bus, 1);
/* Sound card */
audio_init(pci_bus);
diff --git a/hw/mips/mips_malta.c b/hw/mips/mips_malta.c
index e57f78c1e5..533b2e60fe 100644
--- a/hw/mips/mips_malta.c
+++ b/hw/mips/mips_malta.c
@@ -1173,8 +1173,8 @@ void mips_malta_init(MachineState *machine)
rtc_init(isa_bus, 2000, NULL);
serial_hds_isa_init(isa_bus, 2);
- if (parallel_hds[0])
- parallel_init(isa_bus, 0, parallel_hds[0]);
+ parallel_hds_isa_init(isa_bus, 1);
+
for(i = 0; i < MAX_FD; i++) {
fd[i] = drive_get(IF_FLOPPY, 0, i);
}
diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
index 082b8e0eb3..17cf61f720 100644
--- a/hw/sparc64/sun4u.c
+++ b/hw/sparc64/sun4u.c
@@ -851,12 +851,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
}
serial_hds_isa_init(isa_bus, MAX_SERIAL_PORTS);
-
- for(i = 0; i < MAX_PARALLEL_PORTS; i++) {
- if (parallel_hds[i]) {
- parallel_init(isa_bus, i, parallel_hds[i]);
- }
- }
+ parallel_hds_isa_init(isa_bus, MAX_PARALLEL_PORTS);
for(i = 0; i < nb_nics; i++)
pci_nic_init_nofail(&nd_table[i], pci_bus, "ne2k_pci", NULL);