[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 5/9] eepro100: Support byte/word read/write access t
From: |
Stefan Weil |
Subject: |
[Qemu-devel] [PATCH 5/9] eepro100: Support byte/word read/write access to MDI control register |
Date: |
Thu, 31 Mar 2011 22:33:27 +0200 |
MDI control is a 32 bit register, but may be read or written using
8 or 16 bit access. Data is latched when the MSB is written.
Add support for byte/word read/write access.
Signed-off-by: Stefan Weil <address@hidden>
---
hw/eepro100.c | 34 ++++++++++++++++++++++++++++++++--
1 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/hw/eepro100.c b/hw/eepro100.c
index df96394..2332556 100644
--- a/hw/eepro100.c
+++ b/hw/eepro100.c
@@ -1179,8 +1179,9 @@ static uint32_t eepro100_read_mdi(EEPRO100State * s)
return val;
}
-static void eepro100_write_mdi(EEPRO100State * s, uint32_t val)
+static void eepro100_write_mdi(EEPRO100State * s)
{
+ uint32_t val = e100_read_reg4(s, SCBCtrlMDI);
uint8_t raiseint = (val & BIT(29)) >> 29;
uint8_t opcode = (val & BITS(27, 26)) >> 26;
uint8_t phy = (val & BITS(25, 21)) >> 21;
@@ -1356,6 +1357,13 @@ static uint8_t eepro100_read1(EEPRO100State * s,
uint32_t addr)
case SCBeeprom:
val = eepro100_read_eeprom(s);
break;
+ case SCBCtrlMDI:
+ case SCBCtrlMDI + 1:
+ case SCBCtrlMDI + 2:
+ case SCBCtrlMDI + 3:
+ val = (uint8_t)(eepro100_read_mdi(s) >> (8 * (addr & 3)));
+ TRACE(OTHER, logout("addr=%s val=0x%02x\n", regname(addr), val));
+ break;
case SCBpmdr: /* Power Management Driver Register */
val = 0;
TRACE(OTHER, logout("addr=%s val=0x%02x\n", regname(addr), val));
@@ -1388,6 +1396,11 @@ static uint16_t eepro100_read2(EEPRO100State * s,
uint32_t addr)
val = eepro100_read_eeprom(s);
TRACE(OTHER, logout("addr=%s val=0x%04x\n", regname(addr), val));
break;
+ case SCBCtrlMDI:
+ case SCBCtrlMDI + 2:
+ val = (uint16_t)(eepro100_read_mdi(s) >> (8 * (addr & 3)));
+ TRACE(OTHER, logout("addr=%s val=0x%04x\n", regname(addr), val));
+ break;
default:
logout("addr=%s val=0x%04x\n", regname(addr), val);
missing("unknown word read");
@@ -1474,6 +1487,15 @@ static void eepro100_write1(EEPRO100State * s, uint32_t
addr, uint8_t val)
TRACE(OTHER, logout("addr=%s val=0x%02x\n", regname(addr), val));
eepro100_write_eeprom(s->eeprom, val);
break;
+ case SCBCtrlMDI:
+ case SCBCtrlMDI + 1:
+ case SCBCtrlMDI + 2:
+ TRACE(OTHER, logout("addr=%s val=0x%02x\n", regname(addr), val));
+ break;
+ case SCBCtrlMDI + 3:
+ TRACE(OTHER, logout("addr=%s val=0x%02x\n", regname(addr), val));
+ eepro100_write_mdi(s);
+ break;
default:
logout("addr=%s val=0x%02x\n", regname(addr), val);
missing("unknown byte write");
@@ -1513,6 +1535,13 @@ static void eepro100_write2(EEPRO100State * s, uint32_t
addr, uint16_t val)
TRACE(OTHER, logout("addr=%s val=0x%04x\n", regname(addr), val));
eepro100_write_eeprom(s->eeprom, val);
break;
+ case SCBCtrlMDI:
+ TRACE(OTHER, logout("addr=%s val=0x%04x\n", regname(addr), val));
+ break;
+ case SCBCtrlMDI + 2:
+ TRACE(OTHER, logout("addr=%s val=0x%04x\n", regname(addr), val));
+ eepro100_write_mdi(s);
+ break;
default:
logout("addr=%s val=0x%04x\n", regname(addr), val);
missing("unknown word write");
@@ -1534,7 +1563,8 @@ static void eepro100_write4(EEPRO100State * s, uint32_t
addr, uint32_t val)
eepro100_write_port(s);
break;
case SCBCtrlMDI:
- eepro100_write_mdi(s, val);
+ TRACE(OTHER, logout("addr=%s val=0x%08x\n", regname(addr), val));
+ eepro100_write_mdi(s);
break;
default:
logout("addr=%s val=0x%08x\n", regname(addr), val);
--
1.7.2.5
- [Qemu-devel] eepro100: Improve emulation and portability, Stefan Weil, 2011/03/31
- [Qemu-devel] [PATCH 5/9] eepro100: Support byte/word read/write access to MDI control register,
Stefan Weil <=
- [Qemu-devel] [PATCH 4/9] eepro100: Support byte/word writes to pointer register, Stefan Weil, 2011/03/31
- [Qemu-devel] [PATCH 8/9] eepro100: Pad received short frames, Stefan Weil, 2011/03/31
- [Qemu-devel] [PATCH 7/9] eepro100: Support 32 bit read access to flash register, Stefan Weil, 2011/03/31
- [Qemu-devel] [PATCH 2/9] eepro100: Fix endianness issues, Stefan Weil, 2011/03/31
- [Qemu-devel] [PATCH 9/9] eepro100: Simplify receive data structure, Stefan Weil, 2011/03/31
- [Qemu-devel] [PATCH 6/9] eepro100: Support byte read access to general control register, Stefan Weil, 2011/03/31
- [Qemu-devel] [PATCH 3/9] eepro100: Support byte/word writes to port address, Stefan Weil, 2011/03/31
- [Qemu-devel] [PATCH 1/9] eepro100: Avoid duplicate debug messages, Stefan Weil, 2011/03/31