Dmitry V. Levin | 38a34c9 | 2015-12-17 17:56:48 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 1999 Andreas Schwab <schwab@issan.cs.uni-dortmund.de> |
| 3 | * Copyright (c) 2010 Mike Frysinger <vapier@gentoo.org> |
| 4 | * Copyright (c) 2010 Carmelo Amoroso <carmelo.amoroso@st.com> |
| 5 | * Copyright (c) 2015 Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> |
| 6 | * Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org> |
| 7 | * All rights reserved. |
| 8 | * |
| 9 | * Redistribution and use in source and binary forms, with or without |
| 10 | * modification, are permitted provided that the following conditions |
| 11 | * are met: |
| 12 | * 1. Redistributions of source code must retain the above copyright |
| 13 | * notice, this list of conditions and the following disclaimer. |
| 14 | * 2. Redistributions in binary form must reproduce the above copyright |
| 15 | * notice, this list of conditions and the following disclaimer in the |
| 16 | * documentation and/or other materials provided with the distribution. |
| 17 | * 3. The name of the author may not be used to endorse or promote products |
| 18 | * derived from this software without specific prior written permission. |
| 19 | * |
| 20 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
| 21 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
| 22 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 23 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 24 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
| 25 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 27 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 29 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 | */ |
| 31 | |
Dmitry V. Levin | 95edb8b | 2014-12-03 20:50:08 +0000 | [diff] [blame] | 32 | #include "defs.h" |
| 33 | |
| 34 | #ifdef HAVE_ASM_CACHECTL_H |
| 35 | # include <asm/cachectl.h> |
| 36 | #endif |
| 37 | |
| 38 | #ifdef M68K |
| 39 | # include "xlat/cacheflush_scope.h" |
| 40 | |
| 41 | static const struct xlat cacheflush_flags[] = { |
| 42 | #ifdef FLUSH_CACHE_BOTH |
| 43 | XLAT(FLUSH_CACHE_BOTH), |
| 44 | #endif |
| 45 | #ifdef FLUSH_CACHE_DATA |
| 46 | XLAT(FLUSH_CACHE_DATA), |
| 47 | #endif |
| 48 | #ifdef FLUSH_CACHE_INSN |
| 49 | XLAT(FLUSH_CACHE_INSN), |
| 50 | #endif |
| 51 | XLAT_END |
| 52 | }; |
| 53 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 54 | SYS_FUNC(cacheflush) |
Dmitry V. Levin | 95edb8b | 2014-12-03 20:50:08 +0000 | [diff] [blame] | 55 | { |
Dmitry V. Levin | 4b6fc98 | 2015-07-20 18:05:21 +0000 | [diff] [blame] | 56 | /* addr */ |
| 57 | printaddr(tcp->u_arg[0]); |
| 58 | tprints(", "); |
| 59 | /* scope */ |
| 60 | printxval(cacheflush_scope, tcp->u_arg[1], "FLUSH_SCOPE_???"); |
| 61 | tprints(", "); |
| 62 | /* flags */ |
| 63 | printflags(cacheflush_flags, tcp->u_arg[2], "FLUSH_CACHE_???"); |
| 64 | /* len */ |
| 65 | tprintf(", %lu", tcp->u_arg[3]); |
| 66 | |
| 67 | return RVAL_DECODED; |
Dmitry V. Levin | 95edb8b | 2014-12-03 20:50:08 +0000 | [diff] [blame] | 68 | } |
| 69 | #endif /* M68K */ |
| 70 | |
| 71 | #ifdef BFIN |
| 72 | static const struct xlat cacheflush_flags[] = { |
| 73 | XLAT(ICACHE), |
| 74 | XLAT(DCACHE), |
| 75 | XLAT(BCACHE), |
| 76 | XLAT_END |
| 77 | }; |
| 78 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 79 | SYS_FUNC(cacheflush) |
Dmitry V. Levin | 95edb8b | 2014-12-03 20:50:08 +0000 | [diff] [blame] | 80 | { |
Dmitry V. Levin | 4b6fc98 | 2015-07-20 18:05:21 +0000 | [diff] [blame] | 81 | /* start addr */ |
| 82 | printaddr(tcp->u_arg[0]); |
| 83 | /* length */ |
| 84 | tprintf(", %ld, ", tcp->u_arg[1]); |
| 85 | /* flags */ |
| 86 | printxval(cacheflush_flags, tcp->u_arg[1], "?CACHE"); |
| 87 | |
| 88 | return RVAL_DECODED; |
Dmitry V. Levin | 95edb8b | 2014-12-03 20:50:08 +0000 | [diff] [blame] | 89 | } |
| 90 | #endif /* BFIN */ |
| 91 | |
| 92 | #ifdef SH |
| 93 | static const struct xlat cacheflush_flags[] = { |
| 94 | #ifdef CACHEFLUSH_D_INVAL |
| 95 | XLAT(CACHEFLUSH_D_INVAL), |
| 96 | #endif |
| 97 | #ifdef CACHEFLUSH_D_WB |
| 98 | XLAT(CACHEFLUSH_D_WB), |
| 99 | #endif |
| 100 | #ifdef CACHEFLUSH_D_PURGE |
| 101 | XLAT(CACHEFLUSH_D_PURGE), |
| 102 | #endif |
| 103 | #ifdef CACHEFLUSH_I |
| 104 | XLAT(CACHEFLUSH_I), |
| 105 | #endif |
| 106 | XLAT_END |
| 107 | }; |
| 108 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 109 | SYS_FUNC(cacheflush) |
Dmitry V. Levin | 95edb8b | 2014-12-03 20:50:08 +0000 | [diff] [blame] | 110 | { |
Dmitry V. Levin | 4b6fc98 | 2015-07-20 18:05:21 +0000 | [diff] [blame] | 111 | /* addr */ |
| 112 | printaddr(tcp->u_arg[0]); |
| 113 | /* len */ |
| 114 | tprintf(", %lu, ", tcp->u_arg[1]); |
| 115 | /* flags */ |
| 116 | printflags(cacheflush_flags, tcp->u_arg[2], "CACHEFLUSH_???"); |
| 117 | |
| 118 | return RVAL_DECODED; |
Dmitry V. Levin | 95edb8b | 2014-12-03 20:50:08 +0000 | [diff] [blame] | 119 | } |
| 120 | #endif /* SH */ |
Ezequiel Garcia | bd8dd77 | 2015-04-18 17:33:27 -0300 | [diff] [blame] | 121 | |
| 122 | #ifdef NIOS2 |
| 123 | SYS_FUNC(cacheflush) |
| 124 | { |
Dmitry V. Levin | 4b6fc98 | 2015-07-20 18:05:21 +0000 | [diff] [blame] | 125 | /* addr */ |
| 126 | printaddr(tcp->u_arg[0]); |
| 127 | /* len */ |
| 128 | tprintf(", %lu, ", tcp->u_arg[3]); |
| 129 | /* scope and flags (cache type) are currently ignored */ |
| 130 | |
| 131 | return RVAL_DECODED; |
Ezequiel Garcia | bd8dd77 | 2015-04-18 17:33:27 -0300 | [diff] [blame] | 132 | } |
| 133 | #endif /* NIOS2 */ |