Lines Matching refs:map

22 #define map_bankwidth(map) 1
23 #define map_bankwidth_is_1(map) (map_bankwidth(map) == 1)
24 #define map_bankwidth_is_large(map) (0)
25 #define map_words(map) (1)
28 #define map_bankwidth_is_1(map) (0)
34 # define map_bankwidth(map) ((map)->bankwidth)
36 # define map_bankwidth(map) 2
37 # define map_bankwidth_is_large(map) (0)
38 # define map_words(map) (1)
40 #define map_bankwidth_is_2(map) (map_bankwidth(map) == 2)
44 #define map_bankwidth_is_2(map) (0)
50 # define map_bankwidth(map) ((map)->bankwidth)
52 # define map_bankwidth(map) 4
53 # define map_bankwidth_is_large(map) (0)
54 # define map_words(map) (1)
56 #define map_bankwidth_is_4(map) (map_bankwidth(map) == 4)
60 #define map_bankwidth_is_4(map) (0)
66 #define map_calc_words(map) ((map_bankwidth(map) + (sizeof(unsigned long)-1)) / sizeof(unsigned long))
71 # define map_bankwidth(map) ((map)->bankwidth)
74 # define map_bankwidth_is_large(map) (map_bankwidth(map) > BITS_PER_LONG/8)
76 # define map_words(map) map_calc_words(map)
79 # define map_bankwidth(map) 8
80 # define map_bankwidth_is_large(map) (BITS_PER_LONG < 64)
81 # define map_words(map) map_calc_words(map)
83 #define map_bankwidth_is_8(map) (map_bankwidth(map) == 8)
87 #define map_bankwidth_is_8(map) (0)
93 # define map_bankwidth(map) ((map)->bankwidth)
95 # define map_bankwidth_is_large(map) (map_bankwidth(map) > BITS_PER_LONG/8)
97 # define map_words(map) map_calc_words(map)
99 # define map_bankwidth(map) 16
100 # define map_bankwidth_is_large(map) (1)
101 # define map_words(map) map_calc_words(map)
103 #define map_bankwidth_is_16(map) (map_bankwidth(map) == 16)
107 #define map_bankwidth_is_16(map) (0)
113 # define map_bankwidth(map) ((map)->bankwidth)
115 # define map_bankwidth_is_large(map) (map_bankwidth(map) > BITS_PER_LONG/8)
117 # define map_words(map) map_calc_words(map)
118 #define map_bankwidth_is_32(map) (map_bankwidth(map) == 32)
122 #define map_bankwidth_is_32(map) (0)
129 static inline int map_bankwidth(void *map)
134 #define map_bankwidth_is_large(map) (0)
135 #define map_words(map) (0)
173 /* The map stuff is very simple. You fill in your struct map_info with
186 mtd->priv->fldrv_priv field. This allows the map driver to get at
187 the destructor function map->fldrv_destroy() when it's tired
216 /* It's possible for the map driver to use cached memory in its
219 it will signal it to the map driver through this routine to let
220 the map driver invalidate the corresponding cache as needed.
224 /* This will be called with 1 as parameter when the first map user
225 * needs VPP, and called with 0 when the last user exits. The map
240 struct mtd_info *(*probe)(struct map_info *map);
250 struct mtd_info *do_map_probe(const char *name, struct map_info *map);
253 #define ENABLE_VPP(map) do { if (map->set_vpp) map->set_vpp(map, 1); } while (0)
254 #define DISABLE_VPP(map) do { if (map->set_vpp) map->set_vpp(map, 0); } while (0)
256 #define INVALIDATE_CACHED_RANGE(map, from, size) \
257 do { if (map->inval_cache) map->inval_cache(map, from, size); } while (0)
259 #define map_word_equal(map, val1, val2) \
262 for (i = 0; i < map_words(map); i++) \
270 #define map_word_and(map, val1, val2) \
274 for (i = 0; i < map_words(map); i++) \
279 #define map_word_clr(map, val1, val2) \
283 for (i = 0; i < map_words(map); i++) \
288 #define map_word_or(map, val1, val2) \
292 for (i = 0; i < map_words(map); i++) \
297 #define map_word_andequal(map, val1, val2, val3) \
300 for (i = 0; i < map_words(map); i++) { \
309 #define map_word_bitsset(map, val1, val2) \
312 for (i = 0; i < map_words(map); i++) { \
321 static inline map_word map_word_load(struct map_info *map, const void *ptr)
325 if (map_bankwidth_is_1(map))
327 else if (map_bankwidth_is_2(map))
329 else if (map_bankwidth_is_4(map))
332 else if (map_bankwidth_is_8(map))
335 else if (map_bankwidth_is_large(map))
336 memcpy(r.x, ptr, map->bankwidth);
343 static inline map_word map_word_load_partial(struct map_info *map, map_word orig, const unsigned char *buf, int start, int len)
347 if (map_bankwidth_is_large(map)) {
358 bitpos = (map_bankwidth(map) - 1 - i) * 8;
373 static inline map_word map_word_ff(struct map_info *map)
378 if (map_bankwidth(map) < MAP_FF_LIMIT) {
379 int bw = 8 * map_bankwidth(map);
383 for (i = 0; i < map_words(map); i++)
389 static inline map_word inline_map_read(struct map_info *map, unsigned long ofs)
393 if (map_bankwidth_is_1(map))
394 r.x[0] = __raw_readb(map->virt + ofs);
395 else if (map_bankwidth_is_2(map))
396 r.x[0] = __raw_readw(map->virt + ofs);
397 else if (map_bankwidth_is_4(map))
398 r.x[0] = __raw_readl(map->virt + ofs);
400 else if (map_bankwidth_is_8(map))
401 r.x[0] = __raw_readq(map->virt + ofs);
403 else if (map_bankwidth_is_large(map))
404 memcpy_fromio(r.x, map->virt + ofs, map->bankwidth);
411 static inline void inline_map_write(struct map_info *map, const map_word datum, unsigned long ofs)
413 if (map_bankwidth_is_1(map))
414 __raw_writeb(datum.x[0], map->virt + ofs);
415 else if (map_bankwidth_is_2(map))
416 __raw_writew(datum.x[0], map->virt + ofs);
417 else if (map_bankwidth_is_4(map))
418 __raw_writel(datum.x[0], map->virt + ofs);
420 else if (map_bankwidth_is_8(map))
421 __raw_writeq(datum.x[0], map->virt + ofs);
423 else if (map_bankwidth_is_large(map))
424 memcpy_toio(map->virt+ofs, datum.x, map->bankwidth);
430 static inline void inline_map_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
432 if (map->cached)
433 memcpy(to, (char *)map->cached + from, len);
435 memcpy_fromio(to, map->virt + from, len);
438 static inline void inline_map_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
440 memcpy_toio(map->virt + to, from, len);
444 #define map_read(map, ofs) (map)->read(map, ofs)
445 #define map_copy_from(map, to, from, len) (map)->copy_from(map, to, from, len)
446 #define map_write(map, datum, ofs) (map)->write(map, datum, ofs)
447 #define map_copy_to(map, to, from, len) (map)->copy_to(map, to, from, len)
450 #define map_is_linear(map) (map->phys != NO_XIP)
453 #define map_read(map, ofs) inline_map_read(map, ofs)
454 #define map_copy_from(map, to, from, len) inline_map_copy_from(map, to, from, len)
455 #define map_write(map, datum, ofs) inline_map_write(map, datum, ofs)
456 #define map_copy_to(map, to, from, len) inline_map_copy_to(map, to, from, len)
459 #define simple_map_init(map) BUG_ON(!map_bankwidth_supported((map)->bankwidth))
460 #define map_is_linear(map) ({ (void)(map); 1; })