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
6 * Copyright (C) 1996 by Ralf Baechle
7 * Copyright (C) 2000 by Maciej W. Rozycki
9 * Defitions for the address spaces of the MIPS CPUs.
11 #ifndef __ASM_MIPS_ADDRSPACE_H
12 #define __ASM_MIPS_ADDRSPACE_H
15 * Memory segments (32bit kernel mode addresses)
17 #define KUSEG 0x00000000
18 #define KSEG0 0x80000000
19 #define KSEG1 0xa0000000
20 #define KSEG2 0xc0000000
21 #define KSEG3 0xe0000000
26 * Returns the kernel segment base of a given address
29 #define KSEGX(a) (((unsigned long)(a)) & 0xe0000000)
31 #define KSEGX(a) ((a) & 0xe0000000)
35 * Returns the physical address of a KSEG0/KSEG1 address
38 #define PHYSADDR(a) (((unsigned long)(a)) & 0x1fffffff)
40 #define PHYSADDR(a) ((a) & 0x1fffffff)
44 * Returns the uncached address of a sdram address
47 #if defined(CONFIG_AU1X00) || defined(CONFIG_TB0229)
48 /* We use a 36 bit physical address map here and
49 cannot access physical memory directly from core */
50 #define UNCACHED_SDRAM(a) (((unsigned long)(a)) | 0x20000000)
51 #elif defined(CONFIG_AR7100) || defined(CONFIG_AR7240)
52 #define UNCACHED_SDRAM(a) KSEG1ADDR((a))
53 #else /* !CONFIG_AR7100 */
54 #define UNCACHED_SDRAM(a) PHYSADDR(a)
55 #endif /* CONFIG_AU1X00 */
56 #endif /* __ASSEMBLY__ */
58 * Map an address to a certain kernel segment
61 #define KSEG0ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | KSEG0))
62 #define KSEG1ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | KSEG1))
63 #define KSEG2ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | KSEG2))
64 #define KSEG3ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | KSEG3))
66 #define KSEG0ADDR(a) (((a) & 0x1fffffff) | KSEG0)
67 #define KSEG1ADDR(a) (((a) & 0x1fffffff) | KSEG1)
68 #define KSEG2ADDR(a) (((a) & 0x1fffffff) | KSEG2)
69 #define KSEG3ADDR(a) (((a) & 0x1fffffff) | KSEG3)
73 * Memory segments (64bit kernel mode addresses)
75 #define XKUSEG 0x0000000000000000
76 #define XKSSEG 0x4000000000000000
77 #define XKPHYS 0x8000000000000000
78 #define XKSEG 0xc000000000000000
79 #define CKSEG0 0xffffffff80000000
80 #define CKSEG1 0xffffffffa0000000
81 #define CKSSEG 0xffffffffc0000000
82 #define CKSEG3 0xffffffffe0000000
84 #endif /* __ASM_MIPS_ADDRSPACE_H */