blob: ee5ebe98f6cfb6b7104beff6510983266c1b685d [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 */
Paul Burton6c359eb2018-07-27 18:23:20 -070020#ifndef __ASSEMBLY__
21# if defined(CONFIG_MIPS_AUTO_PFN_OFFSET)
22# define PHYS_OFFSET ((unsigned long)PFN_PHYS(ARCH_PFN_OFFSET))
23# elif !defined(PHYS_OFFSET)
24# define PHYS_OFFSET _AC(0, UL)
25# endif
26#endif /* __ASSEMBLY__ */
Franck Bui-Huu41b04832007-06-04 17:46:34 +020027
Ralf Baechle875d43e2005-09-03 15:56:16 -070028#ifdef CONFIG_32BIT
Sanjay Lal9843b032012-11-21 18:34:03 -080029#ifdef CONFIG_KVM_GUEST
30#define CAC_BASE _AC(0x40000000, UL)
31#else
Franck Bui-Huuc4612c82007-06-04 17:46:32 +020032#define CAC_BASE _AC(0x80000000, UL)
Sanjay Lal9843b032012-11-21 18:34:03 -080033#endif
Steven J. Hill7ad18dd2013-07-03 17:28:22 +000034#ifndef IO_BASE
Franck Bui-Huuc4612c82007-06-04 17:46:32 +020035#define IO_BASE _AC(0xa0000000, UL)
Steven J. Hill7ad18dd2013-07-03 17:28:22 +000036#endif
37#ifndef UNCAC_BASE
Franck Bui-Huuc4612c82007-06-04 17:46:32 +020038#define UNCAC_BASE _AC(0xa0000000, UL)
Steven J. Hill7ad18dd2013-07-03 17:28:22 +000039#endif
Franck Bui-Huu09bb9ce2007-06-04 17:46:31 +020040
41#ifndef MAP_BASE
Sanjay Lal9843b032012-11-21 18:34:03 -080042#ifdef CONFIG_KVM_GUEST
43#define MAP_BASE _AC(0x60000000, UL)
44#else
Franck Bui-Huuc4612c82007-06-04 17:46:32 +020045#define MAP_BASE _AC(0xc0000000, UL)
Franck Bui-Huu09bb9ce2007-06-04 17:46:31 +020046#endif
Sanjay Lal9843b032012-11-21 18:34:03 -080047#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070048
49/*
50 * Memory above this physical address will be considered highmem.
51 */
52#ifndef HIGHMEM_START
Franck Bui-Huuc4612c82007-06-04 17:46:32 +020053#define HIGHMEM_START _AC(0x20000000, UL)
Linus Torvalds1da177e2005-04-16 15:20:36 -070054#endif
55
Ralf Baechle875d43e2005-09-03 15:56:16 -070056#endif /* CONFIG_32BIT */
Linus Torvalds1da177e2005-04-16 15:20:36 -070057
Ralf Baechle875d43e2005-09-03 15:56:16 -070058#ifdef CONFIG_64BIT
Linus Torvalds1da177e2005-04-16 15:20:36 -070059
Franck Bui-Huuc4612c82007-06-04 17:46:32 +020060#ifndef CAC_BASE
Paul Burton3ffc17d2016-10-05 18:18:18 +010061#define CAC_BASE PHYS_TO_XKPHYS(read_c0_config() & CONF_CM_CMASK, 0)
Franck Bui-Huu09bb9ce2007-06-04 17:46:31 +020062#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070063
Franck Bui-Huuc4612c82007-06-04 17:46:32 +020064#ifndef IO_BASE
65#define IO_BASE _AC(0x9000000000000000, UL)
66#endif
67
68#ifndef UNCAC_BASE
69#define UNCAC_BASE _AC(0x9000000000000000, UL)
70#endif
71
72#ifndef MAP_BASE
73#define MAP_BASE _AC(0xc000000000000000, UL)
74#endif
75
Linus Torvalds1da177e2005-04-16 15:20:36 -070076/*
77 * Memory above this physical address will be considered highmem.
78 * Fixme: 59 bits is a fictive number and makes assumptions about processors
79 * in the distant future. Nobody will care for a few years :-)
80 */
81#ifndef HIGHMEM_START
Franck Bui-Huuc4612c82007-06-04 17:46:32 +020082#define HIGHMEM_START (_AC(1, UL) << _AC(59, UL))
Franck Bui-Huu09bb9ce2007-06-04 17:46:31 +020083#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070084
Ralf Baechle70342282013-01-22 12:59:30 +010085#define TO_PHYS(x) ( ((x) & TO_PHYS_MASK))
Linus Torvalds1da177e2005-04-16 15:20:36 -070086#define TO_CAC(x) (CAC_BASE | ((x) & TO_PHYS_MASK))
87#define TO_UNCAC(x) (UNCAC_BASE | ((x) & TO_PHYS_MASK))
88
Ralf Baechle875d43e2005-09-03 15:56:16 -070089#endif /* CONFIG_64BIT */
Linus Torvalds1da177e2005-04-16 15:20:36 -070090
Franck Bui-Huuc4612c82007-06-04 17:46:32 +020091/*
92 * This handles the memory map.
93 */
94#ifndef PAGE_OFFSET
Franck Bui-Huudb385012007-06-04 17:46:33 +020095#define PAGE_OFFSET (CAC_BASE + PHYS_OFFSET)
Franck Bui-Huuc4612c82007-06-04 17:46:32 +020096#endif
97
Kevin Cernekee565b60d2010-09-07 12:59:15 -070098#ifndef FIXADDR_TOP
James Hogan8e748c82015-04-27 15:07:16 +010099#ifdef CONFIG_KVM_GUEST
100#define FIXADDR_TOP ((unsigned long)(long)(int)0x7ffe0000)
101#else
Kevin Cernekee565b60d2010-09-07 12:59:15 -0700102#define FIXADDR_TOP ((unsigned long)(long)(int)0xfffe0000)
103#endif
James Hogan8e748c82015-04-27 15:07:16 +0100104#endif
Kevin Cernekee565b60d2010-09-07 12:59:15 -0700105
Linus Torvalds1da177e2005-04-16 15:20:36 -0700106#endif /* __ASM_MACH_GENERIC_SPACES_H */