diff options
Diffstat (limited to 'include/linux/mtd/map.h')
-rw-r--r-- | include/linux/mtd/map.h | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h index f0268b99c900..142963f01d29 100644 --- a/include/linux/mtd/map.h +++ b/include/linux/mtd/map.h | |||
@@ -1,6 +1,6 @@ | |||
1 | 1 | ||
2 | /* Overhauled routines for dealing with different mmap regions of flash */ | 2 | /* Overhauled routines for dealing with different mmap regions of flash */ |
3 | /* $Id: map.h,v 1.46 2005/01/05 17:09:44 dwmw2 Exp $ */ | 3 | /* $Id: map.h,v 1.52 2005/05/25 10:29:41 gleixner Exp $ */ |
4 | 4 | ||
5 | #ifndef __LINUX_MTD_MAP_H__ | 5 | #ifndef __LINUX_MTD_MAP_H__ |
6 | #define __LINUX_MTD_MAP_H__ | 6 | #define __LINUX_MTD_MAP_H__ |
@@ -263,6 +263,17 @@ static inline map_word map_word_and(struct map_info *map, map_word val1, map_wor | |||
263 | return r; | 263 | return r; |
264 | } | 264 | } |
265 | 265 | ||
266 | static inline map_word map_word_clr(struct map_info *map, map_word val1, map_word val2) | ||
267 | { | ||
268 | map_word r; | ||
269 | int i; | ||
270 | |||
271 | for (i=0; i<map_words(map); i++) { | ||
272 | r.x[i] = val1.x[i] & ~val2.x[i]; | ||
273 | } | ||
274 | return r; | ||
275 | } | ||
276 | |||
266 | static inline map_word map_word_or(struct map_info *map, map_word val1, map_word val2) | 277 | static inline map_word map_word_or(struct map_info *map, map_word val1, map_word val2) |
267 | { | 278 | { |
268 | map_word r; | 279 | map_word r; |
@@ -273,6 +284,7 @@ static inline map_word map_word_or(struct map_info *map, map_word val1, map_word | |||
273 | } | 284 | } |
274 | return r; | 285 | return r; |
275 | } | 286 | } |
287 | |||
276 | #define map_word_andequal(m, a, b, z) map_word_equal(m, z, map_word_and(m, a, b)) | 288 | #define map_word_andequal(m, a, b, z) map_word_equal(m, z, map_word_and(m, a, b)) |
277 | 289 | ||
278 | static inline int map_word_bitsset(struct map_info *map, map_word val1, map_word val2) | 290 | static inline int map_word_bitsset(struct map_info *map, map_word val1, map_word val2) |
@@ -328,16 +340,27 @@ static inline map_word map_word_load_partial(struct map_info *map, map_word orig | |||
328 | return orig; | 340 | return orig; |
329 | } | 341 | } |
330 | 342 | ||
343 | #if BITS_PER_LONG < 64 | ||
344 | #define MAP_FF_LIMIT 4 | ||
345 | #else | ||
346 | #define MAP_FF_LIMIT 8 | ||
347 | #endif | ||
348 | |||
331 | static inline map_word map_word_ff(struct map_info *map) | 349 | static inline map_word map_word_ff(struct map_info *map) |
332 | { | 350 | { |
333 | map_word r; | 351 | map_word r; |
334 | int i; | 352 | int i; |
335 | 353 | ||
336 | for (i=0; i<map_words(map); i++) { | 354 | if (map_bankwidth(map) < MAP_FF_LIMIT) { |
337 | r.x[i] = ~0UL; | 355 | int bw = 8 * map_bankwidth(map); |
356 | r.x[0] = (1 << bw) - 1; | ||
357 | } else { | ||
358 | for (i=0; i<map_words(map); i++) | ||
359 | r.x[i] = ~0UL; | ||
338 | } | 360 | } |
339 | return r; | 361 | return r; |
340 | } | 362 | } |
363 | |||
341 | static inline map_word inline_map_read(struct map_info *map, unsigned long ofs) | 364 | static inline map_word inline_map_read(struct map_info *map, unsigned long ofs) |
342 | { | 365 | { |
343 | map_word r; | 366 | map_word r; |
@@ -405,7 +428,7 @@ extern void simple_map_init(struct map_info *); | |||
405 | 428 | ||
406 | 429 | ||
407 | #define simple_map_init(map) BUG_ON(!map_bankwidth_supported((map)->bankwidth)) | 430 | #define simple_map_init(map) BUG_ON(!map_bankwidth_supported((map)->bankwidth)) |
408 | #define map_is_linear(map) (1) | 431 | #define map_is_linear(map) ({ (void)(map); 1; }) |
409 | 432 | ||
410 | #endif /* !CONFIG_MTD_COMPLEX_MAPPINGS */ | 433 | #endif /* !CONFIG_MTD_COMPLEX_MAPPINGS */ |
411 | 434 | ||