--- upstream/dynamips-0.2.6-RC1/dev_dec21140.c 2007/10/06 16:03:58 2 +++ upstream/dynamips-0.2.7-RC1/dev_dec21140.c 2007/10/06 16:23:47 7 @@ -1,5 +1,5 @@ /* - * Cisco C7200 (Predator) DEC21140 Module. + * Cisco router simlation platform. * Copyright (C) 2005,2006 Christophe Fillot. All rights reserved. * * DEC21140 FastEthernet chip emulation. @@ -31,7 +31,8 @@ #include "crc.h" #include "utils.h" -#include "mips64.h" +#include "cpu.h" +#include "vm.h" #include "dynamips.h" #include "memory.h" #include "device.h" @@ -206,11 +207,6 @@ n_eth_hdr_t *hdr = (n_eth_hdr_t *)pkt; int i; - /* Ignore traffic sent by us */ - for(i=0;imac_addr_count;i++) - if (!memcmp(&d->mac_addr[i],&hdr->saddr,N_ETH_ALEN)) - return(FALSE); - /* Accept systematically frames if we are running is promiscuous mode */ if (d->csr[6] & DEC21140_CSR6_PROMISC) return(TRUE); @@ -400,7 +396,7 @@ /* * dev_dec21140_access() */ -void *dev_dec21140_access(cpu_mips_t *cpu,struct vdevice *dev, +void *dev_dec21140_access(cpu_gen_t *cpu,struct vdevice *dev, m_uint32_t offset,u_int op_size,u_int op_type, m_uint64_t *data) { @@ -434,8 +430,9 @@ break; case 8: - /* CSR8 is cleared when read */ + /* CSR8 is cleared when read (missed frame counter) */ d->csr[reg] = 0; + *data = 0; break; default: @@ -510,7 +507,7 @@ return(nrxd_addr); } -/* Read an RX descriptor */ +/* Read a RX descriptor */ static void rxdesc_read(struct dec21140_data *d,m_uint32_t rxd_addr, struct rx_desc *rxd) { @@ -678,9 +675,9 @@ * for this virtual machine. */ if (dec21140_handle_mac_addr(d,pkt)) - dev_dec21140_receive_pkt(d,pkt,pkt_len); + return(dev_dec21140_receive_pkt(d,pkt,pkt_len)); - return(TRUE); + return(FALSE); } /* Read a TX descriptor */ @@ -729,7 +726,7 @@ /* Copy the current txring descriptor */ tx_start = d->tx_current; ptxd = &txd0; - txdesc_read(d,d->tx_current,ptxd); + txdesc_read(d,tx_start,ptxd); /* If we don't own the first descriptor, we cannot transmit */ if (!(txd0.tdes[0] & DEC21140_TXDESC_OWN)) @@ -854,7 +851,7 @@ * * Read a PCI register. */ -static m_uint32_t pci_dec21140_read(cpu_mips_t *cpu,struct pci_device *dev, +static m_uint32_t pci_dec21140_read(cpu_gen_t *cpu,struct pci_device *dev, int reg) { struct dec21140_data *d = dev->priv_data; @@ -880,7 +877,7 @@ * * Write a PCI register. */ -static void pci_dec21140_write(cpu_mips_t *cpu,struct pci_device *dev, +static void pci_dec21140_write(cpu_gen_t *cpu,struct pci_device *dev, int reg,m_uint32_t value) { struct dec21140_data *d = dev->priv_data;