18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public
38c2ecf20Sopenharmony_ci * License.  See the file "COPYING" in the main directory of this archive
48c2ecf20Sopenharmony_ci * for more details.
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * Copyright (C) 1994 - 1999, 2000, 03, 04 Ralf Baechle
78c2ecf20Sopenharmony_ci * Copyright (C) 2000, 2002  Maciej W. Rozycki
88c2ecf20Sopenharmony_ci * Copyright (C) 1990, 1999, 2000 Silicon Graphics, Inc.
98c2ecf20Sopenharmony_ci */
108c2ecf20Sopenharmony_ci#ifndef _ASM_MACH_GENERIC_SPACES_H
118c2ecf20Sopenharmony_ci#define _ASM_MACH_GENERIC_SPACES_H
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#include <linux/const.h>
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#include <asm/mipsregs.h>
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#ifndef IO_SPACE_LIMIT
188c2ecf20Sopenharmony_ci#define IO_SPACE_LIMIT 0xffff
198c2ecf20Sopenharmony_ci#endif
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci/*
228c2ecf20Sopenharmony_ci * This gives the physical RAM offset.
238c2ecf20Sopenharmony_ci */
248c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__
258c2ecf20Sopenharmony_ci# if defined(CONFIG_MIPS_AUTO_PFN_OFFSET)
268c2ecf20Sopenharmony_ci#  define PHYS_OFFSET		((unsigned long)PFN_PHYS(ARCH_PFN_OFFSET))
278c2ecf20Sopenharmony_ci# elif !defined(PHYS_OFFSET)
288c2ecf20Sopenharmony_ci#  define PHYS_OFFSET		_AC(0, UL)
298c2ecf20Sopenharmony_ci# endif
308c2ecf20Sopenharmony_ci#endif /* __ASSEMBLY__ */
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci#ifdef CONFIG_32BIT
338c2ecf20Sopenharmony_ci#ifdef CONFIG_KVM_GUEST
348c2ecf20Sopenharmony_ci#define CAC_BASE		_AC(0x40000000, UL)
358c2ecf20Sopenharmony_ci#else
368c2ecf20Sopenharmony_ci#define CAC_BASE		_AC(0x80000000, UL)
378c2ecf20Sopenharmony_ci#endif
388c2ecf20Sopenharmony_ci#ifndef IO_BASE
398c2ecf20Sopenharmony_ci#define IO_BASE			_AC(0xa0000000, UL)
408c2ecf20Sopenharmony_ci#endif
418c2ecf20Sopenharmony_ci#ifndef UNCAC_BASE
428c2ecf20Sopenharmony_ci#define UNCAC_BASE		_AC(0xa0000000, UL)
438c2ecf20Sopenharmony_ci#endif
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci#ifndef MAP_BASE
468c2ecf20Sopenharmony_ci#ifdef CONFIG_KVM_GUEST
478c2ecf20Sopenharmony_ci#define MAP_BASE		_AC(0x60000000, UL)
488c2ecf20Sopenharmony_ci#else
498c2ecf20Sopenharmony_ci#define MAP_BASE		_AC(0xc0000000, UL)
508c2ecf20Sopenharmony_ci#endif
518c2ecf20Sopenharmony_ci#endif
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci/*
548c2ecf20Sopenharmony_ci * Memory above this physical address will be considered highmem.
558c2ecf20Sopenharmony_ci */
568c2ecf20Sopenharmony_ci#ifndef HIGHMEM_START
578c2ecf20Sopenharmony_ci#define HIGHMEM_START		_AC(0x20000000, UL)
588c2ecf20Sopenharmony_ci#endif
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci#endif /* CONFIG_32BIT */
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci#ifdef CONFIG_64BIT
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ci#ifndef CAC_BASE
658c2ecf20Sopenharmony_ci#define CAC_BASE	PHYS_TO_XKPHYS(read_c0_config() & CONF_CM_CMASK, 0)
668c2ecf20Sopenharmony_ci#endif
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ci#ifndef IO_BASE
698c2ecf20Sopenharmony_ci#define IO_BASE			_AC(0x9000000000000000, UL)
708c2ecf20Sopenharmony_ci#endif
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci#ifndef UNCAC_BASE
738c2ecf20Sopenharmony_ci#define UNCAC_BASE		_AC(0x9000000000000000, UL)
748c2ecf20Sopenharmony_ci#endif
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci#ifndef MAP_BASE
778c2ecf20Sopenharmony_ci#define MAP_BASE		_AC(0xc000000000000000, UL)
788c2ecf20Sopenharmony_ci#endif
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ci/*
818c2ecf20Sopenharmony_ci * Memory above this physical address will be considered highmem.
828c2ecf20Sopenharmony_ci * Fixme: 59 bits is a fictive number and makes assumptions about processors
838c2ecf20Sopenharmony_ci * in the distant future.  Nobody will care for a few years :-)
848c2ecf20Sopenharmony_ci */
858c2ecf20Sopenharmony_ci#ifndef HIGHMEM_START
868c2ecf20Sopenharmony_ci#define HIGHMEM_START		(_AC(1, UL) << _AC(59, UL))
878c2ecf20Sopenharmony_ci#endif
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ci#define TO_PHYS(x)		(	      ((x) & TO_PHYS_MASK))
908c2ecf20Sopenharmony_ci#define TO_CAC(x)		(CAC_BASE   | ((x) & TO_PHYS_MASK))
918c2ecf20Sopenharmony_ci#define TO_UNCAC(x)		(UNCAC_BASE | ((x) & TO_PHYS_MASK))
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci#endif /* CONFIG_64BIT */
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ci/*
968c2ecf20Sopenharmony_ci * This handles the memory map.
978c2ecf20Sopenharmony_ci */
988c2ecf20Sopenharmony_ci#ifndef PAGE_OFFSET
998c2ecf20Sopenharmony_ci#define PAGE_OFFSET		(CAC_BASE + PHYS_OFFSET)
1008c2ecf20Sopenharmony_ci#endif
1018c2ecf20Sopenharmony_ci
1028c2ecf20Sopenharmony_ci#ifndef FIXADDR_TOP
1038c2ecf20Sopenharmony_ci#ifdef CONFIG_KVM_GUEST
1048c2ecf20Sopenharmony_ci#define FIXADDR_TOP		((unsigned long)(long)(int)0x7ffe0000)
1058c2ecf20Sopenharmony_ci#else
1068c2ecf20Sopenharmony_ci#define FIXADDR_TOP		((unsigned long)(long)(int)0xfffe0000)
1078c2ecf20Sopenharmony_ci#endif
1088c2ecf20Sopenharmony_ci#endif
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_ci#endif /* __ASM_MACH_GENERIC_SPACES_H */
111