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: Gabriel L. Somlo
Subject: Re: [Qemu-devel] e1000 patch for osx
Date: Thu, 31 Oct 2013 11:06:52 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

On Wed, Oct 30, 2013 at 6:31 PM, jacek burghardt wrote:
> I got this error
> hw/net/e1000.c: In function 'set_phy_ctrl':
> hw/net/e1000.c:209:10: warning: implicit declaration of function 'set_ics'
> [-Wimplicit-function-declaration]

That's because set_ics needs to be declared before being used in
set_phy_ctrl(). A full patch which builds on the current qemu git
master would look like below.

That being said, now it builds, but doesn't actually make osx
(10.6 in my case) start with a working network interface. I still
need to bounce the link (via "set_link foo off; set_link foo on")
from the qemu monitor command line in order to get network access
from osx.

--Gabriel

diff --git a/hw/net/e1000.c b/hw/net/e1000.c
index 70a59fd..7c2dd9f 100644
--- a/hw/net/e1000.c
+++ b/hw/net/e1000.c
@@ -186,6 +186,9 @@ e1000_link_up(E1000State *s)
     s->phy_reg[PHY_STATUS] |= MII_SR_LINK_STATUS;
 }
 
+//FIXME: maybe move set_phy_ctrl *after* set_ics instead ?
+static void set_ics(E1000State *s, int index, uint32_t val);
+
 static void
 set_phy_ctrl(E1000State *s, int index, uint16_t val)
 {
@@ -203,6 +206,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 +454,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;



reply via email to

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