xref: /netbsd-src/sys/arch/m68k/include/cacheops.h (revision 267197ec1eebfcb9810ea27a89625b6ddf68e3e7)
1 /*	$NetBSD: cacheops.h,v 1.14 2007/10/17 19:55:05 garbled Exp $	*/
2 
3 /*-
4  * Copyright (c) 1997 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Leo Weppelman
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  * 3. All advertising materials mentioning features or use of this software
19  *    must display the following acknowledgement:
20  *        This product includes software developed by the NetBSD
21  *        Foundation, Inc. and its contributors.
22  * 4. Neither the name of The NetBSD Foundation nor the names of its
23  *    contributors may be used to endorse or promote products derived
24  *    from this software without specific prior written permission.
25  *
26  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36  * POSSIBILITY OF SUCH DAMAGE.
37  */
38 
39 #ifndef _M68K_CACHEOPS_H_
40 #define	_M68K_CACHEOPS_H_
41 
42 #if notyet /* XXX */
43 #include <machine/cpuconf.h>
44 #endif
45 
46 #include <m68k/cacheops_20.h>
47 #include <m68k/cacheops_30.h>
48 #include <m68k/cacheops_40.h>
49 #include <m68k/cacheops_60.h>
50 
51 #define M68K_CACHEOPS_NTYPES (defined(M68K_CACHEOPS_MACHDEP) + \
52 	defined(M68020) + defined(M68030) + defined(M68040) + defined(M68060))
53 
54 #if M68K_CACHEOPS_NTYPES == 1
55 
56 #if defined(M68020)
57 
58 #define	DCIA()		DCIA_20()
59 #define	DCIAS(pa)	DCIAS_20((pa))
60 #define	DCIS()		DCIS_20()
61 #define	DCIU()		DCIU_20()
62 #define	ICIA()		ICIA_20()
63 #define	ICPA()		ICPA_20()
64 #define	PCIA()		PCIA_20()
65 #define	TBIA()		TBIA_20()
66 #define	TBIAS()		TBIAS_20()
67 #define	TBIAU()		TBIAU_20()
68 #define	TBIS(va)	TBIS_20((va))
69 
70 #elif defined(M68030)
71 
72 #define	DCIA()		DCIA_30()
73 #define	DCIAS(pa)	DCIAS_30((pa))
74 #define	DCIS()		DCIS_30()
75 #define	DCIU()		DCIU_30()
76 #define	ICIA()		ICIA_30()
77 #define	ICPA()		ICPA_30()
78 #define	PCIA()		PCIA_30()
79 #define	TBIA()		TBIA_30()
80 #define	TBIAS()		TBIAS_30()
81 #define	TBIAU()		TBIAU_30()
82 #define	TBIS(va)	TBIS_30((va))
83 
84 #elif defined(M68040)
85 
86 #define	DCIA()		DCIA_40()
87 #define	DCIAS(pa)	DCIAS_40((pa))
88 #define	DCIS()		DCIS_40()
89 #define	DCIU()		DCIU_40()
90 #define	ICIA()		ICIA_40()
91 #define	ICPA()		ICPA_40()
92 #define	PCIA()		PCIA_40()
93 #define	TBIA()		TBIA_40()
94 #define	TBIAS()		TBIAS_40()
95 #define	TBIAU()		TBIAU_40()
96 #define	TBIS(va)	TBIS_40((va))
97 
98 #elif defined(M68060)
99 
100 #define	DCIA()		DCIA_60()
101 #define	DCIAS(pa)	DCIAS_60((pa))
102 #define	DCIS()		DCIS_60()
103 #define	DCIU()		DCIU_60()
104 #define	ICIA()		ICIA_60()
105 #define	ICPA()		ICPA_60()
106 #define	PCIA()		PCIA_60()
107 #define	TBIA()		TBIA_60()
108 #define	TBIAS()		TBIAS_60()
109 #define	TBIAU()		TBIAU_60()
110 #define	TBIS(va)	TBIS_60((va))
111 
112 #endif
113 
114 #else /* M68K_CACHEOPS_NTYPES == 1 */
115 
116 #define	DCIA()		_DCIA()
117 #define	DCIAS(pa)	_DCIAS((pa))
118 #define	DCIS()		_DCIS()
119 #define	DCIU()		_DCIU()
120 #define	ICIA()		_ICIA()
121 #define	ICPA()		_ICPA()
122 #define	PCIA()		_PCIA()
123 #define	TBIA()		_TBIA()
124 #define	TBIAS()		_TBIAS()
125 #define	TBIAU()		_TBIAU()
126 #define	TBIS(va)	_TBIS((va))
127 
128 #endif /* M68K_CACHEOPS_NTYPES == 1 */
129 
130 void	_DCIA(void);
131 void	_DCIAS(paddr_t);
132 void	_DCIS(void);
133 void	_DCIU(void);
134 void	_ICIA(void);
135 void	_ICPA(void);
136 void	_PCIA(void);
137 void	_TBIA(void);
138 void	_TBIAS(void);
139 void	_TBIAU(void);
140 void	_TBIS(vaddr_t);
141 
142 
143 #if defined(M68040) || defined(M68060)
144 
145 /*
146  * These cache ops are identical between M68040 and M68060
147  * and not available on M68020 and M68030 so no need to check cputype.
148  */
149 #define	DCFA()		DCFA_40()
150 #define	DCPA()		DCPA_40()
151 #define	ICPL(pa)	ICPL_40(pa)
152 #define	ICPP(pa)	ICPP_40(pa)
153 #define	DCPL(pa)	DCPL_40(pa)
154 #define	DCPP(pa)	DCPP_40(pa)
155 #define	DCFL(pa)	DCFL_40(pa)
156 #define	DCFP(pa)	DCFP_40(pa)
157 
158 #endif
159 
160 #endif /* _M68K_CACHEOPS_H_ */
161