162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * fixmap.h: compile-time virtual memory allocation
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public
562306a36Sopenharmony_ci * License.  See the file "COPYING" in the main directory of this archive
662306a36Sopenharmony_ci * for more details.
762306a36Sopenharmony_ci *
862306a36Sopenharmony_ci * Copyright (C) 1998 Ingo Molnar
962306a36Sopenharmony_ci *
1062306a36Sopenharmony_ci * Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999
1162306a36Sopenharmony_ci */
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci#ifndef _ASM_FIXMAP_H
1462306a36Sopenharmony_ci#define _ASM_FIXMAP_H
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci#include <asm/page.h>
1762306a36Sopenharmony_ci#include <spaces.h>
1862306a36Sopenharmony_ci#ifdef CONFIG_HIGHMEM
1962306a36Sopenharmony_ci#include <linux/threads.h>
2062306a36Sopenharmony_ci#include <asm/kmap_size.h>
2162306a36Sopenharmony_ci#endif
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ci/*
2462306a36Sopenharmony_ci * Here we define all the compile-time 'special' virtual
2562306a36Sopenharmony_ci * addresses. The point is to have a constant address at
2662306a36Sopenharmony_ci * compile time, but to set the physical address only
2762306a36Sopenharmony_ci * in the boot process. We allocate these special  addresses
2862306a36Sopenharmony_ci * from the end of virtual memory (0xfffff000) backwards.
2962306a36Sopenharmony_ci * Also this lets us do fail-safe vmalloc(), we
3062306a36Sopenharmony_ci * can guarantee that these special addresses and
3162306a36Sopenharmony_ci * vmalloc()-ed addresses never overlap.
3262306a36Sopenharmony_ci *
3362306a36Sopenharmony_ci * these 'compile-time allocated' memory buffers are
3462306a36Sopenharmony_ci * fixed-size 4k pages. (or larger if used with an increment
3562306a36Sopenharmony_ci * highger than 1) use fixmap_set(idx,phys) to associate
3662306a36Sopenharmony_ci * physical memory with fixmap indices.
3762306a36Sopenharmony_ci *
3862306a36Sopenharmony_ci * TLB entries of such buffers will not be flushed across
3962306a36Sopenharmony_ci * task switches.
4062306a36Sopenharmony_ci */
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ci/*
4362306a36Sopenharmony_ci * on UP currently we will have no trace of the fixmap mechanizm,
4462306a36Sopenharmony_ci * no page table allocations, etc. This might change in the
4562306a36Sopenharmony_ci * future, say framebuffers for the console driver(s) could be
4662306a36Sopenharmony_ci * fix-mapped?
4762306a36Sopenharmony_ci */
4862306a36Sopenharmony_cienum fixed_addresses {
4962306a36Sopenharmony_ci#define FIX_N_COLOURS 8
5062306a36Sopenharmony_ci	FIX_CMAP_BEGIN,
5162306a36Sopenharmony_ci	FIX_CMAP_END = FIX_CMAP_BEGIN + (FIX_N_COLOURS * 2),
5262306a36Sopenharmony_ci#ifdef CONFIG_HIGHMEM
5362306a36Sopenharmony_ci	/* reserved pte's for temporary kernel mappings */
5462306a36Sopenharmony_ci	FIX_KMAP_BEGIN = FIX_CMAP_END + 1,
5562306a36Sopenharmony_ci	FIX_KMAP_END = FIX_KMAP_BEGIN + (KM_MAX_IDX * NR_CPUS) - 1,
5662306a36Sopenharmony_ci#endif
5762306a36Sopenharmony_ci	__end_of_fixed_addresses
5862306a36Sopenharmony_ci};
5962306a36Sopenharmony_ci
6062306a36Sopenharmony_ci/*
6162306a36Sopenharmony_ci * used by vmalloc.c.
6262306a36Sopenharmony_ci *
6362306a36Sopenharmony_ci * Leave one empty page between vmalloc'ed areas and
6462306a36Sopenharmony_ci * the start of the fixmap, and leave one page empty
6562306a36Sopenharmony_ci * at the top of mem..
6662306a36Sopenharmony_ci */
6762306a36Sopenharmony_ci#define FIXADDR_SIZE	(__end_of_fixed_addresses << PAGE_SHIFT)
6862306a36Sopenharmony_ci#define FIXADDR_START	(FIXADDR_TOP - FIXADDR_SIZE)
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_ci#include <asm-generic/fixmap.h>
7162306a36Sopenharmony_ci
7262306a36Sopenharmony_ci/*
7362306a36Sopenharmony_ci * Called from pagetable_init()
7462306a36Sopenharmony_ci */
7562306a36Sopenharmony_ciextern void fixrange_init(unsigned long start, unsigned long end,
7662306a36Sopenharmony_ci	pgd_t *pgd_base);
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_ci
7962306a36Sopenharmony_ci#endif
80