blob: ac1fe8f4e52fcb48cac65a41c6b6dbbafd5cb939 [file] [log] [blame]
wdenkefee1702002-07-20 20:14:13 +00001/*
2 * Copyright (C) 2000 Murray Jensen <Murray.Jensen@cmst.csiro.au>
3 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02004 * SPDX-License-Identifier: GPL-2.0+
wdenkefee1702002-07-20 20:14:13 +00005 */
6
7#include <config.h>
8#include <command.h>
9#include <mpc8xx.h>
10#include <version.h>
11
12#define CONFIG_8xx 1 /* needed for Linux kernel header files */
wdenkefee1702002-07-20 20:14:13 +000013
14#include <ppc_asm.tmpl>
15#include <ppc_defs.h>
16
17#include <asm/cache.h>
18#include <asm/mmu.h>
19
Jon Loeliger526e5ce2007-07-09 19:06:00 -050020#if defined(CONFIG_CMD_KGDB)
wdenkefee1702002-07-20 20:14:13 +000021
22 /*
23 * cache flushing routines for kgdb
24 */
25
26 .globl kgdb_flush_cache_all
27kgdb_flush_cache_all:
28 lis r3, IDC_INVALL@h
29 mtspr DC_CST, r3
30 sync
31 lis r3, IDC_INVALL@h
32 mtspr IC_CST, r3
33 SYNC
34 blr
35
36 .globl kgdb_flush_cache_range
37kgdb_flush_cache_range:
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +020038 li r5,CONFIG_SYS_CACHELINE_SIZE-1
wdenkefee1702002-07-20 20:14:13 +000039 andc r3,r3,r5
40 subf r4,r3,r4
41 add r4,r4,r5
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +020042 srwi. r4,r4,CONFIG_SYS_CACHELINE_SHIFT
wdenkefee1702002-07-20 20:14:13 +000043 beqlr
44 mtctr r4
45 mr r6,r3
461: dcbst 0,r3
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +020047 addi r3,r3,CONFIG_SYS_CACHELINE_SIZE
wdenkefee1702002-07-20 20:14:13 +000048 bdnz 1b
49 sync /* wait for dcbst's to get to ram */
50 mtctr r4
512: icbi 0,r6
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +020052 addi r6,r6,CONFIG_SYS_CACHELINE_SIZE
wdenkefee1702002-07-20 20:14:13 +000053 bdnz 2b
54 SYNC
55 blr
56
Jon Loeliger07efe2a2007-07-10 10:27:39 -050057#endif