wdenk | efee170 | 2002-07-20 20:14:13 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2000 Murray Jensen <Murray.Jensen@cmst.csiro.au> |
| 3 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 4 | * SPDX-License-Identifier: GPL-2.0+ |
wdenk | efee170 | 2002-07-20 20:14:13 +0000 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <config.h> |
| 8 | #include <command.h> |
| 9 | #include <mpc8xx.h> |
wdenk | efee170 | 2002-07-20 20:14:13 +0000 | [diff] [blame] | 10 | |
wdenk | efee170 | 2002-07-20 20:14:13 +0000 | [diff] [blame] | 11 | #include <ppc_asm.tmpl> |
| 12 | #include <ppc_defs.h> |
| 13 | |
| 14 | #include <asm/cache.h> |
| 15 | #include <asm/mmu.h> |
| 16 | |
Jon Loeliger | 526e5ce | 2007-07-09 19:06:00 -0500 | [diff] [blame] | 17 | #if defined(CONFIG_CMD_KGDB) |
wdenk | efee170 | 2002-07-20 20:14:13 +0000 | [diff] [blame] | 18 | |
| 19 | /* |
| 20 | * cache flushing routines for kgdb |
| 21 | */ |
| 22 | |
| 23 | .globl kgdb_flush_cache_all |
| 24 | kgdb_flush_cache_all: |
| 25 | lis r3, IDC_INVALL@h |
| 26 | mtspr DC_CST, r3 |
| 27 | sync |
| 28 | lis r3, IDC_INVALL@h |
| 29 | mtspr IC_CST, r3 |
| 30 | SYNC |
| 31 | blr |
| 32 | |
| 33 | .globl kgdb_flush_cache_range |
| 34 | kgdb_flush_cache_range: |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 35 | li r5,CONFIG_SYS_CACHELINE_SIZE-1 |
wdenk | efee170 | 2002-07-20 20:14:13 +0000 | [diff] [blame] | 36 | andc r3,r3,r5 |
| 37 | subf r4,r3,r4 |
| 38 | add r4,r4,r5 |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 39 | srwi. r4,r4,CONFIG_SYS_CACHELINE_SHIFT |
wdenk | efee170 | 2002-07-20 20:14:13 +0000 | [diff] [blame] | 40 | beqlr |
| 41 | mtctr r4 |
| 42 | mr r6,r3 |
| 43 | 1: dcbst 0,r3 |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 44 | addi r3,r3,CONFIG_SYS_CACHELINE_SIZE |
wdenk | efee170 | 2002-07-20 20:14:13 +0000 | [diff] [blame] | 45 | bdnz 1b |
| 46 | sync /* wait for dcbst's to get to ram */ |
| 47 | mtctr r4 |
| 48 | 2: icbi 0,r6 |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 49 | addi r6,r6,CONFIG_SYS_CACHELINE_SIZE |
wdenk | efee170 | 2002-07-20 20:14:13 +0000 | [diff] [blame] | 50 | bdnz 2b |
| 51 | SYNC |
| 52 | blr |
| 53 | |
Jon Loeliger | 07efe2a | 2007-07-10 10:27:39 -0500 | [diff] [blame] | 54 | #endif |