Patchwork [3/4] qdev: add ethernet capability

login
register
mail settings
Submitter Gerd Hoffmann
Date Aug. 11, 2009, 9:20 a.m.
Message ID <1249982427-14481-3-git-send-email-kraxel@redhat.com>
Download mbox | patch
Permalink /patch/31130/
State Superseded
Headers show

Comments

Gerd Hoffmann - Aug. 11, 2009, 9:20 a.m.
... and tag ethernet drivers.  Also add some descriptions while being
at it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/e1000.c      |    2 ++
 hw/eepro100.c   |    6 ++++++
 hw/ne2000.c     |    2 ++
 hw/pcnet.c      |    3 +++
 hw/qdev.c       |    1 +
 hw/qdev.h       |    2 ++
 hw/rtl8139.c    |    2 ++
 hw/virtio-pci.c |    1 +
 8 files changed, 19 insertions(+), 0 deletions(-)

Patch

diff --git a/hw/e1000.c b/hw/e1000.c
index b0542d7..8ed84ce 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -1136,7 +1136,9 @@  static void pci_e1000_init(PCIDevice *pci_dev)
 
 static PCIDeviceInfo e1000_info = {
     .qdev.name = "e1000",
+    .qdev.desc = "Intel Gigabit Ethernet",
     .qdev.size = sizeof(E1000State),
+    .qdev.caps = DEV_CAP_ETHERNET,
     .init      = pci_e1000_init,
 };
 
diff --git a/hw/eepro100.c b/hw/eepro100.c
index ec31a6a..0c7db58 100644
--- a/hw/eepro100.c
+++ b/hw/eepro100.c
@@ -1794,15 +1794,21 @@  static void pci_i82559er_init(PCIDevice *dev)
 static PCIDeviceInfo eepro100_info[] = {
     {
         .qdev.name = "i82551",
+        .qdev.desc = "Intel EtherExpress PRO 100",
         .qdev.size = sizeof(PCIEEPRO100State),
+        .qdev.caps = DEV_CAP_ETHERNET,
         .init      = pci_i82551_init,
     },{
         .qdev.name = "i82557b",
+        .qdev.desc = "Intel EtherExpress PRO 100",
         .qdev.size = sizeof(PCIEEPRO100State),
+        .qdev.caps = DEV_CAP_ETHERNET,
         .init      = pci_i82557b_init,
     },{
         .qdev.name = "i82559er",
+        .qdev.desc = "Intel EtherExpress PRO 100",
         .qdev.size = sizeof(PCIEEPRO100State),
+        .qdev.caps = DEV_CAP_ETHERNET,
         .init      = pci_i82559er_init,
     },{
         /* end of list */
diff --git a/hw/ne2000.c b/hw/ne2000.c
index b9c018a..78e80b8 100644
--- a/hw/ne2000.c
+++ b/hw/ne2000.c
@@ -834,7 +834,9 @@  static void pci_ne2000_init(PCIDevice *pci_dev)
 
 static PCIDeviceInfo ne2000_info = {
     .qdev.name = "ne2k_pci",
+    .qdev.desc = "NE2000 PCI Ethernet",
     .qdev.size = sizeof(PCINE2000State),
+    .qdev.caps = DEV_CAP_ETHERNET,
     .init      = pci_ne2000_init,
 };
 
diff --git a/hw/pcnet.c b/hw/pcnet.c
index 637dcfb..2e070f1 100644
--- a/hw/pcnet.c
+++ b/hw/pcnet.c
@@ -2144,6 +2144,7 @@  static SysBusDeviceInfo lance_info = {
     .init = lance_init,
     .qdev.name  = "lance",
     .qdev.size  = sizeof(SysBusPCNetState),
+    .qdev.caps  = DEV_CAP_ETHERNET,
     .qdev.props = (Property[]) {
         DEFINE_PROP_PTR("dma", SysBusPCNetState, state.dma_opaque),
         DEFINE_PROP_END_OF_LIST(),
@@ -2154,7 +2155,9 @@  static SysBusDeviceInfo lance_info = {
 
 static PCIDeviceInfo pcnet_info = {
     .qdev.name = "pcnet",
+    .qdev.desc = "PCnet Lance Ethernet",
     .qdev.size = sizeof(PCIPCNetState),
+    .qdev.caps = DEV_CAP_ETHERNET,
     .init      = pci_pcnet_init,
 };
 
diff --git a/hw/qdev.c b/hw/qdev.c
index e501610..c026305 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -109,6 +109,7 @@  static int qdev_print_devinfo(DeviceInfo *info, char *dest, int len)
 {
     static const char *capname[] = {
         [ DEV_CAP_BIT_AUDIO       ] = "audio",
+        [ DEV_CAP_BIT_ETHERNET    ] = "ethernet",
     };
     const char *sep;
     int pos = 0;
diff --git a/hw/qdev.h b/hw/qdev.h
index 90a4446..ee282f0 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -104,9 +104,11 @@  typedef void (*SCSIAttachFn)(DeviceState *host, BlockDriverState *bdrv,
 
 enum DeviceCapBits {
     DEV_CAP_BIT_AUDIO      = 0,
+    DEV_CAP_BIT_ETHERNET   = 1,
 };
 
 #define DEV_CAP_AUDIO      (1 << DEV_CAP_BIT_AUDIO)
+#define DEV_CAP_ETHERNET   (1 << DEV_CAP_BIT_ETHERNET)
 
 struct DeviceInfo {
     const char *name;
diff --git a/hw/rtl8139.c b/hw/rtl8139.c
index fcd6d95..dbb2d95 100644
--- a/hw/rtl8139.c
+++ b/hw/rtl8139.c
@@ -3501,7 +3501,9 @@  static void pci_rtl8139_init(PCIDevice *dev)
 
 static PCIDeviceInfo rtl8139_info = {
     .qdev.name = "rtl8139",
+    .qdev.desc = "Realtek RTL8139 Fast Ethernet",
     .qdev.size = sizeof(PCIRTL8139State),
+    .qdev.caps = DEV_CAP_ETHERNET,
     .init      = pci_rtl8139_init,
 };
 
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index 8b57dfc..7b41e2d 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -509,6 +509,7 @@  static PCIDeviceInfo virtio_info[] = {
     },{
         .qdev.name  = "virtio-net-pci",
         .qdev.size  = sizeof(VirtIOPCIProxy),
+        .qdev.caps  = DEV_CAP_ETHERNET,
         .init       = virtio_net_init_pci,
         .qdev.props = (Property[]) {
             DEFINE_PROP_HEX32("vectors", VirtIOPCIProxy, nvectors,