qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 10/12] qdev/isa: convert ne2000


From: Gerd Hoffmann
Subject: Re: [Qemu-devel] [PATCH 10/12] qdev/isa: convert ne2000
Date: Wed, 09 Sep 2009 21:58:07 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.1) Gecko/20090814 Fedora/3.0-2.6.b3.fc11 Lightning/1.0pre Thunderbird/3.0b3

+
+void isa_ne2000_init(int base, int irq, NICInfo *nd)

Nitpick: in qdev parlance, this function is a create_simple, not an
init.

Long-term I want zap that anyway ...

+{
+    ISADevice *dev;
+    NE2000State *s;
+
+    qemu_check_nic_model(nd, "ne2k_isa");
+
+    dev = isa_create("ne2k_isa");
+    qdev_prop_set_uint32(&dev->qdev, "iobase", base);
+    qdev_prop_set_uint32(&dev->qdev, "irq",    irq);
+    qdev_init(&dev->qdev);
+

Shouldn't the rest be in isa_ne2000_initfn()?  Think of -device, which
doesn't go through this function...

It should.  Need to figure a way to handle that nicely though, see below.

Right now you can't create a single nic via -device because they are not yet completely qdev-ified. ne2k_isa is no exception here ;)

+    s =&DO_UPCAST(ISANE2000State, dev, dev)->ne2000;
+    memcpy(s->macaddr, nd->macaddr, 6);
+    ne2000_reset(s); /* needs macaddr */
+    s->vc = nd->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name,
+                                          ne2000_can_receive, ne2000_receive,
+                                          NULL, isa_ne2000_cleanup, s);

Shouldn't this use qdev_get_vlan_client(), like the other qdevified
NICs?

Have a close look at this vlan stuff is on my todo list. Right now it is a big hack. DeviceState->nd must go away, likewise qdev_get_vlan_client() and qdev_get_macaddr(). Instead do something sane using properties.

+typedef struct ISANE2000State {
+    ISADevice dev;
+    uint32_t iobase;
+    uint32_t isairq;
+    NE2000State ne2000;
+} ISANE2000State;

ISANE2000State doesn't belong here, and isn't used as far as I can see.

Indeed.

cheers,
  Gerd




reply via email to

[Prev in Thread] Current Thread [Next in Thread]