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