blob: b8214b1c8595cdf82d862d1e5fd8cb60ca1037c3 [file] [log] [blame]
wdenk6069ff22003-02-28 00:49:47 +00001/*
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 by Ralf Baechle
7 * Copyright (C) 2000 by Maciej W. Rozycki
8 *
9 * Defitions for the address spaces of the MIPS CPUs.
10 */
11#ifndef __ASM_MIPS_ADDRSPACE_H
12#define __ASM_MIPS_ADDRSPACE_H
13
14/*
15 * Memory segments (32bit kernel mode addresses)
16 */
wdenkd4ca31c2004-01-02 14:00:00 +000017#define KUSEG 0x00000000
18#define KSEG0 0x80000000
19#define KSEG1 0xa0000000
20#define KSEG2 0xc0000000
21#define KSEG3 0xe0000000
wdenk6069ff22003-02-28 00:49:47 +000022
wdenkd4ca31c2004-01-02 14:00:00 +000023#define K0BASE KSEG0
wdenk6069ff22003-02-28 00:49:47 +000024
25/*
26 * Returns the kernel segment base of a given address
27 */
28#ifndef __ASSEMBLY__
wdenkd4ca31c2004-01-02 14:00:00 +000029#define KSEGX(a) (((unsigned long)(a)) & 0xe0000000)
wdenk6069ff22003-02-28 00:49:47 +000030#else
wdenkd4ca31c2004-01-02 14:00:00 +000031#define KSEGX(a) ((a) & 0xe0000000)
wdenk6069ff22003-02-28 00:49:47 +000032#endif
33
34/*
35 * Returns the physical address of a KSEG0/KSEG1 address
36 */
37#ifndef __ASSEMBLY__
38#define PHYSADDR(a) (((unsigned long)(a)) & 0x1fffffff)
39#else
40#define PHYSADDR(a) ((a) & 0x1fffffff)
41#endif
42
wdenkd4ca31c2004-01-02 14:00:00 +000043/*
44 * Returns the uncached address of a sdram address
wdenka2663ea2003-12-07 18:32:37 +000045 */
46#ifndef __ASSEMBLY__
wdenkf4863a72004-02-07 01:27:10 +000047#if defined(CONFIG_AU1X00) || defined(CONFIG_TB0229)
wdenka2663ea2003-12-07 18:32:37 +000048/* 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#else /* !CONFIG_AU1X00 */
wdenkd4ca31c2004-01-02 14:00:00 +000052#define UNCACHED_SDRAM(a) PHYSADDR(a)
wdenka2663ea2003-12-07 18:32:37 +000053#endif /* CONFIG_AU1X00 */
54#endif /* __ASSEMBLY__ */
wdenk6069ff22003-02-28 00:49:47 +000055/*
56 * Map an address to a certain kernel segment
57 */
58#ifndef __ASSEMBLY__
59#define KSEG0ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | KSEG0))
60#define KSEG1ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | KSEG1))
61#define KSEG2ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | KSEG2))
62#define KSEG3ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | KSEG3))
63#else
64#define KSEG0ADDR(a) (((a) & 0x1fffffff) | KSEG0)
65#define KSEG1ADDR(a) (((a) & 0x1fffffff) | KSEG1)
66#define KSEG2ADDR(a) (((a) & 0x1fffffff) | KSEG2)
67#define KSEG3ADDR(a) (((a) & 0x1fffffff) | KSEG3)
68#endif
69
70/*
71 * Memory segments (64bit kernel mode addresses)
72 */
wdenkd4ca31c2004-01-02 14:00:00 +000073#define XKUSEG 0x0000000000000000
74#define XKSSEG 0x4000000000000000
75#define XKPHYS 0x8000000000000000
76#define XKSEG 0xc000000000000000
77#define CKSEG0 0xffffffff80000000
78#define CKSEG1 0xffffffffa0000000
79#define CKSSEG 0xffffffffc0000000
80#define CKSEG3 0xffffffffe0000000
wdenk6069ff22003-02-28 00:49:47 +000081
82#endif /* __ASM_MIPS_ADDRSPACE_H */