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

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

upstream/dynamips-0.2.5/dev_c7200.c revision 1 by dpavlin, Sat Oct 6 16:01:44 2007 UTC upstream/dynamips-0.2.6-RC1/dev_c7200.c revision 2 by dpavlin, Sat Oct 6 16:03:58 2007 UTC
# Line 267  ssize_t c7200_nvram_extract_config(vm_in Line 267  ssize_t c7200_nvram_extract_config(vm_in
267  int c7200_nvram_push_config(vm_instance_t *vm,char *buffer,size_t len)  int c7200_nvram_push_config(vm_instance_t *vm,char *buffer,size_t len)
268  {  {
269     struct vdevice *nvram_dev;     struct vdevice *nvram_dev;
270     m_uint64_t addr,cfg_addr,cfg_start_addr;     m_uint64_t addr,cfg_addr;
271       m_uint32_t cklen;
272       m_uint16_t cksum;
273    
274     if (!(nvram_dev = dev_get_by_name(vm,"nvram")))     if (!(nvram_dev = dev_get_by_name(vm,"nvram")))
275        return(-1);        return(-1);
276    
277     addr = nvram_dev->phys_addr + vm->nvram_rom_space;     addr = nvram_dev->phys_addr + vm->nvram_rom_space;
278     cfg_start_addr = cfg_addr = addr + 0x40;     cfg_addr = addr + 0x2c;
279    
280     /* Write IOS tag, uncompressed config... */     /* Write IOS tag, uncompressed config... */
281     physmem_copy_u16_to_vm(vm,addr+0x06,0xF0A5);     physmem_copy_u16_to_vm(vm,addr+0x06,0xF0A5);
282     physmem_copy_u16_to_vm(vm,addr+0x08,0xABCD);      /* Magic number */     physmem_copy_u16_to_vm(vm,addr+0x08,0xABCD);      /* Magic number */
283     physmem_copy_u16_to_vm(vm,addr+0x0a,0x0001);      /* ??? */     physmem_copy_u16_to_vm(vm,addr+0x0a,0x0001);      /* ??? */
284     physmem_copy_u16_to_vm(vm,addr+0x0c,0x0000);      /* zero */     physmem_copy_u16_to_vm(vm,addr+0x0c,0x0000);      /* zero */
285     physmem_copy_u16_to_vm(vm,addr+0x0e,0x0c04);      /* IOS version */     physmem_copy_u16_to_vm(vm,addr+0x0e,0x0000);      /* IOS version */
286    
287     /* Store file contents to NVRAM */     /* Store file contents to NVRAM */
288     physmem_copy_to_vm(vm,buffer,cfg_addr,len);     physmem_copy_to_vm(vm,buffer,cfg_addr,len);
289    
290     /* Write config addresses + size */     /* Write config addresses + size */
291     physmem_copy_u32_to_vm(vm,addr+0x10,cfg_start_addr);     physmem_copy_u32_to_vm(vm,addr+0x10,cfg_addr);
292     physmem_copy_u32_to_vm(vm,addr+0x14,cfg_addr);     physmem_copy_u32_to_vm(vm,addr+0x14,cfg_addr + len);
293     physmem_copy_u32_to_vm(vm,addr+0x18,cfg_addr - cfg_start_addr);     physmem_copy_u32_to_vm(vm,addr+0x18,len);
294    
295       /* Compute the checksum */
296       cklen = nvram_dev->phys_len - (vm->nvram_rom_space + 0x08);
297       cksum = nvram_cksum(vm,addr+0x08,cklen);
298       physmem_copy_u16_to_vm(vm,addr+0x0c,cksum);
299     return(0);     return(0);
300  }  }
301    
# Line 931  int c7200_pa_shutdown_all(c7200_t *route Line 938  int c7200_pa_shutdown_all(c7200_t *route
938     }     }
939    
940     return(0);     return(0);
941    }
942    
943    /* Show info about all NMs */
944    int c7200_pa_show_all_info(c7200_t *router)
945    {
946       struct c7200_pa_bay *bay;
947       int i;
948    
949       for(i=0;i<C7200_MAX_PA_BAYS;i++) {
950          if (!(bay = c7200_pa_get_info(router,i)) || !bay->pa_driver)
951             continue;
952    
953          if (bay->pa_driver->pa_show_info != NULL)
954             bay->pa_driver->pa_show_info(router,i);
955       }
956    
957       return(0);
958  }  }
959    
960  /* Maximum number of tokens in a PA description */  /* Maximum number of tokens in a PA description */

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

  ViewVC Help
Powered by ViewVC 1.1.26