wdenk | 5c952cf | 2004-10-10 21:27:30 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2004, Psyent Corporation <www.psyent.com> |
| 3 | * Scott McNutt <smcnutt@psyent.com> |
| 4 | * |
| 5 | * See file CREDITS for list of people who contributed to this |
| 6 | * project. |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or |
| 9 | * modify it under the terms of the GNU General Public License as |
| 10 | * published by the Free Software Foundation; either version 2 of |
| 11 | * the License, or (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program; if not, write to the Free Software |
| 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 21 | * MA 02111-1307 USA |
| 22 | */ |
| 23 | |
| 24 | #include <config.h> |
| 25 | |
| 26 | .text |
| 27 | |
| 28 | .global flush_dcache |
| 29 | |
| 30 | flush_dcache: |
| 31 | add r5, r5, r4 |
| 32 | movhi r8, %hi(CFG_DCACHELINE_SIZE) |
| 33 | ori r8, r8, %lo(CFG_DCACHELINE_SIZE) |
| 34 | 0: flushd 0(r4) |
| 35 | add r4, r4, r8 |
| 36 | bltu r4, r5, 0b |
| 37 | ret |
| 38 | |
| 39 | |
| 40 | .global flush_icache |
| 41 | |
| 42 | flush_icache: |
| 43 | add r5, r5, r4 |
| 44 | movhi r8, %hi(CFG_ICACHELINE_SIZE) |
| 45 | ori r8, r8, %lo(CFG_ICACHELINE_SIZE) |
| 46 | 1: flushi r4 |
| 47 | add r4, r4, r8 |
| 48 | bltu r4, r5, 1b |
| 49 | ret |
| 50 | |
| 51 | .global flush_cache |
| 52 | |
| 53 | flush_cache: |
| 54 | add r5, r5, r4 |
| 55 | mov r9, r4 |
| 56 | mov r10, r5 |
| 57 | |
| 58 | movhi r8, %hi(CFG_DCACHELINE_SIZE) |
| 59 | ori r8, r8, %lo(CFG_DCACHELINE_SIZE) |
| 60 | 0: flushd 0(r4) |
| 61 | add r4, r4, r8 |
| 62 | bltu r4, r5, 0b |
| 63 | |
| 64 | mov r4, r9 |
| 65 | mov r5, r10 |
| 66 | movhi r8, %hi(CFG_ICACHELINE_SIZE) |
| 67 | ori r8, r8, %lo(CFG_ICACHELINE_SIZE) |
| 68 | 1: flushi r4 |
| 69 | add r4, r4, r8 |
| 70 | bltu r4, r5, 1b |
| 71 | |
| 72 | sync |
| 73 | flushp |
| 74 | ret |