1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * LZMA compressed kernel loader for Atheros AR7XXX/AR9XXX based boards
5 * Copyright (C) 2011 Gabor Juhos <juhosg@openwrt.org>
7 * Some parts of this code was based on the OpenWrt specific lzma-loader
8 * for the BCM47xx and ADM5120 based boards:
9 * Copyright (C) 2004 Manuel Novoa III (mjn3@codepoet.org)
10 * Copyright (C) 2005 by Oleg I. Vdovikin <oleg@cs.msu.su>
14 #include <asm/regdef.h>
15 #include "cp0regdef.h"
19 #define KSEG0 0x80000000
31 mtc0 zero, CP0_WATCHLO # clear watch registers
32 mtc0 zero, CP0_WATCHHI
33 mtc0 zero, CP0_CAUSE # clear before writing status register
43 mtc0 zero, CP0_COMPARE
46 la t0, __reloc_label # get linked address of label
47 bal __reloc_label # branch and link to label to
48 nop # get actual address
50 subu t0, ra, t0 # get reloc_delta
52 beqz t0, __reloc_done # if delta is 0 we are in the right place
55 /* Copy our code to the right place */
56 la t1, _code_start # get linked address of _code_start
57 la t2, _code_end # get linked address of _code_end
58 addu t0, t0, t1 # calculate actual address of _code_start
64 blt t1, t2, __reloc_copy
71 li t2, ~(CONFIG_CACHELINE_SIZE - 1)
74 li t2, CONFIG_CACHELINE_SIZE
80 cache Hit_Writeback_Inv_D, 0(t0)
81 cache Hit_Invalidate_I, 0(t0)
85 bne t0, t1, __flush_line
103 bne t0, t1, __bss_fill
106 /* Setup new "C" stack */
109 /* reserve stack space for a0-a3 registers */
112 /* jump to the decompressor routine */