18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * fixmap.h: compile-time virtual memory allocation 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (C) 1998 Ingo Molnar 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * Copyright 2008 Freescale Semiconductor Inc. 88c2ecf20Sopenharmony_ci * Port to powerpc added by Kumar Gala 98c2ecf20Sopenharmony_ci * 108c2ecf20Sopenharmony_ci * Copyright 2011 Michal Simek <monstr@monstr.eu> 118c2ecf20Sopenharmony_ci * Copyright 2011 PetaLogix Qld Pty Ltd 128c2ecf20Sopenharmony_ci * Port to Microblaze 138c2ecf20Sopenharmony_ci */ 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci#ifndef _ASM_FIXMAP_H 168c2ecf20Sopenharmony_ci#define _ASM_FIXMAP_H 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__ 198c2ecf20Sopenharmony_ci#include <linux/kernel.h> 208c2ecf20Sopenharmony_ci#include <asm/page.h> 218c2ecf20Sopenharmony_ci#ifdef CONFIG_HIGHMEM 228c2ecf20Sopenharmony_ci#include <linux/threads.h> 238c2ecf20Sopenharmony_ci#include <asm/kmap_types.h> 248c2ecf20Sopenharmony_ci#endif 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci#define FIXADDR_TOP ((unsigned long)(-PAGE_SIZE)) 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci/* 298c2ecf20Sopenharmony_ci * Here we define all the compile-time 'special' virtual 308c2ecf20Sopenharmony_ci * addresses. The point is to have a constant address at 318c2ecf20Sopenharmony_ci * compile time, but to set the physical address only 328c2ecf20Sopenharmony_ci * in the boot process. We allocate these special addresses 338c2ecf20Sopenharmony_ci * from the end of virtual memory (0xfffff000) backwards. 348c2ecf20Sopenharmony_ci * Also this lets us do fail-safe vmalloc(), we 358c2ecf20Sopenharmony_ci * can guarantee that these special addresses and 368c2ecf20Sopenharmony_ci * vmalloc()-ed addresses never overlap. 378c2ecf20Sopenharmony_ci * 388c2ecf20Sopenharmony_ci * these 'compile-time allocated' memory buffers are 398c2ecf20Sopenharmony_ci * fixed-size 4k pages. (or larger if used with an increment 408c2ecf20Sopenharmony_ci * highger than 1) use fixmap_set(idx,phys) to associate 418c2ecf20Sopenharmony_ci * physical memory with fixmap indices. 428c2ecf20Sopenharmony_ci * 438c2ecf20Sopenharmony_ci * TLB entries of such buffers will not be flushed across 448c2ecf20Sopenharmony_ci * task switches. 458c2ecf20Sopenharmony_ci */ 468c2ecf20Sopenharmony_cienum fixed_addresses { 478c2ecf20Sopenharmony_ci FIX_HOLE, 488c2ecf20Sopenharmony_ci#ifdef CONFIG_HIGHMEM 498c2ecf20Sopenharmony_ci FIX_KMAP_BEGIN, /* reserved pte's for temporary kernel mappings */ 508c2ecf20Sopenharmony_ci FIX_KMAP_END = FIX_KMAP_BEGIN + (KM_TYPE_NR * num_possible_cpus()) - 1, 518c2ecf20Sopenharmony_ci#endif 528c2ecf20Sopenharmony_ci __end_of_fixed_addresses 538c2ecf20Sopenharmony_ci}; 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ciextern void __set_fixmap(enum fixed_addresses idx, 568c2ecf20Sopenharmony_ci phys_addr_t phys, pgprot_t flags); 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_ci#define __FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) 598c2ecf20Sopenharmony_ci#define FIXADDR_START (FIXADDR_TOP - __FIXADDR_SIZE) 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_ci#define FIXMAP_PAGE_NOCACHE PAGE_KERNEL_CI 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_ci#include <asm-generic/fixmap.h> 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_ci#endif /* !__ASSEMBLY__ */ 668c2ecf20Sopenharmony_ci#endif 67