1/*
2 * Copyright (C) 1998 Ingo Molnar
3 * Copyright 2010 Tilera Corporation. All Rights Reserved.
4 *
5 *   This program is free software; you can redistribute it and/or
6 *   modify it under the terms of the GNU General Public License
7 *   as published by the Free Software Foundation, version 2.
8 *
9 *   This program is distributed in the hope that it will be useful, but
10 *   WITHOUT ANY WARRANTY; without even the implied warranty of
11 *   MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
12 *   NON INFRINGEMENT.  See the GNU General Public License for
13 *   more details.
14 */
15
16#ifndef _ASM_TILE_FIXMAP_H
17#define _ASM_TILE_FIXMAP_H
18
19#include <asm/page.h>
20
21#ifndef __ASSEMBLY__
22#include <linux/kernel.h>
23#ifdef CONFIG_HIGHMEM
24#include <linux/threads.h>
25#include <asm/kmap_types.h>
26#endif
27
28/*
29 * Here we define all the compile-time 'special' virtual
30 * addresses. The point is to have a constant address at
31 * compile time, but to set the physical address only
32 * in the boot process. We allocate these special addresses
33 * from the end of supervisor virtual memory backwards.
34 * Also this lets us do fail-safe vmalloc(), we
35 * can guarantee that these special addresses and
36 * vmalloc()-ed addresses never overlap.
37 *
38 * these 'compile-time allocated' memory buffers are
39 * fixed-size 4k pages. (or larger if used with an increment
40 * higher than 1) use fixmap_set(idx,phys) to associate
41 * physical memory with fixmap indices.
42 *
43 * TLB entries of such buffers will not be flushed across
44 * task switches.
45 */
46enum fixed_addresses {
47#ifdef __tilegx__
48	/*
49	 * TILEPro has unmapped memory above so the hole isn't needed,
50	 * and in any case the hole pushes us over a single 16MB pmd.
51	 */
52	FIX_HOLE,
53#endif
54#ifdef CONFIG_HIGHMEM
55	FIX_KMAP_BEGIN,	/* reserved pte's for temporary kernel mappings */
56	FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1,
57#endif
58#ifdef __tilegx__  /* see homecache.c */
59	FIX_HOMECACHE_BEGIN,
60	FIX_HOMECACHE_END = FIX_HOMECACHE_BEGIN+(NR_CPUS)-1,
61#endif
62	__end_of_permanent_fixed_addresses,
63
64	/*
65	 * Temporary boot-time mappings, used before ioremap() is functional.
66	 * Not currently needed by the Tile architecture.
67	 */
68#define NR_FIX_BTMAPS	0
69#if NR_FIX_BTMAPS
70	FIX_BTMAP_END = __end_of_permanent_fixed_addresses,
71	FIX_BTMAP_BEGIN = FIX_BTMAP_END + NR_FIX_BTMAPS - 1,
72	__end_of_fixed_addresses
73#else
74	__end_of_fixed_addresses = __end_of_permanent_fixed_addresses
75#endif
76};
77
78#define __FIXADDR_SIZE	(__end_of_permanent_fixed_addresses << PAGE_SHIFT)
79#define __FIXADDR_BOOT_SIZE	(__end_of_fixed_addresses << PAGE_SHIFT)
80#define FIXADDR_START		(FIXADDR_TOP + PAGE_SIZE - __FIXADDR_SIZE)
81#define FIXADDR_BOOT_START	(FIXADDR_TOP + PAGE_SIZE - __FIXADDR_BOOT_SIZE)
82
83#include <asm-generic/fixmap.h>
84
85#endif /* !__ASSEMBLY__ */
86
87#endif /* _ASM_TILE_FIXMAP_H */
88