blob: 74124b0d0d7952f60bee72c69ae49c30eb677c99 [file] [log] [blame]
Nicolas Pitre5f0fbf92008-09-16 13:05:53 -04001#ifndef _ASM_FIXMAP_H
2#define _ASM_FIXMAP_H
3
Liu Huaa05e54c2014-04-18 09:43:32 +01004#define FIXADDR_START 0xffc00000UL
5#define FIXADDR_TOP 0xffe00000UL
Nicolas Pitre5f0fbf92008-09-16 13:05:53 -04006#define FIXADDR_SIZE (FIXADDR_TOP - FIXADDR_START)
7
Liu Hua4221e2e2014-04-18 09:27:01 +01008#define FIX_KMAP_NR_PTES (FIXADDR_SIZE >> PAGE_SHIFT)
Nicolas Pitre5f0fbf92008-09-16 13:05:53 -04009
10#define __fix_to_virt(x) (FIXADDR_START + ((x) << PAGE_SHIFT))
11#define __virt_to_fix(x) (((x) - FIXADDR_START) >> PAGE_SHIFT)
12
13extern void __this_fixmap_does_not_exist(void);
14
15static inline unsigned long fix_to_virt(const unsigned int idx)
16{
Liu Hua4221e2e2014-04-18 09:27:01 +010017 if (idx >= FIX_KMAP_NR_PTES)
Nicolas Pitre5f0fbf92008-09-16 13:05:53 -040018 __this_fixmap_does_not_exist();
19 return __fix_to_virt(idx);
20}
21
22static inline unsigned int virt_to_fix(const unsigned long vaddr)
23{
24 BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START);
25 return __virt_to_fix(vaddr);
26}
27
28#endif