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 | 1a45966 | 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 <mpc8260.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 | 4431283 | 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 | 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 |
| 32 | kgdb_flush_cache_range: |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 33 | li r5,CONFIG_SYS_CACHELINE_SIZE-1 |
wdenk | efee170 | 2002-07-20 20:14:13 +0000 | [diff] [blame] | 34 | andc r3,r3,r5 |
| 35 | subf r4,r3,r4 |
| 36 | add r4,r4,r5 |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 37 | srwi. r4,r4,CONFIG_SYS_CACHELINE_SHIFT |
wdenk | efee170 | 2002-07-20 20:14:13 +0000 | [diff] [blame] | 38 | beqlr |
| 39 | mtctr r4 |
| 40 | mr r6,r3 |
| 41 | 1: dcbst 0,r3 |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 42 | addi r3,r3,CONFIG_SYS_CACHELINE_SIZE |
wdenk | efee170 | 2002-07-20 20:14:13 +0000 | [diff] [blame] | 43 | bdnz 1b |
| 44 | sync /* wait for dcbst's to get to ram */ |
| 45 | mtctr r4 |
| 46 | 2: icbi 0,r6 |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 47 | addi r6,r6,CONFIG_SYS_CACHELINE_SIZE |
wdenk | efee170 | 2002-07-20 20:14:13 +0000 | [diff] [blame] | 48 | bdnz 2b |
| 49 | SYNC |
| 50 | blr |
| 51 | |
Jon Loeliger | 068b60a | 2007-07-10 10:27:39 -0500 | [diff] [blame] | 52 | #endif |