xref: /netbsd-src/sys/arch/m68k/include/cacheops.h (revision 404fbe5fb94ca1e054339640cabb2801ce52dd30)
1 /*	$NetBSD: cacheops.h,v 1.15 2008/04/28 20:23:26 martin 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  *
19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 #ifndef _M68K_CACHEOPS_H_
33 #define	_M68K_CACHEOPS_H_
34 
35 #if notyet /* XXX */
36 #include <machine/cpuconf.h>
37 #endif
38 
39 #include <m68k/cacheops_20.h>
40 #include <m68k/cacheops_30.h>
41 #include <m68k/cacheops_40.h>
42 #include <m68k/cacheops_60.h>
43 
44 #define M68K_CACHEOPS_NTYPES (defined(M68K_CACHEOPS_MACHDEP) + \
45 	defined(M68020) + defined(M68030) + defined(M68040) + defined(M68060))
46 
47 #if M68K_CACHEOPS_NTYPES == 1
48 
49 #if defined(M68020)
50 
51 #define	DCIA()		DCIA_20()
52 #define	DCIAS(pa)	DCIAS_20((pa))
53 #define	DCIS()		DCIS_20()
54 #define	DCIU()		DCIU_20()
55 #define	ICIA()		ICIA_20()
56 #define	ICPA()		ICPA_20()
57 #define	PCIA()		PCIA_20()
58 #define	TBIA()		TBIA_20()
59 #define	TBIAS()		TBIAS_20()
60 #define	TBIAU()		TBIAU_20()
61 #define	TBIS(va)	TBIS_20((va))
62 
63 #elif defined(M68030)
64 
65 #define	DCIA()		DCIA_30()
66 #define	DCIAS(pa)	DCIAS_30((pa))
67 #define	DCIS()		DCIS_30()
68 #define	DCIU()		DCIU_30()
69 #define	ICIA()		ICIA_30()
70 #define	ICPA()		ICPA_30()
71 #define	PCIA()		PCIA_30()
72 #define	TBIA()		TBIA_30()
73 #define	TBIAS()		TBIAS_30()
74 #define	TBIAU()		TBIAU_30()
75 #define	TBIS(va)	TBIS_30((va))
76 
77 #elif defined(M68040)
78 
79 #define	DCIA()		DCIA_40()
80 #define	DCIAS(pa)	DCIAS_40((pa))
81 #define	DCIS()		DCIS_40()
82 #define	DCIU()		DCIU_40()
83 #define	ICIA()		ICIA_40()
84 #define	ICPA()		ICPA_40()
85 #define	PCIA()		PCIA_40()
86 #define	TBIA()		TBIA_40()
87 #define	TBIAS()		TBIAS_40()
88 #define	TBIAU()		TBIAU_40()
89 #define	TBIS(va)	TBIS_40((va))
90 
91 #elif defined(M68060)
92 
93 #define	DCIA()		DCIA_60()
94 #define	DCIAS(pa)	DCIAS_60((pa))
95 #define	DCIS()		DCIS_60()
96 #define	DCIU()		DCIU_60()
97 #define	ICIA()		ICIA_60()
98 #define	ICPA()		ICPA_60()
99 #define	PCIA()		PCIA_60()
100 #define	TBIA()		TBIA_60()
101 #define	TBIAS()		TBIAS_60()
102 #define	TBIAU()		TBIAU_60()
103 #define	TBIS(va)	TBIS_60((va))
104 
105 #endif
106 
107 #else /* M68K_CACHEOPS_NTYPES == 1 */
108 
109 #define	DCIA()		_DCIA()
110 #define	DCIAS(pa)	_DCIAS((pa))
111 #define	DCIS()		_DCIS()
112 #define	DCIU()		_DCIU()
113 #define	ICIA()		_ICIA()
114 #define	ICPA()		_ICPA()
115 #define	PCIA()		_PCIA()
116 #define	TBIA()		_TBIA()
117 #define	TBIAS()		_TBIAS()
118 #define	TBIAU()		_TBIAU()
119 #define	TBIS(va)	_TBIS((va))
120 
121 #endif /* M68K_CACHEOPS_NTYPES == 1 */
122 
123 void	_DCIA(void);
124 void	_DCIAS(paddr_t);
125 void	_DCIS(void);
126 void	_DCIU(void);
127 void	_ICIA(void);
128 void	_ICPA(void);
129 void	_PCIA(void);
130 void	_TBIA(void);
131 void	_TBIAS(void);
132 void	_TBIAU(void);
133 void	_TBIS(vaddr_t);
134 
135 
136 #if defined(M68040) || defined(M68060)
137 
138 /*
139  * These cache ops are identical between M68040 and M68060
140  * and not available on M68020 and M68030 so no need to check cputype.
141  */
142 #define	DCFA()		DCFA_40()
143 #define	DCPA()		DCPA_40()
144 #define	ICPL(pa)	ICPL_40(pa)
145 #define	ICPP(pa)	ICPP_40(pa)
146 #define	DCPL(pa)	DCPL_40(pa)
147 #define	DCPP(pa)	DCPP_40(pa)
148 #define	DCFL(pa)	DCFL_40(pa)
149 #define	DCFP(pa)	DCFP_40(pa)
150 
151 #endif
152 
153 #endif /* _M68K_CACHEOPS_H_ */
154