Path: blob/master/arch/mn10300/boot/compressed/head.S
17498 views
/* Boot entry point for a compressed MN10300 kernel1*2* Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.3* Written by David Howells ([email protected])4*5* This program is free software; you can redistribute it and/or6* modify it under the terms of the GNU General Public Licence7* as published by the Free Software Foundation; either version8* 2 of the Licence, or (at your option) any later version.9*/10.section .text1112#define DEBUG1314#include <linux/linkage.h>15#include <asm/cpu-regs.h>16#include <asm/cache.h>17#ifdef CONFIG_SMP18#include <proc/smp-regs.h>19#endif2021.globl startup_3222startup_32:23#ifdef CONFIG_SMP24#25# Secondary CPUs jump directly to the kernel entry point26#27# Must save primary CPU's D0-D2 registers as they hold boot parameters28#29mov (CPUID), d330and CPUID_MASK,d331beq startup_primary32mov CONFIG_KERNEL_TEXT_ADDRESS,a033jmp (a0)3435startup_primary:36#endif /* CONFIG_SMP */3738# first save parameters from bootloader39mov param_save_area,a040mov d0,(a0)41mov d1,(4,a0)42mov d2,(8,a0)4344mov sp,a345mov decomp_stack+0x2000-4,a046mov a0,sp4748# invalidate and enable both of the caches49mov CHCTR,a050clr d051movhu d0,(a0) # turn off first52mov CHCTR_ICINV|CHCTR_DCINV,d053movhu d0,(a0)54setlb55mov (a0),d056btst CHCTR_ICBUSY|CHCTR_DCBUSY,d0 # wait till not busy57lne5859#ifdef CONFIG_MN10300_CACHE_ENABLED60#ifdef CONFIG_MN10300_CACHE_WBACK61mov CHCTR_ICEN|CHCTR_DCEN|CHCTR_DCWTMD_WRBACK,d062#else63mov CHCTR_ICEN|CHCTR_DCEN|CHCTR_DCWTMD_WRTHROUGH,d064#endif /* WBACK */65movhu d0,(a0) # enable66#endif /* !ENABLED */6768# clear the BSS area69mov __bss_start,a070mov _end,a171clr d072bssclear:73cmp a1,a074bge bssclear_end75movbu d0,(a0)76inc a077bra bssclear78bssclear_end:7980# decompress the kernel81call decompress_kernel[],082#ifdef CONFIG_MN10300_CACHE_WBACK83call mn10300_dcache_flush_inv[],084#endif8586# disable caches again87mov CHCTR,a088clr d089movhu d0,(a0)90setlb91mov (a0),d092btst CHCTR_ICBUSY|CHCTR_DCBUSY,d0 # wait till not busy93lne9495mov param_save_area,a096mov (a0),d097mov (4,a0),d198mov (8,a0),d299100# jump to the kernel proper entry point101mov a3,sp102mov CONFIG_KERNEL_TEXT_ADDRESS,a0103jmp (a0)104105106###############################################################################107#108# Cache flush routines109#110###############################################################################111#ifdef CONFIG_MN10300_CACHE_WBACK112mn10300_dcache_flush_inv:113movhu (CHCTR),d0114btst CHCTR_DCEN,d0115beq mn10300_dcache_flush_inv_end116117mov L1_CACHE_NENTRIES,d1118clr a1119120mn10300_dcache_flush_inv_loop:121mov (DCACHE_PURGE_WAY0(0),a1),d0 # unconditional purge122mov (DCACHE_PURGE_WAY1(0),a1),d0 # unconditional purge123mov (DCACHE_PURGE_WAY2(0),a1),d0 # unconditional purge124mov (DCACHE_PURGE_WAY3(0),a1),d0 # unconditional purge125126add L1_CACHE_BYTES,a1127add -1,d1128bne mn10300_dcache_flush_inv_loop129130mn10300_dcache_flush_inv_end:131ret [],0132#endif /* CONFIG_MN10300_CACHE_WBACK */133134135###############################################################################136#137# Data areas138#139###############################################################################140.data141.align 4142param_save_area:143.rept 3144.word 0145.endr146147.section .bss148.align 4149decomp_stack:150.space 0x2000151152153