]> xenbits.xensource.com Git - qemu-upstream-4.6-testing.git/commitdiff
hw/net/eepro100: Implement read-only bits in MDI registers
authorPeter Maydell <peter.maydell@linaro.org>
Mon, 9 Jun 2014 15:03:08 +0000 (16:03 +0100)
committerStefan Hajnoczi <stefanha@redhat.com>
Fri, 27 Jun 2014 10:23:45 +0000 (12:23 +0200)
Although we defined an eepro100_mdi_mask[] array indicating which bits
in the registers are read-only, we weren't actually doing anything with
it. Make the MDI register-write code use it rather than manually making
register 1 read-only and leaving the rest as reads-as-written. (The
special-case handling of register 0 remains as before since its mask is
all-zeros and the special casing happens before we apply the masking.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1402159924-13853-1-git-send-email-peter.maydell@linaro.org
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
hw/net/eepro100.c

index aaa3ff236067d36d2161ef7d136d33c740948fb0..3263e3fe9080e9d593ca9d2e866003045d75963e 100644 (file)
@@ -1217,7 +1217,6 @@ static void eepro100_write_mdi(EEPRO100State *s)
                 break;
             case 1:            /* Status Register */
                 missing("not writable");
-                data = s->mdimem[reg];
                 break;
             case 2:            /* PHY Identification Register (Word 1) */
             case 3:            /* PHY Identification Register (Word 2) */
@@ -1230,7 +1229,8 @@ static void eepro100_write_mdi(EEPRO100State *s)
             default:
                 missing("not implemented");
             }
-            s->mdimem[reg] = data;
+            s->mdimem[reg] &= eepro100_mdi_mask[reg];
+            s->mdimem[reg] |= data & ~eepro100_mdi_mask[reg];
         } else if (opcode == 2) {
             /* MDI read */
             switch (reg) {