hw/net/eepro100: Implement read-only bits in MDI registers
PATCH v2 1/1 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.)
Message-id: [email protected]
---
No code change, but I fixed the errors in the commit message.
hw/net/eepro100.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/net/eepro100.c +2 -2
@@ -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) {
Signature · 1 line
1.9.2
Ping! Stefan, you said you were going to take this via the net queue?
thanks
-- PMM
Quoted 39 lines · Peter Maydell
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 <[email protected]>Message-id: [email protected]
---
No code change, but I fixed the errors in the commit message.hw/net/eepro100.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)hw/net/eepro100.c +2
-3@@ -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) { --1.9.2
Stefan Hajnoczi
AppliedQuoted 7 lines · Peter Maydell
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.)
Quoted 7 lines
Signed-off-by Peter Maydell <[email protected]>Message-id: [email protected]
---
No code change, but I fixed the errors in the commit message.hw/net/eepro100.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Thanks, applied to my net tree:
https://github.com/stefanha/qemu/commits/net
Stefan