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  * PowerPC version, stolen from the i386 version.
0006  *
0007  * Used in CONFIG_HIGHMEM systems for memory pages which
0008  * are not addressable by direct kernel virtual addresses.
0009  *
0010  * Copyright (C) 1999 Gerhard Wichert, Siemens AG
0011  *            Gerhard.Wichert@pdb.siemens.de
0012  *
0013  *
0014  * Redesigned the x86 32-bit VM architecture to deal with
0015  * up to 16 Terrabyte physical memory. With current x86 CPUs
0016  * we now support up to 64 Gigabytes physical RAM.
0017  *
0018  * Copyright (C) 1999 Ingo Molnar <mingo@redhat.com>
0019  */
0020 
0021 #ifndef _ASM_HIGHMEM_H
0022 #define _ASM_HIGHMEM_H
0023 
0024 #ifdef __KERNEL__
0025 
0026 #include <linux/interrupt.h>
0027 #include <asm/cacheflush.h>
0028 #include <asm/page.h>
0029 #include <asm/fixmap.h>
0030 
0031 extern pte_t *pkmap_page_table;
0032 
0033 /*
0034  * Right now we initialize only a single pte table. It can be extended
0035  * easily, subsequent pte tables have to be allocated in one physical
0036  * chunk of RAM.
0037  */
0038 /*
0039  * We use one full pte table with 4K pages. And with 16K/64K/256K pages pte
0040  * table covers enough memory (32MB/512MB/2GB resp.), so that both FIXMAP
0041  * and PKMAP can be placed in a single pte table. We use 512 pages for PKMAP
0042  * in case of 16K/64K/256K page sizes.
0043  */
0044 #ifdef CONFIG_PPC_4K_PAGES
0045 #define PKMAP_ORDER PTE_SHIFT
0046 #else
0047 #define PKMAP_ORDER 9
0048 #endif
0049 #define LAST_PKMAP  (1 << PKMAP_ORDER)
0050 #ifndef CONFIG_PPC_4K_PAGES
0051 #define PKMAP_BASE  (FIXADDR_START - PAGE_SIZE*(LAST_PKMAP + 1))
0052 #else
0053 #define PKMAP_BASE  ((FIXADDR_START - PAGE_SIZE*(LAST_PKMAP + 1)) & PMD_MASK)
0054 #endif
0055 #define LAST_PKMAP_MASK (LAST_PKMAP-1)
0056 #define PKMAP_NR(virt)  ((virt-PKMAP_BASE) >> PAGE_SHIFT)
0057 #define PKMAP_ADDR(nr)  (PKMAP_BASE + ((nr) << PAGE_SHIFT))
0058 
0059 #define flush_cache_kmaps() flush_cache_all()
0060 
0061 #define arch_kmap_local_set_pte(mm, vaddr, ptep, ptev)  \
0062     __set_pte_at(mm, vaddr, ptep, ptev, 1)
0063 #define arch_kmap_local_post_map(vaddr, pteval) \
0064     local_flush_tlb_page(NULL, vaddr)
0065 #define arch_kmap_local_post_unmap(vaddr)   \
0066     local_flush_tlb_page(NULL, vaddr)
0067 
0068 #endif /* __KERNEL__ */
0069 
0070 #endif /* _ASM_HIGHMEM_H */