Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * highmem.h: virtual kernel memory mappings for high memory
0004  *
0005  * Used in CONFIG_HIGHMEM systems for memory pages which
0006  * are not addressable by direct kernel virtual addresses.
0007  *
0008  * Copyright (C) 1999 Gerhard Wichert, Siemens AG
0009  *            Gerhard.Wichert@pdb.siemens.de
0010  *
0011  *
0012  * Redesigned the x86 32-bit VM architecture to deal with 
0013  * up to 16 Terrabyte physical memory. With current x86 CPUs
0014  * we now support up to 64 Gigabytes physical RAM.
0015  *
0016  * Copyright (C) 1999 Ingo Molnar <mingo@redhat.com>
0017  */
0018 
0019 #ifndef _ASM_HIGHMEM_H
0020 #define _ASM_HIGHMEM_H
0021 
0022 #ifdef __KERNEL__
0023 
0024 #include <linux/interrupt.h>
0025 #include <linux/pgtable.h>
0026 #include <asm/vaddrs.h>
0027 #include <asm/pgtsrmmu.h>
0028 
0029 /* declarations for highmem.c */
0030 extern unsigned long highstart_pfn, highend_pfn;
0031 
0032 #define kmap_prot __pgprot(SRMMU_ET_PTE | SRMMU_PRIV | SRMMU_CACHE)
0033 extern pte_t *pkmap_page_table;
0034 
0035 /*
0036  * Right now we initialize only a single pte table. It can be extended
0037  * easily, subsequent pte tables have to be allocated in one physical
0038  * chunk of RAM.  Currently the simplest way to do this is to align the
0039  * pkmap region on a pagetable boundary (4MB).
0040  */
0041 #define LAST_PKMAP 1024
0042 #define PKMAP_SIZE (LAST_PKMAP << PAGE_SHIFT)
0043 #define PKMAP_BASE PMD_ALIGN(SRMMU_NOCACHE_VADDR + (SRMMU_MAX_NOCACHE_PAGES << PAGE_SHIFT))
0044 
0045 #define LAST_PKMAP_MASK (LAST_PKMAP - 1)
0046 #define PKMAP_NR(virt)  ((virt - PKMAP_BASE) >> PAGE_SHIFT)
0047 #define PKMAP_ADDR(nr)  (PKMAP_BASE + ((nr) << PAGE_SHIFT))
0048 
0049 #define PKMAP_END (PKMAP_ADDR(LAST_PKMAP))
0050 
0051 #define flush_cache_kmaps() flush_cache_all()
0052 
0053 /* FIXME: Use __flush_*_one(vaddr) instead of flush_*_all() -- Anton */
0054 #define arch_kmap_local_pre_map(vaddr, pteval)  flush_cache_all()
0055 #define arch_kmap_local_pre_unmap(vaddr)    flush_cache_all()
0056 #define arch_kmap_local_post_map(vaddr, pteval) flush_tlb_all()
0057 #define arch_kmap_local_post_unmap(vaddr)   flush_tlb_all()
0058 
0059 #endif /* __KERNEL__ */
0060 
0061 #endif /* _ASM_HIGHMEM_H */