162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * fixmap.h: compile-time virtual memory allocation 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright (C) 1998 Ingo Molnar 662306a36Sopenharmony_ci * 762306a36Sopenharmony_ci * Copyright 2008 Freescale Semiconductor Inc. 862306a36Sopenharmony_ci * Port to powerpc added by Kumar Gala 962306a36Sopenharmony_ci * 1062306a36Sopenharmony_ci * Copyright 2011 Michal Simek <monstr@monstr.eu> 1162306a36Sopenharmony_ci * Copyright 2011 PetaLogix Qld Pty Ltd 1262306a36Sopenharmony_ci * Port to Microblaze 1362306a36Sopenharmony_ci */ 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ci#ifndef _ASM_FIXMAP_H 1662306a36Sopenharmony_ci#define _ASM_FIXMAP_H 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci#ifndef __ASSEMBLY__ 1962306a36Sopenharmony_ci#include <linux/kernel.h> 2062306a36Sopenharmony_ci#include <asm/page.h> 2162306a36Sopenharmony_ci#ifdef CONFIG_HIGHMEM 2262306a36Sopenharmony_ci#include <linux/threads.h> 2362306a36Sopenharmony_ci#include <asm/kmap_size.h> 2462306a36Sopenharmony_ci#endif 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_ci#define FIXADDR_TOP ((unsigned long)(-PAGE_SIZE)) 2762306a36Sopenharmony_ci 2862306a36Sopenharmony_ci/* 2962306a36Sopenharmony_ci * Here we define all the compile-time 'special' virtual 3062306a36Sopenharmony_ci * addresses. The point is to have a constant address at 3162306a36Sopenharmony_ci * compile time, but to set the physical address only 3262306a36Sopenharmony_ci * in the boot process. We allocate these special addresses 3362306a36Sopenharmony_ci * from the end of virtual memory (0xfffff000) backwards. 3462306a36Sopenharmony_ci * Also this lets us do fail-safe vmalloc(), we 3562306a36Sopenharmony_ci * can guarantee that these special addresses and 3662306a36Sopenharmony_ci * vmalloc()-ed addresses never overlap. 3762306a36Sopenharmony_ci * 3862306a36Sopenharmony_ci * these 'compile-time allocated' memory buffers are 3962306a36Sopenharmony_ci * fixed-size 4k pages. (or larger if used with an increment 4062306a36Sopenharmony_ci * highger than 1) use fixmap_set(idx,phys) to associate 4162306a36Sopenharmony_ci * physical memory with fixmap indices. 4262306a36Sopenharmony_ci * 4362306a36Sopenharmony_ci * TLB entries of such buffers will not be flushed across 4462306a36Sopenharmony_ci * task switches. 4562306a36Sopenharmony_ci */ 4662306a36Sopenharmony_cienum fixed_addresses { 4762306a36Sopenharmony_ci FIX_HOLE, 4862306a36Sopenharmony_ci#ifdef CONFIG_HIGHMEM 4962306a36Sopenharmony_ci FIX_KMAP_BEGIN, /* reserved pte's for temporary kernel mappings */ 5062306a36Sopenharmony_ci FIX_KMAP_END = FIX_KMAP_BEGIN + (KM_MAX_IDX * num_possible_cpus()) - 1, 5162306a36Sopenharmony_ci#endif 5262306a36Sopenharmony_ci __end_of_fixed_addresses 5362306a36Sopenharmony_ci}; 5462306a36Sopenharmony_ci 5562306a36Sopenharmony_ciextern void __set_fixmap(enum fixed_addresses idx, 5662306a36Sopenharmony_ci phys_addr_t phys, pgprot_t flags); 5762306a36Sopenharmony_ci 5862306a36Sopenharmony_ci#define __FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) 5962306a36Sopenharmony_ci#define FIXADDR_START (FIXADDR_TOP - __FIXADDR_SIZE) 6062306a36Sopenharmony_ci 6162306a36Sopenharmony_ci#define FIXMAP_PAGE_NOCACHE PAGE_KERNEL_CI 6262306a36Sopenharmony_ci 6362306a36Sopenharmony_ci#include <asm-generic/fixmap.h> 6462306a36Sopenharmony_ci 6562306a36Sopenharmony_ci#endif /* !__ASSEMBLY__ */ 6662306a36Sopenharmony_ci#endif 67