fixmap.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #ifndef _ASM_FIXMAP_H
  2. #define _ASM_FIXMAP_H
  3. /*
  4. * Nothing too fancy for now.
  5. *
  6. * On ARM we already have well known fixed virtual addresses imposed by
  7. * the architecture such as the vector page which is located at 0xffff0000,
  8. * therefore a second level page table is already allocated covering
  9. * 0xfff00000 upwards.
  10. *
  11. * The cache flushing code in proc-xscale.S uses the virtual area between
  12. * 0xfffe0000 and 0xfffeffff.
  13. */
  14. #define FIXADDR_START 0xfff00000UL
  15. #define FIXADDR_TOP 0xfffe0000UL
  16. #define FIXADDR_SIZE (FIXADDR_TOP - FIXADDR_START)
  17. #define FIX_KMAP_BEGIN 0
  18. #define FIX_KMAP_END (FIXADDR_SIZE >> PAGE_SHIFT)
  19. #define __fix_to_virt(x) (FIXADDR_START + ((x) << PAGE_SHIFT))
  20. #define __virt_to_fix(x) (((x) - FIXADDR_START) >> PAGE_SHIFT)
  21. extern void __this_fixmap_does_not_exist(void);
  22. static inline unsigned long fix_to_virt(const unsigned int idx)
  23. {
  24. if (idx >= FIX_KMAP_END)
  25. __this_fixmap_does_not_exist();
  26. return __fix_to_virt(idx);
  27. }
  28. static inline unsigned int virt_to_fix(const unsigned long vaddr)
  29. {
  30. BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START);
  31. return __virt_to_fix(vaddr);
  32. }
  33. #endif