OSDN Git Service

hw/char/escc: Lower irq when transmit buffer is filled
authorStephen Checkoway <stephen.checkoway@oberlin.edu>
Fri, 19 Apr 2019 15:40:41 +0000 (11:40 -0400)
committerMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Fri, 17 May 2019 08:11:50 +0000 (09:11 +0100)
commit6b99a110c7f377edd194fe0cc4d3c44b11cf62d8
tree3e5777cfa3cb3ec5215e90cf35b7899e24afc9c6
parentd8276573da58e8ce78dab8c46dd660efd664bcb7
hw/char/escc: Lower irq when transmit buffer is filled

The SCC/ESCC will briefly stop asserting an interrupt when the
transmit FIFO is filled.

This code doesn't model the transmit FIFO/shift register so the
pending transmit interrupt is never deasserted which means that an
edge-triggered interrupt controller will never see the low-to-high
transition it needs to raise another interrupt. The practical
consequence of this is that guest firmware with an interrupt service
routine for the ESCC that does not send all of the data it has
immediately will stop sending data if the following sequence of
events occurs:
1. Disable processor interrupts
2. Write a character to the ESCC
3. Add additional characters to a buffer which is drained by the ISR
4. Enable processor interrupts

In this case, the first character will be sent, the interrupt will
fire and the ISR will output the second character. Since the pending
transmit interrupt remains asserted, no additional interrupts will
ever fire.

This behavior was triggered by firmware for an embedded system with a
Z85C30 which necessitated this patch.

This patch fixes that situation by explicitly lowering the IRQ when a
character is written to the buffer and no other interrupts are currently
pending.

Signed-off-by: Stephen Checkoway <stephen.checkoway@oberlin.edu>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
hw/char/escc.c