/* $NetBSD: cache_tx39.h,v 1.7 2016/07/11 16:15:35 matt Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by UCHIYAMA Yasushi; and by Jason R. Thorpe.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Cache definitions/operations for TX3900-style caches.
*
* XXX THIS IS NOT YET COMPLETE.
*/
#define CACHE_TX39_I 0
#define CACHE_TX39_D 1
#define CACHEOP_TX3900_INDEX_INV (0 << 2) /* I */
#define CACHEOP_TX3900_ILRUC (1 << 2) /* I, D */
#define CACHEOP_TX3900_ILCKC (2 << 2) /* D */
#define CACHEOP_TX3900_HIT_INV (4 << 2) /* D */
#define CACHEOP_TX3920_INDEX_INV CACHEOP_TX3900_INDEX_INV
#define CACHEOP_TX3920_INDEX_WB_INV (0 << 2) /* D */
#define CACHEOP_TX3920_ILRUC CACHEOP_TX3900_ILRUC
#define CACHEOP_TX3920_INDEX_LOAD_TAG (3 << 2) /* I, D */
#define CACHEOP_TX3920_HIT_INV (4 << 2) /* I, D */
#define CACHEOP_TX3920_HIT_WB_INV (5 << 2) /* D */
#define CACHEOP_TX3920_HIT_WB (6 << 2) /* D */
#define CACHEOP_TX3920_ISTTAG (7 << 2) /* I, D */
#if !defined(_LOCORE)
/*
* cache_tx39_op_line:
*
* Perform the specified cache operation on a single line.
*/
#define cache_op_tx39_line(va, op) \
do { \
__asm volatile( \
".set noreorder \n\t" \
".set push \n\t" \
".set mips3 \n\t" \
"cache %1, 0(%0) \n\t" \
".set pop \n\t" \
".set reorder" \
: \
: "r" (va), "i" (op) \
: "memory"); \
} while (/*CONSTCOND*/0)