diff options
author | Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 2021-09-03 12:32:16 +0100 |
---|---|---|
committer | Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 2021-09-08 11:09:45 +0100 |
commit | 9d248a4be524a6c820634e9b58e79085972cb78f (patch) | |
tree | 31adb480c7a782e7e70e5e9edf3f2dc1cd33affe /hw/char | |
parent | 0e042025b9fe262316f29e4b8ec47f0b85c24e5f (diff) | |
download | qemu-9d248a4be524a6c820634e9b58e79085972cb78f.zip qemu-9d248a4be524a6c820634e9b58e79085972cb78f.tar.gz qemu-9d248a4be524a6c820634e9b58e79085972cb78f.tar.bz2 |
escc: reset register values to zero in escc_reset()
This is to ensure that a device reset always returns the ESCC to a known state.
Note that this is currently redundant with the same code in escc_reset_chn()
but that will change shortly.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20210903113223.19551-3-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Diffstat (limited to 'hw/char')
-rw-r--r-- | hw/char/escc.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/hw/char/escc.c b/hw/char/escc.c index c87ecd5..b0d3b92 100644 --- a/hw/char/escc.c +++ b/hw/char/escc.c @@ -300,9 +300,24 @@ static void escc_reset_chn(ESCCChannelState *s) static void escc_reset(DeviceState *d) { ESCCState *s = ESCC(d); + int i, j; - escc_reset_chn(&s->chn[0]); - escc_reset_chn(&s->chn[1]); + for (i = 0; i < 2; i++) { + ESCCChannelState *cs = &s->chn[i]; + + /* + * According to the ESCC datasheet "Miscellaneous Questions" section + * on page 384, the values of the ESCC registers are not guaranteed on + * power-on until an explicit hardware or software reset has been + * issued. For now we zero the registers so that a device reset always + * returns the emulated device to a fixed state. + */ + for (j = 0; j < ESCC_SERIAL_REGS; j++) { + cs->rregs[j] = 0; + cs->wregs[j] = 0; + } + escc_reset_chn(cs); + } } static inline void set_rxint(ESCCChannelState *s) |