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

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

upstream/dynamips-0.2.6-RC5/dev_c3600.c revision 6 by dpavlin, Sat Oct 6 16:09:07 2007 UTC upstream/dynamips-0.2.7-RC1/dev_c3600.c revision 7 by dpavlin, Sat Oct 6 16:23:47 2007 UTC
# Line 12  Line 12 
12  #include <sys/types.h>  #include <sys/types.h>
13  #include <assert.h>  #include <assert.h>
14    
15  #include "mips64.h"  #include "cpu.h"
16  #include "dynamips.h"  #include "dynamips.h"
17  #include "memory.h"  #include "memory.h"
18  #include "device.h"  #include "device.h"
19  #include "pci_io.h"  #include "pci_io.h"
20  #include "dev_gt.h"  #include "dev_gt.h"
21  #include "cisco_eeprom.h"  #include "cisco_eeprom.h"
22    #include "dev_rom.h"
23  #include "dev_c3600.h"  #include "dev_c3600.h"
24  #include "dev_c3600_bay.h"  #include "dev_c3600_bay.h"
25  #include "dev_vtty.h"  #include "dev_vtty.h"
# Line 1108  static int c3620_init(c3600_t *router) Line 1109  static int c3620_init(c3600_t *router)
1109     int i;     int i;
1110    
1111     /* Set the processor type: R4700 */     /* Set the processor type: R4700 */
1112     mips64_set_prid(vm->boot_cpu,MIPS_PRID_R4700);     mips64_set_prid(CPU_MIPS64(vm->boot_cpu),MIPS_PRID_R4700);
1113    
1114     /* Initialize the Galileo GT-64010 PCI controller */     /* Initialize the Galileo GT-64010 PCI controller */
1115     if (c3600_init_gt64010(router) == -1)     if (c3600_init_gt64010(router) == -1)
# Line 1130  static int c3640_init(c3600_t *router) Line 1131  static int c3640_init(c3600_t *router)
1131     int i;     int i;
1132    
1133     /* Set the processor type: R4700 */     /* Set the processor type: R4700 */
1134     mips64_set_prid(vm->boot_cpu,MIPS_PRID_R4700);     mips64_set_prid(CPU_MIPS64(vm->boot_cpu),MIPS_PRID_R4700);
1135    
1136     /* Initialize the Galileo GT-64010 PCI controller */     /* Initialize the Galileo GT-64010 PCI controller */
1137     if (c3600_init_gt64010(router) == -1)     if (c3600_init_gt64010(router) == -1)
# Line 1165  static int c3660_init(c3600_t *router) Line 1166  static int c3660_init(c3600_t *router)
1166     int i;     int i;
1167    
1168     /* Set the processor type: R5271 */     /* Set the processor type: R5271 */
1169     mips64_set_prid(vm->boot_cpu,MIPS_PRID_R527x);     mips64_set_prid(CPU_MIPS64(vm->boot_cpu),MIPS_PRID_R527x);
1170    
1171     /* Initialize the Galileo GT-64120 PCI controller */     /* Initialize the Galileo GT-64120 PCI controller */
1172     if (c3600_init_gt64120(router) == -1)     if (c3600_init_gt64120(router) == -1)
# Line 1265  int c3600_init_platform(c3600_t *router) Line 1266  int c3600_init_platform(c3600_t *router)
1266     vm_instance_t *vm = router->vm;     vm_instance_t *vm = router->vm;
1267     struct c3600_nm_bay *nm_bay;     struct c3600_nm_bay *nm_bay;
1268     cpu_mips_t *cpu;     cpu_mips_t *cpu;
1269       cpu_gen_t *gen;
1270     int i;     int i;
1271    
1272     /* Copy config register setup into "active" config register */     /* Copy config register setup into "active" config register */
# Line 1277  int c3600_init_platform(c3600_t *router) Line 1279  int c3600_init_platform(c3600_t *router)
1279     vm->cpu_group = cpu_group_create("System CPU");     vm->cpu_group = cpu_group_create("System CPU");
1280    
1281     /* Initialize the virtual MIPS processor */     /* Initialize the virtual MIPS processor */
1282     if (!(cpu = cpu_create(vm,0))) {     if (!(gen = cpu_create(vm,CPU_TYPE_MIPS64,0))) {
1283        vm_error(vm,"unable to create CPU!\n");        vm_error(vm,"unable to create CPU!\n");
1284        return(-1);        return(-1);
1285     }     }
1286    
1287       cpu = CPU_MIPS64(gen);
1288    
1289     /* Add this CPU to the system CPU group */     /* Add this CPU to the system CPU group */
1290     cpu_group_add(vm->cpu_group,cpu);     cpu_group_add(vm->cpu_group,gen);
1291     vm->boot_cpu = cpu;     vm->boot_cpu = gen;
1292    
1293       /* Initialize the IRQ routing vectors */
1294       vm->set_irq = mips64_vm_set_irq;
1295       vm->clear_irq = mips64_vm_clear_irq;
1296    
1297     /* Mark the Network IO interrupt as high priority */     /* Mark the Network IO interrupt as high priority */
1298     cpu->irq_idle_preempt[C3600_NETIO_IRQ] = TRUE;     cpu->irq_idle_preempt[C3600_NETIO_IRQ] = TRUE;
# Line 1334  int c3600_init_platform(c3600_t *router) Line 1342  int c3600_init_platform(c3600_t *router)
1342     /* Initialize ROM */     /* Initialize ROM */
1343     if (!vm->rom_filename) {     if (!vm->rom_filename) {
1344        /* use embedded ROM */        /* use embedded ROM */
1345        dev_rom_init(vm,"rom",C3600_ROM_ADDR,vm->rom_size*1048576);        dev_rom_init(vm,"rom",C3600_ROM_ADDR,vm->rom_size*1048576,
1346                       mips64_microcode,mips64_microcode_len);
1347     } else {     } else {
1348        /* use alternate ROM */        /* use alternate ROM */
1349        dev_ram_init(vm,"rom",TRUE,TRUE,NULL,        dev_ram_init(vm,"rom",TRUE,TRUE,NULL,FALSE,
1350                     C3600_ROM_ADDR,vm->rom_size*1048576);                     C3600_ROM_ADDR,vm->rom_size*1048576);
1351     }     }
1352    
# Line 1371  int c3600_init_platform(c3600_t *router) Line 1380  int c3600_init_platform(c3600_t *router)
1380  int c3600_boot_ios(c3600_t *router)  int c3600_boot_ios(c3600_t *router)
1381  {    {  
1382     vm_instance_t *vm = router->vm;     vm_instance_t *vm = router->vm;
1383       cpu_mips_t *cpu;
1384    
1385     if (!vm->boot_cpu)     if (!vm->boot_cpu)
1386        return(-1);        return(-1);
# Line 1385  int c3600_boot_ios(c3600_t *router) Line 1395  int c3600_boot_ios(c3600_t *router)
1395     }     }
1396    
1397     /* Reset the boot CPU */     /* Reset the boot CPU */
1398     mips64_reset(vm->boot_cpu);     cpu = CPU_MIPS64(vm->boot_cpu);
1399       mips64_reset(cpu);
1400    
1401     /* Load IOS image */     /* Load IOS image */
1402     if (mips64_load_elf_image(vm->boot_cpu,vm->ios_image,     if (mips64_load_elf_image(cpu,vm->ios_image,
1403                               (vm->ghost_status == VM_GHOST_RAM_USE),                               (vm->ghost_status == VM_GHOST_RAM_USE),
1404                               &vm->ios_entry_point) < 0)                               &vm->ios_entry_point) < 0)
1405     {     {
# Line 1399  int c3600_boot_ios(c3600_t *router) Line 1410  int c3600_boot_ios(c3600_t *router)
1410     /* Launch the simulation */     /* Launch the simulation */
1411     printf("\nC3600 '%s': starting simulation (CPU0 PC=0x%llx), "     printf("\nC3600 '%s': starting simulation (CPU0 PC=0x%llx), "
1412            "JIT %sabled.\n",            "JIT %sabled.\n",
1413            vm->name,vm->boot_cpu->pc,vm->jit_use ? "en":"dis");            vm->name,cpu->pc,vm->jit_use ? "en":"dis");
1414    
1415     vm_log(vm,"C3600_BOOT",     vm_log(vm,"C3600_BOOT",
1416            "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",
1417            vm->boot_cpu->pc,vm->boot_cpu->idle_pc,vm->jit_use ? "on":"off");            cpu->pc,cpu->idle_pc,vm->jit_use ? "on":"off");
1418    
1419     /* Start main CPU */     /* Start main CPU */
1420     if (vm->ghost_status != VM_GHOST_RAM_GENERATE) {     if (vm->ghost_status != VM_GHOST_RAM_GENERATE) {
# Line 1440  int c3600_init_instance(c3600_t *router) Line 1451  int c3600_init_instance(c3600_t *router)
1451     }     }
1452    
1453     /* Load ROM (ELF image or embedded) */     /* Load ROM (ELF image or embedded) */
1454     cpu0 = vm->boot_cpu;     cpu0 = CPU_MIPS64(vm->boot_cpu);
1455     rom_entry_point = (m_uint32_t)MIPS_ROM_PC;     rom_entry_point = (m_uint32_t)MIPS_ROM_PC;
1456    
1457     if ((vm->rom_filename != NULL) &&     if ((vm->rom_filename != NULL) &&

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

  ViewVC Help
Powered by ViewVC 1.1.26