highmem.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // SPDX-License-Identifier: GPL-2.0
  2. // Copyright (C) 2005-2017 Andes Technology Corporation
  3. #ifndef _ASM_HIGHMEM_H
  4. #define _ASM_HIGHMEM_H
  5. #include <asm/proc-fns.h>
  6. #include <asm/kmap_types.h>
  7. #include <asm/fixmap.h>
  8. #include <asm/pgtable.h>
  9. /*
  10. * Right now we initialize only a single pte table. It can be extended
  11. * easily, subsequent pte tables have to be allocated in one physical
  12. * chunk of RAM.
  13. */
  14. /*
  15. * Ordering is (from lower to higher memory addresses):
  16. *
  17. * high_memory
  18. * Persistent kmap area
  19. * PKMAP_BASE
  20. * fixed_addresses
  21. * FIXADDR_START
  22. * FIXADDR_TOP
  23. * Vmalloc area
  24. * VMALLOC_START
  25. * VMALLOC_END
  26. */
  27. #define PKMAP_BASE ((FIXADDR_START - PGDIR_SIZE) & (PGDIR_MASK))
  28. #define LAST_PKMAP PTRS_PER_PTE
  29. #define LAST_PKMAP_MASK (LAST_PKMAP - 1)
  30. #define PKMAP_NR(virt) (((virt) - (PKMAP_BASE)) >> PAGE_SHIFT)
  31. #define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT))
  32. #define kmap_prot PAGE_KERNEL
  33. static inline void flush_cache_kmaps(void)
  34. {
  35. cpu_dcache_wbinval_all();
  36. }
  37. /* declarations for highmem.c */
  38. extern unsigned long highstart_pfn, highend_pfn;
  39. extern pte_t *pkmap_page_table;
  40. extern void *kmap_high(struct page *page);
  41. extern void kunmap_high(struct page *page);
  42. extern void kmap_init(void);
  43. /*
  44. * The following functions are already defined by <linux/highmem.h>
  45. * when CONFIG_HIGHMEM is not set.
  46. */
  47. #ifdef CONFIG_HIGHMEM
  48. extern void *kmap(struct page *page);
  49. extern void kunmap(struct page *page);
  50. extern void *kmap_atomic(struct page *page);
  51. extern void __kunmap_atomic(void *kvaddr);
  52. extern void *kmap_atomic_pfn(unsigned long pfn);
  53. extern struct page *kmap_atomic_to_page(void *ptr);
  54. #endif
  55. #endif