From 5c66a6d0d684c7379c055fb2645ea0cd256e7c45 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Fri, 30 Oct 2020 17:08:14 -0300 Subject: [PATCH] Clean up VT82C686 Super I/O register writes --- src/sio/sio_vt82c686.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/sio/sio_vt82c686.c b/src/sio/sio_vt82c686.c index 932e79cb1..92d4eef12 100644 --- a/src/sio/sio_vt82c686.c +++ b/src/sio/sio_vt82c686.c @@ -104,12 +104,12 @@ vt82c686_write(uint16_t port, uint8_t val, void *priv) if (!dev->config_enable) return; - /* NOTE: Registers are [0xE0:0xFF] but we store them as [0x00:0x1F]. */ if (!(port & 1)) { dev->cur_reg = val; return; } + /* NOTE: Registers are [0xE0:0xFF] but we store them as [0x00:0x1F]. */ if (dev->cur_reg < 0xe0) return; uint8_t reg = dev->cur_reg & 0x1f; @@ -119,9 +119,10 @@ vt82c686_write(uint16_t port, uint8_t val, void *priv) (reg == 0x13) || (reg == 0x15) || (reg == 0x17) || (reg >= 0x19)) return; + dev->regs[reg] = val; + switch (reg) { case 0x02: - dev->regs[reg] = val; vt82c686_lpt_handler(dev); vt82c686_serial_handler(dev, 0); vt82c686_serial_handler(dev, 1); @@ -129,28 +130,20 @@ vt82c686_write(uint16_t port, uint8_t val, void *priv) break; case 0x03: - dev->regs[reg] = val; vt82c686_fdc_handler(dev); break; case 0x06: - dev->regs[reg] = val; vt82c686_lpt_handler(dev); break; case 0x07: - dev->regs[reg] = val; vt82c686_serial_handler(dev, 0); break; case 0x08: - dev->regs[reg] = val; vt82c686_serial_handler(dev, 1); break; - - default: - dev->regs[reg] = val; - break; } }