xref: /OK3568_Linux_fs/u-boot/arch/mips/include/asm/mach-generic/spaces.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * Copyright (C) 1994 - 1999, 2000, 03, 04 Ralf Baechle
3*4882a593Smuzhiyun  * Copyright (C) 2000, 2002  Maciej W. Rozycki
4*4882a593Smuzhiyun  * Copyright (C) 1990, 1999, 2000 Silicon Graphics, Inc.
5*4882a593Smuzhiyun  *
6*4882a593Smuzhiyun  * SPDX-License-Identifier:	GPL-2.0
7*4882a593Smuzhiyun  */
8*4882a593Smuzhiyun #ifndef _ASM_MACH_GENERIC_SPACES_H
9*4882a593Smuzhiyun #define _ASM_MACH_GENERIC_SPACES_H
10*4882a593Smuzhiyun 
11*4882a593Smuzhiyun #include <asm/const.h>
12*4882a593Smuzhiyun 
13*4882a593Smuzhiyun /*
14*4882a593Smuzhiyun  * This gives the physical RAM offset.
15*4882a593Smuzhiyun  */
16*4882a593Smuzhiyun #ifndef PHYS_OFFSET
17*4882a593Smuzhiyun #define PHYS_OFFSET		_AC(0, UL)
18*4882a593Smuzhiyun #endif
19*4882a593Smuzhiyun 
20*4882a593Smuzhiyun #ifdef CONFIG_32BIT
21*4882a593Smuzhiyun #ifdef CONFIG_KVM_GUEST
22*4882a593Smuzhiyun #define CAC_BASE		_AC(0x40000000, UL)
23*4882a593Smuzhiyun #else
24*4882a593Smuzhiyun #define CAC_BASE		_AC(0x80000000, UL)
25*4882a593Smuzhiyun #endif
26*4882a593Smuzhiyun #ifndef IO_BASE
27*4882a593Smuzhiyun #define IO_BASE			_AC(0xa0000000, UL)
28*4882a593Smuzhiyun #endif
29*4882a593Smuzhiyun #ifndef UNCAC_BASE
30*4882a593Smuzhiyun #define UNCAC_BASE		_AC(0xa0000000, UL)
31*4882a593Smuzhiyun #endif
32*4882a593Smuzhiyun 
33*4882a593Smuzhiyun #ifndef MAP_BASE
34*4882a593Smuzhiyun #ifdef CONFIG_KVM_GUEST
35*4882a593Smuzhiyun #define MAP_BASE		_AC(0x60000000, UL)
36*4882a593Smuzhiyun #else
37*4882a593Smuzhiyun #define MAP_BASE		_AC(0xc0000000, UL)
38*4882a593Smuzhiyun #endif
39*4882a593Smuzhiyun #endif
40*4882a593Smuzhiyun 
41*4882a593Smuzhiyun /*
42*4882a593Smuzhiyun  * Memory above this physical address will be considered highmem.
43*4882a593Smuzhiyun  */
44*4882a593Smuzhiyun #ifndef HIGHMEM_START
45*4882a593Smuzhiyun #define HIGHMEM_START		_AC(0x20000000, UL)
46*4882a593Smuzhiyun #endif
47*4882a593Smuzhiyun 
48*4882a593Smuzhiyun #endif /* CONFIG_32BIT */
49*4882a593Smuzhiyun 
50*4882a593Smuzhiyun #ifdef CONFIG_64BIT
51*4882a593Smuzhiyun 
52*4882a593Smuzhiyun #ifndef CAC_BASE
53*4882a593Smuzhiyun #ifdef CONFIG_DMA_NONCOHERENT
54*4882a593Smuzhiyun #define CAC_BASE		_AC(0x9800000000000000, UL)
55*4882a593Smuzhiyun #else
56*4882a593Smuzhiyun #define CAC_BASE		_AC(0xa800000000000000, UL)
57*4882a593Smuzhiyun #endif
58*4882a593Smuzhiyun #endif
59*4882a593Smuzhiyun 
60*4882a593Smuzhiyun #ifndef IO_BASE
61*4882a593Smuzhiyun #define IO_BASE			_AC(0x9000000000000000, UL)
62*4882a593Smuzhiyun #endif
63*4882a593Smuzhiyun 
64*4882a593Smuzhiyun #ifndef UNCAC_BASE
65*4882a593Smuzhiyun #define UNCAC_BASE		_AC(0x9000000000000000, UL)
66*4882a593Smuzhiyun #endif
67*4882a593Smuzhiyun 
68*4882a593Smuzhiyun #ifndef MAP_BASE
69*4882a593Smuzhiyun #define MAP_BASE		_AC(0xc000000000000000, UL)
70*4882a593Smuzhiyun #endif
71*4882a593Smuzhiyun 
72*4882a593Smuzhiyun /*
73*4882a593Smuzhiyun  * Memory above this physical address will be considered highmem.
74*4882a593Smuzhiyun  * Fixme: 59 bits is a fictive number and makes assumptions about processors
75*4882a593Smuzhiyun  * in the distant future.  Nobody will care for a few years :-)
76*4882a593Smuzhiyun  */
77*4882a593Smuzhiyun #ifndef HIGHMEM_START
78*4882a593Smuzhiyun #define HIGHMEM_START		(_AC(1, UL) << _AC(59, UL))
79*4882a593Smuzhiyun #endif
80*4882a593Smuzhiyun 
81*4882a593Smuzhiyun #define TO_PHYS(x)		(	      ((x) & TO_PHYS_MASK))
82*4882a593Smuzhiyun #define TO_CAC(x)		(CAC_BASE   | ((x) & TO_PHYS_MASK))
83*4882a593Smuzhiyun #define TO_UNCAC(x)		(UNCAC_BASE | ((x) & TO_PHYS_MASK))
84*4882a593Smuzhiyun 
85*4882a593Smuzhiyun #endif /* CONFIG_64BIT */
86*4882a593Smuzhiyun 
87*4882a593Smuzhiyun /*
88*4882a593Smuzhiyun  * This handles the memory map.
89*4882a593Smuzhiyun  */
90*4882a593Smuzhiyun #ifndef PAGE_OFFSET
91*4882a593Smuzhiyun #define PAGE_OFFSET		(CAC_BASE + PHYS_OFFSET)
92*4882a593Smuzhiyun #endif
93*4882a593Smuzhiyun 
94*4882a593Smuzhiyun #ifndef FIXADDR_TOP
95*4882a593Smuzhiyun #ifdef CONFIG_KVM_GUEST
96*4882a593Smuzhiyun #define FIXADDR_TOP		((unsigned long)(long)(int)0x7ffe0000)
97*4882a593Smuzhiyun #else
98*4882a593Smuzhiyun #define FIXADDR_TOP		((unsigned long)(long)(int)0xfffe0000)
99*4882a593Smuzhiyun #endif
100*4882a593Smuzhiyun #endif
101*4882a593Smuzhiyun 
102*4882a593Smuzhiyun #endif /* __ASM_MACH_GENERIC_SPACES_H */
103