/******************************************************************************** * File : reset.S * Author : Alain Greiner * Date : 15/01/2014 ********************************************************************************* * This is a boot code for a generic multi-clusters / multi-processors * TSAR architecture (up to 256 clusters / up to 4 processors per cluster). * The physical address is 40 bits, and the 8 MSB bits A[39:32] define the * cluster index. * * As we don't want to use the virtual memory, the physical address is * equal to the virtual address (identity mapping) and all processors stacks * and code segments are allocated in the physical memory bank in cluster 0. * * Both the reset base address and the kernel base address must be redefined * to use a physical memory bank smaller than 2 Gbytes. * * There is one XCU iand one MMC per cluster. * * There is one IOPIC component in cluster_io. * * There is two sets of peripherals: * * 1) A block device and a single channel TTY controller are available * in cluster(0,0). * * 2) Other peripherals (including another Blockdevice, a multi-channels TTY * contrĂ´ler, a Frame buffer) are located in cluster_io. * For those externals peripherals, hardware interrupts (HWI) are translated * to software interrupts (WTI) by and IOPIC component, that is programmed * to route all SWI to to processor 0 in cluster (0,0). * * The boot sequence is the following: * - Each processor initializes the stack pointer ($29) depending on proc_id. * - Each processor initializes the CP0 EBASE register * - Only processor 0 initializes the Interrupt vector. * - Only processor 0 initializes the IOPIC component. * - Each processor initializes its private XCU mask. * - Each processor initializes the Status Register (SR) * - Each processor jumps to the same main address in kernel mode... ********************************************************************************/ #include "hard_config.h" #include "mips32_registers.h" .section .reset,"ax",@progbits .extern seg_stack_base .extern seg_xcu_base .extern seg_pic_base .extern seg_kcode_base .extern _interrupt_vector .extern _ioc_isr .extern _mmc_isr .extern _tty_isr .extern main .globl reset .ent reset .align 2 reset: .set noreorder /* each proc computes proc_id, lpid, cluster_xy */ mfc0 $26, CP0_PROCID andi $26, $26, 0x3FF /* at most 1024 processors */ move $10, $26 /* $10 <= proc_id */ li $27, NB_PROCS_MAX divu $26, $27 mfhi $11 /* $11 <= lpid */ mflo $12 /* $12 <= cluster_xy */ /* each proc initializes stack pointer (64K per processor) */ srl $8, $12, Y_WIDTH /* $8 <= x */ li $9, Y_SIZE mul $8, $8, $9 /* $8 <= x * Y_SIZE */ andi $13, $12, (1<