int cleanup_before_linux(void) { /* * this function is called just before we call linux * it prepares the processor for linux * * disable interrupt and turn off caches etc ... */ disable_interrupts(); /* * Turn off I-cache and invalidate it */ icache_disable(); invalidate_icache_all(); /* * turn off D-cache * dcache_disable() in turn flushes the d-cache and disables MMU */ dcache_disable(); invalidate_dcache_all(); return 0; }
/* * This function is called from lib/board.c. * It recreates MMU table in main memory. MMU and d-cache are enabled earlier. * There is no need to disable d-cache for this operation. */ void enable_caches(void) { /* The data cache is not active unless the mmu is enabled */ if (!(get_sctlr() & CR_M)) { invalidate_dcache_all(); __asm_invalidate_tlb_all(); zynqmp_mmu_setup(); } puts("Enabling Caches...\n"); set_sctlr(get_sctlr() | CR_C); }
int cleanup_before_linux(void) { /* * this function is called just before we call linux * it prepares the processor for linux * * we turn off caches etc ... */ #ifndef CONFIG_SPL_BUILD disable_interrupts(); #ifdef CONFIG_LCD { /* switch off LCD panel */ lcd_panel_disable(); /* disable LCD controller */ lcd_disable(); } #endif /* CONFIG_LCD */ #endif /* CONFIG_SPL_BUILD */ /* * Turn off I-cache and invalidate it */ icache_disable(); invalidate_icache_all(); /* * turn off D-cache * dcache_disable() in turn flushes the d-cache and disables MMU */ dcache_disable(); v7_outer_cache_disable(); /* * After D-cache is flushed and before it is disabled there may * be some new valid entries brought into the cache. We are sure * that these lines are not dirty and will not affect our execution. * (because unwinding the call-stack and setting a bit in CP15 SCTRL * is all we did during this. We have not pushed anything on to the * stack. Neither have we affected any static data) * So just invalidate the entire d-cache again to avoid coherency * problems for kernel */ invalidate_dcache_all(); /* * Some CPU need more cache attention before starting the kernel. */ cpu_cache_initialization(); return 0; }
int cleanup_before_linux(void) { #ifdef CONFIG_BOOTSTAGE_REPORT bootstage_report(); #endif #ifdef CONFIG_BOOTSTAGE_STASH bootstage_stash((void *)CONFIG_BOOTSTAGE_STASH, CONFIG_BOOTSTAGE_STASH_SIZE); #endif /* * this function is called just before we call linux * it prepares the processor for linux * * we turn off caches etc ... */ disable_interrupts(); #ifdef CONFIG_EXYNOS_LCD exynos_fimd_disable(); #endif /* * Turn off I-cache and invalidate it */ icache_disable(); invalidate_icache_all(); /* * turn off D-cache * dcache_disable() in turn flushes the d-cache and disables MMU */ dcache_disable(); v7_outer_cache_disable(); /* * After D-cache is flushed and before it is disabled there may * be some new valid entries brought into the cache. We are sure * that these lines are not dirty and will not affect our execution. * (because unwinding the call-stack and setting a bit in CP15 SCTRL * is all we did during this. We have not pushed anything on to the * stack. Neither have we affected any static data) * So just invalidate the entire d-cache again to avoid coherency * problems for kernel */ invalidate_dcache_all(); return 0; }
void patch_uname(int mem_fd, int uname_offset, void *new_routine, int routine_length) { if(lseek(mem_fd, uname_offset, SEEK_SET) < 0) { printf("patch_uname: lseek failure %s\n", strerror(errno)); return; } if(write(mem_fd, new_routine, routine_length) != routine_length) { printf("patch_uname: write failure.\n"); return; } invalidate_dcache_all(); invalidate_icache_all(); }
void enable_caches(void) { #if defined(CONFIG_SYS_ARM_CACHE_WRITETHROUGH) enum dcache_option option = DCACHE_WRITETHROUGH; #else enum dcache_option option = DCACHE_WRITEBACK; #endif /* Avoid random hang when download by usb */ invalidate_dcache_all(); /* Enable D-cache. I-cache is already enabled in start.S */ dcache_enable(); /* Enable caching on OCRAM and ROM */ mmu_set_region_dcache_behaviour(ROMCP_ARB_BASE_ADDR, ROMCP_ARB_END_ADDR, option); mmu_set_region_dcache_behaviour(IRAM_BASE_ADDR, IRAM_SIZE, option); }