escc: update the R_SPEC register SPEC_ALLSENT bit when writing to W_TXCTRL1
authorMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Thu, 18 Nov 2021 18:18:35 +0000 (18:18 +0000)
committerMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Sun, 21 Nov 2021 09:56:52 +0000 (09:56 +0000)
commit319e89cdc32096432b578152a47d0d156033b711
treee86a96d22f3b5244d2d82a2c95fb90c94da891f0
parentc29cd47e82df0bc7385cdd49a158d838314daa9e
escc: update the R_SPEC register SPEC_ALLSENT bit when writing to W_TXCTRL1

The ESCC datasheet states that SPEC_ALLSENT is always set in sync mode and set
in async mode once all characters have cleared the transmitter. Since writes to
SERIAL_DATA use a synchronous chardev API, the guest can never see the state when
transmission is in progress so it is possible to set SPEC_ALLSENT in the
R_SPEC register unconditionally.

This fixes a hang when using the Sun PROM as it attempts to enumerate the
onboard serial devices, and a similar hang in OpenBSD SPARC32 where in both cases
the boot process will not proceed until SPEC_ALLSENT has been set after writing
to W_TXCTRL1.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Message-Id: <20211118181835.18497-3-mark.cave-ayland@ilande.co.uk>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
hw/char/escc.c