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 |
|
|
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 |
{ |
{ |
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); |
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 |
|
|
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) */ |
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); |