Home | History | Annotate | Line # | Download | only in include
cacheops.h revision 1.12
      1 /*	$NetBSD: cacheops.h,v 1.12 2007/06/08 15:44:34 tsutsui 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	DCFA()		DCFA_60()
    101 #define	DCFL(pa)	DCFL_60((pa))
    102 #define	DCFP(pa)	DCFP_60((pa))
    103 #define	DCIA()		DCIA_60()
    104 #define	DCIAS(pa)	DCIAS_60((pa))
    105 #define	DCIS()		DCIS_60()
    106 #define	DCIU()		DCIU_60()
    107 #define	DCPA()		DCPA_60()
    108 #define	DCPL(pa)	DCPL_60((pa))
    109 #define	DCPP(pa)	DCPP_60((pa))
    110 #define	ICIA()		ICIA_60()
    111 #define	ICPA()		ICPA_60()
    112 #define	ICPL(pa)	ICPL_60((pa))
    113 #define	ICPP(pa)	ICPP_60((pa))
    114 #define	PCIA()		PCIA_60()
    115 #define	TBIA()		TBIA_60()
    116 #define	TBIAS()		TBIAS_60()
    117 #define	TBIAU()		TBIAU_60()
    118 #define	TBIS(va)	TBIS_60((va))
    119 
    120 #endif
    121 
    122 #else /* M68K_CACHEOPS_NTYPES == 1 */
    123 
    124 #define	DCIA()		_DCIA()
    125 #define	DCIAS(pa)	_DCIAS((pa))
    126 #define	DCIS()		_DCIS()
    127 #define	DCIU()		_DCIU()
    128 #define	ICIA()		_ICIA()
    129 #define	ICPA()		_ICPA()
    130 #define	PCIA()		_PCIA()
    131 #define	TBIA()		_TBIA()
    132 #define	TBIAS()		_TBIAS()
    133 #define	TBIAU()		_TBIAU()
    134 #define	TBIS(va)	_TBIS((va))
    135 
    136 #endif /* M68K_CACHEOPS_NTYPES == 1 */
    137 
    138 void	_DCIA(void);
    139 void	_DCIAS(paddr_t);
    140 void	_DCIS(void);
    141 void	_DCIU(void);
    142 void	_ICIA(void);
    143 void	_ICPA(void);
    144 void	_PCIA(void);
    145 void	_TBIA(void);
    146 void	_TBIAS(void);
    147 void	_TBIAU(void);
    148 void	_TBIS(vaddr_t);
    149 
    150 
    151 #if defined(M68040) || defined(M68060)
    152 
    153 /*
    154  * These cache ops are identical between M68040 and M68060
    155  * and not available on M68020 and M68030 so no need to check cputype.
    156  */
    157 #define	DCFA()		DCFA_40()
    158 #define	DCPA()		DCPA_40()
    159 #define	ICPL(pa)	ICPL_40(pa)
    160 #define	ICPP(pa)	ICPP_40(pa)
    161 #define	DCPL(pa)	DCPL_40(pa)
    162 #define	DCPP(pa)	DCPP_40(pa)
    163 #define	DCFL(pa)	DCFL_40(pa)
    164 #define	DCFP(pa)	DCFP_40(pa)
    165 
    166 #endif
    167 
    168 #endif /* _M68K_CACHEOPS_H_ */
    169