/[dynamips]/upstream/dynamips-0.2.6-RC2/dev_c3600.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.6-RC2/dev_c3600.c

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

upstream/dynamips-0.2.5/dev_c3600.c revision 1 by dpavlin, Sat Oct 6 16:01:44 2007 UTC upstream/dynamips-0.2.6-RC1/dev_c3600.c revision 2 by dpavlin, Sat Oct 6 16:03:58 2007 UTC
# Line 90  static struct c3600_nm_driver *nm_driver Line 90  static struct c3600_nm_driver *nm_driver
90     &dev_c3600_nm_1fe_tx_driver,     &dev_c3600_nm_1fe_tx_driver,
91     &dev_c3600_nm_4t_driver,     &dev_c3600_nm_4t_driver,
92     &dev_c3600_leopard_2fe_driver,     &dev_c3600_leopard_2fe_driver,
93       &dev_c3600_nm_16esw_driver,
94     NULL,     NULL,
95  };  };
96    
# Line 138  ssize_t c3600_nvram_extract_config(vm_in Line 139  ssize_t c3600_nvram_extract_config(vm_in
139     return(clen);     return(clen);
140  }  }
141    
 /* Compute NVRAM checksum */  
 static u_int16_t nvram_cksum(vm_instance_t *vm,m_uint64_t addr,size_t count)  
 {  
    m_uint32_t sum = 0;  
   
    while(count > 1) {  
       sum = sum + physmem_copy_u16_from_vm(vm,addr);  
       addr += sizeof(m_uint16_t);  
       count -= sizeof(m_uint16_t);  
    }  
   
    if (count > 0)  
       sum = sum + ((physmem_copy_u16_from_vm(vm,addr) & 0xFF) << 8);  
   
    while(sum>>16)  
       sum = (sum & 0xffff) + (sum >> 16);  
   
    return(~sum);  
 }  
   
   
142  /* Directly push the IOS configuration to the NVRAM device */  /* Directly push the IOS configuration to the NVRAM device */
143  int c3600_nvram_push_config(vm_instance_t *vm,char *buffer,size_t len)  int c3600_nvram_push_config(vm_instance_t *vm,char *buffer,size_t len)
144  {  {
# Line 173  int c3600_nvram_push_config(vm_instance_ Line 153  int c3600_nvram_push_config(vm_instance_
153    
154     addr = nvram_dev->phys_addr + vm->nvram_rom_space;     addr = nvram_dev->phys_addr + vm->nvram_rom_space;
155     cfg_offset = 0x2c;     cfg_offset = 0x2c;
156     cfg_addr   = addr + cfg_offset;;     cfg_addr   = addr + cfg_offset;
157    
158     /* Write IOS tag, uncompressed config... */     /* Write IOS tag, uncompressed config... */
159     physmem_copy_u16_to_vm(vm,addr+0x06,0xF0A5);     physmem_copy_u16_to_vm(vm,addr+0x06,0xF0A5);
# Line 745  int c3600_nm_shutdown_all(c3600_t *route Line 725  int c3600_nm_shutdown_all(c3600_t *route
725     return(0);     return(0);
726  }  }
727    
728    /* Show info about all NMs */
729    int c3600_nm_show_all_info(c3600_t *router)
730    {
731       struct c3600_nm_bay *bay;
732       int i;
733    
734       for(i=0;i<C3600_MAX_NM_BAYS;i++) {
735          if (!(bay = c3600_nm_get_info(router,i)) || !bay->nm_driver)
736             continue;
737    
738          if (bay->nm_driver->nm_show_info != NULL)
739             bay->nm_driver->nm_show_info(router,i);
740       }
741    
742       return(0);
743    }
744    
745  /* Maximum number of tokens in a NM description */  /* Maximum number of tokens in a NM description */
746  #define NM_DESC_MAX_TOKENS  8  #define NM_DESC_MAX_TOKENS  8
747    
# Line 1315  int c3600_init_platform(c3600_t *router) Line 1312  int c3600_init_platform(c3600_t *router)
1312     }     }
1313    
1314     /* Initialize the NS16552 DUART */     /* Initialize the NS16552 DUART */
1315     dev_ns16552_init(vm,C3600_DUART_ADDR,0x1000,C3600_DUART_IRQ,     dev_ns16552_init(vm,C3600_DUART_ADDR,0x1000,3,C3600_DUART_IRQ,
1316                      vm->vtty_con,vm->vtty_aux);                      vm->vtty_con,vm->vtty_aux);
1317    
1318     /* Cirrus Logic PD6729 (PCI-to-PCMCIA host adapter) */     /* Cirrus Logic PD6729 (PCI-to-PCMCIA host adapter) */
# Line 1380  int c3600_boot_ios(c3600_t *router) Line 1377  int c3600_boot_ios(c3600_t *router)
1377     vm_log(vm,"C3600_BOOT",     vm_log(vm,"C3600_BOOT",
1378            "starting instance (CPU0 PC=0x%llx,idle_pc=0x%llx,JIT %s)\n",            "starting instance (CPU0 PC=0x%llx,idle_pc=0x%llx,JIT %s)\n",
1379            vm->boot_cpu->pc,vm->boot_cpu->idle_pc,vm->jit_use ? "on":"off");            vm->boot_cpu->pc,vm->boot_cpu->idle_pc,vm->jit_use ? "on":"off");
1380      
1381     /* Start main CPU */     /* Start main CPU */
1382     vm->status = VM_STATUS_RUNNING;     vm->status = VM_STATUS_RUNNING;
1383     cpu_start(vm->boot_cpu);     cpu_start(vm->boot_cpu);

Legend:
Removed from v.1  
changed lines
  Added in v.2

  ViewVC Help
Powered by ViewVC 1.1.26