Home | History | Annotate | Line # | Download | only in include
cache_r5900.h revision 1.5.78.1
      1  1.5.78.1     yamt /*	$NetBSD: cache_r5900.h,v 1.5.78.1 2008/05/16 02:22:48 yamt Exp $	*/
      2       1.2  thorpej 
      3       1.2  thorpej /*-
      4       1.2  thorpej  * Copyright (c) 2001 The NetBSD Foundation, Inc.
      5       1.2  thorpej  * All rights reserved.
      6       1.2  thorpej  *
      7       1.2  thorpej  * This code is derived from software contributed to The NetBSD Foundation
      8       1.2  thorpej  * by UCHIYAMA Yasushi.
      9       1.2  thorpej  *
     10       1.2  thorpej  * Redistribution and use in source and binary forms, with or without
     11       1.2  thorpej  * modification, are permitted provided that the following conditions
     12       1.2  thorpej  * are met:
     13       1.2  thorpej  * 1. Redistributions of source code must retain the above copyright
     14       1.2  thorpej  *    notice, this list of conditions and the following disclaimer.
     15       1.2  thorpej  * 2. Redistributions in binary form must reproduce the above copyright
     16       1.2  thorpej  *    notice, this list of conditions and the following disclaimer in the
     17       1.2  thorpej  *    documentation and/or other materials provided with the distribution.
     18       1.2  thorpej  *
     19       1.2  thorpej  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20       1.2  thorpej  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21       1.2  thorpej  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22       1.2  thorpej  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23       1.2  thorpej  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24       1.2  thorpej  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25       1.2  thorpej  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26       1.2  thorpej  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27       1.2  thorpej  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28       1.2  thorpej  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29       1.2  thorpej  * POSSIBILITY OF SUCH DAMAGE.
     30       1.2  thorpej  */
     31       1.2  thorpej 
     32       1.2  thorpej #define CACHE_R5900_SIZE_I		16384
     33       1.2  thorpej #define	CACHE_R5900_SIZE_D		8192
     34       1.2  thorpej 
     35       1.2  thorpej #define CACHE_R5900_LSIZE_I		64
     36       1.2  thorpej #define CACHE_R5900_LSIZE_D		64
     37       1.2  thorpej 
     38       1.2  thorpej #define CACHEOP_R5900_IINV_I		0x07	/* INDEX INVALIDATE */
     39       1.2  thorpej #define CACHEOP_R5900_HINV_I		0x0b	/* HIT INVALIDATE */
     40       1.2  thorpej #define CACHEOP_R5900_IWBINV_D		0x14
     41       1.2  thorpej 					/* INDEX WRITE BACK INVALIDATE */
     42       1.2  thorpej #define CACHEOP_R5900_ILTG_D		0x10	/* INDEX LOAD TAG */
     43       1.2  thorpej #define CACHEOP_R5900_ISTG_D		0x12	/* INDEX STORE TAG */
     44       1.2  thorpej #define CACHEOP_R5900_IINV_D		0x16	/* INDEX INVALIDATE */
     45       1.2  thorpej #define CACHEOP_R5900_HINV_D		0x1a	/* HIT INVALIDATE */
     46       1.2  thorpej #define CACHEOP_R5900_HWBINV_D		0x18	/* HIT WRITEBACK INVALIDATE */
     47       1.2  thorpej #define CACHEOP_R5900_ILDT_D		0x11	/* INDEX LOAD DATA */
     48       1.2  thorpej #define CACHEOP_R5900_ISDT_D		0x13	/* INDEX STORE DATA */
     49       1.2  thorpej #define CACHEOP_R5900_HWB_D		0x1c
     50       1.2  thorpej 					/* HIT WRITEBACK W/O INVALIDATE */
     51       1.2  thorpej 
     52       1.4   simonb #if !defined(_LOCORE)
     53       1.2  thorpej 
     54       1.2  thorpej #define	cache_op_r5900_line_64(va, op)					\
     55       1.2  thorpej do {									\
     56       1.5    perry 	__asm volatile(						\
     57       1.2  thorpej 		".set noreorder					\n\t"	\
     58       1.2  thorpej 		"sync.l						\n\t"	\
     59       1.2  thorpej 		"sync.p						\n\t"	\
     60       1.2  thorpej 		"cache %1, 0(%0)				\n\t"	\
     61       1.2  thorpej 		"sync.l						\n\t"	\
     62       1.2  thorpej 		"sync.p						\n\t"	\
     63       1.2  thorpej 		".set reorder"						\
     64       1.2  thorpej 	    :								\
     65       1.2  thorpej 	    : "r" (va), "i" (op)					\
     66       1.2  thorpej 	    : "memory");						\
     67       1.2  thorpej } while (/*CONSTCOND*/0)
     68       1.2  thorpej 
     69       1.2  thorpej #define	cache_r5900_op_4lines_64(va, op)				\
     70       1.2  thorpej do {									\
     71       1.5    perry 	__asm volatile(						\
     72       1.2  thorpej 		".set noreorder					\n\t"	\
     73       1.2  thorpej 		"sync.l						\n\t"	\
     74       1.2  thorpej 		"sync.p						\n\t"	\
     75       1.2  thorpej 		"cache %1,   0(%0)				\n\t"	\
     76       1.2  thorpej 		"sync.l						\n\t"	\
     77       1.2  thorpej 		"sync.p						\n\t"	\
     78       1.2  thorpej 		"cache %1,  64(%0)				\n\t"	\
     79       1.2  thorpej 		"sync.l						\n\t"	\
     80       1.2  thorpej 		"sync.p						\n\t"	\
     81       1.2  thorpej 		"cache %1, 128(%0)				\n\t"	\
     82       1.2  thorpej 		"sync.l						\n\t"	\
     83       1.2  thorpej 		"sync.p						\n\t"	\
     84       1.2  thorpej 		"cache %1, 192(%0)				\n\t"	\
     85       1.2  thorpej 		"sync.l						\n\t"	\
     86       1.2  thorpej 		"sync.p						\n\t"	\
     87       1.2  thorpej 		".set reorder"						\
     88       1.2  thorpej 	    :								\
     89       1.2  thorpej 	    : "r" (va), "i" (op)					\
     90       1.2  thorpej 	    : "memory");						\
     91       1.2  thorpej } while (/*CONSTCOND*/0)
     92       1.2  thorpej 
     93       1.2  thorpej #define	cache_r5900_op_4lines_64_2way(va, op)				\
     94       1.2  thorpej do {									\
     95       1.5    perry 	__asm volatile(						\
     96       1.2  thorpej 		".set noreorder					\n\t"	\
     97       1.2  thorpej 		"sync.l						\n\t"	\
     98       1.2  thorpej 		"sync.p						\n\t"	\
     99       1.2  thorpej 		"cache %1,   0(%0)				\n\t"	\
    100       1.2  thorpej 		"sync.l						\n\t"	\
    101       1.2  thorpej 		"sync.p						\n\t"	\
    102       1.2  thorpej 		"cache %1,   1(%0)				\n\t"	\
    103       1.2  thorpej 		"sync.l						\n\t"	\
    104       1.2  thorpej 		"sync.p						\n\t"	\
    105       1.2  thorpej 		"cache %1,  64(%0)				\n\t"	\
    106       1.2  thorpej 		"sync.l						\n\t"	\
    107       1.2  thorpej 		"sync.p						\n\t"	\
    108       1.2  thorpej 		"cache %1,  65(%0)				\n\t"	\
    109       1.2  thorpej 		"sync.l						\n\t"	\
    110       1.2  thorpej 		"sync.p						\n\t"	\
    111       1.2  thorpej 		"cache %1, 128(%0)				\n\t"	\
    112       1.2  thorpej 		"sync.l						\n\t"	\
    113       1.2  thorpej 		"sync.p						\n\t"	\
    114       1.2  thorpej 		"cache %1, 129(%0)				\n\t"	\
    115       1.2  thorpej 		"sync.l						\n\t"	\
    116       1.2  thorpej 		"sync.p						\n\t"	\
    117       1.2  thorpej 		"cache %1, 192(%0)				\n\t"	\
    118       1.2  thorpej 		"sync.l						\n\t"	\
    119       1.2  thorpej 		"sync.p						\n\t"	\
    120       1.2  thorpej 		"cache %1, 193(%0)				\n\t"	\
    121       1.2  thorpej 		"sync.l						\n\t"	\
    122       1.2  thorpej 		"sync.p						\n\t"	\
    123       1.2  thorpej 		".set reorder"						\
    124       1.2  thorpej 	    :								\
    125       1.2  thorpej 	    : "r" (va), "i" (op)					\
    126       1.2  thorpej 	    : "memory");						\
    127       1.2  thorpej } while (/*CONSTCOND*/0)
    128       1.2  thorpej 
    129       1.2  thorpej void	r5900_icache_sync_all_64(void);
    130       1.2  thorpej void	r5900_icache_sync_range_64(vaddr_t, vsize_t);
    131       1.2  thorpej void	r5900_icache_sync_range_index_64(vaddr_t, vsize_t);
    132       1.2  thorpej 
    133       1.2  thorpej void	r5900_pdcache_wbinv_all_64(void);
    134       1.2  thorpej void	r5900_pdcache_wbinv_range_64(vaddr_t, vsize_t);
    135       1.2  thorpej void	r5900_pdcache_wbinv_range_index_64(vaddr_t, vsize_t);
    136       1.2  thorpej 
    137       1.2  thorpej void	r5900_pdcache_inv_range_64(vaddr_t, vsize_t);
    138       1.2  thorpej void	r5900_pdcache_wb_range_64(vaddr_t, vsize_t);
    139       1.2  thorpej 
    140       1.4   simonb #endif /* !_LOCORE */
    141