OSDN Git Service

vt82c686: Fix superio_cfg_{read,write}() functions
authorBALATON Zoltan <balaton@eik.bme.hu>
Sat, 9 Jan 2021 20:16:36 +0000 (21:16 +0100)
committerPhilippe Mathieu-Daudé <f4bug@amsat.org>
Sun, 21 Feb 2021 18:42:34 +0000 (19:42 +0100)
These functions are memory region callbacks so we have to check
against relative address not the mapped address.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Message-Id: <15b2968fd300a12d06b42368d084f6f80d3c3be5.1610223397.git.balaton@eik.bme.hu>
[PMD: Split original patch in 5, this is part 5/5]
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
hw/isa/vt82c686.c

index 766584c..5db9b17 100644 (file)
@@ -260,12 +260,13 @@ static void superio_cfg_write(void *opaque, hwaddr addr, uint64_t data,
     SuperIOConfig *sc = opaque;
     uint8_t idx = sc->regs[0];
 
-    if (addr == 0x3f0) { /* config index register */
-        idx = data & 0xff;
+    if (addr == 0) { /* config index register */
+        sc->regs[0] = data;
         return;
     }
-    /* 0x3f1, config data register */
-    trace_via_superio_write(idx, data & 0xff);
+
+    /* config data register */
+    trace_via_superio_write(idx, data);
     switch (idx) {
     case 0x00 ... 0xdf:
     case 0xe4:
@@ -284,7 +285,7 @@ static void superio_cfg_write(void *opaque, hwaddr addr, uint64_t data,
                       "via_superio_cfg: unimplemented register 0x%x\n", idx);
         break;
     }
-    sc->regs[idx] = data & 0xff;
+    sc->regs[idx] = data;
 }
 
 static uint64_t superio_cfg_read(void *opaque, hwaddr addr, unsigned size)