highmem.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Copyright (C) 2015 Synopsys, Inc. (www.synopsys.com)
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. *
  8. */
  9. #ifndef _ASM_HIGHMEM_H
  10. #define _ASM_HIGHMEM_H
  11. #ifdef CONFIG_HIGHMEM
  12. #include <uapi/asm/page.h>
  13. #include <asm/kmap_types.h>
  14. /* start after vmalloc area */
  15. #define FIXMAP_BASE (PAGE_OFFSET - FIXMAP_SIZE - PKMAP_SIZE)
  16. #define FIXMAP_SIZE PGDIR_SIZE /* only 1 PGD worth */
  17. #define KM_TYPE_NR ((FIXMAP_SIZE >> PAGE_SHIFT)/NR_CPUS)
  18. #define FIXMAP_ADDR(nr) (FIXMAP_BASE + ((nr) << PAGE_SHIFT))
  19. /* start after fixmap area */
  20. #define PKMAP_BASE (FIXMAP_BASE + FIXMAP_SIZE)
  21. #define PKMAP_SIZE PGDIR_SIZE
  22. #define LAST_PKMAP (PKMAP_SIZE >> PAGE_SHIFT)
  23. #define LAST_PKMAP_MASK (LAST_PKMAP - 1)
  24. #define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT))
  25. #define PKMAP_NR(virt) (((virt) - PKMAP_BASE) >> PAGE_SHIFT)
  26. #define kmap_prot PAGE_KERNEL
  27. #include <asm/cacheflush.h>
  28. extern void *kmap(struct page *page);
  29. extern void *kmap_high(struct page *page);
  30. extern void *kmap_atomic(struct page *page);
  31. extern void __kunmap_atomic(void *kvaddr);
  32. extern void kunmap_high(struct page *page);
  33. extern void kmap_init(void);
  34. static inline void flush_cache_kmaps(void)
  35. {
  36. flush_cache_all();
  37. }
  38. static inline void kunmap(struct page *page)
  39. {
  40. BUG_ON(in_interrupt());
  41. if (!PageHighMem(page))
  42. return;
  43. kunmap_high(page);
  44. }
  45. #endif
  46. #endif