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