OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [include/] [asm-mips64/] [addrspace.h] - Blame information for rev 1774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
/*
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) 1996, 1999 by Ralf Baechle
7
 * Copyright (C) 1990, 1999 by Silicon Graphics, Inc.
8
 * Copyright (C) 2002  Maciej W. Rozycki
9
 */
10
#ifndef __ASM_MIPS64_ADDRSPACE_H
11
#define __ASM_MIPS64_ADDRSPACE_H
12
 
13
#include <linux/config.h>
14
 
15
/*
16
 *  Configure language
17
 */
18
#ifdef __ASSEMBLY__
19
#define _ATYPE_
20
#define _ATYPE32_
21
#define _ATYPE64_
22
#else
23
#define _ATYPE_         __PTRDIFF_TYPE__
24
#define _ATYPE32_       int
25
#define _ATYPE64_       long long
26
#endif
27
 
28
/*
29
 *  32-bit MIPS address spaces
30
 */
31
#ifdef __ASSEMBLY__
32
#define _ACAST32_
33
#define _ACAST64_
34
#else
35
#define _ACAST32_               (_ATYPE_)(_ATYPE32_)    /* widen if necessary */
36
#define _ACAST64_               (_ATYPE64_)             /* do _not_ narrow */
37
#endif
38
 
39
/*
40
 * Memory segments (32bit kernel mode addresses)
41
 */
42
#define KUSEG                   0x0000000000000000
43
#define KSEG0                   0xffffffff80000000
44
#define KSEG1                   0xffffffffa0000000
45
#define KSEG2                   0xffffffffc0000000
46
#define KSEG3                   0xffffffffe0000000
47
 
48
/*
49
 * Returns the kernel segment base of a given address
50
 */
51
#define KSEGX(a)                ((_ACAST64_ (a)) & 0xffffffffe0000000)
52
 
53
/*
54
 * Returns the physical address of a KSEG0/KSEG1 address
55
 */
56
#define XPHYSADDR(a)            ((_ACAST64_ (a)) & 0x000000ffffffffff)
57
#define CPHYSADDR(a)            ((_ACAST64_ (a)) & 0x000000001fffffff)
58
 
59
#ifndef __ASSEMBLY__
60
#define PHYSADDR(a) ({                                          \
61
        const _ATYPE64_ _a = _ACAST64_ (a);                     \
62
        _a == _ACAST32_ _a ? CPHYSADDR(_a) : XPHYSADDR(_a); })
63
#endif
64
 
65
/*
66
 * Map an address to a certain kernel segment
67
 */
68
#define KSEG0ADDR(a)            (CPHYSADDR(a) | KSEG0)
69
#define KSEG1ADDR(a)            (CPHYSADDR(a) | KSEG1)
70
#define KSEG2ADDR(a)            (CPHYSADDR(a) | KSEG2)
71
#define KSEG3ADDR(a)            (CPHYSADDR(a) | KSEG3)
72
 
73
/*
74
 * Memory segments (64bit kernel mode addresses)
75
 */
76
#define XKUSEG                  0x0000000000000000
77
#define XKSSEG                  0x4000000000000000
78
#define XKPHYS                  0x8000000000000000
79
#define XKSEG                   0xc000000000000000
80
#define CKSEG0                  0xffffffff80000000
81
#define CKSEG1                  0xffffffffa0000000
82
#define CKSSEG                  0xffffffffc0000000
83
#define CKSEG3                  0xffffffffe0000000
84
 
85
#if defined (CONFIG_CPU_R4300)                                          \
86
    || defined (CONFIG_CPU_R4X00)                                       \
87
    || defined (CONFIG_CPU_RM7000)                                      \
88
    || defined (CONFIG_CPU_RM9000)                                      \
89
    || defined (CONFIG_CPU_R5000)                                       \
90
    || defined (CONFIG_CPU_NEVADA)                                      \
91
    || defined (CONFIG_CPU_MIPS64)
92
#define KUSIZE                  0x0000010000000000      /* 2^^40 */
93
#define KUSIZE_64               0x0000010000000000      /* 2^^40 */
94
#define K0SIZE                  0x0000001000000000      /* 2^^36 */
95
#define K1SIZE                  0x0000001000000000      /* 2^^36 */
96
#define K2SIZE                  0x000000ff80000000
97
#define KSEGSIZE                0x000000ff80000000      /* max syssegsz */
98
#define TO_PHYS_MASK            0x0000000fffffffff      /* 2^^36 - 1 */
99
#endif
100
 
101
#if defined (CONFIG_CPU_R8000)
102
/* We keep KUSIZE consistent with R4000 for now (2^^40) instead of (2^^48) */
103
#define KUSIZE                  0x0000010000000000      /* 2^^40 */
104
#define KUSIZE_64               0x0000010000000000      /* 2^^40 */
105
#define K0SIZE                  0x0000010000000000      /* 2^^40 */
106
#define K1SIZE                  0x0000010000000000      /* 2^^40 */
107
#define K2SIZE                  0x0001000000000000
108
#define KSEGSIZE                0x0000010000000000      /* max syssegsz */
109
#define TO_PHYS_MASK            0x000000ffffffffff      /* 2^^40 - 1 */
110
#endif
111
 
112
#if defined (CONFIG_CPU_R10000)
113
#define KUSIZE                  0x0000010000000000      /* 2^^40 */
114
#define KUSIZE_64               0x0000010000000000      /* 2^^40 */
115
#define K0SIZE                  0x0000010000000000      /* 2^^40 */
116
#define K1SIZE                  0x0000010000000000      /* 2^^40 */
117
#define K2SIZE                  0x00000fff80000000
118
#define KSEGSIZE                0x00000fff80000000      /* max syssegsz */
119
#define TO_PHYS_MASK            0x000000ffffffffff      /* 2^^40 - 1 */
120
#endif
121
 
122
/*
123
 * Further names for SGI source compatibility.  These are stolen from
124
 * IRIX's <sys/mips_addrspace.h>.
125
 */
126
#define KUBASE                  0
127
#define KUSIZE_32               0x0000000080000000      /* KUSIZE
128
                                                           for a 32 bit proc */
129
#ifdef CONFIG_CPU_RM7000
130
#define K0BASE                  0x9800000000000000UL
131
#else
132
#define K0BASE                  0xa800000000000000
133
#endif
134
#define K0BASE_EXL_WR           K0BASE                  /* exclusive on write */
135
#define K0BASE_NONCOH           0x9800000000000000      /* noncoherent */
136
#define K0BASE_EXL              0xa000000000000000      /* exclusive */
137
 
138
#ifdef CONFIG_SGI_IP27
139
#define K1BASE                  0x9600000000000000      /* uncached attr 3,
140
                                                           uncac */
141
#else
142
#define K1BASE                  0x9000000000000000
143
#endif
144
#define K2BASE                  0xc000000000000000
145
 
146
#if !defined (CONFIG_CPU_R8000)
147
#define COMPAT_K1BASE32         0xffffffffa0000000
148
#define PHYS_TO_COMPATK1(x)     ((x) | COMPAT_K1BASE32) /* 32-bit compat k1 */
149
#endif
150
 
151
#define KDM_TO_PHYS(x)          (_ACAST64_ (x) & TO_PHYS_MASK)
152
#define PHYS_TO_K0(x)           (_ACAST64_ (x) | K0BASE)
153
 
154
#endif /* __ASM_MIPS64_ADDRSPACE_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.