/* Initialize the C1700 Platform */ static int c1700_init_platform(c1700_t *router) { vm_instance_t *vm = router->vm; vm_obj_t *obj; cpu_ppc_t *cpu; cpu_gen_t *gen; /* Copy config register setup into "active" config register */ vm->conf_reg = vm->conf_reg_setup; /* Create Console and AUX ports */ vm_init_vtty(vm); /* Create a CPU group */ vm->cpu_group = cpu_group_create("System CPU"); /* Initialize the virtual PowerPC processor */ if (!(gen = cpu_create(vm,CPU_TYPE_PPC32,0))) { vm_error(vm,"unable to create CPU!\n"); return(-1); } cpu = CPU_PPC32(gen); /* Add this CPU to the system CPU group */ cpu_group_add(vm->cpu_group,gen); vm->boot_cpu = gen; /* Set processor ID */ ppc32_set_pvr(cpu,0x00500202); /* Mark the Network IO interrupt as high priority */ vm->irq_idle_preempt[C1700_NETIO_IRQ] = TRUE; vm->irq_idle_preempt[C1700_DUART_IRQ] = TRUE; /* Copy some parameters from VM to CPU (idle PC, ...) */ cpu->idle_pc = vm->idle_pc; if (vm->timer_irq_check_itv) cpu->timer_irq_check_itv = vm->timer_irq_check_itv; /* Remote emulator control */ dev_remote_control_init(vm,0xf6000000,0x1000); /* MPC860 */ cpu->mpc860_immr = C1700_MPC860_ADDR; if (dev_mpc860_init(vm,"MPC860",C1700_MPC860_ADDR,0x10000) == -1) return(-1); if (!(obj = vm_object_find(router->vm,"MPC860"))) return(-1); router->mpc_data = obj->data; /* IO FPGA */ if (dev_c1700_iofpga_init(router,C1700_IOFPGA_ADDR,0x10000) == -1) return(-1); if (!(obj = vm_object_find(router->vm,"io_fpga"))) return(-1); router->iofpga_data = obj->data; /* Initialize the chassis */ if (c1700_init(router) == -1) return(-1); /* Initialize RAM */ vm_ram_init(vm,0x00000000ULL); /* Initialize ROM */ if (!vm->rom_filename) { /* use embedded ROM */ dev_rom_init(vm,"rom",C1700_ROM_ADDR,512*1024, ppc32_microcode,ppc32_microcode_len); } else { /* use alternate ROM */ dev_ram_init(vm,"rom",TRUE,TRUE,NULL,FALSE,C1700_ROM_ADDR,512*1024); } /* RAM aliasing */ dev_create_ram_alias(vm,"ram_alias","ram",0x80000000,vm->ram_size*1048576); /* NVRAM */ dev_nvram_init(vm,"nvram", C1700_NVRAM_ADDR,vm->nvram_size*1024,&vm->conf_reg); /* Bootflash (4 Mb) */ dev_bootflash_init(vm,"bootflash","c1700-bootflash-4mb",C1700_FLASH_ADDR); /* Initialize the NS16552 DUART */ dev_ns16552_init(vm,C1700_DUART_ADDR,0x1000,0,C1700_DUART_IRQ, vm->vtty_con,vm->vtty_aux); /* Initialize Network Modules */ if (vm_slot_init_all(vm) == -1) return(-1); /* Show device list */ c1700_show_hardware(router); return(0); }
/* Initialize the C3725 Platform */ static int c3725_init_platform(c3725_t *router) { vm_instance_t *vm = router->vm; cpu_mips_t *cpu; cpu_gen_t *gen; vm_obj_t *obj; /* Copy config register setup into "active" config register */ vm->conf_reg = vm->conf_reg_setup; /* Create Console and AUX ports */ vm_init_vtty(vm); /* Create a CPU group */ vm->cpu_group = cpu_group_create("System CPU"); /* Initialize the virtual MIPS processor */ if (!(gen = cpu_create(vm,CPU_TYPE_MIPS64,0))) { vm_error(vm,"unable to create CPU!\n"); return(-1); } cpu = CPU_MIPS64(gen); /* Add this CPU to the system CPU group */ cpu_group_add(vm->cpu_group,gen); vm->boot_cpu = gen; /* Initialize the IRQ routing vectors */ vm->set_irq = mips64_vm_set_irq; vm->clear_irq = mips64_vm_clear_irq; /* Mark the Network IO interrupt as high priority */ cpu->irq_idle_preempt[C3725_NETIO_IRQ] = TRUE; cpu->irq_idle_preempt[C3725_GT96K_IRQ] = TRUE; cpu->irq_idle_preempt[C3725_DUART_IRQ] = TRUE; /* Copy some parameters from VM to CPU (idle PC, ...) */ cpu->idle_pc = vm->idle_pc; if (vm->timer_irq_check_itv) cpu->timer_irq_check_itv = vm->timer_irq_check_itv; /* Remote emulator control */ dev_remote_control_init(vm,0x16000000,0x1000); /* Specific Storage Area (SSA) */ dev_ram_init(vm,"ssa",TRUE,FALSE,NULL,FALSE,0x16001000ULL,0x7000); /* IO FPGA */ if (dev_c3725_iofpga_init(router,C3725_IOFPGA_ADDR,0x40000) == -1) return(-1); if (!(obj = vm_object_find(router->vm,"io_fpga"))) return(-1); router->iofpga_data = obj->data; #if 0 /* PCI IO space */ if (!(vm->pci_io_space = pci_io_data_init(vm,C3725_PCI_IO_ADDR))) return(-1); #endif /* Initialize the chassis */ if (c3725_init(router) == -1) return(-1); /* Initialize RAM */ vm_ram_init(vm,0x00000000ULL); /* Initialize ROM (as a Flash) */ if (!(obj = dev_flash_init(vm,"rom",C3725_ROM_ADDR,vm->rom_size*1048576))) return(-1); dev_flash_copy_data(obj,0,mips64_microcode,mips64_microcode_len); c3725_nvram_check_empty_config(vm); /* Byte swapping */ dev_bswap_init(vm,"mem_bswap",C3725_BSWAP_ADDR,1024*1048576,0x00000000ULL); /* Initialize the NS16552 DUART */ dev_ns16552_init(vm,C3725_DUART_ADDR,0x1000,3,C3725_DUART_IRQ, vm->vtty_con,vm->vtty_aux); /* PCMCIA Slot 0 */ dev_pcmcia_disk_init(vm,"slot0",C3725_SLOT0_ADDR,0x200000, vm->pcmcia_disk_size[0],1); /* PCMCIA Slot 1 */ dev_pcmcia_disk_init(vm,"slot1",C3725_SLOT1_ADDR,0x200000, vm->pcmcia_disk_size[1],1); /* Initialize Network Modules */ if (vm_slot_init_all(vm) == -1) return(-1); /* Show device list */ c3725_show_hardware(router); return(0); }
/* Initialize the PPC32 VM test Platform */ static int ppc32_vmtest_init_platform(vm_instance_t *vm) { cpu_ppc_t *cpu0; cpu_gen_t *gen0; /* Create Console and AUX ports */ vm_init_vtty(vm); /* Create a CPU group */ vm->cpu_group = cpu_group_create("System CPU"); /* Initialize the virtual PowerPC processor */ if (!(gen0 = cpu_create(vm,CPU_TYPE_PPC32,0))) { vm_error(vm,"unable to create CPU0!\n"); return(-1); } cpu0 = CPU_PPC32(gen0); /* Enable as PowerPC 405 */ //ppc32_set_pvr(cpu0,PPC32_PVR_405 | 0x0102); /* Add this CPU to the system CPU group */ cpu_group_add(vm->cpu_group,gen0); vm->boot_cpu = gen0; /* Set IRQ vectors */ vm->set_irq = ppc32_vmtest_set_irq; vm->clear_irq = ppc32_vmtest_clear_irq; #if 0 { vm_obj_t *obj; /* Initialize ROM (as a Flash) */ if (!(obj = dev_flash_init(vm,"rom",0xFF000000,16*1048576))) return(-1); dev_flash_copy_data(obj,0x0F00000,ppc32_microcode,ppc32_microcode_len); } #endif //dev_bootflash_init(vm,"bootflash",0xFF000000,8*1048576); #if 1 /* Initialize ROM */ if (!vm->rom_filename) { /* use embedded ROM */ dev_rom_init(vm,"rom",0xFFF00000,512*1024, ppc32_microcode,ppc32_microcode_len); } else { /* use alternate ROM */ dev_ram_init(vm,"rom",TRUE,TRUE,NULL,FALSE, 0xFFF00000,512*1024); } #endif dev_ram_init(vm,"nvram",TRUE,FALSE,NULL,FALSE, 0x67c00000,vm->nvram_size*4096); dev_ns16552_init(vm,0xffe00000,0x1000,0,0,vm->vtty_con,vm->vtty_aux); /* Remote emulator control */ dev_remote_control_init(vm,0xf6000000,0x1000); /* Initialize RAM */ vm_ram_init(vm,0x00000000); /* RAM aliasing */ dev_create_ram_alias(vm,"ram_alias","ram",0x80000000,vm->ram_size*1048576); /* Display the device list */ dev_show_list(vm); return(0); }