/* * \file : reset.S * \date : 01/12/2012 * \author: Cesar FUGUET & Manuel BOUYER & Alain Greiner * * This is a generic reset code for a generic multi-clusters / multi-processors * TSAR architecture (up to 256 clusters / up to 4 processors per cluster). * * There is one XICU, one TTY, one DMA, and one memory bank per cluster. * * This preloader uses a stack segment allocated in cluster 0 for processor 0. * The stack allocation is not performed for other processors as they do not * need it during the preloader execution. Therefore, this allocation should be * done by the loaded Operating System. * * The replicated XICU is used to awake the sleeping processors: * xicu_paddr_base = ICU_PADDR_BASE + (cluster_xy << 32) * * It is intended to be used with various operating systems or nano kernels, * including NetBSD, Linux, ALMOS, and GIET_VM. * * - Each processor initializes its Status Register (SR) to disable interrupts. * - Each processor initializes its Count Register. * - Each processor initialises its private XICU WTI mask register. * - Only processor 0 executes the reset_load_elf function to load into memory * the system specific boot-loader stored on disk at RESET_LOADER_LBA * - All other processors wait in a low power consumption mode that the * processor 0 wakes them using an IPI (Inter Processor Interruption) */ #include #include /* These define should be consistent with values defined in map.xml file */ .section .reset,"ax",@progbits .extern reset_putc .extern reset_getc .extern reset_ioc_read .extern reset_elf_loader .extern memcpy .extern reset_puts .extern reset_putx .extern reset_putd .extern reset_ioc_init .extern versionstr .extern dtb_start .extern dtb_addr .globl reset /* Makes reset an external symbol */ .ent reset .align 2 .set noreorder reset: b _reset /* 0xbfc0000 */ nop /* 0xbfc0004 */ /* Addresses of the functions provided by this reset code */ preloader_vector: .word RESET_VERSION /* 0xbfc0008 */ .word dtb_start /* 0xbfc000c */ .word reset_putc /* 0xbfc0010 */ .word reset_getc /* 0xbfc0014 */ .word reset_ioc_read /* 0xbfc0018 */ .word reset_elf_loader /* 0xbfc001C */ .word memcpy /* 0xbfc0020 */ .word reset_puts /* 0xbfc0024 */ .word reset_putx /* 0xbfc0028 */ .word reset_putd /* 0xbfc002C */ _reset: /* All processors Disable interruptions, keep STATUSbev enabled */ li k0, (1 << 22) mtc0 k0, CP0_STATUS /* * All processors compute gpid, lpid, cluster_xy * gpid = ebase[11:0] = X_WIDTH : Y_WIDTH : P_WIDTH * x y lpid * X, Y and LPID fields are left-aligned */ mfc0 k0, CP0_EBASE andi t0, k0, 0xFFF /* t0 <= gpid (<= 4096 procs) */ andi t1, t0, ((1<