Patchwork e1000 patch for osx

login
register
mail settings
Submitter Paolo Bonzini
Date Oct. 30, 2013, 4:52 p.m.
Message ID <52713936.9070309@redhat.com>
Download mbox | patch
Permalink /patch/287296/
State New
Headers show

Comments

Paolo Bonzini - Oct. 30, 2013, 4:52 p.m.
Il 25/10/2013 15:53, jacek burghardt ha scritto:
> Is there a patch for qemu git master that pre init e1000 so I can get
> rid off unpluged network cable message ? I know there is patch but is is
> for older version of qemu and it seeem that it no longer functions and
> does not apply fully as code was changed. 

Does this patch work?


Paolo
Peter Maydell - Oct. 30, 2013, 5:29 p.m.
On 30 October 2013 16:52, Paolo Bonzini <pbonzini@redhat.com> wrote:
> Il 25/10/2013 15:53, jacek burghardt ha scritto:
>> Is there a patch for qemu git master that pre init e1000 so I can get
>> rid off unpluged network cable message ? I know there is patch but is is
>> for older version of qemu and it seeem that it no longer functions and
>> does not apply fully as code was changed.
>
> Does this patch work?
>
> diff --git a/hw/net/e1000.c b/hw/net/e1000.c
> index 70a59fd..a9ce08f 100644
> --- a/hw/net/e1000.c
> +++ b/hw/net/e1000.c
> @@ -203,6 +203,11 @@ 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);
> +    }

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.



thanks
-- PMM
jacek burghardt - Oct. 30, 2013, 5:50 p.m.
The function of this patch is initialize emulated network card and pass
data just like Mac firmware

Patch

diff --git a/hw/net/e1000.c b/hw/net/e1000.c
index 70a59fd..a9ce08f 100644
--- a/hw/net/e1000.c
+++ b/hw/net/e1000.c
@@ -203,6 +203,11 @@  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);
+    }
 }
 
 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;
         }
     }
     s->mac_reg[MDIC] = val | E1000_MDIC_READY;