Nicolas Pitre | 5f0fbf9 | 2008-09-16 13:05:53 -0400 | [diff] [blame] | 1 | #ifndef _ASM_FIXMAP_H |
| 2 | #define _ASM_FIXMAP_H |
| 3 | |
Liu Hua | a05e54c | 2014-04-18 09:43:32 +0100 | [diff] [blame] | 4 | #define FIXADDR_START 0xffc00000UL |
| 5 | #define FIXADDR_TOP 0xffe00000UL |
Nicolas Pitre | 5f0fbf9 | 2008-09-16 13:05:53 -0400 | [diff] [blame] | 6 | #define FIXADDR_SIZE (FIXADDR_TOP - FIXADDR_START) |
| 7 | |
Liu Hua | 4221e2e | 2014-04-18 09:27:01 +0100 | [diff] [blame] | 8 | #define FIX_KMAP_NR_PTES (FIXADDR_SIZE >> PAGE_SHIFT) |
Nicolas Pitre | 5f0fbf9 | 2008-09-16 13:05:53 -0400 | [diff] [blame] | 9 | |
| 10 | #define __fix_to_virt(x) (FIXADDR_START + ((x) << PAGE_SHIFT)) |
| 11 | #define __virt_to_fix(x) (((x) - FIXADDR_START) >> PAGE_SHIFT) |
| 12 | |
| 13 | extern void __this_fixmap_does_not_exist(void); |
| 14 | |
| 15 | static inline unsigned long fix_to_virt(const unsigned int idx) |
| 16 | { |
Liu Hua | 4221e2e | 2014-04-18 09:27:01 +0100 | [diff] [blame] | 17 | if (idx >= FIX_KMAP_NR_PTES) |
Nicolas Pitre | 5f0fbf9 | 2008-09-16 13:05:53 -0400 | [diff] [blame] | 18 | __this_fixmap_does_not_exist(); |
| 19 | return __fix_to_virt(idx); |
| 20 | } |
| 21 | |
| 22 | static 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 |