From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58603) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WtJqg-0003JR-1n for qemu-devel@nongnu.org; Sat, 07 Jun 2014 12:52:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WtJqe-0001u2-VP for qemu-devel@nongnu.org; Sat, 07 Jun 2014 12:52:05 -0400 From: Peter Maydell Date: Sat, 7 Jun 2014 17:52:04 +0100 Message-Id: <1402159924-13853-1-git-send-email-peter.maydell@linaro.org> Subject: [Qemu-devel] [PATCH] hw/net/eepro100: Implement read-only bits in MDI registers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org, patches@linaro.org 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-read code use it rather than manually making registers 2 and 3 totally read-only and the rest totally read-write. Signed-off-by: Peter Maydell --- This seemed a better fix for the unused variable than just deleting it... hw/net/eepro100.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c index 3b891ca..9c70cce 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) { -- 1.8.5.4