xref: /netbsd-src/sys/arch/sh3/include/ubcreg.h (revision db245f3eb5dd1128d81f2fcafd146babff37886e)
1*db245f3eSuwe /*	$NetBSD: ubcreg.h,v 1.5 2008/06/06 03:17:28 uwe Exp $	*/
265363da2Sitojun 
365363da2Sitojun /*-
465363da2Sitojun  * Copyright (C) 1999 SAITOH Masanobu.  All rights reserved.
565363da2Sitojun  *
665363da2Sitojun  * Redistribution and use in source and binary forms, with or without
765363da2Sitojun  * modification, are permitted provided that the following conditions
865363da2Sitojun  * are met:
965363da2Sitojun  * 1. Redistributions of source code must retain the above copyright
1065363da2Sitojun  *    notice, this list of conditions and the following disclaimer.
1165363da2Sitojun  * 2. Redistributions in binary form must reproduce the above copyright
1265363da2Sitojun  *    notice, this list of conditions and the following disclaimer in the
1365363da2Sitojun  *    documentation and/or other materials provided with the distribution.
1465363da2Sitojun  * 3. The name of the author may not be used to endorse or promote products
1565363da2Sitojun  *    derived from this software without specific prior written permission.
1665363da2Sitojun  *
1765363da2Sitojun  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1865363da2Sitojun  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1965363da2Sitojun  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2065363da2Sitojun  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2165363da2Sitojun  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2265363da2Sitojun  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2365363da2Sitojun  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2465363da2Sitojun  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2565363da2Sitojun  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2665363da2Sitojun  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2765363da2Sitojun  */
2865363da2Sitojun 
2965363da2Sitojun #ifndef _SH3_UBCREG_H_
3065363da2Sitojun #define	_SH3_UBCREG_H_
31bbc655c4Such #include <sh3/devreg.h>
3265363da2Sitojun 
3365363da2Sitojun /*
3465363da2Sitojun  * User Break Controller
3565363da2Sitojun  */
3665363da2Sitojun 
37*db245f3eSuwe /* Channel A */
38*db245f3eSuwe #define	SH3_BARA		0xffffffb0 /* 32: address */
39*db245f3eSuwe #define	SH3_BAMRA		0xffffffb4 /* 32: address mask */
40*db245f3eSuwe #define	SH3_BASRA		0xffffffe4 /* 16: ASID */
41*db245f3eSuwe #define	SH3_BBRA		0xffffffb8 /* 16: bus cycle */
42*db245f3eSuwe /* Channel B */
43*db245f3eSuwe #define	SH3_BARB		0xffffffa0 /* 32: address */
44*db245f3eSuwe #define	SH3_BAMRB		0xffffffa4 /* 32: address mask */
45*db245f3eSuwe #define	SH3_BDRB		0xffffff90 /* 32: data */
46*db245f3eSuwe #define	SH3_BDMRB		0xffffff94 /* 32: data mask */
47*db245f3eSuwe #define	SH3_BASRB		0xffffffe8 /* 16: asid */
48*db245f3eSuwe #define	SH3_BBRB		0xffffffa8 /* 16: bus cycle */
49*db245f3eSuwe /* Common */
50*db245f3eSuwe #define	SH3_BRCR		0xffffff98 /* 32: control */
51*db245f3eSuwe 
52*db245f3eSuwe 
53*db245f3eSuwe /* Channel A */
54*db245f3eSuwe #define	SH4_BARA		0xff200000 /* 32: address */
55*db245f3eSuwe #define	SH4_BAMRA		0xff200004 /*  8: address/asid mask */
56*db245f3eSuwe #define	SH4_BASRA		0xff000014 /*  8: ASID */
57*db245f3eSuwe #define	SH4_BBRA		0xff200008 /* 16: bus cycle */
58*db245f3eSuwe 
59*db245f3eSuwe /* Channel B */
60*db245f3eSuwe #define	SH4_BARB		0xff20000c /* 32: address */
61*db245f3eSuwe #define	SH4_BAMRB		0xff200010 /*  8: address/asid mask */
62*db245f3eSuwe #define	SH4_BASRB		0xff000018 /*  8: ASID */
63*db245f3eSuwe #define	SH4_BDRB		0xff200018 /* 32: data */
64*db245f3eSuwe #define	SH4_BDMRB		0xff20001c /* 32: data mask */
65*db245f3eSuwe #define	SH4_BBRB		0xff200014 /* 16: bus cycle */
66bbc655c4Such /* common */
67*db245f3eSuwe #define	SH4_BRCR		0xff200020 /* 16: control */
6865363da2Sitojun 
6965363da2Sitojun 
70*db245f3eSuwe /* SH4_BAMRx bits (sh3 uses plain 32-bit address mask) */
71*db245f3eSuwe #define SH4_UBC_MASK_ASID	0x04 		/* ignore BASRx */
72*db245f3eSuwe #define SH4_UBC_MASK_MASK	0x0b		/* mask BARx: */
73*db245f3eSuwe #define SH4_UBC_MASK_NONE		0x00	/* - compare all bits */
74*db245f3eSuwe #define SH4_UBC_MASK_10			0x01	/* - mask lower 10 bits */
75*db245f3eSuwe #define SH4_UBC_MASK_12			0x02	/* - mask lower 12 bits */
76*db245f3eSuwe #define SH4_UBC_MASK_ALL		0x03	/* - mask all bits */
77*db245f3eSuwe #define SH4_UBC_MASK_16			0x08	/* - mask lower 16 bits */
78*db245f3eSuwe #define SH4_UBC_MASK_20			0x09	/* - mask lower 20 bits */
79bbc655c4Such 
80*db245f3eSuwe /* BBRx bits */
81*db245f3eSuwe #define SH3_UBC_CYCLE_SZ_MASK	0x03 /* exclusive */
82*db245f3eSuwe #define SH4_UBC_CYCLE_SZ_MASK	0x43
83*db245f3eSuwe #define UBC_CYCLE_8			0x01
84*db245f3eSuwe #define UBC_CYCLE_16			0x02
85*db245f3eSuwe #define UBC_CYCLE_32			0x03
86*db245f3eSuwe #define SH4_UBC_CYCLE_64		0x40
87*db245f3eSuwe #define UBC_CYCLE_RW_MASK	0x0c /* can be combined */
88*db245f3eSuwe #define UBC_CYCLE_READ			0x04
89*db245f3eSuwe #define UBC_CYCLE_WRITE			0x08
90*db245f3eSuwe #define UBC_CYCLE_ID_MASK	0x30 /* can be combined */
91*db245f3eSuwe #define UBC_CYCLE_INSN			0x10
92*db245f3eSuwe #define UBC_CYCLE_DATA			0x20
93*db245f3eSuwe #define SH3_UBC_CYCLE_CD_MASK	0xc0 /* exclusive */
94*db245f3eSuwe #define SH3_UBC_CYCLE_CPU		0x40
95*db245f3eSuwe #define SH3_UBC_CYCLE_DMAC		0x80
96*db245f3eSuwe 
97*db245f3eSuwe /* BRCR bits */
98*db245f3eSuwe #define UBC_CTL_SEQ			0x0008 /* A||B vs A&&B */
99*db245f3eSuwe #define UBC_CTL_B_AFTER_INSN		0x0040 /* B: before/after execution */
100*db245f3eSuwe #define UBC_CTL_B_DATA			0x0080 /* B: match BDRB/BDMRB */
101*db245f3eSuwe #define UBC_CTL_A_AFTER_INSN		0x0400 /* A: before/after execution */
102*db245f3eSuwe #define UBC_CTL_B_MATCH			0x4000 /* B matched (sh3: cpu) */
103*db245f3eSuwe #define UBC_CTL_A_MATCH			0x8000 /* A matched (sh3: cpu) */
104*db245f3eSuwe #define SH3_UBC_CTL_B_MASK_ASID	    0x00100000 /* ignore BASRB */
105*db245f3eSuwe #define SH3_UBC_CTL_A_MASK_ASID	    0x00200000 /* ignore BASRA */
106*db245f3eSuwe 
10765363da2Sitojun 
108bbc655c4Such #ifndef _LOCORE
109bbc655c4Such #if defined(SH3) && defined(SH4)
110970e24eeSuwe extern uint32_t __sh_BARA;
111970e24eeSuwe extern uint32_t __sh_BAMRA;
112970e24eeSuwe extern uint32_t __sh_BASRA;
113970e24eeSuwe extern uint32_t __sh_BBRA;
114970e24eeSuwe extern uint32_t __sh_BARB;
115970e24eeSuwe extern uint32_t __sh_BAMRB;
116970e24eeSuwe extern uint32_t __sh_BASRB;
117970e24eeSuwe extern uint32_t __sh_BBRB;
118970e24eeSuwe extern uint32_t __sh_BDRB;
119970e24eeSuwe extern uint32_t __sh_BDMRB;
120970e24eeSuwe extern uint32_t __sh_BRCR;
121bbc655c4Such #endif /* SH3 && SH4 */
122bbc655c4Such #endif /* !_LOCORE */
12365363da2Sitojun 
12465363da2Sitojun #endif	/* !_SH3_UBCREG_H_ */
125