Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1179 | serge | 1 | |
2 | #define __TYPES_H__ |
||
3 | |||
4 | |||
5 | # define __force |
||
6 | # define __user |
||
7 | |||
8 | |||
9 | |||
10 | |||
11 | |||
12 | |||
13 | #define true 1 |
||
14 | |||
15 | |||
16 | typedef long long loff_t; |
||
17 | |||
18 | |||
19 | typedef unsigned int count_t; |
||
20 | typedef unsigned int addr_t; |
||
21 | |||
22 | |||
23 | typedef unsigned short u16; |
||
24 | typedef unsigned int u32; |
||
25 | typedef unsigned long long u64; |
||
26 | |||
27 | |||
28 | typedef unsigned short __u16; |
||
29 | typedef unsigned int __u32; |
||
30 | typedef unsigned long long __u64; |
||
31 | |||
32 | |||
33 | typedef signed short __s16; |
||
34 | typedef signed int __s32; |
||
35 | typedef signed long long __s64; |
||
36 | |||
37 | |||
38 | |||
39 | typedef unsigned short uint16_t; |
||
40 | typedef unsigned int uint32_t; |
||
41 | typedef unsigned long long uint64_t; |
||
42 | |||
43 | |||
44 | typedef unsigned short u16_t; |
||
45 | typedef unsigned int u32_t; |
||
46 | typedef unsigned long long u64_t; |
||
47 | |||
48 | |||
49 | typedef signed int int32_t; |
||
50 | typedef signed long long int64_t; |
||
51 | |||
52 | |||
53 | |||
54 | |||
55 | typedef uint32_t resource_size_t; |
||
56 | |||
57 | |||
58 | |||
59 | #define cpu_to_le32(v32) (v32) |
||
60 | #define cpu_to_le64(v64) (v64) |
||
61 | #define le16_to_cpu(v16) (v16) |
||
62 | #define le32_to_cpu(v32) (v32) |
||
63 | #define le64_to_cpu(v64) (v64) |
||
64 | |||
65 | |||
66 | #define unlikely(x) __builtin_expect(!!(x), 0) |
||
67 | |||
68 | |||
69 | |||
70 | |||
71 | |||
72 | |||
73 | |||
74 | |||
75 | unsigned long name[BITS_TO_LONGS(bits)] |
||
76 | |||
77 | |||
78 | |||
79 | #define KERN_ALERT "<1>" /* action must be taken immediately */ |
||
80 | #define KERN_CRIT "<2>" /* critical conditions */ |
||
81 | #define KERN_ERR "<3>" /* error conditions */ |
||
82 | #define KERN_WARNING "<4>" /* warning conditions */ |
||
83 | #define KERN_NOTICE "<5>" /* normal but significant condition */ |
||
84 | #define KERN_INFO "<6>" /* informational */ |
||
85 | #define KERN_DEBUG "<7>" /* debug-level messages */ |
||
86 | |||
87 | |||
88 | |||
89 | |||
90 | |||
91 | |||
92 | |||
93 | |||
94 | |||
95 | |||
96 | |||
97 | printk(KERN_ERR "[" DRM_NAME ":%s] *ERROR* " fmt , __func__ , ##arg) |
||
98 | |||
99 | |||
100 | |||
101 | |||
102 | BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0]))) |
||
103 | |||
104 | |||
105 | |||
106 | |||
107 | |||
108 | |||
109 | |||
110 | #define BUG() do { \ |
||
111 | printk("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __FUNCTION__); \ |
||
112 | /* panic("BUG!"); */ \ |
||
113 | } while (0) |
||
114 | #endif |
||
115 | |||
116 | |||
117 | #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while(0) |
||
118 | #endif |
||
119 | |||
120 | |||
121 | |||
122 | |||
123 | #define MTRR_TYPE_WRCOMB 1 |
||
124 | #define MTRR_TYPE_WRTHROUGH 4 |
||
125 | #define MTRR_TYPE_WRPROT 5 |
||
126 | #define MTRR_TYPE_WRBACK 6 |
||
127 | #define MTRR_NUM_TYPES 7 |
||
128 | |||
129 | |||
130 | |||
131 | |||
132 | |||
133 | |||
134 | |||
135 | |||
136 | |||
137 | |||
138 | |||
139 | |||
140 | |||
141 | void* memset(void *s, int c, size_t n); |
||
142 | size_t strlen(const char *s); |
||
143 | char *strcpy(char *s1, const char *s2); |
||
144 | char *strncpy (char *dst, const char *src, size_t len); |
||
145 | |||
146 | |||
147 | |||
148 | |||
149 | #define kfree free |
||
150 | |||
151 | |||
152 | { |
||
153 | void *ret = malloc(size); |
||
154 | memset(ret, 0, size); |
||
155 | return ret; |
||
156 | } |
||
157 | |||
158 | |||
159 | |||
160 | |||
161 | |||
162 | |||
163 | const typeof( ((type *)0)->member ) *__mptr = (ptr); \ |
||
164 | (type *)( (char *)__mptr - offsetof(type,member) );}) |
||
165 | |||
166 | |||
167 | |||
168 | |||
169 | #define mb() __asm__ __volatile__("lock; addl $0,0(%esp)") |
||
170 | |||
171 | |||
172 | |||
173 | #define PAGE_SIZE (1UL << PAGE_SHIFT) |
||
174 | #define PAGE_MASK (~(PAGE_SIZE-1)) |
||
175 | |||
176 | |||
177 | |||
178 | |||
179 | { |
||
180 | if (nbits <= BITS_PER_LONG) |
||
181 | *dst = 0UL; |
||
182 | else { |
||
183 | int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long); |
||
184 | memset(dst, 0, len); |
||
185 | } |
||
186 | } |
||
187 | |||
188 | |||
189 | |||
190 | |||
191 | typeof(x) _x = (x); \ |
||
192 | typeof(y) _y = (y); \ |
||
193 | (void) (&_x == &_y); \ |
||
194 | _x < _y ? _x : _y; }) |
||
195 | |||
196 | |||
197 | typeof(x) _x = (x); \ |
||
198 | typeof(y) _y = (y); \ |
||
199 | (void) (&_x == &_y); \ |
||
200 | _x > _y ? _x : _y; }) |
||
201 | |||
202 | |||
203 | |||
204 | |||
205 | |||
206 | uint32_t __base = (base); \ |
||
207 | uint32_t __rem; \ |
||
208 | (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \ |
||
209 | if (likely(((n) >> 32) == 0)) { \ |
||
210 | __rem = (uint32_t)(n) % __base; \ |
||
211 | (n) = (uint32_t)(n) / __base; \ |
||
212 | } else \ |
||
213 | __rem = __div64_32(&(n), __base); \ |
||
214 | __rem; \ |
||
215 | }) |
||
216 | |||
217 | |||
218 | |||
219 | |||
220 | #define INT_MIN (-INT_MAX - 1) |
||
221 | #define UINT_MAX (~0U) |
||
222 | #define LONG_MAX ((long)(~0UL>>1)) |
||
223 | #define LONG_MIN (-LONG_MAX - 1) |
||
224 | #define ULONG_MAX (~0UL) |
||
225 | #define LLONG_MAX ((long long)(~0ULL>>1)) |
||
226 | #define LLONG_MIN (-LLONG_MAX - 1) |
||
227 | #define ULLONG_MAX (~0ULL) |
||
228 | |||
229 | |||
230 | |||
231 | { |
||
232 | if (n != 0 && size > ULONG_MAX / n) |
||
233 | return NULL; |
||
234 | return kzalloc(n * size, 0); |
||
235 | } |
||
236 | |||
237 | |||
238 | #define LEAVE() dbgprintf("leave %s\n",__FUNCTION__) |
||
239 | |||
240 | |||
241 | #define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask)) |
||
242 | |||
243 | |||
244 | |||
245 | |||
246 | |||
247 |