Revision d537cf6c hw/ne2000.c
b/hw/ne2000.c | ||
---|---|---|
136 | 136 |
uint8_t phys[6]; /* mac address */ |
137 | 137 |
uint8_t curpag; |
138 | 138 |
uint8_t mult[8]; /* multicast mask array */ |
139 |
int irq;
|
|
139 |
qemu_irq irq;
|
|
140 | 140 |
PCIDevice *pci_dev; |
141 | 141 |
VLANClientState *vc; |
142 | 142 |
uint8_t macaddr[6]; |
... | ... | |
164 | 164 |
int isr; |
165 | 165 |
isr = (s->isr & s->imr) & 0x7f; |
166 | 166 |
#if defined(DEBUG_NE2000) |
167 |
printf("NE2000: Set IRQ line %d to %d (%02x %02x)\n",
|
|
168 |
s->irq, isr ? 1 : 0, s->isr, s->imr);
|
|
167 |
printf("NE2000: Set IRQ to %d (%02x %02x)\n", |
|
168 |
isr ? 1 : 0, s->isr, s->imr); |
|
169 | 169 |
#endif |
170 |
if (s->irq == 16) { |
|
171 |
/* PCI irq */ |
|
172 |
pci_set_irq(s->pci_dev, 0, (isr != 0)); |
|
173 |
} else { |
|
174 |
/* ISA irq */ |
|
175 |
pic_set_irq(s->irq, (isr != 0)); |
|
176 |
} |
|
170 |
qemu_set_irq(s->irq, (isr != 0)); |
|
177 | 171 |
} |
178 | 172 |
|
179 | 173 |
#define POLYNOMIAL 0x04c11db6 |
... | ... | |
647 | 641 |
static void ne2000_save(QEMUFile* f,void* opaque) |
648 | 642 |
{ |
649 | 643 |
NE2000State* s=(NE2000State*)opaque; |
644 |
int tmp; |
|
650 | 645 |
|
651 | 646 |
if (s->pci_dev) |
652 | 647 |
pci_device_save(s->pci_dev, f); |
... | ... | |
669 | 664 |
qemu_put_buffer(f, s->phys, 6); |
670 | 665 |
qemu_put_8s(f, &s->curpag); |
671 | 666 |
qemu_put_buffer(f, s->mult, 8); |
672 |
qemu_put_be32s(f, &s->irq); |
|
667 |
tmp = 0; |
|
668 |
qemu_put_be32s(f, &tmp); /* ignored, was irq */ |
|
673 | 669 |
qemu_put_buffer(f, s->mem, NE2000_MEM_SIZE); |
674 | 670 |
} |
675 | 671 |
|
... | ... | |
677 | 673 |
{ |
678 | 674 |
NE2000State* s=(NE2000State*)opaque; |
679 | 675 |
int ret; |
676 |
int tmp; |
|
680 | 677 |
|
681 | 678 |
if (version_id > 3) |
682 | 679 |
return -EINVAL; |
... | ... | |
709 | 706 |
qemu_get_buffer(f, s->phys, 6); |
710 | 707 |
qemu_get_8s(f, &s->curpag); |
711 | 708 |
qemu_get_buffer(f, s->mult, 8); |
712 |
qemu_get_be32s(f, &s->irq);
|
|
709 |
qemu_get_be32s(f, &tmp); /* ignored */
|
|
713 | 710 |
qemu_get_buffer(f, s->mem, NE2000_MEM_SIZE); |
714 | 711 |
|
715 | 712 |
return 0; |
716 | 713 |
} |
717 | 714 |
|
718 |
void isa_ne2000_init(int base, int irq, NICInfo *nd)
|
|
715 |
void isa_ne2000_init(int base, qemu_irq irq, NICInfo *nd)
|
|
719 | 716 |
{ |
720 | 717 |
NE2000State *s; |
721 | 718 |
|
... | ... | |
804 | 801 |
pci_register_io_region(&d->dev, 0, 0x100, |
805 | 802 |
PCI_ADDRESS_SPACE_IO, ne2000_map); |
806 | 803 |
s = &d->ne2000; |
807 |
s->irq = 16; // PCI interrupt
|
|
804 |
s->irq = d->dev.irq[0];
|
|
808 | 805 |
s->pci_dev = (PCIDevice *)d; |
809 | 806 |
memcpy(s->macaddr, nd->macaddr, 6); |
810 | 807 |
ne2000_reset(s); |
Also available in: Unified diff