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

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

upstream/dynamips-0.2.6-RC5/dev_c2691.c revision 6 by dpavlin, Sat Oct 6 16:09:07 2007 UTC upstream/dynamips-0.2.7-RC1/dev_c2691.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 "vm.h"
17  #include "dynamips.h"  #include "dynamips.h"
18  #include "memory.h"  #include "memory.h"
19  #include "device.h"  #include "device.h"
20  #include "pci_io.h"  #include "pci_io.h"
21  #include "dev_gt.h"  #include "dev_gt.h"
22  #include "cisco_eeprom.h"  #include "cisco_eeprom.h"
23    #include "dev_rom.h"
24  #include "dev_c2691.h"  #include "dev_c2691.h"
25  #include "dev_vtty.h"  #include "dev_vtty.h"
26  #include "registry.h"  #include "registry.h"
# Line 1016  static int c2691_init(c2691_t *router) Line 1018  static int c2691_init(c2691_t *router)
1018     vm_instance_t *vm = router->vm;     vm_instance_t *vm = router->vm;
1019    
1020     /* Set the processor type: R7000 */     /* Set the processor type: R7000 */
1021     mips64_set_prid(vm->boot_cpu,MIPS_PRID_R7000);     mips64_set_prid(CPU_MIPS64(vm->boot_cpu),MIPS_PRID_R7000);
1022    
1023     /* Initialize the Galileo GT-96100 PCI controller */     /* Initialize the Galileo GT-96100 PCI controller */
1024     if (c2691_init_gt96100(router) == -1)     if (c2691_init_gt96100(router) == -1)
# Line 1091  void c2691_init_defaults(c2691_t *router Line 1093  void c2691_init_defaults(c2691_t *router
1093  /* Initialize the C2691 Platform */  /* Initialize the C2691 Platform */
1094  int c2691_init_platform(c2691_t *router)  int c2691_init_platform(c2691_t *router)
1095  {  {
    extern m_uint8_t microcode[];  
    extern ssize_t microcode_len;  
1096     vm_instance_t *vm = router->vm;     vm_instance_t *vm = router->vm;
1097     struct c2691_nm_bay *nm_bay;     struct c2691_nm_bay *nm_bay;
1098     cpu_mips_t *cpu;     cpu_mips_t *cpu;
1099       cpu_gen_t *gen;
1100     vm_obj_t *obj;     vm_obj_t *obj;
1101     int i;     int i;
1102    
# Line 1109  int c2691_init_platform(c2691_t *router) Line 1110  int c2691_init_platform(c2691_t *router)
1110     vm->cpu_group = cpu_group_create("System CPU");     vm->cpu_group = cpu_group_create("System CPU");
1111    
1112     /* Initialize the virtual MIPS processor */     /* Initialize the virtual MIPS processor */
1113     if (!(cpu = cpu_create(vm,0))) {     if (!(gen = cpu_create(vm,CPU_TYPE_MIPS64,0))) {
1114        vm_error(vm,"unable to create CPU!\n");        vm_error(vm,"unable to create CPU!\n");
1115        return(-1);        return(-1);
1116     }     }
1117    
1118       cpu = CPU_MIPS64(gen);
1119    
1120     /* Add this CPU to the system CPU group */     /* Add this CPU to the system CPU group */
1121     cpu_group_add(vm->cpu_group,cpu);     cpu_group_add(vm->cpu_group,gen);
1122     vm->boot_cpu = cpu;     vm->boot_cpu = gen;
1123    
1124       /* Initialize the IRQ routing vectors */
1125       vm->set_irq = mips64_vm_set_irq;
1126       vm->clear_irq = mips64_vm_clear_irq;
1127    
1128     /* Mark the Network IO interrupt as high priority */     /* Mark the Network IO interrupt as high priority */
1129     cpu->irq_idle_preempt[C2691_NETIO_IRQ] = TRUE;     cpu->irq_idle_preempt[C2691_NETIO_IRQ] = TRUE;
# Line 1133  int c2691_init_platform(c2691_t *router) Line 1140  int c2691_init_platform(c2691_t *router)
1140     dev_remote_control_init(vm,0x16000000,0x1000);     dev_remote_control_init(vm,0x16000000,0x1000);
1141    
1142     /* Specific Storage Area (SSA) */     /* Specific Storage Area (SSA) */
1143     dev_ram_init(vm,"ssa",TRUE,FALSE,NULL,0x16001000ULL,0x7000);     dev_ram_init(vm,"ssa",TRUE,FALSE,NULL,FALSE,0x16001000ULL,0x7000);
1144    
1145     /* IO FPGA */     /* IO FPGA */
1146     if (dev_c2691_iofpga_init(router,C2691_IOFPGA_ADDR,0x40000) == -1)     if (dev_c2691_iofpga_init(router,C2691_IOFPGA_ADDR,0x40000) == -1)
# Line 1156  int c2691_init_platform(c2691_t *router) Line 1163  int c2691_init_platform(c2691_t *router)
1163     if (!(obj = dev_flash_init(vm,"rom",C2691_ROM_ADDR,vm->rom_size*1048576)))     if (!(obj = dev_flash_init(vm,"rom",C2691_ROM_ADDR,vm->rom_size*1048576)))
1164        return(-1);        return(-1);
1165    
1166     dev_flash_copy_data(obj,0,microcode,microcode_len);     dev_flash_copy_data(obj,0,mips64_microcode,mips64_microcode_len);
1167     c2691_nvram_check_empty_config(vm);     c2691_nvram_check_empty_config(vm);
1168    
1169     /* Initialize the NS16552 DUART */     /* Initialize the NS16552 DUART */
# Line 1197  int c2691_init_platform(c2691_t *router) Line 1204  int c2691_init_platform(c2691_t *router)
1204  int c2691_boot_ios(c2691_t *router)  int c2691_boot_ios(c2691_t *router)
1205  {    {  
1206     vm_instance_t *vm = router->vm;     vm_instance_t *vm = router->vm;
1207       cpu_mips_t *cpu;
1208    
1209     if (!vm->boot_cpu)     if (!vm->boot_cpu)
1210        return(-1);        return(-1);
# Line 1211  int c2691_boot_ios(c2691_t *router) Line 1219  int c2691_boot_ios(c2691_t *router)
1219     }     }
1220    
1221     /* Reset the boot CPU */     /* Reset the boot CPU */
1222     mips64_reset(vm->boot_cpu);     cpu = CPU_MIPS64(vm->boot_cpu);
1223       mips64_reset(cpu);
1224    
1225     /* Load IOS image */     /* Load IOS image */
1226     if (mips64_load_elf_image(vm->boot_cpu,vm->ios_image,     if (mips64_load_elf_image(cpu,vm->ios_image,
1227                               (vm->ghost_status == VM_GHOST_RAM_USE),                               (vm->ghost_status == VM_GHOST_RAM_USE),
1228                               &vm->ios_entry_point) < 0)                               &vm->ios_entry_point) < 0)
1229     {     {
# Line 1225  int c2691_boot_ios(c2691_t *router) Line 1234  int c2691_boot_ios(c2691_t *router)
1234     /* Launch the simulation */     /* Launch the simulation */
1235     printf("\nC2691 '%s': starting simulation (CPU0 PC=0x%llx), "     printf("\nC2691 '%s': starting simulation (CPU0 PC=0x%llx), "
1236            "JIT %sabled.\n",            "JIT %sabled.\n",
1237            vm->name,vm->boot_cpu->pc,vm->jit_use ? "en":"dis");            vm->name,cpu->pc,vm->jit_use ? "en":"dis");
1238    
1239     vm_log(vm,"C2691_BOOT",     vm_log(vm,"C2691_BOOT",
1240            "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",
1241            vm->boot_cpu->pc,vm->boot_cpu->idle_pc,vm->jit_use ? "on":"off");            cpu->pc,cpu->idle_pc,vm->jit_use ? "on":"off");
1242    
1243     /* Start main CPU */     /* Start main CPU */
1244     if (vm->ghost_status != VM_GHOST_RAM_GENERATE) {     if (vm->ghost_status != VM_GHOST_RAM_GENERATE) {
# Line 1266  int c2691_init_instance(c2691_t *router) Line 1275  int c2691_init_instance(c2691_t *router)
1275     }     }
1276    
1277     /* Load ROM (ELF image or embedded) */     /* Load ROM (ELF image or embedded) */
1278     cpu0 = vm->boot_cpu;     cpu0 = CPU_MIPS64(vm->boot_cpu);
1279     rom_entry_point = (m_uint32_t)MIPS_ROM_PC;     rom_entry_point = (m_uint32_t)MIPS_ROM_PC;
1280    
1281     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