Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 7 Jun 2009 21:42:56 +0200
From:      Juergen Lock <nox@jelal.kn-bremen.de>
To:        freebsd-emulation@freebsd.org
Cc:        sebosik@demax.sk
Subject:   qemu patch (was: em(4) patch for qemu/kvm/vbox guests)
Message-ID:  <20090607194256.GA17327@triton.kn-bremen.de>
In-Reply-To: <200906071727.n57HRCZK012510@triton.kn-bremen.de>
References:  <4A2BC96B.9010209@demax.sk> <200906071727.n57HRCZK012510@triton.kn-bremen.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Jun 07, 2009 at 07:27:12PM +0200, Juergen Lock wrote:
> In article <4A2BC96B.9010209@demax.sk> you write:
> >Hi
> >
> >I think its caused by internal control of MAC address validity in 
> >freebsd-sources ( sys/dev/e1000/if_em.c ) on line 4950.
> >You can safely remove references to that function + function itself and than 
> >happily use if_em undex VBox as before.
> 
> Actually that wasn't it, in fact commit 190872 changed the way mac addresses
> are read (e1000_read_mac_addr_generic() in sys/dev/e1000/e1000_nvm.c) - if I
> add the old way back for the case that the new code gets all zeros em(4)
> works again:

And I just submitted a qemu git patch for this problem on the qemu list;
here is a version for 0.10.5, you can put it in
/usr/ports/emulators/qemu/files/patch-e1000-fbsd8 :

Index: qemu/hw/e1000.c
@@ -1100,6 +1100,16 @@ pci_e1000_init(PCIBus *bus, NICInfo *nd,
     memmove(d->phy_reg, phy_reg_init, sizeof phy_reg_init);
     memset(d->mac_reg, 0, sizeof d->mac_reg);
     memmove(d->mac_reg, mac_reg_init, sizeof mac_reg_init);
+    /*
+     * FreeBSD 8.0-current svn rev >= 190872 expects the mac address here,
+     * see e1000_read_mac_addr_generic() in sys/dev/e1000/if_em.c:
+     * http://svn.freebsd.org/viewvc/base/head/sys/dev/e1000/e1000_nvm.c?view=markup&pathrev=190872
+     * http://svn.freebsd.org/viewvc/base?view=revision&revision=190872
+     */
+    d->mac_reg[RA] = (nd->macaddr[3]<<24) | (nd->macaddr[2]<<16) |
+        (nd->macaddr[1]<<8) | nd->macaddr[0]; 
+    d->mac_reg[RA+1] = (nd->macaddr[5]<<8) | nd->macaddr[4]; 
+
     d->rxbuf_min_shift = 1;
     memset(&d->tx, 0, sizeof d->tx);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090607194256.GA17327>