Commit 0113f48d authored by Stefan Weil's avatar Stefan Weil Committed by Michael S. Tsirkin
Browse files

eepro100: Support byte/word read/write access to MDI control register



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: default avatarStefan Weil <weil@mail.berlios.de>
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
parent 27a05006
......@@ -1193,8 +1193,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;
......@@ -1370,6 +1371,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));
......@@ -1402,6 +1410,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");
......@@ -1488,6 +1501,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");
......@@ -1527,6 +1549,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");
......@@ -1548,7 +1577,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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment