18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * highmem.h: virtual kernel memory mappings for high memory 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * PowerPC version, stolen from the i386 version. 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * Used in CONFIG_HIGHMEM systems for memory pages which 88c2ecf20Sopenharmony_ci * are not addressable by direct kernel virtual addresses. 98c2ecf20Sopenharmony_ci * 108c2ecf20Sopenharmony_ci * Copyright (C) 1999 Gerhard Wichert, Siemens AG 118c2ecf20Sopenharmony_ci * Gerhard.Wichert@pdb.siemens.de 128c2ecf20Sopenharmony_ci * 138c2ecf20Sopenharmony_ci * 148c2ecf20Sopenharmony_ci * Redesigned the x86 32-bit VM architecture to deal with 158c2ecf20Sopenharmony_ci * up to 16 Terrabyte physical memory. With current x86 CPUs 168c2ecf20Sopenharmony_ci * we now support up to 64 Gigabytes physical RAM. 178c2ecf20Sopenharmony_ci * 188c2ecf20Sopenharmony_ci * Copyright (C) 1999 Ingo Molnar <mingo@redhat.com> 198c2ecf20Sopenharmony_ci */ 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci#ifndef _ASM_HIGHMEM_H 228c2ecf20Sopenharmony_ci#define _ASM_HIGHMEM_H 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci#ifdef __KERNEL__ 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci#include <linux/interrupt.h> 278c2ecf20Sopenharmony_ci#include <asm/kmap_types.h> 288c2ecf20Sopenharmony_ci#include <asm/cacheflush.h> 298c2ecf20Sopenharmony_ci#include <asm/page.h> 308c2ecf20Sopenharmony_ci#include <asm/fixmap.h> 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ciextern pte_t *kmap_pte; 338c2ecf20Sopenharmony_ciextern pte_t *pkmap_page_table; 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci/* 368c2ecf20Sopenharmony_ci * Right now we initialize only a single pte table. It can be extended 378c2ecf20Sopenharmony_ci * easily, subsequent pte tables have to be allocated in one physical 388c2ecf20Sopenharmony_ci * chunk of RAM. 398c2ecf20Sopenharmony_ci */ 408c2ecf20Sopenharmony_ci/* 418c2ecf20Sopenharmony_ci * We use one full pte table with 4K pages. And with 16K/64K/256K pages pte 428c2ecf20Sopenharmony_ci * table covers enough memory (32MB/512MB/2GB resp.), so that both FIXMAP 438c2ecf20Sopenharmony_ci * and PKMAP can be placed in a single pte table. We use 512 pages for PKMAP 448c2ecf20Sopenharmony_ci * in case of 16K/64K/256K page sizes. 458c2ecf20Sopenharmony_ci */ 468c2ecf20Sopenharmony_ci#ifdef CONFIG_PPC_4K_PAGES 478c2ecf20Sopenharmony_ci#define PKMAP_ORDER PTE_SHIFT 488c2ecf20Sopenharmony_ci#else 498c2ecf20Sopenharmony_ci#define PKMAP_ORDER 9 508c2ecf20Sopenharmony_ci#endif 518c2ecf20Sopenharmony_ci#define LAST_PKMAP (1 << PKMAP_ORDER) 528c2ecf20Sopenharmony_ci#ifndef CONFIG_PPC_4K_PAGES 538c2ecf20Sopenharmony_ci#define PKMAP_BASE (FIXADDR_START - PAGE_SIZE*(LAST_PKMAP + 1)) 548c2ecf20Sopenharmony_ci#else 558c2ecf20Sopenharmony_ci#define PKMAP_BASE ((FIXADDR_START - PAGE_SIZE*(LAST_PKMAP + 1)) & PMD_MASK) 568c2ecf20Sopenharmony_ci#endif 578c2ecf20Sopenharmony_ci#define LAST_PKMAP_MASK (LAST_PKMAP-1) 588c2ecf20Sopenharmony_ci#define PKMAP_NR(virt) ((virt-PKMAP_BASE) >> PAGE_SHIFT) 598c2ecf20Sopenharmony_ci#define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT)) 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_ci#define flush_cache_kmaps() flush_cache_all() 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_ci#endif /* __KERNEL__ */ 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_ci#endif /* _ASM_HIGHMEM_H */ 66