Home | History | Annotate | Line # | Download | only in include
cacheops_40.h revision 1.10
      1  1.10  garbled /*	$NetBSD: cacheops_40.h,v 1.10 2007/10/17 19:55:05 garbled 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.8    perry static __inline void __attribute__((__unused__))
     43   1.6      chs TBIA_40(void)
     44   1.1      leo {
     45   1.7    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.8    perry static __inline void __attribute__((__unused__))
     52   1.6      chs TBIS_40(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.7    perry 	__asm volatile (" movc   %1, %%dfc;"	/* select supervisor	*/
     58   1.5  thorpej 			  " .word 0xf508;"	/* pflush %a0@		*/
     59   1.1      leo 			  " moveq  %3, %1;"	/* select user		*/
     60   1.5  thorpej 			  " movc   %1, %%dfc;"
     61   1.1      leo 			  " .word 0xf508;" : "=d" (tmp) :
     62   1.1      leo 			  "0" (FC_SUPERD), "a" (r_va), "i" (FC_USERD));
     63   1.1      leo }
     64   1.1      leo 
     65   1.1      leo /*
     66   1.1      leo  * Invalidate supervisor side of TLB
     67   1.1      leo  */
     68   1.8    perry static __inline void __attribute__((__unused__))
     69   1.6      chs TBIAS_40(void)
     70   1.1      leo {
     71   1.1      leo 	/*
     72   1.1      leo 	 * Cannot specify supervisor/user on pflusha, so we flush all
     73   1.1      leo 	 */
     74   1.7    perry 	__asm volatile (" .word 0xf518;");
     75   1.1      leo }
     76   1.1      leo 
     77   1.1      leo /*
     78   1.1      leo  * Invalidate user side of TLB
     79   1.1      leo  */
     80   1.8    perry static __inline void __attribute__((__unused__))
     81   1.6      chs TBIAU_40(void)
     82   1.1      leo {
     83   1.1      leo 	/*
     84   1.1      leo 	 * Cannot specify supervisor/user on pflusha, so we flush all
     85   1.1      leo 	 */
     86   1.7    perry 	__asm volatile (" .word 0xf518;");
     87   1.1      leo }
     88   1.1      leo 
     89   1.1      leo /*
     90   1.1      leo  * Invalidate instruction cache
     91   1.1      leo  */
     92   1.8    perry static __inline void __attribute__((__unused__))
     93   1.6      chs ICIA_40(void)
     94   1.1      leo {
     95   1.7    perry 	__asm volatile (" .word 0xf498;"); /* cinva ic */
     96   1.1      leo }
     97   1.1      leo 
     98   1.8    perry static __inline void __attribute__((__unused__))
     99   1.6      chs ICPA_40(void)
    100   1.1      leo {
    101   1.7    perry 	__asm volatile (" .word 0xf498;"); /* cinva ic */
    102   1.1      leo }
    103   1.1      leo 
    104   1.1      leo /*
    105   1.1      leo  * Invalidate data cache.
    106   1.1      leo  */
    107   1.8    perry static __inline void __attribute__((__unused__))
    108   1.6      chs DCIA_40(void)
    109   1.1      leo {
    110   1.7    perry 	__asm volatile (" .word 0xf478;"); /* cpusha dc */
    111   1.1      leo }
    112   1.1      leo 
    113   1.8    perry static __inline void __attribute__((__unused__))
    114   1.6      chs DCIS_40(void)
    115   1.1      leo {
    116   1.7    perry 	__asm volatile (" .word 0xf478;"); /* cpusha dc */
    117   1.1      leo }
    118   1.1      leo 
    119   1.8    perry static __inline void __attribute__((__unused__))
    120   1.6      chs DCIU_40(void)
    121   1.1      leo {
    122   1.7    perry 	__asm volatile (" .word 0xf478;"); /* cpusha dc */
    123   1.1      leo }
    124   1.1      leo 
    125   1.8    perry static __inline void __attribute__((__unused__))
    126   1.6      chs DCIAS_40(paddr_t pa)
    127   1.1      leo {
    128   1.9  tsutsui 	register uint8_t *r_pa __asm("%a0") = (void *)pa;
    129   1.1      leo 
    130   1.7    perry 	__asm volatile (" .word 0xf468;" : : "a" (r_pa)); /* cpushl dc,%a0@ */
    131   1.1      leo }
    132   1.1      leo 
    133   1.8    perry static __inline void __attribute__((__unused__))
    134   1.6      chs PCIA_40(void)
    135   1.1      leo {
    136   1.7    perry 	__asm volatile (" .word 0xf478;"); /* cpusha dc */
    137   1.1      leo }
    138   1.1      leo 
    139   1.8    perry static __inline void __attribute__((__unused__))
    140   1.6      chs DCFA_40(void)
    141   1.1      leo {
    142   1.7    perry 	__asm volatile (" .word 0xf478;"); /* cpusha dc */
    143   1.1      leo }
    144   1.1      leo 
    145   1.1      leo /* invalidate instruction physical cache line */
    146   1.8    perry static __inline void __attribute__((__unused__))
    147   1.6      chs ICPL_40(paddr_t pa)
    148   1.1      leo {
    149   1.9  tsutsui 	register uint8_t *r_pa __asm("%a0") = (void *)pa;
    150   1.1      leo 
    151   1.7    perry 	__asm volatile (" .word 0xf488;" : : "a" (r_pa)); /* cinvl ic,%a0@ */
    152   1.1      leo }
    153   1.1      leo 
    154   1.1      leo /* invalidate instruction physical cache page */
    155   1.8    perry static __inline void __attribute__((__unused__))
    156   1.6      chs ICPP_40(paddr_t pa)
    157   1.1      leo {
    158   1.9  tsutsui 	register uint8_t *r_pa __asm("%a0") = (void *)pa;
    159   1.1      leo 
    160   1.7    perry 	__asm volatile (" .word 0xf490;" : : "a" (r_pa)); /* cinvp ic,%a0@ */
    161   1.1      leo }
    162   1.1      leo 
    163   1.1      leo /* invalidate data physical cache line */
    164   1.8    perry static __inline void __attribute__((__unused__))
    165   1.6      chs DCPL_40(paddr_t pa)
    166   1.1      leo {
    167   1.9  tsutsui 	register uint8_t *r_pa __asm("%a0") = (void *)pa;
    168   1.1      leo 
    169   1.7    perry 	__asm volatile (" .word 0xf448;" : : "a" (r_pa)); /* cinvl dc,%a0@ */
    170   1.1      leo }
    171   1.1      leo 
    172   1.1      leo /* invalidate data physical cache page */
    173   1.8    perry static __inline void __attribute__((__unused__))
    174   1.6      chs DCPP_40(paddr_t pa)
    175   1.1      leo {
    176   1.9  tsutsui 	register uint8_t *r_pa __asm("%a0") = (void *)pa;
    177   1.1      leo 
    178   1.7    perry 	__asm volatile (" .word 0xf450;" : : "a" (r_pa)); /* cinvp dc,%a0@ */
    179   1.1      leo }
    180   1.1      leo 
    181   1.1      leo /* invalidate data physical all */
    182   1.8    perry static __inline void __attribute__((__unused__))
    183   1.6      chs DCPA_40(void)
    184   1.1      leo {
    185   1.7    perry 	__asm volatile (" .word 0xf458;"); /* cinva dc */
    186   1.1      leo }
    187   1.1      leo 
    188   1.1      leo /* data cache flush line */
    189   1.8    perry static __inline void __attribute__((__unused__))
    190   1.6      chs DCFL_40(paddr_t pa)
    191   1.1      leo {
    192   1.9  tsutsui 	register uint8_t *r_pa __asm("%a0") = (void *)pa;
    193   1.1      leo 
    194   1.7    perry 	__asm volatile (" .word 0xf468;" : : "a" (r_pa)); /* cpushl dc,%a0@ */
    195   1.1      leo }
    196   1.1      leo 
    197   1.1      leo /* data cache flush page */
    198   1.8    perry static __inline void __attribute__((__unused__))
    199   1.6      chs DCFP_40(paddr_t pa)
    200   1.1      leo {
    201   1.9  tsutsui 	register uint8_t *r_pa __asm("%a0") = (void *)pa;
    202   1.1      leo 
    203   1.7    perry 	__asm volatile (" .word 0xf470;" : : "a" (r_pa)); /* cpushp dc,%a0@ */
    204   1.1      leo }
    205