Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 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-Huu | c4612c8 | 2007-06-04 17:46:32 +0200 | [diff] [blame] | 13 | #include <linux/const.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | |
Paul Burton | 3ffc17d | 2016-10-05 18:18:18 +0100 | [diff] [blame] | 15 | #include <asm/mipsregs.h> |
| 16 | |
Franck Bui-Huu | 41b0483 | 2007-06-04 17:46:34 +0200 | [diff] [blame] | 17 | /* |
| 18 | * This gives the physical RAM offset. |
| 19 | */ |
| 20 | #ifndef PHYS_OFFSET |
| 21 | #define PHYS_OFFSET _AC(0, UL) |
| 22 | #endif |
| 23 | |
Ralf Baechle | 875d43e | 2005-09-03 15:56:16 -0700 | [diff] [blame] | 24 | #ifdef CONFIG_32BIT |
Sanjay Lal | 9843b03 | 2012-11-21 18:34:03 -0800 | [diff] [blame] | 25 | #ifdef CONFIG_KVM_GUEST |
| 26 | #define CAC_BASE _AC(0x40000000, UL) |
| 27 | #else |
Franck Bui-Huu | c4612c8 | 2007-06-04 17:46:32 +0200 | [diff] [blame] | 28 | #define CAC_BASE _AC(0x80000000, UL) |
Sanjay Lal | 9843b03 | 2012-11-21 18:34:03 -0800 | [diff] [blame] | 29 | #endif |
Steven J. Hill | 7ad18dd | 2013-07-03 17:28:22 +0000 | [diff] [blame] | 30 | #ifndef IO_BASE |
Franck Bui-Huu | c4612c8 | 2007-06-04 17:46:32 +0200 | [diff] [blame] | 31 | #define IO_BASE _AC(0xa0000000, UL) |
Steven J. Hill | 7ad18dd | 2013-07-03 17:28:22 +0000 | [diff] [blame] | 32 | #endif |
| 33 | #ifndef UNCAC_BASE |
Franck Bui-Huu | c4612c8 | 2007-06-04 17:46:32 +0200 | [diff] [blame] | 34 | #define UNCAC_BASE _AC(0xa0000000, UL) |
Steven J. Hill | 7ad18dd | 2013-07-03 17:28:22 +0000 | [diff] [blame] | 35 | #endif |
Franck Bui-Huu | 09bb9ce | 2007-06-04 17:46:31 +0200 | [diff] [blame] | 36 | |
| 37 | #ifndef MAP_BASE |
Sanjay Lal | 9843b03 | 2012-11-21 18:34:03 -0800 | [diff] [blame] | 38 | #ifdef CONFIG_KVM_GUEST |
| 39 | #define MAP_BASE _AC(0x60000000, UL) |
| 40 | #else |
Franck Bui-Huu | c4612c8 | 2007-06-04 17:46:32 +0200 | [diff] [blame] | 41 | #define MAP_BASE _AC(0xc0000000, UL) |
Franck Bui-Huu | 09bb9ce | 2007-06-04 17:46:31 +0200 | [diff] [blame] | 42 | #endif |
Sanjay Lal | 9843b03 | 2012-11-21 18:34:03 -0800 | [diff] [blame] | 43 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | |
| 45 | /* |
| 46 | * Memory above this physical address will be considered highmem. |
| 47 | */ |
| 48 | #ifndef HIGHMEM_START |
Franck Bui-Huu | c4612c8 | 2007-06-04 17:46:32 +0200 | [diff] [blame] | 49 | #define HIGHMEM_START _AC(0x20000000, UL) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | #endif |
| 51 | |
Ralf Baechle | 875d43e | 2005-09-03 15:56:16 -0700 | [diff] [blame] | 52 | #endif /* CONFIG_32BIT */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | |
Ralf Baechle | 875d43e | 2005-09-03 15:56:16 -0700 | [diff] [blame] | 54 | #ifdef CONFIG_64BIT |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | |
Franck Bui-Huu | c4612c8 | 2007-06-04 17:46:32 +0200 | [diff] [blame] | 56 | #ifndef CAC_BASE |
Paul Burton | 3ffc17d | 2016-10-05 18:18:18 +0100 | [diff] [blame] | 57 | #define CAC_BASE PHYS_TO_XKPHYS(read_c0_config() & CONF_CM_CMASK, 0) |
Franck Bui-Huu | 09bb9ce | 2007-06-04 17:46:31 +0200 | [diff] [blame] | 58 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 59 | |
Franck Bui-Huu | c4612c8 | 2007-06-04 17:46:32 +0200 | [diff] [blame] | 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 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 |
Franck Bui-Huu | c4612c8 | 2007-06-04 17:46:32 +0200 | [diff] [blame] | 78 | #define HIGHMEM_START (_AC(1, UL) << _AC(59, UL)) |
Franck Bui-Huu | 09bb9ce | 2007-06-04 17:46:31 +0200 | [diff] [blame] | 79 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 80 | |
Ralf Baechle | 7034228 | 2013-01-22 12:59:30 +0100 | [diff] [blame] | 81 | #define TO_PHYS(x) ( ((x) & TO_PHYS_MASK)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 82 | #define TO_CAC(x) (CAC_BASE | ((x) & TO_PHYS_MASK)) |
| 83 | #define TO_UNCAC(x) (UNCAC_BASE | ((x) & TO_PHYS_MASK)) |
| 84 | |
Ralf Baechle | 875d43e | 2005-09-03 15:56:16 -0700 | [diff] [blame] | 85 | #endif /* CONFIG_64BIT */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 86 | |
Franck Bui-Huu | c4612c8 | 2007-06-04 17:46:32 +0200 | [diff] [blame] | 87 | /* |
| 88 | * This handles the memory map. |
| 89 | */ |
| 90 | #ifndef PAGE_OFFSET |
Franck Bui-Huu | db38501 | 2007-06-04 17:46:33 +0200 | [diff] [blame] | 91 | #define PAGE_OFFSET (CAC_BASE + PHYS_OFFSET) |
Franck Bui-Huu | c4612c8 | 2007-06-04 17:46:32 +0200 | [diff] [blame] | 92 | #endif |
| 93 | |
Kevin Cernekee | 565b60d | 2010-09-07 12:59:15 -0700 | [diff] [blame] | 94 | #ifndef FIXADDR_TOP |
James Hogan | 8e748c8 | 2015-04-27 15:07:16 +0100 | [diff] [blame] | 95 | #ifdef CONFIG_KVM_GUEST |
| 96 | #define FIXADDR_TOP ((unsigned long)(long)(int)0x7ffe0000) |
| 97 | #else |
Kevin Cernekee | 565b60d | 2010-09-07 12:59:15 -0700 | [diff] [blame] | 98 | #define FIXADDR_TOP ((unsigned long)(long)(int)0xfffe0000) |
| 99 | #endif |
James Hogan | 8e748c8 | 2015-04-27 15:07:16 +0100 | [diff] [blame] | 100 | #endif |
Kevin Cernekee | 565b60d | 2010-09-07 12:59:15 -0700 | [diff] [blame] | 101 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 102 | #endif /* __ASM_MACH_GENERIC_SPACES_H */ |