Home | History | Annotate | Line # | Download | only in include
      1 /*	$NetBSD: cacheops.h,v 1.18 2026/07/06 14:55:28 thorpej 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 #include "opt_m68k_arch.h"
     36 
     37 #if defined(__mc68010__)
     38 
     39 /*
     40  * None of these are relevant on the 68010, but generic m68k code
     41  * may reference them.
     42  */
     43 
     44 #define	DCIA()		__nothing
     45 #define	DCIAS(pa)	__nothing
     46 #define	DCIS()		__nothing
     47 #define	DCIU()		__nothing
     48 #define	ICIA()		__nothing
     49 #define	ICPA()		__nothing
     50 #define	PCIA()		__nothing
     51 
     52 #else /* ! __mc68010__ */
     53 
     54 #if notyet /* XXX */
     55 #include <machine/cpuconf.h>
     56 #endif
     57 
     58 #include <m68k/cacheops_20.h>
     59 #include <m68k/cacheops_30.h>
     60 #include <m68k/cacheops_40.h>
     61 #include <m68k/cacheops_60.h>
     62 
     63 /* XXX MMU and cache operations should not be intermingled. */
     64 
     65 #define M68K_CACHEOPS_NTYPES (defined(M68K_CACHEOPS_MACHDEP) + \
     66 	defined(M68020) + defined(M68030) + defined(M68040) + defined(M68060))
     67 
     68 #if M68K_CACHEOPS_NTYPES == 1
     69 
     70 #if defined(M68020)
     71 
     72 #define	DCIA()		DCIA_20()
     73 #define	DCIAS(pa)	DCIAS_20((pa))
     74 #define	DCIS()		DCIS_20()
     75 #define	DCIU()		DCIU_20()
     76 #define	ICIA()		ICIA_20()
     77 #define	ICPA()		ICPA_20()
     78 #define	PCIA()		PCIA_20()
     79 #if defined(M68K_MMU_MOTOROLA) || defined(M68K_MMU_HP)
     80 #define	TBIA()		TBIA_20()
     81 #define	TBIAS()		TBIAS_20()
     82 #define	TBIAU()		TBIAU_20()
     83 #define	TBIS(va)	TBIS_20((va))
     84 #endif
     85 
     86 #elif defined(M68030)
     87 
     88 #define	DCIA()		DCIA_30()
     89 #define	DCIAS(pa)	DCIAS_30((pa))
     90 #define	DCIS()		DCIS_30()
     91 #define	DCIU()		DCIU_30()
     92 #define	ICIA()		ICIA_30()
     93 #define	ICPA()		ICPA_30()
     94 #define	PCIA()		PCIA_30()
     95 #if defined(M68K_MMU_MOTOROLA) || defined(M68K_MMU_HP)
     96 #define	TBIA()		TBIA_30()
     97 #define	TBIAS()		TBIAS_30()
     98 #define	TBIAU()		TBIAU_30()
     99 #define	TBIS(va)	TBIS_30((va))
    100 #endif
    101 
    102 #elif defined(M68040)
    103 
    104 #define	DCIA()		DCIA_40()
    105 #define	DCIAS(pa)	DCIAS_40((pa))
    106 #define	DCIS()		DCIS_40()
    107 #define	DCIU()		DCIU_40()
    108 #define	ICIA()		ICIA_40()
    109 #define	ICPA()		ICPA_40()
    110 #define	PCIA()		PCIA_40()
    111 #if defined(M68K_MMU_MOTOROLA) || defined(M68K_MMU_HP)
    112 #define	TBIA()		TBIA_40()
    113 #define	TBIAS()		TBIAS_40()
    114 #define	TBIAU()		TBIAU_40()
    115 #define	TBIS(va)	TBIS_40((va))
    116 #endif
    117 
    118 #elif defined(M68060)
    119 
    120 #define	DCIA()		DCIA_60()
    121 #define	DCIAS(pa)	DCIAS_60((pa))
    122 #define	DCIS()		DCIS_60()
    123 #define	DCIU()		DCIU_60()
    124 #define	ICIA()		ICIA_60()
    125 #define	ICPA()		ICPA_60()
    126 #define	PCIA()		PCIA_60()
    127 #if defined(M68K_MMU_MOTOROLA) || defined(M68K_MMU_HP)
    128 #define	TBIA()		TBIA_60()
    129 #define	TBIAS()		TBIAS_60()
    130 #define	TBIAU()		TBIAU_60()
    131 #define	TBIS(va)	TBIS_60((va))
    132 #endif
    133 
    134 #endif
    135 
    136 #else /* M68K_CACHEOPS_NTYPES == 1 */
    137 
    138 #define	DCIA()		_DCIA()
    139 #define	DCIAS(pa)	_DCIAS((pa))
    140 #define	DCIS()		_DCIS()
    141 #define	DCIU()		_DCIU()
    142 #define	ICIA()		_ICIA()
    143 #define	ICPA()		_ICPA()
    144 #define	PCIA()		_PCIA()
    145 #if defined(M68K_MMU_MOTOROLA) || defined(M68K_MMU_HP)
    146 #define	TBIA()		_TBIA()
    147 #define	TBIAS()		_TBIAS()
    148 #define	TBIAU()		_TBIAU()
    149 #define	TBIS(va)	_TBIS((va))
    150 #endif
    151 
    152 #endif /* M68K_CACHEOPS_NTYPES == 1 */
    153 
    154 void	_DCIA(void);
    155 void	_DCIAS(paddr_t);
    156 void	_DCIS(void);
    157 void	_DCIU(void);
    158 void	_ICIA(void);
    159 void	_ICPA(void);
    160 void	_PCIA(void);
    161 #if defined(M68K_MMU_MOTOROLA) || defined(M68K_MMU_HP)
    162 void	_TBIA(void);
    163 void	_TBIAS(void);
    164 void	_TBIAU(void);
    165 void	_TBIS(vaddr_t);
    166 #endif
    167 
    168 #if defined(M68040) || defined(M68060)
    169 /*
    170  * These cache ops are identical between M68040 and M68060
    171  * and not available on M68020 and M68030 so no need to check cputype.
    172  */
    173 #define	DCFA()		DCFA_40()
    174 #define	DCPA()		DCPA_40()
    175 #define	ICPL(pa)	ICPL_40(pa)
    176 #define	ICPP(pa)	ICPP_40(pa)
    177 #define	DCPL(pa)	DCPL_40(pa)
    178 #define	DCPP(pa)	DCPP_40(pa)
    179 #define	DCFL(pa)	DCFL_40(pa)
    180 #define	DCFP(pa)	DCFP_40(pa)
    181 #endif
    182 
    183 #endif /* __mc68010__ */
    184 
    185 #endif /* _M68K_CACHEOPS_H_ */
    186