3 See NetBSD PR pkg/43311 and QEMU Bugs #581737:
4 https://bugs.launchpad.net/qemu/+bug/581737
6 --- hw/e1000.c.orig 2010-02-24 05:54:38.000000000 +0900
7 +++ hw/e1000.c 2010-05-08 04:04:39.000000000 +0900
10 s->eecd_state.old_eecd = val & (E1000_EECD_SK | E1000_EECD_CS |
11 E1000_EECD_DI|E1000_EECD_FWE_MASK|E1000_EECD_REQ);
12 + if (!(E1000_EECD_CS & val)) // CS inactive; nothing to do
14 + if (E1000_EECD_CS & (val ^ oldval)) { // CS rise edge; reset state
15 + s->eecd_state.val_in = 0;
16 + s->eecd_state.bitnum_in = 0;
17 + s->eecd_state.bitnum_out = 0;
18 + s->eecd_state.reading = 0;
20 if (!(E1000_EECD_SK & (val ^ oldval))) // no clock edge
22 if (!(E1000_EECD_SK & val)) { // falling edge
23 s->eecd_state.bitnum_out++;
26 - if (!(val & E1000_EECD_CS)) { // rising, no CS (EEPROM reset)
27 - memset(&s->eecd_state, 0, sizeof s->eecd_state);
29 - * restore old_eecd's E1000_EECD_SK (known to be on)
30 - * to avoid false detection of a clock edge
32 - s->eecd_state.old_eecd = E1000_EECD_SK;
35 s->eecd_state.val_in <<= 1;
36 if (val & E1000_EECD_DI)
37 s->eecd_state.val_in |= 1;