highmem.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * include/asm-xtensa/highmem.h
  3. *
  4. * This file is subject to the terms and conditions of the GNU General
  5. * Public License. See the file "COPYING" in the main directory of
  6. * this archive for more details.
  7. *
  8. * Copyright (C) 2003 - 2005 Tensilica Inc.
  9. * Copyright (C) 2014 Cadence Design Systems Inc.
  10. */
  11. #ifndef _XTENSA_HIGHMEM_H
  12. #define _XTENSA_HIGHMEM_H
  13. #include <asm/cacheflush.h>
  14. #include <asm/fixmap.h>
  15. #include <asm/kmap_types.h>
  16. #include <asm/pgtable.h>
  17. #define PKMAP_BASE (FIXADDR_START - PMD_SIZE)
  18. #define LAST_PKMAP PTRS_PER_PTE
  19. #define LAST_PKMAP_MASK (LAST_PKMAP - 1)
  20. #define PKMAP_NR(virt) (((virt) - PKMAP_BASE) >> PAGE_SHIFT)
  21. #define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT))
  22. #define kmap_prot PAGE_KERNEL
  23. extern pte_t *pkmap_page_table;
  24. void *kmap_high(struct page *page);
  25. void kunmap_high(struct page *page);
  26. static inline void *kmap(struct page *page)
  27. {
  28. BUG_ON(in_interrupt());
  29. if (!PageHighMem(page))
  30. return page_address(page);
  31. return kmap_high(page);
  32. }
  33. static inline void kunmap(struct page *page)
  34. {
  35. BUG_ON(in_interrupt());
  36. if (!PageHighMem(page))
  37. return;
  38. kunmap_high(page);
  39. }
  40. static inline void flush_cache_kmaps(void)
  41. {
  42. flush_cache_all();
  43. }
  44. void *kmap_atomic(struct page *page);
  45. void __kunmap_atomic(void *kvaddr);
  46. void kmap_init(void);
  47. #endif