Skip to contentSkip to conversation

e1000 emulation

PATCH New Alex Williamson 1 participant 1 message Feb 25, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 e1000 emulation

The attached patch adds e1000 emulation to Xen. This is a direct
port of the e1000 driver currently in Qemu CVS with extremely minimal changes (as shown below). This is useful for Xen as new OSes may not support the old 100Mbps NICs we currently support (especially on non-x86). Drivers for e1000 should be more readily available.

The diff from Qemu CVS is as follows (for reference only):

e1000.c +2 -4
@@ -23,9 +23,7 @@
  */
 
 
-#include "hw.h"
-#include "pci.h"
-#include "net.h"
+#include "vl.h"
 
 #include "e1000_hw.h"
 
@@ -153,7 +151,7 @@
     if (val)
         val |= E1000_ICR_INT_ASSERTED;
     s->mac_reg[ICR] = val;
-    qemu_set_irq(s->dev.irq[0], (s->mac_reg[IMS] & s->mac_reg[ICR]) != 0);
+    pci_set_irq(&s->dev, 0, (s->mac_reg[IMS] & s->mac_reg[ICR]) != 0);
 }
 
 static void

Both Linux and Windows Server 2008 guests work with this device model on Xen/ia64. Please apply the attached patch. Thanks,

Alex

# HG changeset patch
# User Alex Williamson <[email protected]> # Date 1203974210 25200
# Node ID 3e6208e7f928cae2c9c117d6ae1cfbab86a3b377 # Parent 7e8334e651c479fc1277db84d49a97b73b86d27e [IOEMU] e1000 device emulation

Quoted 1 line

From upstream Qemu

tools/ioemu/Makefile.target +1 -1
diff -r 7e8334e651c4 -r 3e6208e7f928 tools/ioemu/Makefile.target
@@ -415,7 +415,7 @@ VL_OBJS+= usb.o usb-hub.o usb-linux.o us
 VL_OBJS+= usb.o usb-hub.o usb-linux.o usb-hid.o usb-ohci.o usb-msd.o
 
 # PCI network cards
-VL_OBJS+= ne2000.o rtl8139.o pcnet.o e100.o
+VL_OBJS+= ne2000.o rtl8139.o pcnet.o e100.o e1000.o
 
 ifeq ($(TARGET_BASE_ARCH), i386)
 # Hardware support
tools/ioemu/hw/e1000.c new file +995 -0

995 lines not on this page · raw message

tools/ioemu/hw/e1000_hw.h new file +865 -0

865 lines not on this page · raw message

tools/ioemu/hw/pci.c +2 -0
diff -r 7e8334e651c4 -r 3e6208e7f928 tools/ioemu/hw/pci.c
@@ -574,6 +574,8 @@ void pci_nic_init(PCIBus *bus, NICInfo *
         pci_pcnet_init(bus, nd, devfn);
     } else if (strcmp(nd->model, "e100") == 0) {
         pci_e100_init(bus, nd);
+    } else if (strcmp(nd->model, "e1000") == 0) {
+        pci_e1000_init(bus, nd, devfn);
     } else {
         fprintf(stderr, "qemu: Unsupported NIC: %s\n", nd->model);
         exit (1);
tools/ioemu/vl.h +5 -0
diff -r 7e8334e651c4 -r 3e6208e7f928 tools/ioemu/vl.h
@@ -1055,6 +1055,11 @@ void pcnet_h_reset(void *opaque);
 void pcnet_h_reset(void *opaque);
 void *lance_init(NICInfo *nd, uint32_t leaddr, void *dma_opaque);
 
+/* e100.c */
+void pci_e100_init(PCIBus *bus, NICInfo *nd);
+
+/* e1000.c */
+void pci_e1000_init(PCIBus *bus, NICInfo *nd, int devfn);
 
 /* pckbd.c */
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel