blob: bc9c62852c43961722a60a5ecfb42fa730828498 [file] [log] [blame]
wdenkefee1702002-07-20 20:14:13 +00001/*
2 * Copyright (C) 2000 Murray Jensen <Murray.Jensen@cmst.csiro.au>
3 *
Wolfgang Denk1a459662013-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 <mpc8260.h>
wdenkefee1702002-07-20 20:14:13 +000010
wdenkefee1702002-07-20 20:14:13 +000011#include <ppc_asm.tmpl>
12#include <ppc_defs.h>
13
14#include <asm/cache.h>
15#include <asm/mmu.h>
16
Jon Loeliger44312832007-07-09 19:06:00 -050017#if defined(CONFIG_CMD_KGDB)
wdenkefee1702002-07-20 20:14:13 +000018
19 /*
20 * cache flushing routines for kgdb
21 */
22
23 .globl kgdb_flush_cache_all
24kgdb_flush_cache_all:
25 mfspr r3, HID0
26 ori r3, r3, HID0_ICFI|HID0_DCI /* Invalidate All */
27 SYNC
28 mtspr HID0, r3
29 blr
30
31 .globl kgdb_flush_cache_range
32kgdb_flush_cache_range:
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020033 li r5,CONFIG_SYS_CACHELINE_SIZE-1
wdenkefee1702002-07-20 20:14:13 +000034 andc r3,r3,r5
35 subf r4,r3,r4
36 add r4,r4,r5
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020037 srwi. r4,r4,CONFIG_SYS_CACHELINE_SHIFT
wdenkefee1702002-07-20 20:14:13 +000038 beqlr
39 mtctr r4
40 mr r6,r3
411: dcbst 0,r3
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020042 addi r3,r3,CONFIG_SYS_CACHELINE_SIZE
wdenkefee1702002-07-20 20:14:13 +000043 bdnz 1b
44 sync /* wait for dcbst's to get to ram */
45 mtctr r4
462: icbi 0,r6
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020047 addi r6,r6,CONFIG_SYS_CACHELINE_SIZE
wdenkefee1702002-07-20 20:14:13 +000048 bdnz 2b
49 SYNC
50 blr
51
Jon Loeliger068b60a2007-07-10 10:27:39 -050052#endif