2 * QEMU NE2000 emulation
4 * Copyright (c) 2003-2004 Fabrice Bellard
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 #include "qemu/osdep.h"
26 #include "hw/pci/pci.h"
29 #include "hw/loader.h"
30 #include "sysemu/sysemu.h"
32 /* debug NE2000 card */
33 //#define DEBUG_NE2000
35 #define MAX_ETH_FRAME_SIZE 1514
37 #define E8390_CMD 0x00 /* The command register (for all pages) */
38 /* Page 0 register offsets. */
39 #define EN0_CLDALO 0x01 /* Low byte of current local dma addr RD */
40 #define EN0_STARTPG 0x01 /* Starting page of ring bfr WR */
41 #define EN0_CLDAHI 0x02 /* High byte of current local dma addr RD */
42 #define EN0_STOPPG 0x02 /* Ending page +1 of ring bfr WR */
43 #define EN0_BOUNDARY 0x03 /* Boundary page of ring bfr RD WR */
44 #define EN0_TSR 0x04 /* Transmit status reg RD */
45 #define EN0_TPSR 0x04 /* Transmit starting page WR */
46 #define EN0_NCR 0x05 /* Number of collision reg RD */
47 #define EN0_TCNTLO 0x05 /* Low byte of tx byte count WR */
48 #define EN0_FIFO 0x06 /* FIFO RD */
49 #define EN0_TCNTHI 0x06 /* High byte of tx byte count WR */
50 #define EN0_ISR 0x07 /* Interrupt status reg RD WR */
51 #define EN0_CRDALO 0x08 /* low byte of current remote dma address RD */
52 #define EN0_RSARLO 0x08 /* Remote start address reg 0 */
53 #define EN0_CRDAHI 0x09 /* high byte, current remote dma address RD */
54 #define EN0_RSARHI 0x09 /* Remote start address reg 1 */
55 #define EN0_RCNTLO 0x0a /* Remote byte count reg WR */
56 #define EN0_RTL8029ID0 0x0a /* Realtek ID byte #1 RD */
57 #define EN0_RCNTHI 0x0b /* Remote byte count reg WR */
58 #define EN0_RTL8029ID1 0x0b /* Realtek ID byte #2 RD */
59 #define EN0_RSR 0x0c /* rx status reg RD */
60 #define EN0_RXCR 0x0c /* RX configuration reg WR */
61 #define EN0_TXCR 0x0d /* TX configuration reg WR */
62 #define EN0_COUNTER0 0x0d /* Rcv alignment error counter RD */
63 #define EN0_DCFG 0x0e /* Data configuration reg WR */
64 #define EN0_COUNTER1 0x0e /* Rcv CRC error counter RD */
65 #define EN0_IMR 0x0f /* Interrupt mask reg WR */
66 #define EN0_COUNTER2 0x0f /* Rcv missed frame error counter RD */
69 #define EN1_CURPAG 0x17
72 #define EN2_STARTPG 0x21 /* Starting page of ring bfr RD */
73 #define EN2_STOPPG 0x22 /* Ending page +1 of ring bfr RD */
75 #define EN3_CONFIG0 0x33
76 #define EN3_CONFIG1 0x34
77 #define EN3_CONFIG2 0x35
78 #define EN3_CONFIG3 0x36
80 /* Register accessed at EN_CMD, the 8390 base addr. */
81 #define E8390_STOP 0x01 /* Stop and reset the chip */
82 #define E8390_START 0x02 /* Start the chip, clear reset */
83 #define E8390_TRANS 0x04 /* Transmit a frame */
84 #define E8390_RREAD 0x08 /* Remote read */
85 #define E8390_RWRITE 0x10 /* Remote write */
86 #define E8390_NODMA 0x20 /* Remote DMA */
87 #define E8390_PAGE0 0x00 /* Select page chip registers */
88 #define E8390_PAGE1 0x40 /* using the two high-order bits */
89 #define E8390_PAGE2 0x80 /* Page 3 is invalid. */
91 /* Bits in EN0_ISR - Interrupt status register */
92 #define ENISR_RX 0x01 /* Receiver, no error */
93 #define ENISR_TX 0x02 /* Transmitter, no error */
94 #define ENISR_RX_ERR 0x04 /* Receiver, with error */
95 #define ENISR_TX_ERR 0x08 /* Transmitter, with error */
96 #define ENISR_OVER 0x10 /* Receiver overwrote the ring */
97 #define ENISR_COUNTERS 0x20 /* Counters need emptying */
98 #define ENISR_RDC 0x40 /* remote dma complete */
99 #define ENISR_RESET 0x80 /* Reset completed */
100 #define ENISR_ALL 0x3f /* Interrupts we will enable */
102 /* Bits in received packet status byte and EN0_RSR*/
103 #define ENRSR_RXOK 0x01 /* Received a good packet */
104 #define ENRSR_CRC 0x02 /* CRC error */
105 #define ENRSR_FAE 0x04 /* frame alignment error */
106 #define ENRSR_FO 0x08 /* FIFO overrun */
107 #define ENRSR_MPA 0x10 /* missed pkt */
108 #define ENRSR_PHY 0x20 /* physical/multicast address */
109 #define ENRSR_DIS 0x40 /* receiver disable. set in monitor mode */
110 #define ENRSR_DEF 0x80 /* deferring */
112 /* Transmitted packet status, EN0_TSR. */
113 #define ENTSR_PTX 0x01 /* Packet transmitted without error */
114 #define ENTSR_ND 0x02 /* The transmit wasn't deferred. */
115 #define ENTSR_COL 0x04 /* The transmit collided at least once. */
116 #define ENTSR_ABT 0x08 /* The transmit collided 16 times, and was deferred. */
117 #define ENTSR_CRS 0x10 /* The carrier sense was lost. */
118 #define ENTSR_FU 0x20 /* A "FIFO underrun" occurred during transmit. */
119 #define ENTSR_CDH 0x40 /* The collision detect "heartbeat" signal was lost. */
120 #define ENTSR_OWC 0x80 /* There was an out-of-window collision. */
122 typedef struct PCINE2000State
{
127 void ne2000_reset(NE2000State
*s
)
131 s
->isr
= ENISR_RESET
;
132 memcpy(s
->mem
, &s
->c
.macaddr
, 6);
136 /* duplicate prom data */
137 for(i
= 15;i
>= 0; i
--) {
138 s
->mem
[2 * i
] = s
->mem
[i
];
139 s
->mem
[2 * i
+ 1] = s
->mem
[i
];
143 static void ne2000_update_irq(NE2000State
*s
)
146 isr
= (s
->isr
& s
->imr
) & 0x7f;
147 #if defined(DEBUG_NE2000)
148 printf("NE2000: Set IRQ to %d (%02x %02x)\n",
149 isr
? 1 : 0, s
->isr
, s
->imr
);
151 qemu_set_irq(s
->irq
, (isr
!= 0));
154 static int ne2000_buffer_full(NE2000State
*s
)
156 int avail
, index
, boundary
;
158 index
= s
->curpag
<< 8;
159 boundary
= s
->boundary
<< 8;
160 if (index
< boundary
)
161 avail
= boundary
- index
;
163 avail
= (s
->stop
- s
->start
) - (index
- boundary
);
164 if (avail
< (MAX_ETH_FRAME_SIZE
+ 4))
169 #define MIN_BUF_SIZE 60
171 ssize_t
ne2000_receive(NetClientState
*nc
, const uint8_t *buf
, size_t size_
)
173 NE2000State
*s
= qemu_get_nic_opaque(nc
);
176 unsigned int total_len
, next
, avail
, len
, index
, mcast_idx
;
178 static const uint8_t broadcast_macaddr
[6] =
179 { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
181 #if defined(DEBUG_NE2000)
182 printf("NE2000: received len=%d\n", size
);
185 if (s
->cmd
& E8390_STOP
|| ne2000_buffer_full(s
))
188 /* XXX: check this */
189 if (s
->rxcr
& 0x10) {
190 /* promiscuous: receive all */
192 if (!memcmp(buf
, broadcast_macaddr
, 6)) {
193 /* broadcast address */
194 if (!(s
->rxcr
& 0x04))
196 } else if (buf
[0] & 0x01) {
198 if (!(s
->rxcr
& 0x08))
200 mcast_idx
= compute_mcast_idx(buf
);
201 if (!(s
->mult
[mcast_idx
>> 3] & (1 << (mcast_idx
& 7))))
203 } else if (s
->mem
[0] == buf
[0] &&
204 s
->mem
[2] == buf
[1] &&
205 s
->mem
[4] == buf
[2] &&
206 s
->mem
[6] == buf
[3] &&
207 s
->mem
[8] == buf
[4] &&
208 s
->mem
[10] == buf
[5]) {
216 /* if too small buffer, then expand it */
217 if (size
< MIN_BUF_SIZE
) {
218 memcpy(buf1
, buf
, size
);
219 memset(buf1
+ size
, 0, MIN_BUF_SIZE
- size
);
224 index
= s
->curpag
<< 8;
225 if (index
>= NE2000_PMEM_END
) {
228 /* 4 bytes for header */
229 total_len
= size
+ 4;
230 /* address for next packet (4 bytes for CRC) */
231 next
= index
+ ((total_len
+ 4 + 255) & ~0xff);
233 next
-= (s
->stop
- s
->start
);
234 /* prepare packet header */
236 s
->rsr
= ENRSR_RXOK
; /* receive status */
237 /* XXX: check this */
243 p
[3] = total_len
>> 8;
246 /* write packet data */
248 if (index
<= s
->stop
)
249 avail
= s
->stop
- index
;
255 memcpy(s
->mem
+ index
, buf
, len
);
258 if (index
== s
->stop
)
262 s
->curpag
= next
>> 8;
264 /* now we can signal we have received something */
266 ne2000_update_irq(s
);
271 static void ne2000_ioport_write(void *opaque
, uint32_t addr
, uint32_t val
)
273 NE2000State
*s
= opaque
;
274 int offset
, page
, index
;
278 printf("NE2000: write addr=0x%x val=0x%02x\n", addr
, val
);
280 if (addr
== E8390_CMD
) {
281 /* control register */
283 if (!(val
& E8390_STOP
)) { /* START bit makes no sense on RTL8029... */
284 s
->isr
&= ~ENISR_RESET
;
285 /* test specific case: zero length transfer */
286 if ((val
& (E8390_RREAD
| E8390_RWRITE
)) &&
289 ne2000_update_irq(s
);
291 if (val
& E8390_TRANS
) {
292 index
= (s
->tpsr
<< 8);
293 /* XXX: next 2 lines are a hack to make netware 3.11 work */
294 if (index
>= NE2000_PMEM_END
)
295 index
-= NE2000_PMEM_SIZE
;
296 /* fail safe: check range on the transmitted length */
297 if (index
+ s
->tcnt
<= NE2000_PMEM_END
) {
298 qemu_send_packet(qemu_get_queue(s
->nic
), s
->mem
+ index
,
301 /* signal end of transfer */
304 s
->cmd
&= ~E8390_TRANS
;
305 ne2000_update_irq(s
);
310 offset
= addr
| (page
<< 4);
313 if (val
<< 8 <= NE2000_PMEM_END
) {
318 if (val
<< 8 <= NE2000_PMEM_END
) {
323 if (val
<< 8 < NE2000_PMEM_END
) {
329 ne2000_update_irq(s
);
335 s
->tcnt
= (s
->tcnt
& 0xff00) | val
;
338 s
->tcnt
= (s
->tcnt
& 0x00ff) | (val
<< 8);
341 s
->rsar
= (s
->rsar
& 0xff00) | val
;
344 s
->rsar
= (s
->rsar
& 0x00ff) | (val
<< 8);
347 s
->rcnt
= (s
->rcnt
& 0xff00) | val
;
350 s
->rcnt
= (s
->rcnt
& 0x00ff) | (val
<< 8);
359 s
->isr
&= ~(val
& 0x7f);
360 ne2000_update_irq(s
);
362 case EN1_PHYS
... EN1_PHYS
+ 5:
363 s
->phys
[offset
- EN1_PHYS
] = val
;
366 if (val
<< 8 < NE2000_PMEM_END
) {
370 case EN1_MULT
... EN1_MULT
+ 7:
371 s
->mult
[offset
- EN1_MULT
] = val
;
377 static uint32_t ne2000_ioport_read(void *opaque
, uint32_t addr
)
379 NE2000State
*s
= opaque
;
380 int offset
, page
, ret
;
383 if (addr
== E8390_CMD
) {
387 offset
= addr
| (page
<< 4);
399 ret
= s
->rsar
& 0x00ff;
404 case EN1_PHYS
... EN1_PHYS
+ 5:
405 ret
= s
->phys
[offset
- EN1_PHYS
];
410 case EN1_MULT
... EN1_MULT
+ 7:
411 ret
= s
->mult
[offset
- EN1_MULT
];
429 ret
= 0; /* 10baseT media */
432 ret
= 0x40; /* 10baseT active */
435 ret
= 0x40; /* Full duplex */
443 printf("NE2000: read addr=0x%x val=%02x\n", addr
, ret
);
448 static inline void ne2000_mem_writeb(NE2000State
*s
, uint32_t addr
,
452 (addr
>= NE2000_PMEM_START
&& addr
< NE2000_MEM_SIZE
)) {
457 static inline void ne2000_mem_writew(NE2000State
*s
, uint32_t addr
,
460 addr
&= ~1; /* XXX: check exact behaviour if not even */
462 (addr
>= NE2000_PMEM_START
&& addr
< NE2000_MEM_SIZE
)) {
463 *(uint16_t *)(s
->mem
+ addr
) = cpu_to_le16(val
);
467 static inline void ne2000_mem_writel(NE2000State
*s
, uint32_t addr
,
470 addr
&= ~1; /* XXX: check exact behaviour if not even */
472 || (addr
>= NE2000_PMEM_START
473 && addr
+ sizeof(uint32_t) <= NE2000_MEM_SIZE
)) {
474 stl_le_p(s
->mem
+ addr
, val
);
478 static inline uint32_t ne2000_mem_readb(NE2000State
*s
, uint32_t addr
)
481 (addr
>= NE2000_PMEM_START
&& addr
< NE2000_MEM_SIZE
)) {
488 static inline uint32_t ne2000_mem_readw(NE2000State
*s
, uint32_t addr
)
490 addr
&= ~1; /* XXX: check exact behaviour if not even */
492 (addr
>= NE2000_PMEM_START
&& addr
< NE2000_MEM_SIZE
)) {
493 return le16_to_cpu(*(uint16_t *)(s
->mem
+ addr
));
499 static inline uint32_t ne2000_mem_readl(NE2000State
*s
, uint32_t addr
)
501 addr
&= ~1; /* XXX: check exact behaviour if not even */
503 || (addr
>= NE2000_PMEM_START
504 && addr
+ sizeof(uint32_t) <= NE2000_MEM_SIZE
)) {
505 return ldl_le_p(s
->mem
+ addr
);
511 static inline void ne2000_dma_update(NE2000State
*s
, int len
)
515 /* XXX: check what to do if rsar > stop */
516 if (s
->rsar
== s
->stop
)
519 if (s
->rcnt
<= len
) {
521 /* signal end of transfer */
523 ne2000_update_irq(s
);
529 static void ne2000_asic_ioport_write(void *opaque
, uint32_t addr
, uint32_t val
)
531 NE2000State
*s
= opaque
;
534 printf("NE2000: asic write val=0x%04x\n", val
);
538 if (s
->dcfg
& 0x01) {
540 ne2000_mem_writew(s
, s
->rsar
, val
);
541 ne2000_dma_update(s
, 2);
544 ne2000_mem_writeb(s
, s
->rsar
, val
);
545 ne2000_dma_update(s
, 1);
549 static uint32_t ne2000_asic_ioport_read(void *opaque
, uint32_t addr
)
551 NE2000State
*s
= opaque
;
554 if (s
->dcfg
& 0x01) {
556 ret
= ne2000_mem_readw(s
, s
->rsar
);
557 ne2000_dma_update(s
, 2);
560 ret
= ne2000_mem_readb(s
, s
->rsar
);
561 ne2000_dma_update(s
, 1);
564 printf("NE2000: asic read val=0x%04x\n", ret
);
569 static void ne2000_asic_ioport_writel(void *opaque
, uint32_t addr
, uint32_t val
)
571 NE2000State
*s
= opaque
;
574 printf("NE2000: asic writel val=0x%04x\n", val
);
579 ne2000_mem_writel(s
, s
->rsar
, val
);
580 ne2000_dma_update(s
, 4);
583 static uint32_t ne2000_asic_ioport_readl(void *opaque
, uint32_t addr
)
585 NE2000State
*s
= opaque
;
589 ret
= ne2000_mem_readl(s
, s
->rsar
);
590 ne2000_dma_update(s
, 4);
592 printf("NE2000: asic readl val=0x%04x\n", ret
);
597 static void ne2000_reset_ioport_write(void *opaque
, uint32_t addr
, uint32_t val
)
599 /* nothing to do (end of reset pulse) */
602 static uint32_t ne2000_reset_ioport_read(void *opaque
, uint32_t addr
)
604 NE2000State
*s
= opaque
;
609 static int ne2000_post_load(void* opaque
, int version_id
)
611 NE2000State
* s
= opaque
;
613 if (version_id
< 2) {
619 const VMStateDescription vmstate_ne2000
= {
622 .minimum_version_id
= 0,
623 .post_load
= ne2000_post_load
,
624 .fields
= (VMStateField
[]) {
625 VMSTATE_UINT8_V(rxcr
, NE2000State
, 2),
626 VMSTATE_UINT8(cmd
, NE2000State
),
627 VMSTATE_UINT32(start
, NE2000State
),
628 VMSTATE_UINT32(stop
, NE2000State
),
629 VMSTATE_UINT8(boundary
, NE2000State
),
630 VMSTATE_UINT8(tsr
, NE2000State
),
631 VMSTATE_UINT8(tpsr
, NE2000State
),
632 VMSTATE_UINT16(tcnt
, NE2000State
),
633 VMSTATE_UINT16(rcnt
, NE2000State
),
634 VMSTATE_UINT32(rsar
, NE2000State
),
635 VMSTATE_UINT8(rsr
, NE2000State
),
636 VMSTATE_UINT8(isr
, NE2000State
),
637 VMSTATE_UINT8(dcfg
, NE2000State
),
638 VMSTATE_UINT8(imr
, NE2000State
),
639 VMSTATE_BUFFER(phys
, NE2000State
),
640 VMSTATE_UINT8(curpag
, NE2000State
),
641 VMSTATE_BUFFER(mult
, NE2000State
),
642 VMSTATE_UNUSED(4), /* was irq */
643 VMSTATE_BUFFER(mem
, NE2000State
),
644 VMSTATE_END_OF_LIST()
648 static const VMStateDescription vmstate_pci_ne2000
= {
651 .minimum_version_id
= 3,
652 .fields
= (VMStateField
[]) {
653 VMSTATE_PCI_DEVICE(dev
, PCINE2000State
),
654 VMSTATE_STRUCT(ne2000
, PCINE2000State
, 0, vmstate_ne2000
, NE2000State
),
655 VMSTATE_END_OF_LIST()
659 static uint64_t ne2000_read(void *opaque
, hwaddr addr
,
662 NE2000State
*s
= opaque
;
664 if (addr
< 0x10 && size
== 1) {
665 return ne2000_ioport_read(s
, addr
);
666 } else if (addr
== 0x10) {
668 return ne2000_asic_ioport_read(s
, addr
);
670 return ne2000_asic_ioport_readl(s
, addr
);
672 } else if (addr
== 0x1f && size
== 1) {
673 return ne2000_reset_ioport_read(s
, addr
);
675 return ((uint64_t)1 << (size
* 8)) - 1;
678 static void ne2000_write(void *opaque
, hwaddr addr
,
679 uint64_t data
, unsigned size
)
681 NE2000State
*s
= opaque
;
683 if (addr
< 0x10 && size
== 1) {
684 ne2000_ioport_write(s
, addr
, data
);
685 } else if (addr
== 0x10) {
687 ne2000_asic_ioport_write(s
, addr
, data
);
689 ne2000_asic_ioport_writel(s
, addr
, data
);
691 } else if (addr
== 0x1f && size
== 1) {
692 ne2000_reset_ioport_write(s
, addr
, data
);
696 static const MemoryRegionOps ne2000_ops
= {
698 .write
= ne2000_write
,
699 .endianness
= DEVICE_LITTLE_ENDIAN
,
702 /***********************************************************/
703 /* PCI NE2000 definitions */
705 void ne2000_setup_io(NE2000State
*s
, DeviceState
*dev
, unsigned size
)
707 memory_region_init_io(&s
->io
, OBJECT(dev
), &ne2000_ops
, s
, "ne2000", size
);
710 static NetClientInfo net_ne2000_info
= {
711 .type
= NET_CLIENT_OPTIONS_KIND_NIC
,
712 .size
= sizeof(NICState
),
713 .receive
= ne2000_receive
,
716 static void pci_ne2000_realize(PCIDevice
*pci_dev
, Error
**errp
)
718 PCINE2000State
*d
= DO_UPCAST(PCINE2000State
, dev
, pci_dev
);
722 pci_conf
= d
->dev
.config
;
723 pci_conf
[PCI_INTERRUPT_PIN
] = 1; /* interrupt pin A */
726 ne2000_setup_io(s
, DEVICE(pci_dev
), 0x100);
727 pci_register_bar(&d
->dev
, 0, PCI_BASE_ADDRESS_SPACE_IO
, &s
->io
);
728 s
->irq
= pci_allocate_irq(&d
->dev
);
730 qemu_macaddr_default_if_unset(&s
->c
.macaddr
);
733 s
->nic
= qemu_new_nic(&net_ne2000_info
, &s
->c
,
734 object_get_typename(OBJECT(pci_dev
)), pci_dev
->qdev
.id
, s
);
735 qemu_format_nic_info_str(qemu_get_queue(s
->nic
), s
->c
.macaddr
.a
);
738 static void pci_ne2000_exit(PCIDevice
*pci_dev
)
740 PCINE2000State
*d
= DO_UPCAST(PCINE2000State
, dev
, pci_dev
);
741 NE2000State
*s
= &d
->ne2000
;
743 qemu_del_nic(s
->nic
);
744 qemu_free_irq(s
->irq
);
747 static void ne2000_instance_init(Object
*obj
)
749 PCIDevice
*pci_dev
= PCI_DEVICE(obj
);
750 PCINE2000State
*d
= DO_UPCAST(PCINE2000State
, dev
, pci_dev
);
751 NE2000State
*s
= &d
->ne2000
;
753 device_add_bootindex_property(obj
, &s
->c
.bootindex
,
754 "bootindex", "/ethernet-phy@0",
755 &pci_dev
->qdev
, NULL
);
758 static Property ne2000_properties
[] = {
759 DEFINE_NIC_PROPERTIES(PCINE2000State
, ne2000
.c
),
760 DEFINE_PROP_END_OF_LIST(),
763 static void ne2000_class_init(ObjectClass
*klass
, void *data
)
765 DeviceClass
*dc
= DEVICE_CLASS(klass
);
766 PCIDeviceClass
*k
= PCI_DEVICE_CLASS(klass
);
768 k
->realize
= pci_ne2000_realize
;
769 k
->exit
= pci_ne2000_exit
;
770 k
->romfile
= "efi-ne2k_pci.rom",
771 k
->vendor_id
= PCI_VENDOR_ID_REALTEK
;
772 k
->device_id
= PCI_DEVICE_ID_REALTEK_8029
;
773 k
->class_id
= PCI_CLASS_NETWORK_ETHERNET
;
774 dc
->vmsd
= &vmstate_pci_ne2000
;
775 dc
->props
= ne2000_properties
;
776 set_bit(DEVICE_CATEGORY_NETWORK
, dc
->categories
);
779 static const TypeInfo ne2000_info
= {
781 .parent
= TYPE_PCI_DEVICE
,
782 .instance_size
= sizeof(PCINE2000State
),
783 .class_init
= ne2000_class_init
,
784 .instance_init
= ne2000_instance_init
,
787 static void ne2000_register_types(void)
789 type_register_static(&ne2000_info
);
792 type_init(ne2000_register_types
)