1384740dcSRalf Baechle /*
2384740dcSRalf Baechle  * This file is subject to the terms and conditions of the GNU General Public
3384740dcSRalf Baechle  * License.  See the file "COPYING" in the main directory of this archive
4384740dcSRalf Baechle  * for more details.
5384740dcSRalf Baechle  *
6384740dcSRalf Baechle  * Copyright (C) 1994 - 1999, 2000, 03, 04 Ralf Baechle
7384740dcSRalf Baechle  * Copyright (C) 2000, 2002  Maciej W. Rozycki
8384740dcSRalf Baechle  * Copyright (C) 1990, 1999, 2000 Silicon Graphics, Inc.
9384740dcSRalf Baechle  */
10384740dcSRalf Baechle #ifndef _ASM_MACH_GENERIC_SPACES_H
11384740dcSRalf Baechle #define _ASM_MACH_GENERIC_SPACES_H
12384740dcSRalf Baechle 
13384740dcSRalf Baechle #include <linux/const.h>
14384740dcSRalf Baechle 
153ffc17d8SPaul Burton #include <asm/mipsregs.h>
163ffc17d8SPaul Burton 
1721a379a8SJiaxun Yang #ifndef IO_SPACE_LIMIT
1821a379a8SJiaxun Yang #define IO_SPACE_LIMIT 0xffff
1921a379a8SJiaxun Yang #endif
2021a379a8SJiaxun Yang 
21384740dcSRalf Baechle /*
22384740dcSRalf Baechle  * This gives the physical RAM offset.
23384740dcSRalf Baechle  */
246c359eb1SPaul Burton #ifndef __ASSEMBLY__
256c359eb1SPaul Burton # if defined(CONFIG_MIPS_AUTO_PFN_OFFSET)
266c359eb1SPaul Burton #  define PHYS_OFFSET		((unsigned long)PFN_PHYS(ARCH_PFN_OFFSET))
276c359eb1SPaul Burton # elif !defined(PHYS_OFFSET)
28384740dcSRalf Baechle #  define PHYS_OFFSET		_AC(0, UL)
29384740dcSRalf Baechle # endif
306c359eb1SPaul Burton #endif /* __ASSEMBLY__ */
31384740dcSRalf Baechle 
32384740dcSRalf Baechle #ifdef CONFIG_32BIT
339843b030SSanjay Lal #ifdef CONFIG_KVM_GUEST
349843b030SSanjay Lal #define CAC_BASE		_AC(0x40000000, UL)
359843b030SSanjay Lal #else
36384740dcSRalf Baechle #define CAC_BASE		_AC(0x80000000, UL)
379843b030SSanjay Lal #endif
387ad18dd0SSteven J. Hill #ifndef IO_BASE
39384740dcSRalf Baechle #define IO_BASE			_AC(0xa0000000, UL)
407ad18dd0SSteven J. Hill #endif
417ad18dd0SSteven J. Hill #ifndef UNCAC_BASE
42384740dcSRalf Baechle #define UNCAC_BASE		_AC(0xa0000000, UL)
437ad18dd0SSteven J. Hill #endif
44384740dcSRalf Baechle 
45384740dcSRalf Baechle #ifndef MAP_BASE
469843b030SSanjay Lal #ifdef CONFIG_KVM_GUEST
479843b030SSanjay Lal #define MAP_BASE		_AC(0x60000000, UL)
489843b030SSanjay Lal #else
49384740dcSRalf Baechle #define MAP_BASE		_AC(0xc0000000, UL)
50384740dcSRalf Baechle #endif
519843b030SSanjay Lal #endif
52384740dcSRalf Baechle 
53384740dcSRalf Baechle /*
54384740dcSRalf Baechle  * Memory above this physical address will be considered highmem.
55384740dcSRalf Baechle  */
56384740dcSRalf Baechle #ifndef HIGHMEM_START
57384740dcSRalf Baechle #define HIGHMEM_START		_AC(0x20000000, UL)
58384740dcSRalf Baechle #endif
59384740dcSRalf Baechle 
60384740dcSRalf Baechle #endif /* CONFIG_32BIT */
61384740dcSRalf Baechle 
62384740dcSRalf Baechle #ifdef CONFIG_64BIT
63384740dcSRalf Baechle 
64384740dcSRalf Baechle #ifndef CAC_BASE
653ffc17d8SPaul Burton #define CAC_BASE	PHYS_TO_XKPHYS(read_c0_config() & CONF_CM_CMASK, 0)
66384740dcSRalf Baechle #endif
67384740dcSRalf Baechle 
68384740dcSRalf Baechle #ifndef IO_BASE
69384740dcSRalf Baechle #define IO_BASE			_AC(0x9000000000000000, UL)
70384740dcSRalf Baechle #endif
71384740dcSRalf Baechle 
72384740dcSRalf Baechle #ifndef UNCAC_BASE
73384740dcSRalf Baechle #define UNCAC_BASE		_AC(0x9000000000000000, UL)
74384740dcSRalf Baechle #endif
75384740dcSRalf Baechle 
76384740dcSRalf Baechle #ifndef MAP_BASE
77384740dcSRalf Baechle #define MAP_BASE		_AC(0xc000000000000000, UL)
78384740dcSRalf Baechle #endif
79384740dcSRalf Baechle 
80384740dcSRalf Baechle /*
81384740dcSRalf Baechle  * Memory above this physical address will be considered highmem.
82384740dcSRalf Baechle  * Fixme: 59 bits is a fictive number and makes assumptions about processors
83384740dcSRalf Baechle  * in the distant future.  Nobody will care for a few years :-)
84384740dcSRalf Baechle  */
85384740dcSRalf Baechle #ifndef HIGHMEM_START
86384740dcSRalf Baechle #define HIGHMEM_START		(_AC(1, UL) << _AC(59, UL))
87384740dcSRalf Baechle #endif
88384740dcSRalf Baechle 
89384740dcSRalf Baechle #define TO_PHYS(x)		(	      ((x) & TO_PHYS_MASK))
90384740dcSRalf Baechle #define TO_CAC(x)		(CAC_BASE   | ((x) & TO_PHYS_MASK))
91384740dcSRalf Baechle #define TO_UNCAC(x)		(UNCAC_BASE | ((x) & TO_PHYS_MASK))
92384740dcSRalf Baechle 
93384740dcSRalf Baechle #endif /* CONFIG_64BIT */
94384740dcSRalf Baechle 
95384740dcSRalf Baechle /*
96384740dcSRalf Baechle  * This handles the memory map.
97384740dcSRalf Baechle  */
98384740dcSRalf Baechle #ifndef PAGE_OFFSET
99384740dcSRalf Baechle #define PAGE_OFFSET		(CAC_BASE + PHYS_OFFSET)
100384740dcSRalf Baechle #endif
101384740dcSRalf Baechle 
102565b60deSKevin Cernekee #ifndef FIXADDR_TOP
1038e748c8dSJames Hogan #ifdef CONFIG_KVM_GUEST
1048e748c8dSJames Hogan #define FIXADDR_TOP		((unsigned long)(long)(int)0x7ffe0000)
1058e748c8dSJames Hogan #else
106565b60deSKevin Cernekee #define FIXADDR_TOP		((unsigned long)(long)(int)0xfffe0000)
107565b60deSKevin Cernekee #endif
1088e748c8dSJames Hogan #endif
109565b60deSKevin Cernekee 
110384740dcSRalf Baechle #endif /* __ASM_MACH_GENERIC_SPACES_H */
111