xref: /openbsd-src/sys/arch/powerpc/include/bat.h (revision 5c8048c1d30761e2471fbfddb5e4847568d14a54)
1*5c8048c1Smpi /*	$OpenBSD: bat.h,v 1.6 2015/03/31 16:00:38 mpi Exp $	*/
247bc79e1Srahnds 
347bc79e1Srahnds /*
447bc79e1Srahnds  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
547bc79e1Srahnds  * Copyright (C) 1995, 1996 TooLs GmbH.
647bc79e1Srahnds  * All rights reserved.
747bc79e1Srahnds  *
847bc79e1Srahnds  * Redistribution and use in source and binary forms, with or without
947bc79e1Srahnds  * modification, are permitted provided that the following conditions
1047bc79e1Srahnds  * are met:
1147bc79e1Srahnds  * 1. Redistributions of source code must retain the above copyright
1247bc79e1Srahnds  *    notice, this list of conditions and the following disclaimer.
1347bc79e1Srahnds  * 2. Redistributions in binary form must reproduce the above copyright
1447bc79e1Srahnds  *    notice, this list of conditions and the following disclaimer in the
1547bc79e1Srahnds  *    documentation and/or other materials provided with the distribution.
1647bc79e1Srahnds  * 3. All advertising materials mentioning features or use of this software
1747bc79e1Srahnds  *    must display the following acknowledgement:
1847bc79e1Srahnds  *	This product includes software developed by TooLs GmbH.
1947bc79e1Srahnds  * 4. The name of TooLs GmbH may not be used to endorse or promote products
2047bc79e1Srahnds  *    derived from this software without specific prior written permission.
2147bc79e1Srahnds  *
2247bc79e1Srahnds  * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
2347bc79e1Srahnds  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
2447bc79e1Srahnds  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2547bc79e1Srahnds  * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2647bc79e1Srahnds  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
2747bc79e1Srahnds  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
2847bc79e1Srahnds  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
2947bc79e1Srahnds  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
3047bc79e1Srahnds  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
3147bc79e1Srahnds  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3247bc79e1Srahnds  */
3347bc79e1Srahnds 
3452c13d20Sdrahn #ifndef	_POWERPC_BAT_H_
3552c13d20Sdrahn #define	_POWERPC_BAT_H_
3647bc79e1Srahnds 
3747bc79e1Srahnds struct bat {
3847bc79e1Srahnds 	u_int32_t batu;
3947bc79e1Srahnds 	u_int32_t batl;
4047bc79e1Srahnds };
4147bc79e1Srahnds 
42ff429d49Skettenis #define	BATU(vaddr,len)		(((vaddr)&0xf0000000)|(len)|0x2)
4347bc79e1Srahnds #define	BATL(raddr,wimg)	(((raddr)&0xf0000000)|(wimg)|0x2)
4447bc79e1Srahnds 
4547bc79e1Srahnds #define	BAT_W		0x40
4647bc79e1Srahnds #define	BAT_I		0x20
4747bc79e1Srahnds #define	BAT_M		0x10
4847bc79e1Srahnds #define	BAT_G		0x08
4947bc79e1Srahnds 
50ff429d49Skettenis #define BAT_BL_128K     0x00000000
51ff429d49Skettenis #define BAT_BL_256K     0x00000004
52ff429d49Skettenis #define BAT_BL_512K     0x0000000c
53ff429d49Skettenis #define BAT_BL_1M       0x0000001c
54ff429d49Skettenis #define BAT_BL_2M       0x0000003c
55ff429d49Skettenis #define BAT_BL_4M       0x0000007c
56ff429d49Skettenis #define BAT_BL_8M       0x000000fc
57ff429d49Skettenis #define BAT_BL_16M      0x000001fc
58ff429d49Skettenis #define BAT_BL_32M      0x000003fc
59ff429d49Skettenis #define BAT_BL_64M      0x000007fc
60ff429d49Skettenis #define BAT_BL_128M     0x00000ffc
61ff429d49Skettenis #define BAT_BL_256M     0x00001ffc
62*5c8048c1Smpi /* Extended Block Lengths (7455+) */
63*5c8048c1Smpi #define	BAT_BL_512M	0x00003ffc
64*5c8048c1Smpi #define	BAT_BL_1G	0x00007ffc
65*5c8048c1Smpi #define	BAT_BL_2G	0x0000fffc
66*5c8048c1Smpi #define	BAT_BL_4G	0x0001fffc
67ff429d49Skettenis 
6847bc79e1Srahnds #ifdef	_KERNEL
6947bc79e1Srahnds extern struct bat battable[16];
7047bc79e1Srahnds #endif
7147bc79e1Srahnds 
7252c13d20Sdrahn #endif	/* _POWERPC_BAT_H_ */
73