Commit aeeb69c73e0c239be10ac411c41e986f3c23acf2

Authored by aurel32
1 parent 13d7ec0f

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.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6295 c046a42c-6fe2-441c-8c8c-71466251a162
hw/escc.c
... ... @@ -719,8 +719,9 @@ static int escc_load(QEMUFile *f, void *opaque, int version_id)
719 719  
720 720 }
721 721  
722   -int escc_init(target_phys_addr_t base, qemu_irq irq, CharDriverState *chrA,
723   - CharDriverState *chrB, int clock, int it_shift)
  722 +int escc_init(target_phys_addr_t base, qemu_irq irqA, qemu_irq irqB,
  723 + CharDriverState *chrA, CharDriverState *chrB,
  724 + int clock, int it_shift)
724 725 {
725 726 int escc_io_memory, i;
726 727 SerialState *s;
... ... @@ -741,9 +742,10 @@ int escc_init(target_phys_addr_t base, qemu_irq irq, CharDriverState *chrA,
741 742 s->chn[1].chr = chrA;
742 743 s->chn[0].disabled = 0;
743 744 s->chn[1].disabled = 0;
  745 + s->chn[0].irq = irqB;
  746 + s->chn[1].irq = irqA;
744 747  
745 748 for (i = 0; i < 2; i++) {
746   - s->chn[i].irq = irq;
747 749 s->chn[i].chn = 1 - i;
748 750 s->chn[i].type = ser;
749 751 s->chn[i].clock = clock / 2;
... ...
hw/escc.h
1 1 /* escc.c */
2 2 #define ESCC_SIZE 4
3   -int escc_init(target_phys_addr_t base, qemu_irq irq, CharDriverState *chrA,
4   - CharDriverState *chrB, int clock, int it_shift);
  3 +int escc_init(target_phys_addr_t base, qemu_irq irqA, qemu_irq irqB,
  4 + CharDriverState *chrA, CharDriverState *chrB,
  5 + int clock, int it_shift);
5 6  
6 7 void slavio_serial_ms_kbd_init(target_phys_addr_t base, qemu_irq irq,
7 8 int disabled, int clock, int it_shift);
... ...
hw/ppc_chrp.c
... ... @@ -263,8 +263,8 @@ static void ppc_core99_init (ram_addr_t ram_size, int vga_ram_size,
263 263 /* XXX: suppress that */
264 264 dummy_irq = i8259_init(NULL);
265 265  
266   - escc_mem_index = escc_init(0x80013000, dummy_irq[4], serial_hds[0],
267   - serial_hds[1], ESCC_CLOCK, 4);
  266 + escc_mem_index = escc_init(0x80013000, dummy_irq[4], dummy_irq[5],
  267 + serial_hds[0], serial_hds[1], ESCC_CLOCK, 4);
268 268  
269 269 for(i = 0; i < nb_nics; i++)
270 270 pci_nic_init(pci_bus, &nd_table[i], -1, "ne2k_pci");
... ...
hw/ppc_oldworld.c
... ... @@ -304,7 +304,7 @@ static void ppc_heathrow_init (ram_addr_t ram_size, int vga_ram_size,
304 304 /* XXX: suppress that */
305 305 dummy_irq = i8259_init(NULL);
306 306  
307   - escc_mem_index = escc_init(0x80013000, pic[0x10], serial_hds[0],
  307 + escc_mem_index = escc_init(0x80013000, pic[0x0f], pic[0x10], serial_hds[0],
308 308 serial_hds[1], ESCC_CLOCK, 4);
309 309  
310 310 for(i = 0; i < nb_nics; i++)
... ...
hw/sun4m.c
... ... @@ -548,8 +548,8 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef, ram_addr_t RAM_size,
548 548 nographic, ESCC_CLOCK, 1);
549 549 // Slavio TTYA (base+4, Linux ttyS0) is the first Qemu serial device
550 550 // Slavio TTYB (base+0, Linux ttyS1) is the second Qemu serial device
551   - escc_init(hwdef->serial_base, slavio_irq[hwdef->ser_irq], serial_hds[0],
552   - serial_hds[1], ESCC_CLOCK, 1);
  551 + escc_init(hwdef->serial_base, slavio_irq[hwdef->ser_irq], slavio_irq[hwdef->ser_irq],
  552 + serial_hds[0], serial_hds[1], ESCC_CLOCK, 1);
553 553  
554 554 cpu_halt = qemu_allocate_irqs(cpu_halt_signal, NULL, 1);
555 555 slavio_misc = slavio_misc_init(hwdef->slavio_base, hwdef->apc_base,
... ... @@ -1331,8 +1331,8 @@ static void sun4d_hw_init(const struct sun4d_hwdef *hwdef, ram_addr_t RAM_size,
1331 1331 nographic, ESCC_CLOCK, 1);
1332 1332 // Slavio TTYA (base+4, Linux ttyS0) is the first Qemu serial device
1333 1333 // Slavio TTYB (base+0, Linux ttyS1) is the second Qemu serial device
1334   - escc_init(hwdef->serial_base, sbi_irq[hwdef->ser_irq], serial_hds[0],
1335   - serial_hds[1], ESCC_CLOCK, 1);
  1334 + escc_init(hwdef->serial_base, sbi_irq[hwdef->ser_irq], sbi_irq[hwdef->ser_irq],
  1335 + serial_hds[0], serial_hds[1], ESCC_CLOCK, 1);
1336 1336  
1337 1337 if (drive_get_max_bus(IF_SCSI) > 0) {
1338 1338 fprintf(stderr, "qemu: too many SCSI bus\n");
... ... @@ -1534,8 +1534,9 @@ static void sun4c_hw_init(const struct sun4c_hwdef *hwdef, ram_addr_t RAM_size,
1534 1534 nographic, ESCC_CLOCK, 1);
1535 1535 // Slavio TTYA (base+4, Linux ttyS0) is the first Qemu serial device
1536 1536 // Slavio TTYB (base+0, Linux ttyS1) is the second Qemu serial device
1537   - escc_init(hwdef->serial_base, slavio_irq[hwdef->ser_irq], serial_hds[0],
1538   - serial_hds[1], ESCC_CLOCK, 1);
  1537 + escc_init(hwdef->serial_base, slavio_irq[hwdef->ser_irq],
  1538 + slavio_irq[hwdef->ser_irq], serial_hds[0], serial_hds[1],
  1539 + ESCC_CLOCK, 1);
1539 1540  
1540 1541 slavio_misc = slavio_misc_init(0, 0, hwdef->aux1_base, 0,
1541 1542 slavio_irq[hwdef->me_irq], NULL, &fdc_tc);
... ...