11 typedef unsigned long dma_addr_t
;
15 #define BUG_ON(x) assert(!(x))
17 #define WARN_ON(condition) ({ \
18 int __ret_warn_on = !!(condition); \
19 unlikely(__ret_warn_on); \
22 #define WARN_ON_ONCE(condition) ({ \
23 int __ret_warn_on = !!(condition); \
24 if (unlikely(__ret_warn_on)) \
26 unlikely(__ret_warn_on); \
29 #define PAGE_SIZE (4096)
30 #define PAGE_SHIFT (12)
31 #define PAGE_MASK (~(PAGE_SIZE-1))
33 #define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
34 #define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
35 #define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
37 #define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE)
39 #define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK)
41 #define virt_to_page(x) ((void *)x)
42 #define page_address(x) ((void *)x)
44 static inline unsigned long page_to_phys(struct page
*page
)
51 #define page_to_pfn(page) ((unsigned long)(page) / PAGE_SIZE)
52 #define pfn_to_page(pfn) (void *)((pfn) * PAGE_SIZE)
53 #define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n))
55 #define __min(t1, t2, min1, min2, x, y) ({ \
58 (void) (&min1 == &min2); \
59 min1 < min2 ? min1 : min2; })
61 #define ___PASTE(a,b) a##b
62 #define __PASTE(a,b) ___PASTE(a,b)
64 #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
67 __min(typeof(x), typeof(y), \
68 __UNIQUE_ID(min1_), __UNIQUE_ID(min2_), \
71 #define min_t(type, x, y) \
73 __UNIQUE_ID(min1_), __UNIQUE_ID(min2_), \
76 #define preemptible() (1)
78 static inline void *kmap(struct page
*page
)
85 static inline void *kmap_atomic(struct page
*page
)
92 static inline void kunmap(void *addr
)
97 static inline void kunmap_atomic(void *addr
)
102 static inline unsigned long __get_free_page(unsigned int flags
)
104 return (unsigned long)malloc(PAGE_SIZE
);
107 static inline void free_page(unsigned long page
)
112 static inline void *kmalloc(unsigned int size
, unsigned int flags
)
117 #define kfree(x) free(x)
119 #define kmemleak_alloc(a, b, c, d)
120 #define kmemleak_free(a)
122 #define PageSlab(p) (0)
123 #define flush_kernel_dcache_page(p)