All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: QEMU Developers <qemu-devel@nongnu.org>,
	jacek burghardt <jaceksburghardt@gmail.com>,
	qemu-discuss <qemu-discuss@nongnu.org>
Subject: Re: [Qemu-devel] e1000 patch for osx
Date: Wed, 30 Oct 2013 19:00:09 +0100	[thread overview]
Message-ID: <52714929.1050005@redhat.com> (raw)
In-Reply-To: <CAFEAcA_+ODuDUB_CHGQvMzZdNe8Yux9qWvC9bndEu74TN+7K6g@mail.gmail.com>

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

      parent reply	other threads:[~2013-10-30 18:36 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-25 13:53 [Qemu-devel] e1000 patch for osx jacek burghardt
2013-10-25 14:21 ` Paolo Bonzini
2013-10-25 14:27   ` jacek burghardt
2013-10-30  9:41     ` Stefan Hajnoczi
2013-10-30 13:26       ` jacek burghardt
2013-10-30 13:35         ` Andreas Färber
2013-10-30 23:54     ` jacek burghardt
2013-10-31  0:00       ` Paolo Bonzini
2013-10-31  0:21         ` jacek burghardt
2013-10-31  0:24           ` jacek burghardt
2013-10-31  0:27           ` Paolo Bonzini
2013-10-31  0:31             ` jacek burghardt
2013-10-31  0:51               ` jacek burghardt
2013-10-31 15:06                 ` Gabriel L. Somlo
2013-10-31 21:38                   ` jacek burghardt
2013-11-07 18:04                   ` [Qemu-devel] [PATCH v1] e1000: initial link negotiation on mac osx Gabriel L. Somlo
2013-11-07 19:28                     ` Paolo Bonzini
2013-11-07 19:44                       ` jacek burghardt
2013-11-07 20:28                       ` [Qemu-devel] [PATCH v2] " Gabriel L. Somlo
2013-11-07 23:12                         ` Alexander Graf
2013-11-08 13:39                           ` Stefan Hajnoczi
2013-11-08 15:52                             ` Gabriel L. Somlo
2013-11-11  9:48                               ` Stefan Hajnoczi
2013-10-30 16:52 ` [Qemu-devel] e1000 patch for osx Paolo Bonzini
2013-10-30 17:29   ` Peter Maydell
2013-10-30 17:50     ` jacek burghardt
2013-10-30 18:00     ` Paolo Bonzini [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52714929.1050005@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=jaceksburghardt@gmail.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-discuss@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.