1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */ 2*4882a593Smuzhiyun /* 3*4882a593Smuzhiyun * highmem.h: virtual kernel memory mappings for high memory 4*4882a593Smuzhiyun * 5*4882a593Smuzhiyun * PowerPC version, stolen from the i386 version. 6*4882a593Smuzhiyun * 7*4882a593Smuzhiyun * Used in CONFIG_HIGHMEM systems for memory pages which 8*4882a593Smuzhiyun * are not addressable by direct kernel virtual addresses. 9*4882a593Smuzhiyun * 10*4882a593Smuzhiyun * Copyright (C) 1999 Gerhard Wichert, Siemens AG 11*4882a593Smuzhiyun * Gerhard.Wichert@pdb.siemens.de 12*4882a593Smuzhiyun * 13*4882a593Smuzhiyun * 14*4882a593Smuzhiyun * Redesigned the x86 32-bit VM architecture to deal with 15*4882a593Smuzhiyun * up to 16 Terrabyte physical memory. With current x86 CPUs 16*4882a593Smuzhiyun * we now support up to 64 Gigabytes physical RAM. 17*4882a593Smuzhiyun * 18*4882a593Smuzhiyun * Copyright (C) 1999 Ingo Molnar <mingo@redhat.com> 19*4882a593Smuzhiyun */ 20*4882a593Smuzhiyun 21*4882a593Smuzhiyun #ifndef _ASM_HIGHMEM_H 22*4882a593Smuzhiyun #define _ASM_HIGHMEM_H 23*4882a593Smuzhiyun 24*4882a593Smuzhiyun #ifdef __KERNEL__ 25*4882a593Smuzhiyun 26*4882a593Smuzhiyun #include <linux/interrupt.h> 27*4882a593Smuzhiyun #include <asm/kmap_types.h> 28*4882a593Smuzhiyun #include <asm/cacheflush.h> 29*4882a593Smuzhiyun #include <asm/page.h> 30*4882a593Smuzhiyun #include <asm/fixmap.h> 31*4882a593Smuzhiyun 32*4882a593Smuzhiyun extern pte_t *kmap_pte; 33*4882a593Smuzhiyun extern pte_t *pkmap_page_table; 34*4882a593Smuzhiyun 35*4882a593Smuzhiyun /* 36*4882a593Smuzhiyun * Right now we initialize only a single pte table. It can be extended 37*4882a593Smuzhiyun * easily, subsequent pte tables have to be allocated in one physical 38*4882a593Smuzhiyun * chunk of RAM. 39*4882a593Smuzhiyun */ 40*4882a593Smuzhiyun /* 41*4882a593Smuzhiyun * We use one full pte table with 4K pages. And with 16K/64K/256K pages pte 42*4882a593Smuzhiyun * table covers enough memory (32MB/512MB/2GB resp.), so that both FIXMAP 43*4882a593Smuzhiyun * and PKMAP can be placed in a single pte table. We use 512 pages for PKMAP 44*4882a593Smuzhiyun * in case of 16K/64K/256K page sizes. 45*4882a593Smuzhiyun */ 46*4882a593Smuzhiyun #ifdef CONFIG_PPC_4K_PAGES 47*4882a593Smuzhiyun #define PKMAP_ORDER PTE_SHIFT 48*4882a593Smuzhiyun #else 49*4882a593Smuzhiyun #define PKMAP_ORDER 9 50*4882a593Smuzhiyun #endif 51*4882a593Smuzhiyun #define LAST_PKMAP (1 << PKMAP_ORDER) 52*4882a593Smuzhiyun #ifndef CONFIG_PPC_4K_PAGES 53*4882a593Smuzhiyun #define PKMAP_BASE (FIXADDR_START - PAGE_SIZE*(LAST_PKMAP + 1)) 54*4882a593Smuzhiyun #else 55*4882a593Smuzhiyun #define PKMAP_BASE ((FIXADDR_START - PAGE_SIZE*(LAST_PKMAP + 1)) & PMD_MASK) 56*4882a593Smuzhiyun #endif 57*4882a593Smuzhiyun #define LAST_PKMAP_MASK (LAST_PKMAP-1) 58*4882a593Smuzhiyun #define PKMAP_NR(virt) ((virt-PKMAP_BASE) >> PAGE_SHIFT) 59*4882a593Smuzhiyun #define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT)) 60*4882a593Smuzhiyun 61*4882a593Smuzhiyun #define flush_cache_kmaps() flush_cache_all() 62*4882a593Smuzhiyun 63*4882a593Smuzhiyun #endif /* __KERNEL__ */ 64*4882a593Smuzhiyun 65*4882a593Smuzhiyun #endif /* _ASM_HIGHMEM_H */ 66