blob: 8c2c05c3d36d7638923edd47dcae8c19f16b3ca0 [file] [log] [blame]
Dmitry V. Levin38a34c92015-12-17 17:56:48 +00001/*
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. Levin95edb8b2014-12-03 20:50:08 +000032#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
41static 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. Levina0bd3742015-04-07 01:36:50 +000054SYS_FUNC(cacheflush)
Dmitry V. Levin95edb8b2014-12-03 20:50:08 +000055{
Dmitry V. Levin4b6fc982015-07-20 18:05:21 +000056 /* 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. Levin95edb8b2014-12-03 20:50:08 +000068}
69#endif /* M68K */
70
71#ifdef BFIN
72static const struct xlat cacheflush_flags[] = {
73 XLAT(ICACHE),
74 XLAT(DCACHE),
75 XLAT(BCACHE),
76 XLAT_END
77};
78
Dmitry V. Levina0bd3742015-04-07 01:36:50 +000079SYS_FUNC(cacheflush)
Dmitry V. Levin95edb8b2014-12-03 20:50:08 +000080{
Dmitry V. Levin4b6fc982015-07-20 18:05:21 +000081 /* start addr */
82 printaddr(tcp->u_arg[0]);
83 /* length */
Dmitry V. Levin2eb56d12016-05-16 21:31:54 +000084 tprintf(", %lu, ", tcp->u_arg[1]);
Dmitry V. Levin4b6fc982015-07-20 18:05:21 +000085 /* flags */
Dmitry V. Levin2eb56d12016-05-16 21:31:54 +000086 printxval(cacheflush_flags, tcp->u_arg[2], "?CACHE");
Dmitry V. Levin4b6fc982015-07-20 18:05:21 +000087
88 return RVAL_DECODED;
Dmitry V. Levin95edb8b2014-12-03 20:50:08 +000089}
90#endif /* BFIN */
91
92#ifdef SH
93static 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. Levina0bd3742015-04-07 01:36:50 +0000109SYS_FUNC(cacheflush)
Dmitry V. Levin95edb8b2014-12-03 20:50:08 +0000110{
Dmitry V. Levin4b6fc982015-07-20 18:05:21 +0000111 /* 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. Levin95edb8b2014-12-03 20:50:08 +0000119}
120#endif /* SH */
Ezequiel Garciabd8dd772015-04-18 17:33:27 -0300121
122#ifdef NIOS2
123SYS_FUNC(cacheflush)
124{
Dmitry V. Levin4b6fc982015-07-20 18:05:21 +0000125 /* 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 Garciabd8dd772015-04-18 17:33:27 -0300132}
133#endif /* NIOS2 */