/[dynamips]/trunk/dev_am79c971.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/dev_am79c971.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

upstream/dynamips-0.2.7/dev_am79c971.c revision 10 by dpavlin, Sat Oct 6 16:29:14 2007 UTC upstream/dynamips-0.2.8-RC1/dev_am79c971.c revision 11 by dpavlin, Sat Oct 6 16:33:40 2007 UTC
# Line 30  Line 30 
30  #define DEBUG_BCR_REGS   0  #define DEBUG_BCR_REGS   0
31  #define DEBUG_PCI_REGS   0  #define DEBUG_PCI_REGS   0
32  #define DEBUG_ACCESS     0  #define DEBUG_ACCESS     0
33  #define DEBUG_TRANSMIT   0  #define DEBUG_TRANSMIT   1
34  #define DEBUG_RECEIVE    0  #define DEBUG_RECEIVE    1
35  #define DEBUG_UNKNOWN    0  #define DEBUG_UNKNOWN    0
36    
37  /* AMD Am79c971 PCI vendor/product codes */  /* AMD Am79c971 PCI vendor/product codes */
# Line 502  static void am79c971_bdp_access(cpu_gen_ Line 502  static void am79c971_bdp_access(cpu_gen_
502           if (op_type == MTS_READ) {           if (op_type == MTS_READ) {
503              cpu_log(cpu,d->name,"read access to unknown BCR %d\n",d->rap);              cpu_log(cpu,d->name,"read access to unknown BCR %d\n",d->rap);
504           } else {           } else {
505              cpu_log(cpu,d->name,"write access to unknown BCR %d, value=0x%x\n",              cpu_log(cpu,d->name,
506                        "write access to unknown BCR %d, value=0x%x\n",
507                      d->rap,*data);                      d->rap,*data);
508           }           }
509  #endif  #endif
# Line 737  static int am79c971_handle_rxring(netio_ Line 738  static int am79c971_handle_rxring(netio_
738      * Don't start receive if the RX ring address has not been set      * Don't start receive if the RX ring address has not been set
739      * and if RX ON is not set.      * and if RX ON is not set.
740      */      */
741     if ((d->rx_start == 0) || !(d->csr[0] & AM79C971_CSR0_TXON))     if ((d->rx_start == 0) || !(d->csr[0] & AM79C971_CSR0_RXON))
742        return(FALSE);        return(FALSE);
743    
744  #if DEBUG_RECEIVE  #if DEBUG_RECEIVE
# Line 752  static int am79c971_handle_rxring(netio_ Line 753  static int am79c971_handle_rxring(netio_
753      * for this virtual machine.      * for this virtual machine.
754      */      */
755     hdr = (n_eth_hdr_t *)pkt;     hdr = (n_eth_hdr_t *)pkt;
756    
757     if (am79c971_handle_mac_addr(d,pkt))     if (am79c971_handle_mac_addr(d,pkt))
758        am79c971_receive_pkt(d,pkt,pkt_len);        am79c971_receive_pkt(d,pkt,pkt_len);
759    
# Line 817  static int am79c971_handle_txring_single Line 819  static int am79c971_handle_txring_single
819     struct tx_desc txd0,ctxd,ntxd,*ptxd;     struct tx_desc txd0,ctxd,ntxd,*ptxd;
820     m_uint32_t tx_start,tx_current;     m_uint32_t tx_start,tx_current;
821     m_uint32_t clen,tot_len;     m_uint32_t clen,tot_len;
822      
823     if ((d->tx_start == 0) || !(d->csr[0] & AM79C971_CSR0_TXON))     if ((d->tx_start == 0) || !(d->csr[0] & AM79C971_CSR0_TXON))
824        return(FALSE);        return(FALSE);
825        
# Line 825  static int am79c971_handle_txring_single Line 827  static int am79c971_handle_txring_single
827     tx_start = tx_current = txdesc_get_current(d);     tx_start = tx_current = txdesc_get_current(d);
828     ptxd = &txd0;     ptxd = &txd0;
829     txdesc_read(d,tx_start,ptxd);     txdesc_read(d,tx_start,ptxd);
830      
831     /* If we don't own the first descriptor, we cannot transmit */     /* If we don't own the first descriptor, we cannot transmit */
832     if (!(ptxd->tmd[1] & AM79C971_TMD1_OWN))     if (!(ptxd->tmd[1] & AM79C971_TMD1_OWN))
833        return(FALSE);        return(FALSE);
834          
835  #if DEBUG_TRANSMIT  #if DEBUG_TRANSMIT
836     AM79C971_LOG(d,"am79c971_handle_txring: 1st desc: "     AM79C971_LOG(d,"am79c971_handle_txring: 1st desc: "
837                  "tmd[0]=0x%x, tmd[1]=0x%x, tmd[2]=0x%x, tmd[3]=0x%x\n",                  "tmd[0]=0x%x, tmd[1]=0x%x, tmd[2]=0x%x, tmd[3]=0x%x\n",
# Line 886  static int am79c971_handle_txring_single Line 888  static int am79c971_handle_txring_single
888        AM79C971_LOG(d,"sending packet of %u bytes\n",tot_len);        AM79C971_LOG(d,"sending packet of %u bytes\n",tot_len);
889        mem_dump(log_file,pkt,tot_len);        mem_dump(log_file,pkt,tot_len);
890  #endif  #endif
891          /* rewrite ISL header if required */
892          cisco_isl_rewrite(pkt,tot_len);
893    
894        /* send it on wire */        /* send it on wire */
895        netio_send(d->nio,pkt,tot_len);        netio_send(d->nio,pkt,tot_len);
896     }     }
# Line 1036  void dev_am79c971_remove(struct am79c971 Line 1041  void dev_am79c971_remove(struct am79c971
1041    
1042  /* Bind a NIO to an AMD Am79c971 device */  /* Bind a NIO to an AMD Am79c971 device */
1043  int dev_am79c971_set_nio(struct am79c971_data *d,netio_desc_t *nio)  int dev_am79c971_set_nio(struct am79c971_data *d,netio_desc_t *nio)
1044  {  {  
1045     /* check that a NIO is not already bound */     /* check that a NIO is not already bound */
1046     if (d->nio != NULL)     if (d->nio != NULL)
1047        return(-1);        return(-1);

Legend:
Removed from v.10  
changed lines
  Added in v.11

  ViewVC Help
Powered by ViewVC 1.1.26