highmem.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * highmem.h: virtual kernel memory mappings for high memory
  4. *
  5. * Used in CONFIG_HIGHMEM systems for memory pages which
  6. * are not addressable by direct kernel virtual addresses.
  7. *
  8. * Copyright (C) 1999 Gerhard Wichert, Siemens AG
  9. * [email protected]
  10. *
  11. *
  12. * Redesigned the x86 32-bit VM architecture to deal with
  13. * up to 16 Terrabyte physical memory. With current x86 CPUs
  14. * we now support up to 64 Gigabytes physical RAM.
  15. *
  16. * Copyright (C) 1999 Ingo Molnar <[email protected]>
  17. */
  18. #ifndef _ASM_HIGHMEM_H
  19. #define _ASM_HIGHMEM_H
  20. #ifdef __KERNEL__
  21. #include <linux/interrupt.h>
  22. #include <linux/pgtable.h>
  23. #include <asm/vaddrs.h>
  24. #include <asm/pgtsrmmu.h>
  25. /* declarations for highmem.c */
  26. extern unsigned long highstart_pfn, highend_pfn;
  27. #define kmap_prot __pgprot(SRMMU_ET_PTE | SRMMU_PRIV | SRMMU_CACHE)
  28. extern pte_t *pkmap_page_table;
  29. /*
  30. * Right now we initialize only a single pte table. It can be extended
  31. * easily, subsequent pte tables have to be allocated in one physical
  32. * chunk of RAM. Currently the simplest way to do this is to align the
  33. * pkmap region on a pagetable boundary (4MB).
  34. */
  35. #define LAST_PKMAP 1024
  36. #define PKMAP_SIZE (LAST_PKMAP << PAGE_SHIFT)
  37. #define PKMAP_BASE PMD_ALIGN(SRMMU_NOCACHE_VADDR + (SRMMU_MAX_NOCACHE_PAGES << PAGE_SHIFT))
  38. #define LAST_PKMAP_MASK (LAST_PKMAP - 1)
  39. #define PKMAP_NR(virt) ((virt - PKMAP_BASE) >> PAGE_SHIFT)
  40. #define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT))
  41. #define PKMAP_END (PKMAP_ADDR(LAST_PKMAP))
  42. #define flush_cache_kmaps() flush_cache_all()
  43. /* FIXME: Use __flush_*_one(vaddr) instead of flush_*_all() -- Anton */
  44. #define arch_kmap_local_pre_map(vaddr, pteval) flush_cache_all()
  45. #define arch_kmap_local_pre_unmap(vaddr) flush_cache_all()
  46. #define arch_kmap_local_post_map(vaddr, pteval) flush_tlb_all()
  47. #define arch_kmap_local_post_unmap(vaddr) flush_tlb_all()
  48. #endif /* __KERNEL__ */
  49. #endif /* _ASM_HIGHMEM_H */