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 * The cache manipulation routine has been taken from the U-Boot project.
9 * Wolfgang Denk, DENX Software Engineering, <wd@denx.de>
17 #define cache_op(op,addr) \
18 __asm__ __volatile__( \
20 " .set noreorder \n" \
21 " .set mips3\n\t \n" \
25 : "i" (op), "R" (*(unsigned char *)(addr)))
27 void flush_cache(unsigned long start_addr
, unsigned long size
)
29 unsigned long lsize
= CONFIG_CACHELINE_SIZE
;
30 unsigned long addr
= start_addr
& ~(lsize
- 1);
31 unsigned long aend
= (start_addr
+ size
+ (lsize
- 1)) & ~(lsize
- 1);
33 printf("blasting from 0x%08x to 0x%08x (0x%08x - 0x%08x)\n", start_addr
, size
, addr
, aend
);
36 cache_op(Hit_Writeback_Inv_D
, addr
);
37 cache_op(Hit_Invalidate_I
, addr
);