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 | |
wdenk | efee170 | 2002-07-20 20:14:13 +0000 | [diff] [blame] | 7 | #include <config.h> |
| 8 | #include <command.h> |
| 9 | #include <74xx_7xx.h> |
| 10 | #include <version.h> |
| 11 | |
| 12 | #include <ppc_asm.tmpl> |
| 13 | #include <ppc_defs.h> |
| 14 | |
| 15 | #include <asm/cache.h> |
| 16 | #include <asm/mmu.h> |
| 17 | |
Jon Loeliger | a521774 | 2007-07-09 18:57:22 -0500 | [diff] [blame] | 18 | #if defined(CONFIG_CMD_KGDB) |
wdenk | efee170 | 2002-07-20 20:14:13 +0000 | [diff] [blame] | 19 | |
| 20 | /* |
| 21 | * cache flushing routines for kgdb |
| 22 | */ |
| 23 | |
| 24 | .globl kgdb_flush_cache_all |
| 25 | kgdb_flush_cache_all: |
wdenk | 9965160 | 2004-09-28 21:39:45 +0000 | [diff] [blame] | 26 | lis r3,0 |
| 27 | addis r4,r0,0x0040 |
| 28 | kgdb_flush_loop: |
| 29 | lwz r5,0(r3) |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 30 | addi r3,r3,CONFIG_SYS_CACHELINE_SIZE |
wdenk | 9965160 | 2004-09-28 21:39:45 +0000 | [diff] [blame] | 31 | cmp 0,0,r3,r4 |
| 32 | bne kgdb_flush_loop |
wdenk | efee170 | 2002-07-20 20:14:13 +0000 | [diff] [blame] | 33 | SYNC |
wdenk | 9965160 | 2004-09-28 21:39:45 +0000 | [diff] [blame] | 34 | mfspr r3,1008 |
| 35 | ori r3,r3,0x8800 |
| 36 | mtspr 1008,r3 |
| 37 | sync |
wdenk | efee170 | 2002-07-20 20:14:13 +0000 | [diff] [blame] | 38 | blr |
| 39 | |
| 40 | .globl kgdb_flush_cache_range |
| 41 | kgdb_flush_cache_range: |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 42 | li r5,CONFIG_SYS_CACHELINE_SIZE-1 |
wdenk | efee170 | 2002-07-20 20:14:13 +0000 | [diff] [blame] | 43 | andc r3,r3,r5 |
| 44 | subf r4,r3,r4 |
| 45 | add r4,r4,r5 |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 46 | srwi. r4,r4,CONFIG_SYS_CACHELINE_SHIFT |
wdenk | efee170 | 2002-07-20 20:14:13 +0000 | [diff] [blame] | 47 | beqlr |
| 48 | mtctr r4 |
| 49 | mr r6,r3 |
| 50 | 1: dcbst 0,r3 |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 51 | addi r3,r3,CONFIG_SYS_CACHELINE_SIZE |
wdenk | efee170 | 2002-07-20 20:14:13 +0000 | [diff] [blame] | 52 | bdnz 1b |
| 53 | sync /* wait for dcbst's to get to ram */ |
| 54 | mtctr r4 |
| 55 | 2: icbi 0,r6 |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 56 | addi r6,r6,CONFIG_SYS_CACHELINE_SIZE |
wdenk | efee170 | 2002-07-20 20:14:13 +0000 | [diff] [blame] | 57 | bdnz 2b |
| 58 | SYNC |
| 59 | blr |
| 60 | |
Jon Loeliger | 07efe2a | 2007-07-10 10:27:39 -0500 | [diff] [blame] | 61 | #endif |