2nd try: [PATCH] fix for bad macaddr of e1000 in Windows 2003 server with original Microsoft driver
After comments from [email protected] and [email protected], here's the 2nd try:
The sequence of reading from eeprom is "offset by one" moved because of a false detection of a clock cycle after an eeprom reset. Keeping the last clock value after a reset keeps it in sync.
---hw/e1000.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
hw/e1000.c +0 -0
@@ -262,6 +262,8 @@ set_eecd(E1000State *s, int index, uint32_t val) }if (!(val &E1000_EECD_CS )) {// rising, no CS (EEPROM
reset)
memset(&s->eecd_state, 0, sizeof s->eecd_state);
+ // restore old_eecd's E1000_EECD_SK to avoid false detection of a clock edge
+ s->eecd_state.old_eecd = E1000_EECD_SK;
return;
}
s->eecd_state.val_in <<= 1;--
1.5.5.6
Quoted 25 lines · Naphtali Sprei
After comments from [email protected] and [email protected], here's the 2nd try:
The sequence of reading from eeprom is "offset by one" moved because of a false detection
of a clock cycle after an eeprom reset. Keeping the last clock value after a reset keeps it in sync.Signed-off-by Naphtali Sprei <[email protected]>--- hw/e1000.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)hw/e1000.c +1
-0@@ -262,6 +262,8 @@ set_eecd(E1000State *s, int index, uint32_t val) }if (!(val &E1000_EECD_CS )) {// rising, no CS (EEPROM reset) memset(&s->eecd_state, 0, sizeof s->eecd_state); +// restore old_eecd's E1000_EECD_SK to avoid false detection of a clock edge
Quoted 6 lines
+ s->eecd_state.old_eecd = E1000_EECD_SK; return; } s->eecd_state.val_in <<= 1;--
1.5.5.6
This fixes the problem for me.
Signature · 2 lines
Hollis Blanchard IBM Linux Technology Center
Quoted 6 lines · Naphtali Sprei
After comments from [email protected] and [email protected], here's the 2nd try:
The sequence of reading from eeprom is "offset by one" moved because of a false detection of a clock cycle after an eeprom reset. Keeping the last clock value after a reset keeps it in sync.
Isn't it more likely that the real hardware resets the clock value to a fixed level - the polarity being the opposite of what QEMU currently does, so that there's no edge caused by the first write?
-- Jamie
Quoted 11 lines · Jamie Lokier
Quoted 6 lines · Naphtali Sprei
After comments from [email protected] and [email protected], here's the 2nd try:
The sequence of reading from eeprom is "offset by one" moved because of a false detection of a clock cycle after an eeprom reset. Keeping the last clock value after a reset keeps it in sync.
Isn't it more likely that the real hardware resets the clock value to a fixed level - the polarity being the opposite of what QEMU currently does, so that there's no edge caused by the first write?
The eeprom reset I referred to is actually a reset of the internal state of (part of) the device emulation in qemu. The software drives the clock bit (SK) and the reset shouldn't change it.
Quoted 6 lines
-- Jamie
Quoted 21 lines · Naphtali Sprei
After comments from [email protected] and [email protected], here's the 2nd try:
The sequence of reading from eeprom is "offset by one" moved because of a false detection of a clock cycle after an eeprom reset. Keeping the last clock value after a reset keeps it in sync.
Signed-off-by Naphtali Sprei <[email protected]>---
hw/e1000.c| 2 ++1 files changed, 2 insertions(+), 0 deletions(-)hw/e1000.c +1
-0@@ -262,6 +262,8 @@ set_eecd(E1000State *s, int index, uint32_t val) }if (!(val &E1000_EECD_CS )) {// rising, no CS (EEPROM reset)memset (&s->eecd_state,0 ,sizeof s->eecd_state); +// restore old_eecd's E1000_EECD_SK to avoid false detection
Quoted 1 line
of a clock edge
Your mailer is wrapping these lines. We also prefer C89 comments in QEMU.
Regards,
Anthony Liguori
comment format changed, (hopefully) fixed mailer wrapping.
Subject: [PATCH] fix for bad macaddr of e1000 in Windows 2003 server with original Microsoft driver
The sequence of reading from eeprom is "offset by one" moved because of a false detection of a clock cycle after an eeprom reset. Keeping the last clock value after a reset keeps it in sync.
--- hw/e1000.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
hw/e1000.c +5 -0
@@ -262,6 +262,11 @@ set_eecd(E1000State *s, int index, uint32_t val) }if (!(val &E1000_EECD_CS )) {// rising, no CS (EEPROM reset) memset (&s->eecd_state,0 ,sizeof s->eecd_state); +/* +* restore old_eecd's E1000_EECD_SK (known to be on) +* to avoid false detection of a clock edge +*/ + s->eecd_state.old_eecd =E1000_EECD_SK ;return ; } s->eecd_state.val_in <<=1 ;
Signature · 1 line
1.5.5.6