Home | History | Annotate | Download | only in mtd

Lines Matching refs:map

3 /* $Id: map.h,v 1.54 2005/11/07 11:14:54 gleixner Exp $ */
19 #define map_bankwidth(map) 1
20 #define map_bankwidth_is_1(map) (map_bankwidth(map) == 1)
21 #define map_bankwidth_is_large(map) (0)
22 #define map_words(map) (1)
25 #define map_bankwidth_is_1(map) (0)
31 # define map_bankwidth(map) ((map)->bankwidth)
33 # define map_bankwidth(map) 2
34 # define map_bankwidth_is_large(map) (0)
35 # define map_words(map) (1)
37 #define map_bankwidth_is_2(map) (map_bankwidth(map) == 2)
41 #define map_bankwidth_is_2(map) (0)
47 # define map_bankwidth(map) ((map)->bankwidth)
49 # define map_bankwidth(map) 4
50 # define map_bankwidth_is_large(map) (0)
51 # define map_words(map) (1)
53 #define map_bankwidth_is_4(map) (map_bankwidth(map) == 4)
57 #define map_bankwidth_is_4(map) (0)
63 #define map_calc_words(map) ((map_bankwidth(map) + (sizeof(unsigned long)-1))/ sizeof(unsigned long))
68 # define map_bankwidth(map) ((map)->bankwidth)
71 # define map_bankwidth_is_large(map) (map_bankwidth(map) > BITS_PER_LONG/8)
73 # define map_words(map) map_calc_words(map)
76 # define map_bankwidth(map) 8
77 # define map_bankwidth_is_large(map) (BITS_PER_LONG < 64)
78 # define map_words(map) map_calc_words(map)
80 #define map_bankwidth_is_8(map) (map_bankwidth(map) == 8)
84 #define map_bankwidth_is_8(map) (0)
90 # define map_bankwidth(map) ((map)->bankwidth)
92 # define map_bankwidth_is_large(map) (map_bankwidth(map) > BITS_PER_LONG/8)
94 # define map_words(map) map_calc_words(map)
96 # define map_bankwidth(map) 16
97 # define map_bankwidth_is_large(map) (1)
98 # define map_words(map) map_calc_words(map)
100 #define map_bankwidth_is_16(map) (map_bankwidth(map) == 16)
104 #define map_bankwidth_is_16(map) (0)
110 # define map_bankwidth(map) ((map)->bankwidth)
112 # define map_bankwidth_is_large(map) (map_bankwidth(map) > BITS_PER_LONG/8)
114 # define map_words(map) map_calc_words(map)
116 # define map_bankwidth(map) 32
117 # define map_bankwidth_is_large(map) (1)
118 # define map_words(map) map_calc_words(map)
120 #define map_bankwidth_is_32(map) (map_bankwidth(map) == 32)
124 #define map_bankwidth_is_32(map) (0)
165 /* The map stuff is very simple. You fill in your struct map_info with
178 mtd->priv->fldrv_priv field. This allows the map driver to get at
179 the destructor function map->fldrv_destroy() when it's tired
207 /* It's possible for the map driver to use cached memory in its
210 it will signal it to the map driver through this routine to let
211 the map driver invalidate the corresponding cache as needed.
226 struct mtd_info *(*probe)(struct map_info *map);
236 struct mtd_info *do_map_probe(const char *name, struct map_info *map);
239 #define ENABLE_VPP(map) do { if(map->set_vpp) map->set_vpp(map, 1); } while(0)
240 #define DISABLE_VPP(map) do { if(map->set_vpp) map->set_vpp(map, 0); } while(0)
242 #define INVALIDATE_CACHED_RANGE(map, from, size) \
243 do { if(map->inval_cache) map->inval_cache(map, from, size); } while(0)
246 static inline int map_word_equal(struct map_info *map, map_word val1, map_word val2)
249 for (i=0; i<map_words(map); i++) {
256 static inline map_word map_word_and(struct map_info *map, map_word val1, map_word val2)
261 for (i=0; i<map_words(map); i++) {
267 static inline map_word map_word_clr(struct map_info *map, map_word val1, map_word val2)
272 for (i=0; i<map_words(map); i++) {
278 static inline map_word map_word_or(struct map_info *map, map_word val1, map_word val2)
283 for (i=0; i<map_words(map); i++) {
291 static inline int map_word_bitsset(struct map_info *map, map_word val1, map_word val2)
295 for (i=0; i<map_words(map); i++) {
302 static inline map_word map_word_load(struct map_info *map, const void *ptr)
306 if (map_bankwidth_is_1(map))
308 else if (map_bankwidth_is_2(map))
310 else if (map_bankwidth_is_4(map))
313 else if (map_bankwidth_is_8(map))
316 else if (map_bankwidth_is_large(map))
317 memcpy(r.x, ptr, map->bankwidth);
322 static inline map_word map_word_load_partial(struct map_info *map, map_word orig, const unsigned char *buf, int start, int len)
326 if (map_bankwidth_is_large(map)) {
335 bitpos = (map_bankwidth(map)-1-i)*8;
350 static inline map_word map_word_ff(struct map_info *map)
355 if (map_bankwidth(map) < MAP_FF_LIMIT) {
356 int bw = 8 * map_bankwidth(map);
359 for (i=0; i<map_words(map); i++)
365 static inline map_word inline_map_read(struct map_info *map, unsigned long ofs)
369 if (map_bankwidth_is_1(map))
370 r.x[0] = __raw_readb(map->virt + ofs);
371 else if (map_bankwidth_is_2(map))
372 r.x[0] = __raw_readw(map->virt + ofs);
373 else if (map_bankwidth_is_4(map))
374 r.x[0] = __raw_readl(map->virt + ofs);
376 else if (map_bankwidth_is_8(map))
377 r.x[0] = __raw_readq(map->virt + ofs);
379 else if (map_bankwidth_is_large(map))
380 memcpy_fromio(r.x, map->virt+ofs, map->bankwidth);
385 static inline void inline_map_write(struct map_info *map, const map_word datum, unsigned long ofs)
387 if (map_bankwidth_is_1(map))
388 __raw_writeb(datum.x[0], map->virt + ofs);
389 else if (map_bankwidth_is_2(map))
390 __raw_writew(datum.x[0], map->virt + ofs);
391 else if (map_bankwidth_is_4(map))
392 __raw_writel(datum.x[0], map->virt + ofs);
394 else if (map_bankwidth_is_8(map))
395 __raw_writeq(datum.x[0], map->virt + ofs);
397 else if (map_bankwidth_is_large(map))
398 memcpy_toio(map->virt+ofs, datum.x, map->bankwidth);
402 static inline void inline_map_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
404 if (map->cached)
405 memcpy(to, (char *)map->cached + from, len);
407 memcpy_fromio(to, map->virt + from, len);
410 static inline void inline_map_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
412 memcpy_toio(map->virt + to, from, len);
416 #define map_read(map, ofs) (map)->read(map, ofs)
417 #define map_copy_from(map, to, from, len) (map)->copy_from(map, to, from, len)
418 #define map_write(map, datum, ofs) (map)->write(map, datum, ofs)
419 #define map_copy_to(map, to, from, len) (map)->copy_to(map, to, from, len)
422 #define map_is_linear(map) (map->phys != NO_XIP)
425 #define map_read(map, ofs) inline_map_read(map, ofs)
426 #define map_copy_from(map, to, from, len) inline_map_copy_from(map, to, from, len)
427 #define map_write(map, datum, ofs) inline_map_write(map, datum, ofs)
428 #define map_copy_to(map, to, from, len) inline_map_copy_to(map, to, from, len)
431 #define simple_map_init(map) BUG_ON(!map_bankwidth_supported((map)->bankwidth))
432 #define map_is_linear(map) ({ (void)(map); 1; })