~ubuntu-branches/ubuntu/trusty/qemu/trusty

« back to all changes in this revision

Viewing changes to hw/net/lan9118.c

  • Committer: Package Import Robot
  • Author(s): Serge Hallyn
  • Date: 2013-10-22 22:47:07 UTC
  • mfrom: (1.8.3) (10.1.42 sid)
  • Revision ID: package-import@ubuntu.com-20131022224707-1lya34fw3k3f24tv
Tags: 1.6.0+dfsg-2ubuntu1
* Merge 1.6.0~rc0+dfsg-2exp from debian experimental.  Remaining changes:
  - debian/control
    * update maintainer
    * remove libiscsi, usb-redir, vde, vnc-jpeg, and libssh2-1-dev
      from build-deps
    * enable rbd
    * add qemu-system and qemu-common B/R to qemu-keymaps
    * add D:udev, R:qemu, R:qemu-common and B:qemu-common to
      qemu-system-common
    * qemu-system-arm, qemu-system-ppc, qemu-system-sparc:
      - add qemu-kvm to Provides
      - add qemu-common, qemu-kvm, kvm to B/R
      - remove openbios-sparc from qemu-system-sparc D
      - drop openbios-ppc and openhackware Depends to Suggests (for now)
    * qemu-system-x86:
      - add qemu-common to Breaks/Replaces.
      - add cpu-checker to Recommends.
    * qemu-user: add B/R:qemu-kvm
    * qemu-kvm:
      - add armhf armel powerpc sparc to Architecture
      - C/R/P: qemu-kvm-spice
    * add qemu-common package
    * drop qemu-slof which is not packaged in ubuntu
  - add qemu-system-common.links for tap ifup/down scripts and OVMF link.
  - qemu-system-x86.links:
    * remove pxe rom links which are in kvm-ipxe
    * add symlink for kvm.1 manpage
  - debian/rules
    * add kvm-spice symlink to qemu-kvm
    * call dh_installmodules for qemu-system-x86
    * update dh_installinit to install upstart script
    * run dh_installman (Closes: #709241) (cherrypicked from 1.5.0+dfsg-2)
  - Add qemu-utils.links for kvm-* symlinks.
  - Add qemu-system-x86.qemu-kvm.upstart and .default
  - Add qemu-system-x86.modprobe to set nesting=1
  - Add qemu-system-common.preinst to add kvm group
  - qemu-system-common.postinst: remove bad group acl if there, then have
    udev relabel /dev/kvm.
  - New linaro patches from qemu-linaro rebasing branch
  - Dropped patches:
    * xen-simplify-xen_enabled.patch
    * sparc-linux-user-fix-missing-symbols-in-.rel-.rela.plt-sections.patch
    * main_loop-do-not-set-nonblocking-if-xen_enabled.patch
    * xen_machine_pv-do-not-create-a-dummy-CPU-in-machine-.patch
    * virtio-rng-fix-crash
  - Kept patches:
    * expose_vms_qemu64cpu.patch - updated
    * linaro arm patches from qemu-linaro rebasing branch
  - New patches:
    * fix-pci-add: change CONFIG variable in ifdef to make sure that
      pci_add is defined.
* Add linaro patches
* Add experimental mach-virt patches for arm virtualization.
* qemu-system-common.install: add debian/tmp/usr/lib to install the
  qemu-bridge-helper

Show diffs side-by-side

added added

removed removed

Lines of Context:
170
170
    }
171
171
};
172
172
 
 
173
#define TYPE_LAN9118 "lan9118"
 
174
#define LAN9118(obj) OBJECT_CHECK(lan9118_state, (obj), TYPE_LAN9118)
 
175
 
173
176
typedef struct {
174
 
    SysBusDevice busdev;
 
177
    SysBusDevice parent_obj;
 
178
 
175
179
    NICState *nic;
176
180
    NICConf conf;
177
181
    qemu_irq irq;
401
405
 
402
406
static void lan9118_reset(DeviceState *d)
403
407
{
404
 
    lan9118_state *s = FROM_SYSBUS(lan9118_state, SYS_BUS_DEVICE(d));
 
408
    lan9118_state *s = LAN9118(d);
 
409
 
405
410
    s->irq_cfg &= (IRQ_TYPE | IRQ_POL);
406
411
    s->int_sts = 0;
407
412
    s->int_en = 0;
1053
1058
    case CSR_HW_CFG:
1054
1059
        if (val & 1) {
1055
1060
            /* SRST */
1056
 
            lan9118_reset(&s->busdev.qdev);
 
1061
            lan9118_reset(DEVICE(s));
1057
1062
        } else {
1058
1063
            s->hw_cfg = (val & 0x003f300) | (s->hw_cfg & 0x4);
1059
1064
        }
1320
1325
    .link_status_changed = lan9118_set_link,
1321
1326
};
1322
1327
 
1323
 
static int lan9118_init1(SysBusDevice *dev)
 
1328
static int lan9118_init1(SysBusDevice *sbd)
1324
1329
{
1325
 
    lan9118_state *s = FROM_SYSBUS(lan9118_state, dev);
 
1330
    DeviceState *dev = DEVICE(sbd);
 
1331
    lan9118_state *s = LAN9118(dev);
1326
1332
    QEMUBH *bh;
1327
1333
    int i;
1328
1334
    const MemoryRegionOps *mem_ops =
1329
1335
            s->mode_16bit ? &lan9118_16bit_mem_ops : &lan9118_mem_ops;
1330
1336
 
1331
 
    memory_region_init_io(&s->mmio, mem_ops, s, "lan9118-mmio", 0x100);
1332
 
    sysbus_init_mmio(dev, &s->mmio);
1333
 
    sysbus_init_irq(dev, &s->irq);
 
1337
    memory_region_init_io(&s->mmio, OBJECT(dev), mem_ops, s,
 
1338
                          "lan9118-mmio", 0x100);
 
1339
    sysbus_init_mmio(sbd, &s->mmio);
 
1340
    sysbus_init_irq(sbd, &s->irq);
1334
1341
    qemu_macaddr_default_if_unset(&s->conf.macaddr);
1335
1342
 
1336
1343
    s->nic = qemu_new_nic(&net_lan9118_info, &s->conf,
1337
 
                          object_get_typename(OBJECT(dev)), dev->qdev.id, s);
 
1344
                          object_get_typename(OBJECT(dev)), dev->id, s);
1338
1345
    qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a);
1339
1346
    s->eeprom[0] = 0xa5;
1340
1347
    for (i = 0; i < 6; i++) {
1369
1376
}
1370
1377
 
1371
1378
static const TypeInfo lan9118_info = {
1372
 
    .name          = "lan9118",
 
1379
    .name          = TYPE_LAN9118,
1373
1380
    .parent        = TYPE_SYS_BUS_DEVICE,
1374
1381
    .instance_size = sizeof(lan9118_state),
1375
1382
    .class_init    = lan9118_class_init,
1388
1395
    SysBusDevice *s;
1389
1396
 
1390
1397
    qemu_check_nic_model(nd, "lan9118");
1391
 
    dev = qdev_create(NULL, "lan9118");
 
1398
    dev = qdev_create(NULL, TYPE_LAN9118);
1392
1399
    qdev_set_nic_properties(dev, nd);
1393
1400
    qdev_init_nofail(dev);
1394
1401
    s = SYS_BUS_DEVICE(dev);