qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] e1000 patch for osx


From: Paolo Bonzini
Subject: Re: [Qemu-devel] e1000 patch for osx
Date: Wed, 30 Oct 2013 19:00:09 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130923 Thunderbird/17.0.9

Il 30/10/2013 18:29, Peter Maydell ha scritto:
> This looks odd -- you seem to be modifying val but then not
> using the modified value before we reach the end of the function.
> 
>> >  }
>> >
>> >  static void
>> > @@ -445,8 +450,9 @@ set_mdic(E1000State *s, int index, uint32_t val)
>> >          } else {
>> >              if (addr < NPHYWRITEOPS && phyreg_writeops[addr]) {
>> >                  phyreg_writeops[addr](s, index, data);
>> > +            } else {
>> > +                s->phy_reg[addr] = data;
>> >              }
>> > -            s->phy_reg[addr] = data;
>> >          }
> ...and this part seems to remove the code which sets
> phy_reg[PHY_CTRL], so it will now always read back as zero.

Yeah, I forgot one line:

diff --git a/hw/net/e1000.c b/hw/net/e1000.c
index 70a59fd..b7a1953 100644
--- a/hw/net/e1000.c
+++ b/hw/net/e1000.c
@@ -203,6 +203,12 @@ set_phy_ctrl(E1000State *s, int index, uint16_t val)
         DBGOUT(PHY, "Start link auto negotiation\n");
         timer_mod(s->autoneg_timer, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + 
500);
     }
+
+    if (val & 0x8000) {
+        val &= 0x7fff;
+        set_ics(s, 0, E1000_ICR_LSC);
+    }
+    s->phy_reg[PHY_CTRL] = val;
 }
 
 static void
@@ -445,8 +451,9 @@ set_mdic(E1000State *s, int index, uint32_t val)
         } else {
             if (addr < NPHYWRITEOPS && phyreg_writeops[addr]) {
                 phyreg_writeops[addr](s, index, data);
+            } else {
+                s->phy_reg[addr] = data;
             }
-            s->phy_reg[addr] = data;
         }
     }
     s->mac_reg[MDIC] = val | E1000_MDIC_READY;

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]