From: Peter Maydell Date: Mon, 9 Jun 2014 15:03:08 +0000 (+0100) Subject: hw/net/eepro100: Implement read-only bits in MDI registers X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.2~629^2~22^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a89b4c2d12129e0563c14be8185efbe979a83e01;p=sdk%2Femulator%2Fqemu.git hw/net/eepro100: Implement read-only bits in MDI registers 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.) Change-Id: I28b6ee4691f5e8c325430eb429bee1b06c9a818e Signed-off-by: Peter Maydell Message-id: 1402159924-13853-1-git-send-email-peter.maydell@linaro.org Signed-off-by: Stefan Hajnoczi --- diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c index 3b891ca340..9c70cce2a8 100644 --- a/hw/net/eepro100.c +++ b/hw/net/eepro100.c @@ -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) {