From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58346) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VeVGF-00057Y-UZ for qemu-devel@nongnu.org; Thu, 07 Nov 2013 14:29:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VeVG9-0005py-CV for qemu-devel@nongnu.org; Thu, 07 Nov 2013 14:28:59 -0500 Received: from mail-ea0-x236.google.com ([2a00:1450:4013:c01::236]:43421) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VeVG9-0005pm-3s for qemu-devel@nongnu.org; Thu, 07 Nov 2013 14:28:53 -0500 Received: by mail-ea0-f182.google.com with SMTP id o10so566979eaj.41 for ; Thu, 07 Nov 2013 11:28:51 -0800 (PST) Sender: Paolo Bonzini Message-ID: <527BE9EF.50906@redhat.com> Date: Thu, 07 Nov 2013 20:28:47 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <20131031150651.GI9423@HEDWIG.INI.CMU.EDU> <20131107180440.GC13775@HEDWIG.INI.CMU.EDU> In-Reply-To: <20131107180440.GC13775@HEDWIG.INI.CMU.EDU> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v1] e1000: initial link negotiation on mac osx List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Gabriel L. Somlo" Cc: stefanha@gmail.com, qemu-devel@nongnu.org, jaceksburghardt@gmail.com Il 07/11/2013 19:04, Gabriel L. Somlo ha scritto: > Some guest operating systems' drivers (particularly Mac OS X) > expect the link state to be pre-initialized by an earlier > component such as a proprietary BIOS. This patch injects an > additional LSC event upon PHY reset, allowing the OS X driver > to successfully complete initial link negotiation. This is a > follow-up to commit 372254c6e5c078fb13b236bb648d2b9b2b0c70f1, > which works around the OS X driver's failure to properly set > up the MAC address. > > Signed-off-by: Gabriel Somlo > --- > > I studied the Intel 8254xxx manual and the various earlier > suggestions, and came up with the following, which both works > (at least for me, using SnowLeopard) and also appears to make > sense from a "code flow" point of view. Please let me know > what you all think. > > Thanks, > Gabriel > > hw/net/e1000.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/hw/net/e1000.c b/hw/net/e1000.c > index ec8ecd7..2f2fc3a 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; > } > > +/* Forward decl. for use in set_phy_ctrl() (OS X link nego. workaround) */ > +static void set_ics(E1000State *s, int index, uint32_t val); > + > static void > set_phy_ctrl(E1000State *s, int index, uint16_t val) > { > @@ -197,6 +200,15 @@ set_phy_ctrl(E1000State *s, int index, uint16_t val) > if (!(s->compat_flags & E1000_FLAG_AUTONEG)) { > return; > } > + /* > + * The Mac OS X driver expects a pre-initialized network card; injecting > + * an extra LSC event here allows initial link negotiation to succeed in > + * the absence of the Apple EFI BIOS. > + */ > + if ((val & MII_CR_RESET)) { > + set_ics(s, 0, E1000_ICR_LSC); > + return; > + } > if ((val & MII_CR_AUTO_NEG_EN) && (val & MII_CR_RESTART_AUTO_NEG)) { > e1000_link_down(s); > s->phy_reg[PHY_STATUS] &= ~MII_SR_AUTONEG_COMPLETE; > Is there any way to work around this in the guest? Such as using a UEFI driver for e1000 or something like that. Paolo