Home | History | Annotate | Line # | Download | only in include
cacheops_60.h revision 1.11
      1  1.11       he /*	$NetBSD: cacheops_60.h,v 1.11 2007/06/13 13:13:29 he Exp $	*/
      2   1.1      leo 
      3   1.1      leo /*-
      4   1.1      leo  * Copyright (c) 1997 The NetBSD Foundation, Inc.
      5   1.1      leo  * All rights reserved.
      6   1.1      leo  *
      7   1.1      leo  * This code is derived from software contributed to The NetBSD Foundation
      8   1.1      leo  * by Leo Weppelman
      9   1.1      leo  *
     10   1.1      leo  * Redistribution and use in source and binary forms, with or without
     11   1.1      leo  * modification, are permitted provided that the following conditions
     12   1.1      leo  * are met:
     13   1.1      leo  * 1. Redistributions of source code must retain the above copyright
     14   1.1      leo  *    notice, this list of conditions and the following disclaimer.
     15   1.1      leo  * 2. Redistributions in binary form must reproduce the above copyright
     16   1.1      leo  *    notice, this list of conditions and the following disclaimer in the
     17   1.1      leo  *    documentation and/or other materials provided with the distribution.
     18   1.1      leo  * 3. All advertising materials mentioning features or use of this software
     19   1.1      leo  *    must display the following acknowledgement:
     20   1.1      leo  *        This product includes software developed by the NetBSD
     21   1.1      leo  *        Foundation, Inc. and its contributors.
     22   1.1      leo  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23   1.1      leo  *    contributors may be used to endorse or promote products derived
     24   1.1      leo  *    from this software without specific prior written permission.
     25   1.1      leo  *
     26   1.1      leo  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27   1.1      leo  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28   1.1      leo  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29   1.1      leo  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30   1.1      leo  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31   1.1      leo  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32   1.1      leo  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33   1.1      leo  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34   1.1      leo  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35   1.1      leo  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36   1.1      leo  * POSSIBILITY OF SUCH DAMAGE.
     37   1.1      leo  */
     38   1.1      leo 
     39   1.1      leo /*
     40   1.1      leo  * Invalidate entire TLB.
     41   1.1      leo  */
     42   1.7    perry static __inline void __attribute__((__unused__))
     43   1.5      chs TBIA_60(void)
     44   1.1      leo {
     45   1.6    perry 	__asm volatile (" .word 0xf518" ); /*  pflusha */
     46   1.1      leo }
     47   1.1      leo 
     48   1.1      leo /*
     49   1.1      leo  * Invalidate any TLB entry for given VA (TB Invalidate Single)
     50   1.1      leo  */
     51   1.7    perry static __inline void __attribute__((__unused__))
     52   1.5      chs TBIS_60(vaddr_t va)
     53   1.1      leo {
     54   1.9  tsutsui 	register uint8_t *r_va __asm("%a0") = (void *)va;
     55   1.1      leo 	int	tmp;
     56   1.1      leo 
     57   1.6    perry 	__asm volatile (" movc   %1, %%dfc;"	/* select supervisor	*/
     58   1.4  thorpej 			  " .word 0xf508;"	/* pflush %a0@		*/
     59   1.1      leo 			  " moveq  %3, %1;"	/* select user		*/
     60   1.4  thorpej 			  " movc   %1, %%dfc;"
     61   1.4  thorpej 			  " .word 0xf508;"	/* pflush %a0@		*/
     62   1.4  thorpej 			  " movc   %%cacr,%1;"
     63   1.1      leo 			  " orl    %4,%1;"
     64   1.4  thorpej 			  " movc   %1,%%cacr" : "=d" (tmp) :
     65   1.1      leo 			  "0" (FC_SUPERD), "a" (r_va), "i" (FC_USERD),
     66   1.1      leo 			  "i" (IC60_CABC));
     67   1.1      leo }
     68   1.1      leo 
     69   1.1      leo /*
     70   1.1      leo  * Invalidate supervisor side of TLB
     71   1.1      leo  */
     72   1.7    perry static __inline void __attribute__((__unused__))
     73   1.5      chs TBIAS_60(void)
     74   1.1      leo {
     75   1.1      leo 	int	tmp;
     76   1.5      chs 
     77   1.1      leo 	/*
     78   1.1      leo 	 * Cannot specify supervisor/user on pflusha, so we flush all
     79   1.1      leo 	 */
     80   1.6    perry 	__asm volatile (" .word 0xf518;"
     81   1.4  thorpej 			  " movc  %%cacr,%0;"
     82   1.1      leo 			  " orl   %1,%0;"
     83   1.4  thorpej 			  " movc  %0,%%cacr" /* clear all branch cache
     84   1.4  thorpej 			 		        entries */
     85   1.1      leo 			  : "=d" (tmp) : "i" (IC60_CABC) );
     86   1.1      leo }
     87   1.1      leo 
     88   1.1      leo /*
     89   1.1      leo  * Invalidate user side of TLB
     90   1.1      leo  */
     91   1.7    perry static __inline void __attribute__((__unused__))
     92   1.5      chs TBIAU_60(void)
     93   1.1      leo {
     94   1.1      leo 	int	tmp;
     95   1.5      chs 
     96   1.1      leo 	/*
     97   1.1      leo 	 * Cannot specify supervisor/user on pflusha, so we flush all
     98   1.1      leo 	 */
     99   1.6    perry 	__asm volatile (" .word 0xf518;"
    100   1.4  thorpej 			  " movc  %%cacr,%0;"
    101   1.1      leo 			  " orl   %1,%0;"
    102   1.4  thorpej 			  " movc  %0,%%cacr" /* clear all branch cache
    103   1.4  thorpej 			 		        entries */
    104   1.1      leo 			  : "=d" (tmp) : "i" (IC60_CUBC) );
    105   1.1      leo }
    106   1.1      leo 
    107   1.1      leo /*
    108   1.1      leo  * Invalidate instruction cache
    109   1.1      leo  */
    110   1.7    perry static __inline void __attribute__((__unused__))
    111   1.5      chs ICIA_60(void)
    112   1.1      leo {
    113   1.1      leo 	/* inva ic (also clears branch cache) */
    114   1.6    perry 	__asm volatile (" .word 0xf498;");
    115   1.1      leo }
    116   1.1      leo 
    117   1.7    perry static __inline void __attribute__((__unused__))
    118   1.5      chs ICPA_60(void)
    119   1.1      leo {
    120   1.1      leo 	/* inva ic (also clears branch cache) */
    121   1.6    perry 	__asm volatile (" .word 0xf498;");
    122   1.1      leo }
    123   1.1      leo 
    124   1.1      leo /*
    125   1.1      leo  * Invalidate data cache.
    126   1.1      leo  */
    127   1.7    perry static __inline void __attribute__((__unused__))
    128   1.5      chs DCIA_60(void)
    129   1.1      leo {
    130   1.6    perry 	__asm volatile (" .word 0xf478;"); /* cpusha dc */
    131   1.1      leo }
    132   1.1      leo 
    133   1.7    perry static __inline void __attribute__((__unused__))
    134   1.5      chs DCIS_60(void)
    135   1.1      leo {
    136   1.6    perry 	__asm volatile (" .word 0xf478;"); /* cpusha dc */
    137   1.1      leo }
    138   1.1      leo 
    139   1.7    perry static __inline void __attribute__((__unused__))
    140   1.5      chs DCIU_60(void)
    141   1.1      leo {
    142   1.6    perry 	__asm volatile (" .word 0xf478;"); /* cpusha dc */
    143   1.1      leo }
    144   1.1      leo 
    145   1.7    perry static __inline void __attribute__((__unused__))
    146   1.5      chs DCIAS_60(paddr_t pa)
    147   1.1      leo {
    148   1.9  tsutsui 	register uint8_t *r_pa __asm("%a0") = (void *)pa;
    149   1.1      leo 
    150   1.6    perry 	__asm volatile (" .word 0xf468;" : : "a" (r_pa)); /* cpushl dc,%a0@ */
    151   1.1      leo }
    152   1.1      leo 
    153   1.7    perry static __inline void __attribute__((__unused__))
    154   1.5      chs PCIA_60(void)
    155   1.1      leo {
    156   1.6    perry 	__asm volatile (" .word 0xf478;"); /* cpusha dc */
    157   1.1      leo }
    158  1.11       he 
    159  1.11       he #define	DCFA_60()	DCFA_40()
    160  1.11       he #define	DCPA_60()	DCPA_40()
    161  1.11       he #define	ICPL_60(pa)	ICPL_40(pa)
    162  1.11       he #define	ICPP_60(pa)	ICPP_40(pa)
    163  1.11       he #define	DCPL_60(pa)	DCPL_40(pa)
    164  1.11       he #define	DCPP_60(pa)	DCPP_40(pa)
    165  1.11       he #define	DCFL_60(pa)	DCFL_40(pa)
    166  1.11       he #define	DCFP_60(pa)	DCFP_40(pa)
    167