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

« back to all changes in this revision

Viewing changes to hw/net/rtl8139.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:
92
92
}
93
93
#endif
94
94
 
 
95
#define TYPE_RTL8139 "rtl8139"
 
96
 
 
97
#define RTL8139(obj) \
 
98
     OBJECT_CHECK(RTL8139State, (obj), TYPE_RTL8139)
 
99
 
95
100
/* Symbolic offsets to registers. */
96
101
enum RTL8139_registers {
97
102
    MAC0 = 0,        /* Ethernet hardware address. */
428
433
static void RTL8139TallyCounters_clear(RTL8139TallyCounters* counters);
429
434
 
430
435
typedef struct RTL8139State {
431
 
    PCIDevice dev;
 
436
    /*< private >*/
 
437
    PCIDevice parent_obj;
 
438
    /*< public >*/
 
439
 
432
440
    uint8_t phys[8]; /* mac address */
433
441
    uint8_t mult[8]; /* multicast mask array */
434
442
 
701
709
 
702
710
static void rtl8139_update_irq(RTL8139State *s)
703
711
{
 
712
    PCIDevice *d = PCI_DEVICE(s);
704
713
    int isr;
705
714
    isr = (s->IntrStatus & s->IntrMask) & 0xffff;
706
715
 
707
716
    DPRINTF("Set IRQ to %d (%04x %04x)\n", isr ? 1 : 0, s->IntrStatus,
708
717
        s->IntrMask);
709
718
 
710
 
    qemu_set_irq(s->dev.irq[0], (isr != 0));
 
719
    qemu_set_irq(d->irq[0], (isr != 0));
711
720
}
712
721
 
713
722
static int rtl8139_RxWrap(RTL8139State *s)
738
747
 
739
748
static void rtl8139_write_buffer(RTL8139State *s, const void *buf, int size)
740
749
{
 
750
    PCIDevice *d = PCI_DEVICE(s);
 
751
 
741
752
    if (s->RxBufAddr + size > s->RxBufferSize)
742
753
    {
743
754
        int wrapped = MOD2(s->RxBufAddr + size, s->RxBufferSize);
749
760
 
750
761
            if (size > wrapped)
751
762
            {
752
 
                pci_dma_write(&s->dev, s->RxBuf + s->RxBufAddr,
 
763
                pci_dma_write(d, s->RxBuf + s->RxBufAddr,
753
764
                              buf, size-wrapped);
754
765
            }
755
766
 
756
767
            /* reset buffer pointer */
757
768
            s->RxBufAddr = 0;
758
769
 
759
 
            pci_dma_write(&s->dev, s->RxBuf + s->RxBufAddr,
 
770
            pci_dma_write(d, s->RxBuf + s->RxBufAddr,
760
771
                          buf + (size-wrapped), wrapped);
761
772
 
762
773
            s->RxBufAddr = wrapped;
766
777
    }
767
778
 
768
779
    /* non-wrapping path or overwrapping enabled */
769
 
    pci_dma_write(&s->dev, s->RxBuf + s->RxBufAddr, buf, size);
 
780
    pci_dma_write(d, s->RxBuf + s->RxBufAddr, buf, size);
770
781
 
771
782
    s->RxBufAddr += size;
772
783
}
809
820
static ssize_t rtl8139_do_receive(NetClientState *nc, const uint8_t *buf, size_t size_, int do_interrupt)
810
821
{
811
822
    RTL8139State *s = qemu_get_nic_opaque(nc);
 
823
    PCIDevice *d = PCI_DEVICE(s);
812
824
    /* size is the length of the buffer passed to the driver */
813
825
    int size = size_;
814
826
    const uint8_t *dot1q_buf = NULL;
973
985
 
974
986
        uint32_t val, rxdw0,rxdw1,rxbufLO,rxbufHI;
975
987
 
976
 
        pci_dma_read(&s->dev, cplus_rx_ring_desc, &val, 4);
 
988
        pci_dma_read(d, cplus_rx_ring_desc, &val, 4);
977
989
        rxdw0 = le32_to_cpu(val);
978
 
        pci_dma_read(&s->dev, cplus_rx_ring_desc+4, &val, 4);
 
990
        pci_dma_read(d, cplus_rx_ring_desc+4, &val, 4);
979
991
        rxdw1 = le32_to_cpu(val);
980
 
        pci_dma_read(&s->dev, cplus_rx_ring_desc+8, &val, 4);
 
992
        pci_dma_read(d, cplus_rx_ring_desc+8, &val, 4);
981
993
        rxbufLO = le32_to_cpu(val);
982
 
        pci_dma_read(&s->dev, cplus_rx_ring_desc+12, &val, 4);
 
994
        pci_dma_read(d, cplus_rx_ring_desc+12, &val, 4);
983
995
        rxbufHI = le32_to_cpu(val);
984
996
 
985
997
        DPRINTF("+++ C+ mode RX descriptor %d %08x %08x %08x %08x\n",
1047
1059
 
1048
1060
        /* receive/copy to target memory */
1049
1061
        if (dot1q_buf) {
1050
 
            pci_dma_write(&s->dev, rx_addr, buf, 2 * ETHER_ADDR_LEN);
1051
 
            pci_dma_write(&s->dev, rx_addr + 2 * ETHER_ADDR_LEN,
 
1062
            pci_dma_write(d, rx_addr, buf, 2 * ETHER_ADDR_LEN);
 
1063
            pci_dma_write(d, rx_addr + 2 * ETHER_ADDR_LEN,
1052
1064
                          buf + 2 * ETHER_ADDR_LEN + VLAN_HLEN,
1053
1065
                          size - 2 * ETHER_ADDR_LEN);
1054
1066
        } else {
1055
 
            pci_dma_write(&s->dev, rx_addr, buf, size);
 
1067
            pci_dma_write(d, rx_addr, buf, size);
1056
1068
        }
1057
1069
 
1058
1070
        if (s->CpCmd & CPlusRxChkSum)
1062
1074
 
1063
1075
        /* write checksum */
1064
1076
        val = cpu_to_le32(crc32(0, buf, size_));
1065
 
        pci_dma_write(&s->dev, rx_addr+size, (uint8_t *)&val, 4);
 
1077
        pci_dma_write(d, rx_addr+size, (uint8_t *)&val, 4);
1066
1078
 
1067
1079
/* first segment of received packet flag */
1068
1080
#define CP_RX_STATUS_FS (1<<29)
1108
1120
 
1109
1121
        /* update ring data */
1110
1122
        val = cpu_to_le32(rxdw0);
1111
 
        pci_dma_write(&s->dev, cplus_rx_ring_desc, (uint8_t *)&val, 4);
 
1123
        pci_dma_write(d, cplus_rx_ring_desc, (uint8_t *)&val, 4);
1112
1124
        val = cpu_to_le32(rxdw1);
1113
 
        pci_dma_write(&s->dev, cplus_rx_ring_desc+4, (uint8_t *)&val, 4);
 
1125
        pci_dma_write(d, cplus_rx_ring_desc+4, (uint8_t *)&val, 4);
1114
1126
 
1115
1127
        /* update tally counter */
1116
1128
        ++s->tally_counters.RxOk;
1197
1209
 
1198
1210
static void rtl8139_reset(DeviceState *d)
1199
1211
{
1200
 
    RTL8139State *s = container_of(d, RTL8139State, dev.qdev);
 
1212
    RTL8139State *s = RTL8139(d);
1201
1213
    int i;
1202
1214
 
1203
1215
    /* restore MAC address */
1293
1305
 
1294
1306
static void RTL8139TallyCounters_dma_write(RTL8139State *s, dma_addr_t tc_addr)
1295
1307
{
 
1308
    PCIDevice *d = PCI_DEVICE(s);
1296
1309
    RTL8139TallyCounters *tally_counters = &s->tally_counters;
1297
1310
    uint16_t val16;
1298
1311
    uint32_t val32;
1299
1312
    uint64_t val64;
1300
1313
 
1301
1314
    val64 = cpu_to_le64(tally_counters->TxOk);
1302
 
    pci_dma_write(&s->dev, tc_addr + 0,     (uint8_t *)&val64, 8);
 
1315
    pci_dma_write(d, tc_addr + 0,     (uint8_t *)&val64, 8);
1303
1316
 
1304
1317
    val64 = cpu_to_le64(tally_counters->RxOk);
1305
 
    pci_dma_write(&s->dev, tc_addr + 8,     (uint8_t *)&val64, 8);
 
1318
    pci_dma_write(d, tc_addr + 8,     (uint8_t *)&val64, 8);
1306
1319
 
1307
1320
    val64 = cpu_to_le64(tally_counters->TxERR);
1308
 
    pci_dma_write(&s->dev, tc_addr + 16,    (uint8_t *)&val64, 8);
 
1321
    pci_dma_write(d, tc_addr + 16,    (uint8_t *)&val64, 8);
1309
1322
 
1310
1323
    val32 = cpu_to_le32(tally_counters->RxERR);
1311
 
    pci_dma_write(&s->dev, tc_addr + 24,    (uint8_t *)&val32, 4);
 
1324
    pci_dma_write(d, tc_addr + 24,    (uint8_t *)&val32, 4);
1312
1325
 
1313
1326
    val16 = cpu_to_le16(tally_counters->MissPkt);
1314
 
    pci_dma_write(&s->dev, tc_addr + 28,    (uint8_t *)&val16, 2);
 
1327
    pci_dma_write(d, tc_addr + 28,    (uint8_t *)&val16, 2);
1315
1328
 
1316
1329
    val16 = cpu_to_le16(tally_counters->FAE);
1317
 
    pci_dma_write(&s->dev, tc_addr + 30,    (uint8_t *)&val16, 2);
 
1330
    pci_dma_write(d, tc_addr + 30,    (uint8_t *)&val16, 2);
1318
1331
 
1319
1332
    val32 = cpu_to_le32(tally_counters->Tx1Col);
1320
 
    pci_dma_write(&s->dev, tc_addr + 32,    (uint8_t *)&val32, 4);
 
1333
    pci_dma_write(d, tc_addr + 32,    (uint8_t *)&val32, 4);
1321
1334
 
1322
1335
    val32 = cpu_to_le32(tally_counters->TxMCol);
1323
 
    pci_dma_write(&s->dev, tc_addr + 36,    (uint8_t *)&val32, 4);
 
1336
    pci_dma_write(d, tc_addr + 36,    (uint8_t *)&val32, 4);
1324
1337
 
1325
1338
    val64 = cpu_to_le64(tally_counters->RxOkPhy);
1326
 
    pci_dma_write(&s->dev, tc_addr + 40,    (uint8_t *)&val64, 8);
 
1339
    pci_dma_write(d, tc_addr + 40,    (uint8_t *)&val64, 8);
1327
1340
 
1328
1341
    val64 = cpu_to_le64(tally_counters->RxOkBrd);
1329
 
    pci_dma_write(&s->dev, tc_addr + 48,    (uint8_t *)&val64, 8);
 
1342
    pci_dma_write(d, tc_addr + 48,    (uint8_t *)&val64, 8);
1330
1343
 
1331
1344
    val32 = cpu_to_le32(tally_counters->RxOkMul);
1332
 
    pci_dma_write(&s->dev, tc_addr + 56,    (uint8_t *)&val32, 4);
 
1345
    pci_dma_write(d, tc_addr + 56,    (uint8_t *)&val32, 4);
1333
1346
 
1334
1347
    val16 = cpu_to_le16(tally_counters->TxAbt);
1335
 
    pci_dma_write(&s->dev, tc_addr + 60,    (uint8_t *)&val16, 2);
 
1348
    pci_dma_write(d, tc_addr + 60,    (uint8_t *)&val16, 2);
1336
1349
 
1337
1350
    val16 = cpu_to_le16(tally_counters->TxUndrn);
1338
 
    pci_dma_write(&s->dev, tc_addr + 62,    (uint8_t *)&val16, 2);
 
1351
    pci_dma_write(d, tc_addr + 62,    (uint8_t *)&val16, 2);
1339
1352
}
1340
1353
 
1341
1354
/* Loads values of tally counters from VM state file */
1364
1377
 
1365
1378
static void rtl8139_ChipCmd_write(RTL8139State *s, uint32_t val)
1366
1379
{
 
1380
    DeviceState *d = DEVICE(s);
 
1381
 
1367
1382
    val &= 0xff;
1368
1383
 
1369
1384
    DPRINTF("ChipCmd write val=0x%08x\n", val);
1371
1386
    if (val & CmdReset)
1372
1387
    {
1373
1388
        DPRINTF("ChipCmd reset\n");
1374
 
        rtl8139_reset(&s->dev.qdev);
 
1389
        rtl8139_reset(d);
1375
1390
    }
1376
1391
    if (val & CmdRxEnb)
1377
1392
    {
1525
1540
 
1526
1541
static void rtl8139_Cfg9346_write(RTL8139State *s, uint32_t val)
1527
1542
{
 
1543
    DeviceState *d = DEVICE(s);
 
1544
 
1528
1545
    val &= 0xff;
1529
1546
 
1530
1547
    DPRINTF("Cfg9346 write val=0x%02x\n", val);
1544
1561
    } else if (opmode == 0x40) {
1545
1562
        /* Reset.  */
1546
1563
        val = 0;
1547
 
        rtl8139_reset(&s->dev.qdev);
 
1564
        rtl8139_reset(d);
1548
1565
    }
1549
1566
 
1550
1567
    s->Cfg9346 = val;
1821
1838
 
1822
1839
    DPRINTF("+++ transmitting from descriptor %d\n", descriptor);
1823
1840
 
 
1841
    PCIDevice *d = PCI_DEVICE(s);
1824
1842
    int txsize = s->TxStatus[descriptor] & 0x1fff;
1825
1843
    uint8_t txbuffer[0x2000];
1826
1844
 
1827
1845
    DPRINTF("+++ transmit reading %d bytes from host memory at 0x%08x\n",
1828
1846
        txsize, s->TxAddr[descriptor]);
1829
1847
 
1830
 
    pci_dma_read(&s->dev, s->TxAddr[descriptor], txbuffer, txsize);
 
1848
    pci_dma_read(d, s->TxAddr[descriptor], txbuffer, txsize);
1831
1849
 
1832
1850
    /* Mark descriptor as transferred */
1833
1851
    s->TxStatus[descriptor] |= TxHostOwns;
1946
1964
        return 0 ;
1947
1965
    }
1948
1966
 
 
1967
    PCIDevice *d = PCI_DEVICE(s);
1949
1968
    int descriptor = s->currCPlusTxDesc;
1950
1969
 
1951
1970
    dma_addr_t cplus_tx_ring_desc = rtl8139_addr64(s->TxAddr[0], s->TxAddr[1]);
1959
1978
 
1960
1979
    uint32_t val, txdw0,txdw1,txbufLO,txbufHI;
1961
1980
 
1962
 
    pci_dma_read(&s->dev, cplus_tx_ring_desc,    (uint8_t *)&val, 4);
 
1981
    pci_dma_read(d, cplus_tx_ring_desc,    (uint8_t *)&val, 4);
1963
1982
    txdw0 = le32_to_cpu(val);
1964
 
    pci_dma_read(&s->dev, cplus_tx_ring_desc+4,  (uint8_t *)&val, 4);
 
1983
    pci_dma_read(d, cplus_tx_ring_desc+4,  (uint8_t *)&val, 4);
1965
1984
    txdw1 = le32_to_cpu(val);
1966
 
    pci_dma_read(&s->dev, cplus_tx_ring_desc+8,  (uint8_t *)&val, 4);
 
1985
    pci_dma_read(d, cplus_tx_ring_desc+8,  (uint8_t *)&val, 4);
1967
1986
    txbufLO = le32_to_cpu(val);
1968
 
    pci_dma_read(&s->dev, cplus_tx_ring_desc+12, (uint8_t *)&val, 4);
 
1987
    pci_dma_read(d, cplus_tx_ring_desc+12, (uint8_t *)&val, 4);
1969
1988
    txbufHI = le32_to_cpu(val);
1970
1989
 
1971
1990
    DPRINTF("+++ C+ mode TX descriptor %d %08x %08x %08x %08x\n", descriptor,
2072
2091
            DMA_ADDR_FMT" to offset %d\n", txsize, tx_addr,
2073
2092
            s->cplus_txbuffer_offset);
2074
2093
 
2075
 
    pci_dma_read(&s->dev, tx_addr,
 
2094
    pci_dma_read(d, tx_addr,
2076
2095
                 s->cplus_txbuffer + s->cplus_txbuffer_offset, txsize);
2077
2096
    s->cplus_txbuffer_offset += txsize;
2078
2097
 
2100
2119
 
2101
2120
    /* update ring data */
2102
2121
    val = cpu_to_le32(txdw0);
2103
 
    pci_dma_write(&s->dev, cplus_tx_ring_desc, (uint8_t *)&val, 4);
 
2122
    pci_dma_write(d, cplus_tx_ring_desc, (uint8_t *)&val, 4);
2104
2123
 
2105
2124
    /* Now decide if descriptor being processed is holding the last segment of packet */
2106
2125
    if (txdw0 & CP_TX_LS)
2575
2594
    /* this value is off by 16 */
2576
2595
    s->RxBufPtr = MOD2(val + 0x10, s->RxBufferSize);
2577
2596
 
 
2597
    /* more buffer space may be available so try to receive */
 
2598
    qemu_flush_queued_packets(qemu_get_queue(s->nic));
 
2599
 
2578
2600
    DPRINTF(" CAPR write: rx buffer length %d head 0x%04x read 0x%04x\n",
2579
2601
        s->RxBufferSize, s->RxBufAddr, s->RxBufPtr);
2580
2602
}
3270
3292
    .post_load = rtl8139_post_load,
3271
3293
    .pre_save  = rtl8139_pre_save,
3272
3294
    .fields      = (VMStateField []) {
3273
 
        VMSTATE_PCI_DEVICE(dev, RTL8139State),
 
3295
        VMSTATE_PCI_DEVICE(parent_obj, RTL8139State),
3274
3296
        VMSTATE_PARTIAL_BUFFER(phys, RTL8139State, 6),
3275
3297
        VMSTATE_BUFFER(mult, RTL8139State),
3276
3298
        VMSTATE_UINT32_ARRAY(TxStatus, RTL8139State, 4),
3436
3458
 
3437
3459
static void pci_rtl8139_uninit(PCIDevice *dev)
3438
3460
{
3439
 
    RTL8139State *s = DO_UPCAST(RTL8139State, dev, dev);
 
3461
    RTL8139State *s = RTL8139(dev);
3440
3462
 
3441
3463
    memory_region_destroy(&s->bar_io);
3442
3464
    memory_region_destroy(&s->bar_mem);
3474
3496
 
3475
3497
static int pci_rtl8139_init(PCIDevice *dev)
3476
3498
{
3477
 
    RTL8139State * s = DO_UPCAST(RTL8139State, dev, dev);
 
3499
    RTL8139State *s = RTL8139(dev);
 
3500
    DeviceState *d = DEVICE(dev);
3478
3501
    uint8_t *pci_conf;
3479
3502
 
3480
 
    pci_conf = s->dev.config;
 
3503
    pci_conf = dev->config;
3481
3504
    pci_conf[PCI_INTERRUPT_PIN] = 1;    /* interrupt pin A */
3482
3505
    /* TODO: start of capability list, but no capability
3483
3506
     * list bit in status register, and offset 0xdc seems unused. */
3484
3507
    pci_conf[PCI_CAPABILITY_LIST] = 0xdc;
3485
3508
 
3486
 
    memory_region_init_io(&s->bar_io, &rtl8139_io_ops, s, "rtl8139", 0x100);
3487
 
    memory_region_init_io(&s->bar_mem, &rtl8139_mmio_ops, s, "rtl8139", 0x100);
3488
 
    pci_register_bar(&s->dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &s->bar_io);
3489
 
    pci_register_bar(&s->dev, 1, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->bar_mem);
 
3509
    memory_region_init_io(&s->bar_io, OBJECT(s), &rtl8139_io_ops, s,
 
3510
                          "rtl8139", 0x100);
 
3511
    memory_region_init_io(&s->bar_mem, OBJECT(s), &rtl8139_mmio_ops, s,
 
3512
                          "rtl8139", 0x100);
 
3513
    pci_register_bar(dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &s->bar_io);
 
3514
    pci_register_bar(dev, 1, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->bar_mem);
3490
3515
 
3491
3516
    qemu_macaddr_default_if_unset(&s->conf.macaddr);
3492
3517
 
3502
3527
    s->eeprom.contents[9] = s->conf.macaddr.a[4] | s->conf.macaddr.a[5] << 8;
3503
3528
 
3504
3529
    s->nic = qemu_new_nic(&net_rtl8139_info, &s->conf,
3505
 
                          object_get_typename(OBJECT(dev)), dev->qdev.id, s);
 
3530
                          object_get_typename(OBJECT(dev)), d->id, s);
3506
3531
    qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a);
3507
3532
 
3508
3533
    s->cplus_txbuffer = NULL;
3513
3538
    s->timer = qemu_new_timer_ns(vm_clock, rtl8139_timer, s);
3514
3539
    rtl8139_set_next_tctr_time(s, qemu_get_clock_ns(vm_clock));
3515
3540
 
3516
 
    add_boot_device_path(s->conf.bootindex, &dev->qdev, "/ethernet-phy@0");
 
3541
    add_boot_device_path(s->conf.bootindex, d, "/ethernet-phy@0");
3517
3542
 
3518
3543
    return 0;
3519
3544
}
3538
3563
    dc->reset = rtl8139_reset;
3539
3564
    dc->vmsd = &vmstate_rtl8139;
3540
3565
    dc->props = rtl8139_properties;
 
3566
    set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
3541
3567
}
3542
3568
 
3543
3569
static const TypeInfo rtl8139_info = {
3544
 
    .name          = "rtl8139",
 
3570
    .name          = TYPE_RTL8139,
3545
3571
    .parent        = TYPE_PCI_DEVICE,
3546
3572
    .instance_size = sizeof(RTL8139State),
3547
3573
    .class_init    = rtl8139_class_init,