/[dynamips]/upstream/dynamips-0.2.7-RC2/dev_pa_a1.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 /upstream/dynamips-0.2.7-RC2/dev_pa_a1.c

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

upstream/dynamips-0.2.7-RC1/dev_pa_a1.c revision 7 by dpavlin, Sat Oct 6 16:23:47 2007 UTC upstream/dynamips-0.2.7-RC2/dev_pa_a1.c revision 8 by dpavlin, Sat Oct 6 16:24:54 2007 UTC
# Line 285  struct ti1570_rcr_entry { Line 285  struct ti1570_rcr_entry {
285  struct pa_a1_data {  struct pa_a1_data {
286     char *name;     char *name;
287    
288       /* IRQ clearing counter */
289       u_int irq_clear_count;
290    
291     /* Control Memory pointer */     /* Control Memory pointer */
292     m_uint32_t *ctrl_mem_ptr;     m_uint32_t *ctrl_mem_ptr;
293    
# Line 336  struct pa_a1_data { Line 339  struct pa_a1_data {
339  /* Reset the TI1570 (forward declaration) */  /* Reset the TI1570 (forward declaration) */
340  static void ti1570_reset(struct pa_a1_data *d,int clear_ctrl_mem);  static void ti1570_reset(struct pa_a1_data *d,int clear_ctrl_mem);
341    
342    /* Update the interrupt status */
343    static inline void dev_pa_a1_update_irq_status(struct pa_a1_data *d)
344    {
345       if (d->iregs[TI1570_REG_STATUS] & d->iregs[TI1570_REG_IMASK]) {
346          pci_dev_trigger_irq(d->vm,d->pci_dev_ti);
347       } else {
348          pci_dev_clear_irq(d->vm,d->pci_dev_ti);
349       }
350    }
351    
352  /*  /*
353   * dev_pa_a1_access()   * dev_pa_a1_access()
354   */   */
# Line 359  void *dev_pa_a1_access(cpu_gen_t *cpu,st Line 372  void *dev_pa_a1_access(cpu_gen_t *cpu,st
372    
373     /* Specific cases */     /* Specific cases */
374     switch(offset) {     switch(offset) {
375          /* Status register */
376          case 0x3204:
377             if (op_type == MTS_READ) {
378                *data = d->iregs[TI1570_REG_STATUS];
379    
380                if (++d->irq_clear_count == 2) {
381                   d->iregs[TI1570_REG_STATUS] &= ~0x3FF;
382                   d->irq_clear_count = 0;
383                }
384    
385                dev_pa_a1_update_irq_status(d);
386             }
387             break;
388    
389          /* Software Reset register */
390        case 0x3238:        case 0x3238:
391           TI1570_LOG(d,"reset issued.\n");           TI1570_LOG(d,"reset issued.\n");
392           ti1570_reset(d,FALSE);           ti1570_reset(d,FALSE);
# Line 888  static int ti1570_scan_tx_dma_entry_sing Line 916  static int ti1570_scan_tx_dma_entry_sing
916     /* Generate an interrupt if required */     /* Generate an interrupt if required */
917     if (tde->ctrl_buf & TI1570_TX_DMA_TCR_SELECT)     if (tde->ctrl_buf & TI1570_TX_DMA_TCR_SELECT)
918     {     {
919        if (((d->iregs[TI1570_REG_STATUS] & TI1570_CFG_BP_SEL) && buf_end) ||        if (((d->iregs[TI1570_REG_CONFIG] & TI1570_CFG_BP_SEL) && buf_end) ||
920            pkt_end)            pkt_end)
921        {        {
922           d->iregs[TI1570_REG_STATUS] |= TI1570_STAT_CP_TX;           d->iregs[TI1570_REG_STATUS] |= TI1570_STAT_CP_TX;
923           pci_dev_trigger_irq(d->vm,d->pci_dev_ti);           dev_pa_a1_update_irq_status(d);
924        }        }
925     }     }
926    
# Line 1025  static void ti1570_update_rx_cring(struc Line 1053  static void ti1570_update_rx_cring(struc
1053    
1054        /* generate the appropriate IRQ */        /* generate the appropriate IRQ */
1055        d->iregs[TI1570_REG_STATUS] |= TI1570_STAT_CP_RX;        d->iregs[TI1570_REG_STATUS] |= TI1570_STAT_CP_RX;
1056        pci_dev_trigger_irq(d->vm,d->pci_dev_ti);        dev_pa_a1_update_irq_status(d);
1057     } else  {     } else  {
1058        rcr_end = (d->iregs[TI1570_REG_RX_CRING_SIZE] >> 16);        rcr_end = (d->iregs[TI1570_REG_RX_CRING_SIZE] >> 16);
1059        rcr_end &= TI1570_RCR_SIZE_MASK;        rcr_end &= TI1570_RCR_SIZE_MASK;
# Line 1472  static void pci_ti1570_write(cpu_gen_t * Line 1500  static void pci_ti1570_write(cpu_gen_t *
1500  static m_uint32_t pci_plx9060es_read(cpu_gen_t *cpu,struct pci_device *dev,  static m_uint32_t pci_plx9060es_read(cpu_gen_t *cpu,struct pci_device *dev,
1501                                       int reg)                                       int reg)
1502  {  {
1503       struct pa_a1_data *d = dev->priv_data;
1504    
1505  #if DEBUG_ACCESS  #if DEBUG_ACCESS
1506     TI1570_LOG(d,"PLX9060ES","read reg 0x%x\n",reg);     TI1570_LOG(d,"PLX9060ES","read reg 0x%x\n",reg);
1507  #endif  #endif
# Line 1487  static m_uint32_t pci_plx9060es_read(cpu Line 1517  static m_uint32_t pci_plx9060es_read(cpu
1517  static void pci_plx9060es_write(cpu_gen_t *cpu,struct pci_device *dev,  static void pci_plx9060es_write(cpu_gen_t *cpu,struct pci_device *dev,
1518                                  int reg,m_uint32_t value)                                  int reg,m_uint32_t value)
1519  {  {
1520       struct pa_a1_data *d = dev->priv_data;
1521    
1522  #if DEBUG_ACCESS  #if DEBUG_ACCESS
1523     TI1570_LOG(d,"PLX9060ES","write reg 0x%x, value 0x%x\n",reg,value);     TI1570_LOG(d,"PLX9060ES","write reg 0x%x, value 0x%x\n",reg,value);
1524  #endif  #endif
# Line 1533  int dev_c7200_pa_a1_init(c7200_t *router Line 1565  int dev_c7200_pa_a1_init(c7200_t *router
1565     /* Add PCI device TI1570 */     /* Add PCI device TI1570 */
1566     pci_dev_ti = pci_dev_add(router->pa_bay[pa_bay].pci_map,name,     pci_dev_ti = pci_dev_add(router->pa_bay[pa_bay].pci_map,name,
1567                              TI1570_PCI_VENDOR_ID,TI1570_PCI_PRODUCT_ID,                              TI1570_PCI_VENDOR_ID,TI1570_PCI_PRODUCT_ID,
1568                              0,0,C7200_NETIO_IRQ,d,                              0,0,c7200_net_irq_for_slot_port(pa_bay,0),d,
1569                              NULL,pci_ti1570_read,pci_ti1570_write);                              NULL,pci_ti1570_read,pci_ti1570_write);
1570    
1571     if (!pci_dev_ti) {     if (!pci_dev_ti) {
# Line 1546  int dev_c7200_pa_a1_init(c7200_t *router Line 1578  int dev_c7200_pa_a1_init(c7200_t *router
1578     pci_dev_plx = pci_dev_add(router->pa_bay[pa_bay].pci_map,name,     pci_dev_plx = pci_dev_add(router->pa_bay[pa_bay].pci_map,name,
1579                               PLX_9060ES_PCI_VENDOR_ID,                               PLX_9060ES_PCI_VENDOR_ID,
1580                               PLX_9060ES_PCI_PRODUCT_ID,                               PLX_9060ES_PCI_PRODUCT_ID,
1581                               1,0,C7200_NETIO_IRQ,d,                               1,0,-1,d,
1582                               NULL,pci_plx9060es_read,pci_plx9060es_write);                               NULL,pci_plx9060es_read,pci_plx9060es_write);
1583    
1584     if (!pci_dev_plx) {     if (!pci_dev_plx) {

Legend:
Removed from v.7  
changed lines
  Added in v.8

  ViewVC Help
Powered by ViewVC 1.1.26