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