xref: /linux/arch/microblaze/include/asm/fixmap.h (revision 142885379a8d296e89b9a89c95e40af7068b4bb3)
141938761SMichal Simek /*
241938761SMichal Simek  * fixmap.h: compile-time virtual memory allocation
341938761SMichal Simek  *
441938761SMichal Simek  * This file is subject to the terms and conditions of the GNU General Public
541938761SMichal Simek  * License.  See the file "COPYING" in the main directory of this archive
641938761SMichal Simek  * for more details.
741938761SMichal Simek  *
841938761SMichal Simek  * Copyright (C) 1998 Ingo Molnar
941938761SMichal Simek  *
1041938761SMichal Simek  * Copyright 2008 Freescale Semiconductor Inc.
1141938761SMichal Simek  *   Port to powerpc added by Kumar Gala
1241938761SMichal Simek  *
1341938761SMichal Simek  * Copyright 2011 Michal Simek <monstr@monstr.eu>
1441938761SMichal Simek  * Copyright 2011 PetaLogix Qld Pty Ltd
1541938761SMichal Simek  *   Port to Microblaze
1641938761SMichal Simek  */
1741938761SMichal Simek 
1841938761SMichal Simek #ifndef _ASM_FIXMAP_H
1941938761SMichal Simek #define _ASM_FIXMAP_H
2041938761SMichal Simek 
2141938761SMichal Simek #ifndef __ASSEMBLY__
2241938761SMichal Simek #include <linux/kernel.h>
2341938761SMichal Simek #include <asm/page.h>
242f2f371fSMichal Simek #ifdef CONFIG_HIGHMEM
252f2f371fSMichal Simek #include <linux/threads.h>
262f2f371fSMichal Simek #include <asm/kmap_types.h>
272f2f371fSMichal Simek #endif
2841938761SMichal Simek 
2941938761SMichal Simek #define FIXADDR_TOP	((unsigned long)(-PAGE_SIZE))
3041938761SMichal Simek 
3141938761SMichal Simek /*
3241938761SMichal Simek  * Here we define all the compile-time 'special' virtual
3341938761SMichal Simek  * addresses. The point is to have a constant address at
3441938761SMichal Simek  * compile time, but to set the physical address only
3541938761SMichal Simek  * in the boot process. We allocate these special addresses
3641938761SMichal Simek  * from the end of virtual memory (0xfffff000) backwards.
3741938761SMichal Simek  * Also this lets us do fail-safe vmalloc(), we
3841938761SMichal Simek  * can guarantee that these special addresses and
3941938761SMichal Simek  * vmalloc()-ed addresses never overlap.
4041938761SMichal Simek  *
4141938761SMichal Simek  * these 'compile-time allocated' memory buffers are
4241938761SMichal Simek  * fixed-size 4k pages. (or larger if used with an increment
4341938761SMichal Simek  * highger than 1) use fixmap_set(idx,phys) to associate
4441938761SMichal Simek  * physical memory with fixmap indices.
4541938761SMichal Simek  *
4641938761SMichal Simek  * TLB entries of such buffers will not be flushed across
4741938761SMichal Simek  * task switches.
4841938761SMichal Simek  */
4941938761SMichal Simek enum fixed_addresses {
5041938761SMichal Simek 	FIX_HOLE,
512f2f371fSMichal Simek #ifdef CONFIG_HIGHMEM
522f2f371fSMichal Simek 	FIX_KMAP_BEGIN,	/* reserved pte's for temporary kernel mappings */
532f2f371fSMichal Simek 	FIX_KMAP_END = FIX_KMAP_BEGIN + (KM_TYPE_NR * num_possible_cpus()) - 1,
542f2f371fSMichal Simek #endif
5541938761SMichal Simek 	__end_of_fixed_addresses
5641938761SMichal Simek };
5741938761SMichal Simek 
5841938761SMichal Simek extern void __set_fixmap(enum fixed_addresses idx,
5941938761SMichal Simek 					phys_addr_t phys, pgprot_t flags);
6041938761SMichal Simek 
6141938761SMichal Simek #define __FIXADDR_SIZE	(__end_of_fixed_addresses << PAGE_SHIFT)
6241938761SMichal Simek #define FIXADDR_START		(FIXADDR_TOP - __FIXADDR_SIZE)
6341938761SMichal Simek 
64*14288537SMark Salter #define FIXMAP_PAGE_NOCACHE PAGE_KERNEL_CI
6541938761SMichal Simek 
66*14288537SMark Salter #include <asm-generic/fixmap.h>
6741938761SMichal Simek 
6841938761SMichal Simek #endif /* !__ASSEMBLY__ */
6941938761SMichal Simek #endif
70