7709a.h revision 1.4
11.4Suwe/*	$NetBSD: 7709a.h,v 1.4 2006/03/05 04:05:39 uwe Exp $	*/
21.1Such
31.1Such/*-
41.1Such * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
51.1Such * All rights reserved.
61.1Such *
71.1Such * This code is derived from software contributed to The NetBSD Foundation
81.1Such * by UCHIYAMA Yasushi.
91.1Such *
101.1Such * Redistribution and use in source and binary forms, with or without
111.1Such * modification, are permitted provided that the following conditions
121.1Such * are met:
131.1Such * 1. Redistributions of source code must retain the above copyright
141.1Such *    notice, this list of conditions and the following disclaimer.
151.1Such * 2. Redistributions in binary form must reproduce the above copyright
161.1Such *    notice, this list of conditions and the following disclaimer in the
171.1Such *    documentation and/or other materials provided with the distribution.
181.1Such * 3. All advertising materials mentioning features or use of this software
191.1Such *    must display the following acknowledgement:
201.1Such *        This product includes software developed by the NetBSD
211.1Such *        Foundation, Inc. and its contributors.
221.1Such * 4. Neither the name of The NetBSD Foundation nor the names of its
231.1Such *    contributors may be used to endorse or promote products derived
241.1Such *    from this software without specific prior written permission.
251.1Such *
261.1Such * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
271.1Such * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
281.1Such * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
291.1Such * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
301.1Such * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
311.1Such * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
321.1Such * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
331.1Such * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
341.1Such * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
351.1Such * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
361.1Such * POSSIBILITY OF SUCH DAMAGE.
371.1Such */
381.1Such
391.1Such#ifndef _HPCBOOT_SH_CPU_7709A_H_
401.2Such#define	_HPCBOOT_SH_CPU_7709A_H_
411.1Such
421.2Such#define	SH7709A_CACHE_LINESZ		16
431.2Such#define	SH7709A_CACHE_ENTRY		256
441.2Such#define	SH7709A_CACHE_WAY		4
451.2Such#define	SH7709A_CACHE_SIZE						\
461.1Such	(SH7709A_CACHE_LINESZ * SH7709A_CACHE_ENTRY * SH7709A_CACHE_WAY)
471.1Such
481.2Such#define	SH7709A_CACHE_ENTRY_SHIFT	4
491.2Such#define	SH7709A_CACHE_ENTRY_MASK	0x00000ff0
501.2Such#define	SH7709A_CACHE_WAY_SHIFT		12
511.2Such#define	SH7709A_CACHE_WAY_MASK		0x00003000
521.1Such
531.2Such#define	SH7709A_CACHE_FLUSH()						\
541.1Such__BEGIN_MACRO								\
551.4Suwe	uint32_t __e, __w, __wa, __a;					\
561.1Such									\
571.1Such	for (__w = 0; __w < SH7709A_CACHE_WAY; __w++) {			\
581.1Such		__wa = SH3_CCA | __w << SH7709A_CACHE_WAY_SHIFT;	\
591.1Such		for (__e = 0; __e < SH7709A_CACHE_ENTRY; __e++)	{	\
601.1Such			__a = __wa |(__e << SH7709A_CACHE_ENTRY_SHIFT);	\
611.1Such			_reg_read_4(__a) &= ~0x3; /* Clear U,V bit */	\
621.1Such		}							\
631.1Such	}								\
641.1Such__END_MACRO
651.1Such
661.2Such#define	SH7709A_MMU_DISABLE	SH3_MMU_DISABLE
671.1Such
681.1Such#endif // _HPCBOOT_SH_CPU_7709A_H_
69