1 /* $Id: addrspace.h,v 1.5 2000/02/01 00:32:01 kanoj Exp $
2 *
3 * This file is subject to the terms and conditions of the GNU General Public
4 * License. See the file "COPYING" in the main directory of this archive
5 * for more details.
6 *
7 * Copyright (C) 1996, 1999 by Ralf Baechle
8 * Copyright (C) 1990, 1999 by Silicon Graphics, Inc.
9 */
10 #ifndef _ASM_ADDRSPACE_H
11 #define _ASM_ADDRSPACE_H
12
13 #include <linux/config.h>
14
15 /*
16 * Memory segments (32bit kernel mode addresses)
17 */
18 #define KUSEG 0x0000000000000000
19 #define KSEG0 0xffffffff80000000
20 #define KSEG1 0xffffffffa0000000
21 #define KSEG2 0xffffffffc0000000
22 #define KSEG3 0xffffffffe0000000
23
24 /*
25 * Returns the kernel segment base of a given address
26 */
27 #define KSEGX(a) (((unsigned long)(a)) & 0xe0000000)
28
29 /*
30 * Returns the physical address of a KSEG0/KSEG1 address
31 */
32 #define CPHYSADDR(a) (((unsigned long)(a)) & 0x000000001fffffffUL)
33 #define PHYSADDR(a) (((unsigned long)(a)) & 0x000000ffffffffffUL)
34
35 /*
36 * Map an address to a certain kernel segment
37 */
38 #define KSEG0ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x000000ffffffffffUL) | KSEG0))
39 #define KSEG1ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x000000ffffffffffUL) | KSEG1))
40 #define KSEG2ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x000000ffffffffffUL) | KSEG2))
41 #define KSEG3ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x000000ffffffffffUL) | KSEG3))
42
43 /*
44 * Memory segments (64bit kernel mode addresses)
45 */
46 #define XKUSEG 0x0000000000000000
47 #define XKSSEG 0x4000000000000000
48 #define XKPHYS 0x8000000000000000
49 #define XKSEG 0xc000000000000000
50 #define CKSEG0 0xffffffff80000000
51 #define CKSEG1 0xffffffffa0000000
52 #define CKSSEG 0xffffffffc0000000
53 #define CKSEG3 0xffffffffe0000000
54
55 #if defined (CONFIG_CPU_R4300) \
56 || defined (CONFIG_CPU_R4X00) \
57 || defined (CONFIG_CPU_R5000) \
58 || defined (CONFIG_CPU_NEVADA)
59 #define KUSIZE 0x0000010000000000 /* 2^^40 */
60 #define KUSIZE_64 0x0000010000000000 /* 2^^40 */
61 #define K0SIZE 0x0000001000000000 /* 2^^36 */
62 #define K1SIZE 0x0000001000000000 /* 2^^36 */
63 #define K2SIZE 0x000000ff80000000
64 #define KSEGSIZE 0x000000ff80000000 /* max syssegsz */
65 #define TO_PHYS_MASK 0x0000000fffffffff /* 2^^36 - 1 */
66 #endif
67
68 #if defined (CONFIG_CPU_R8000)
69 /* We keep KUSIZE consistent with R4000 for now (2^^40) instead of (2^^48) */
70 #define KUSIZE 0x0000010000000000 /* 2^^40 */
71 #define KUSIZE_64 0x0000010000000000 /* 2^^40 */
72 #define K0SIZE 0x0000010000000000 /* 2^^40 */
73 #define K1SIZE 0x0000010000000000 /* 2^^40 */
74 #define K2SIZE 0x0001000000000000
75 #define KSEGSIZE 0x0000010000000000 /* max syssegsz */
76 #define TO_PHYS_MASK 0x000000ffffffffff /* 2^^40 - 1 */
77 #endif
78
79 #if defined (CONFIG_CPU_R10000)
80 #define KUSIZE 0x0000010000000000 /* 2^^40 */
81 #define KUSIZE_64 0x0000010000000000 /* 2^^40 */
82 #define K0SIZE 0x0000010000000000 /* 2^^40 */
83 #define K1SIZE 0x0000010000000000 /* 2^^40 */
84 #define K2SIZE 0x00000fff80000000
85 #define KSEGSIZE 0x00000fff80000000 /* max syssegsz */
86 #define TO_PHYS_MASK 0x000000ffffffffff /* 2^^40 - 1 */
87 #endif
88
89 /*
90 * Further names for SGI source compatibility. These are stolen from
91 * IRIX's <sys/mips_addrspace.h>.
92 */
93 #define KUBASE 0
94 #define KUSIZE_32 0x0000000080000000 /* KUSIZE for a 32 bit proc */
95 #define K0BASE 0xa800000000000000
96 #define K0BASE_EXL_WR K0BASE /* exclusive on write */
97 #define K0BASE_NONCOH 0x9800000000000000 /* noncoherent */
98 #define K0BASE_EXL 0xa000000000000000 /* exclusive */
99
100 #ifdef CONFIG_SGI_IP27
101 #define K1BASE 0x9600000000000000 /* Uncached attr 3, uncac */
102 #else
103 #define K1BASE 0x9000000000000000
104 #endif
105 #define K2BASE 0xc000000000000000
106
107 #if !defined (CONFIG_CPU_R8000)
108 #define COMPAT_K1BASE32 0xffffffffa0000000
109 #define PHYS_TO_COMPATK1(x) ((x) | COMPAT_K1BASE32) /* 32-bit compat k1 */
110 #endif
111
112 #define KDM_TO_PHYS(x) ((unsigned long)(x) & TO_PHYS_MASK)
113 #define PHYS_TO_K0(x) ((unsigned long)(x) | K0BASE)
114
115 #endif /* _ASM_ADDRSPACE_H */
116
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.