blob: 5a298f9d050b617d07b1bf3e8c021344ef55313c [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>
10#include <version.h>
11
12#define CONFIG_8260 1 /* needed for Linux kernel header files */
13#define _LINUX_CONFIG_H 1 /* avoid reading Linux autoconf.h file */
14
15#include <ppc_asm.tmpl>
16#include <ppc_defs.h>
17
18#include <asm/cache.h>
19#include <asm/mmu.h>
20
Jon Loeliger44312832007-07-09 19:06:00 -050021#if defined(CONFIG_CMD_KGDB)
wdenkefee1702002-07-20 20:14:13 +000022
23 /*
24 * cache flushing routines for kgdb
25 */
26
27 .globl kgdb_flush_cache_all
28kgdb_flush_cache_all:
29 mfspr r3, HID0
30 ori r3, r3, HID0_ICFI|HID0_DCI /* Invalidate All */
31 SYNC
32 mtspr HID0, r3
33 blr
34
35 .globl kgdb_flush_cache_range
36kgdb_flush_cache_range:
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020037 li r5,CONFIG_SYS_CACHELINE_SIZE-1
wdenkefee1702002-07-20 20:14:13 +000038 andc r3,r3,r5
39 subf r4,r3,r4
40 add r4,r4,r5
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020041 srwi. r4,r4,CONFIG_SYS_CACHELINE_SHIFT
wdenkefee1702002-07-20 20:14:13 +000042 beqlr
43 mtctr r4
44 mr r6,r3
451: dcbst 0,r3
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020046 addi r3,r3,CONFIG_SYS_CACHELINE_SIZE
wdenkefee1702002-07-20 20:14:13 +000047 bdnz 1b
48 sync /* wait for dcbst's to get to ram */
49 mtctr r4
502: icbi 0,r6
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020051 addi r6,r6,CONFIG_SYS_CACHELINE_SIZE
wdenkefee1702002-07-20 20:14:13 +000052 bdnz 2b
53 SYNC
54 blr
55
Jon Loeliger068b60a2007-07-10 10:27:39 -050056#endif