blob: 952b0fdfda0e637849315f534043137f10972414 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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) 1994 - 1999, 2000, 03, 04 Ralf Baechle
7 * Copyright (C) 2000, 2002 Maciej W. Rozycki
8 * Copyright (C) 1990, 1999, 2000 Silicon Graphics, Inc.
9 */
10#ifndef _ASM_MACH_GENERIC_SPACES_H
11#define _ASM_MACH_GENERIC_SPACES_H
12
Franck Bui-Huuc4612c82007-06-04 17:46:32 +020013#include <linux/const.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070014
Paul Burton3ffc17d2016-10-05 18:18:18 +010015#include <asm/mipsregs.h>
16
Franck Bui-Huu41b04832007-06-04 17:46:34 +020017/*
18 * This gives the physical RAM offset.
19 */
20#ifndef PHYS_OFFSET
21#define PHYS_OFFSET _AC(0, UL)
22#endif
23
Ralf Baechle875d43e2005-09-03 15:56:16 -070024#ifdef CONFIG_32BIT
Sanjay Lal9843b032012-11-21 18:34:03 -080025#ifdef CONFIG_KVM_GUEST
26#define CAC_BASE _AC(0x40000000, UL)
27#else
Franck Bui-Huuc4612c82007-06-04 17:46:32 +020028#define CAC_BASE _AC(0x80000000, UL)
Sanjay Lal9843b032012-11-21 18:34:03 -080029#endif
Steven J. Hill7ad18dd2013-07-03 17:28:22 +000030#ifndef IO_BASE
Franck Bui-Huuc4612c82007-06-04 17:46:32 +020031#define IO_BASE _AC(0xa0000000, UL)
Steven J. Hill7ad18dd2013-07-03 17:28:22 +000032#endif
33#ifndef UNCAC_BASE
Franck Bui-Huuc4612c82007-06-04 17:46:32 +020034#define UNCAC_BASE _AC(0xa0000000, UL)
Steven J. Hill7ad18dd2013-07-03 17:28:22 +000035#endif
Franck Bui-Huu09bb9ce2007-06-04 17:46:31 +020036
37#ifndef MAP_BASE
Sanjay Lal9843b032012-11-21 18:34:03 -080038#ifdef CONFIG_KVM_GUEST
39#define MAP_BASE _AC(0x60000000, UL)
40#else
Franck Bui-Huuc4612c82007-06-04 17:46:32 +020041#define MAP_BASE _AC(0xc0000000, UL)
Franck Bui-Huu09bb9ce2007-06-04 17:46:31 +020042#endif
Sanjay Lal9843b032012-11-21 18:34:03 -080043#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070044
45/*
46 * Memory above this physical address will be considered highmem.
47 */
48#ifndef HIGHMEM_START
Franck Bui-Huuc4612c82007-06-04 17:46:32 +020049#define HIGHMEM_START _AC(0x20000000, UL)
Linus Torvalds1da177e2005-04-16 15:20:36 -070050#endif
51
Ralf Baechle875d43e2005-09-03 15:56:16 -070052#endif /* CONFIG_32BIT */
Linus Torvalds1da177e2005-04-16 15:20:36 -070053
Ralf Baechle875d43e2005-09-03 15:56:16 -070054#ifdef CONFIG_64BIT
Linus Torvalds1da177e2005-04-16 15:20:36 -070055
Franck Bui-Huuc4612c82007-06-04 17:46:32 +020056#ifndef CAC_BASE
Paul Burton3ffc17d2016-10-05 18:18:18 +010057#define CAC_BASE PHYS_TO_XKPHYS(read_c0_config() & CONF_CM_CMASK, 0)
Franck Bui-Huu09bb9ce2007-06-04 17:46:31 +020058#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070059
Franck Bui-Huuc4612c82007-06-04 17:46:32 +020060#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
Linus Torvalds1da177e2005-04-16 15:20:36 -070072/*
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
Franck Bui-Huuc4612c82007-06-04 17:46:32 +020078#define HIGHMEM_START (_AC(1, UL) << _AC(59, UL))
Franck Bui-Huu09bb9ce2007-06-04 17:46:31 +020079#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070080
Ralf Baechle70342282013-01-22 12:59:30 +010081#define TO_PHYS(x) ( ((x) & TO_PHYS_MASK))
Linus Torvalds1da177e2005-04-16 15:20:36 -070082#define TO_CAC(x) (CAC_BASE | ((x) & TO_PHYS_MASK))
83#define TO_UNCAC(x) (UNCAC_BASE | ((x) & TO_PHYS_MASK))
84
Ralf Baechle875d43e2005-09-03 15:56:16 -070085#endif /* CONFIG_64BIT */
Linus Torvalds1da177e2005-04-16 15:20:36 -070086
Franck Bui-Huuc4612c82007-06-04 17:46:32 +020087/*
88 * This handles the memory map.
89 */
90#ifndef PAGE_OFFSET
Franck Bui-Huudb385012007-06-04 17:46:33 +020091#define PAGE_OFFSET (CAC_BASE + PHYS_OFFSET)
Franck Bui-Huuc4612c82007-06-04 17:46:32 +020092#endif
93
Kevin Cernekee565b60d2010-09-07 12:59:15 -070094#ifndef FIXADDR_TOP
James Hogan8e748c82015-04-27 15:07:16 +010095#ifdef CONFIG_KVM_GUEST
96#define FIXADDR_TOP ((unsigned long)(long)(int)0x7ffe0000)
97#else
Kevin Cernekee565b60d2010-09-07 12:59:15 -070098#define FIXADDR_TOP ((unsigned long)(long)(int)0xfffe0000)
99#endif
James Hogan8e748c82015-04-27 15:07:16 +0100100#endif
Kevin Cernekee565b60d2010-09-07 12:59:15 -0700101
Linus Torvalds1da177e2005-04-16 15:20:36 -0700102#endif /* __ASM_MACH_GENERIC_SPACES_H */