Skip to contentSkip to conversation

fix for bad macaddr of e1000 in Windows 2003 server with original Microsoft driver

PATCH In review Naphtali Sprei 2 participants 2 messages Jul 15, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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 | 3 +++

1 files changed, 3 insertions(+), 0 deletions(-)
hw/e1000.c +0 -0
index 4ac8918..7d7cc2e 100644
@@ -261,7 +261,10 @@ set_eecd(E1000State *s, int index, uint32_t val)
        return;
    }
    if (!(val & E1000_EECD_CS)) {              // rising, no CS (EEPROM 

reset)
+ // save/restore old_eecd to avoid false detection of a clock edge

+        uint32_t keep = s->eecd_state.old_eecd;
        memset(&s->eecd_state, 0, sizeof s->eecd_state);
+        s->eecd_state.old_eecd = keep;
        return;
    }
    s->eecd_state.val_in <<= 1;

--
1.5.5.6

#1 lore raw
Quoted 13 lines · Naphtali Sprei

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 | 3 +++

1 files changed, 3 insertions(+), 0 deletions(-)
hw/e1000.c +0 -0
index 4ac8918..7d7cc2e 100644

hw/e1000.c set_eecd(E1000State *s, int index, uint32_t val) · line 268

Quoted 8 lines
hw/e1000.c +3 -0
@@ -261,7 +261,10 @@ set_eecd(E1000State *s, int index, uint32_t val)
        return;
    }
    if (!(val & E1000_EECD_CS)) {              // rising, no CS (EEPROM  
 reset)
+        // save/restore old_eecd to avoid false detection of a clock edge
+        uint32_t keep = s->eecd_state.old_eecd;
        memset(&s->eecd_state, 0, sizeof s->eecd_state);
+        s->eecd_state.old_eecd = keep;

Would it be safer to only restore the SK bit?

Quoted 7 lines
hw/e1000.c +0 -0
        return;
    }
    s->eecd_state.val_in <<= 1;

--
1.5.5.6