1 /*
2  * This file is subject to the terms and conditions of the GNU General Public
3  * License.  See the file "COPYING" in the main directory of this archive
4  * for more details.
5  *
6  * Copyright (C) 1999 by Kaz Kojima
7  *
8  * Defitions for the address spaces of the SH CPUs.
9  */
10 #ifndef __ASM_SH_ADDRSPACE_H
11 #define __ASM_SH_ADDRSPACE_H
12 
13 /* Memory segments (32bit Priviledged mode addresses)  */
14 #define P0SEG		0x00000000
15 #define P1SEG		0x80000000
16 #define P2SEG		0xa0000000
17 #define P3SEG		0xc0000000
18 #define P4SEG		0xe0000000
19 
20 #if defined(__sh3__)
21 /* Should fill here */
22 #elif defined(__SH4__)
23 /* Detailed P4SEG  */
24 #define P4SEG_STORE_QUE	(P4SEG)
25 #define P4SEG_IC_ADDR	0xf0000000
26 #define P4SEG_IC_DATA	0xf1000000
27 #define P4SEG_ITLB_ADDR	0xf2000000
28 #define P4SEG_ITLB_DATA	0xf3000000
29 #define P4SEG_OC_ADDR	0xf4000000
30 #define P4SEG_OC_DATA	0xf5000000
31 #define P4SEG_TLB_ADDR	0xf6000000
32 #define P4SEG_TLB_DATA	0xf7000000
33 #define P4SEG_REG_BASE	0xff000000
34 #endif
35 
36 /* Returns the privileged segment base of a given address  */
37 #define PXSEG(a)	(((unsigned long)(a)) & 0xe0000000)
38 
39 /* Returns the physical address of a PnSEG (n=1,2) address   */
40 #define PHYSADDR(a)	(((unsigned long)(a)) & 0x1fffffff)
41 
42 /*
43  * Map an address to a certain privileged segment
44  */
45 #define P1SEGADDR(a)	((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | P1SEG))
46 #define P2SEGADDR(a)	((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | P2SEG))
47 #define P3SEGADDR(a)	((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | P3SEG))
48 #define P4SEGADDR(a)	((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | P4SEG))
49 
50 #endif /* __ASM_SH_ADDRSPACE_H */
51