Skip to contentSkip to conversation

[6295] escc: allow one IRQ per serial channel

Qemu-devel Aurelien Jarno 1 participant 1 message Jan 14, 2009

lore
Share & tools
lore
#0 lore raw

Revision: 6295

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6295
Author:   aurel32
Date:     2009-01-14 14:47:56 +0000 (Wed, 14 Jan 2009)

Log Message:
-----------
escc: allow one IRQ per serial channel

The Z85C30 on the PowerMAC machines have one interrupt per serial channel, while the Sparc machines have only one for both. Allow the emulated device to use one IRQ per channel.

Patch by Laurent Vivier.

Modified Paths:
--------------
trunk/hw/escc.c
trunk/hw/escc.h
trunk/hw/ppc_chrp.c
trunk/hw/ppc_oldworld.c
trunk/hw/sun4m.c

Modified: trunk/hw/escc.c
===================================================================

hw/escc.c +5 -3
@@ -719,8 +719,9 @@
 
 }
 
-int escc_init(target_phys_addr_t base, qemu_irq irq, CharDriverState *chrA,
-              CharDriverState *chrB, int clock, int it_shift)
+int escc_init(target_phys_addr_t base, qemu_irq irqA, qemu_irq irqB,
+              CharDriverState *chrA, CharDriverState *chrB,
+              int clock, int it_shift)
 {
     int escc_io_memory, i;
     SerialState *s;
@@ -741,9 +742,10 @@
     s->chn[1].chr = chrA;
     s->chn[0].disabled = 0;
     s->chn[1].disabled = 0;
+    s->chn[0].irq = irqB;
+    s->chn[1].irq = irqA;
 
     for (i = 0; i < 2; i++) {
-        s->chn[i].irq = irq;
         s->chn[i].chn = 1 - i;
         s->chn[i].type = ser;
         s->chn[i].clock = clock / 2;

Modified: trunk/hw/escc.h
===================================================================

hw/escc.h +3 -2
@@ -1,7 +1,8 @@
 /* escc.c */
 #define ESCC_SIZE 4
-int escc_init(target_phys_addr_t base, qemu_irq irq, CharDriverState *chrA,
-              CharDriverState *chrB, int clock, int it_shift);
+int escc_init(target_phys_addr_t base, qemu_irq irqA, qemu_irq irqB,
+              CharDriverState *chrA, CharDriverState *chrB,
+              int clock, int it_shift);
 
 void slavio_serial_ms_kbd_init(target_phys_addr_t base, qemu_irq irq,
                                int disabled, int clock, int it_shift);

Modified: trunk/hw/ppc_chrp.c
===================================================================

hw/ppc_chrp.c +2 -2
@@ -263,8 +263,8 @@
     /* XXX: suppress that */
     dummy_irq = i8259_init(NULL);
 
-    escc_mem_index = escc_init(0x80013000, dummy_irq[4], serial_hds[0],
-                               serial_hds[1], ESCC_CLOCK, 4);
+    escc_mem_index = escc_init(0x80013000, dummy_irq[4], dummy_irq[5],
+                               serial_hds[0], serial_hds[1], ESCC_CLOCK, 4);
 
     for(i = 0; i < nb_nics; i++)
         pci_nic_init(pci_bus, &nd_table[i], -1, "ne2k_pci");

Modified: trunk/hw/ppc_oldworld.c
===================================================================

hw/ppc_oldworld.c +1 -1
@@ -304,7 +304,7 @@
     /* XXX: suppress that */
     dummy_irq = i8259_init(NULL);
 
-    escc_mem_index = escc_init(0x80013000, pic[0x10], serial_hds[0],
+    escc_mem_index = escc_init(0x80013000, pic[0x0f], pic[0x10], serial_hds[0],
                                serial_hds[1], ESCC_CLOCK, 4);
 
     for(i = 0; i < nb_nics; i++)

Modified: trunk/hw/sun4m.c
===================================================================

hw/sun4m.c +7 -6
@@ -548,8 +548,8 @@
                               nographic, ESCC_CLOCK, 1);
     // Slavio TTYA (base+4, Linux ttyS0) is the first Qemu serial device
     // Slavio TTYB (base+0, Linux ttyS1) is the second Qemu serial device
-    escc_init(hwdef->serial_base, slavio_irq[hwdef->ser_irq], serial_hds[0],
-              serial_hds[1], ESCC_CLOCK, 1);
+    escc_init(hwdef->serial_base, slavio_irq[hwdef->ser_irq], slavio_irq[hwdef->ser_irq],
+              serial_hds[0], serial_hds[1], ESCC_CLOCK, 1);
 
     cpu_halt = qemu_allocate_irqs(cpu_halt_signal, NULL, 1);
     slavio_misc = slavio_misc_init(hwdef->slavio_base, hwdef->apc_base,
@@ -1331,8 +1331,8 @@
                               nographic, ESCC_CLOCK, 1);
     // Slavio TTYA (base+4, Linux ttyS0) is the first Qemu serial device
     // Slavio TTYB (base+0, Linux ttyS1) is the second Qemu serial device
-    escc_init(hwdef->serial_base, sbi_irq[hwdef->ser_irq], serial_hds[0],
-              serial_hds[1], ESCC_CLOCK, 1);
+    escc_init(hwdef->serial_base, sbi_irq[hwdef->ser_irq], sbi_irq[hwdef->ser_irq],
+              serial_hds[0], serial_hds[1], ESCC_CLOCK, 1);
 
     if (drive_get_max_bus(IF_SCSI) > 0) {
         fprintf(stderr, "qemu: too many SCSI bus\n");
@@ -1534,8 +1534,9 @@
                               nographic, ESCC_CLOCK, 1);
     // Slavio TTYA (base+4, Linux ttyS0) is the first Qemu serial device
     // Slavio TTYB (base+0, Linux ttyS1) is the second Qemu serial device
-    escc_init(hwdef->serial_base, slavio_irq[hwdef->ser_irq], serial_hds[0],
-              serial_hds[1], ESCC_CLOCK, 1);
+    escc_init(hwdef->serial_base, slavio_irq[hwdef->ser_irq],
+              slavio_irq[hwdef->ser_irq], serial_hds[0], serial_hds[1],
+              ESCC_CLOCK, 1);
 
     slavio_misc = slavio_misc_init(0, 0, hwdef->aux1_base, 0,
                                    slavio_irq[hwdef->me_irq], NULL, &fdc_tc);