/drivers/mtd/ubi/ |
D | wl.c | 125 static int self_check_ec(struct ubi_device *ubi, int pnum, int ec); 126 static int self_check_in_wl_tree(const struct ubi_device *ubi, 128 static int self_check_in_pq(const struct ubi_device *ubi, 175 static void wl_entry_destroy(struct ubi_device *ubi, struct ubi_wl_entry *e) in wl_entry_destroy() argument 177 ubi->lookuptbl[e->pnum] = NULL; in wl_entry_destroy() 188 static int do_work(struct ubi_device *ubi) in do_work() argument 201 down_read(&ubi->work_sem); in do_work() 202 spin_lock(&ubi->wl_lock); in do_work() 203 if (list_empty(&ubi->works)) { in do_work() 204 spin_unlock(&ubi->wl_lock); in do_work() [all …]
|
D | build.c | 155 int ubi_volume_notify(struct ubi_device *ubi, struct ubi_volume *vol, int ntype) in ubi_volume_notify() argument 160 ubi_do_get_device_info(ubi, &nt.di); in ubi_volume_notify() 161 ubi_do_get_volume_info(ubi, vol, &nt.vi); in ubi_volume_notify() 168 ret = ubi_update_fastmap(ubi); in ubi_volume_notify() 170 ubi_msg(ubi, "Unable to write a new fastmap: %i", ret); in ubi_volume_notify() 187 int ubi_notify_all(struct ubi_device *ubi, int ntype, struct notifier_block *nb) in ubi_notify_all() argument 192 ubi_do_get_device_info(ubi, &nt.di); in ubi_notify_all() 194 mutex_lock(&ubi->device_mutex); in ubi_notify_all() 195 for (i = 0; i < ubi->vtbl_slots; i++) { in ubi_notify_all() 201 if (!ubi->volumes[i]) in ubi_notify_all() [all …]
|
D | fastmap-wl.c | 14 struct ubi_device *ubi = container_of(wrk, struct ubi_device, fm_work); in update_fastmap_work_fn() local 16 ubi_update_fastmap(ubi); in update_fastmap_work_fn() 17 spin_lock(&ubi->wl_lock); in update_fastmap_work_fn() 18 ubi->fm_work_scheduled = 0; in update_fastmap_work_fn() 19 spin_unlock(&ubi->wl_lock); in update_fastmap_work_fn() 42 static inline void return_unused_peb(struct ubi_device *ubi, in return_unused_peb() argument 45 wl_tree_add(e, &ubi->free); in return_unused_peb() 46 ubi->free_count++; in return_unused_peb() 54 static void return_unused_pool_pebs(struct ubi_device *ubi, in return_unused_pool_pebs() argument 61 e = ubi->lookuptbl[pool->pebs[i]]; in return_unused_pool_pebs() [all …]
|
D | io.c | 81 static int self_check_not_bad(const struct ubi_device *ubi, int pnum); 82 static int self_check_peb_ec_hdr(const struct ubi_device *ubi, int pnum); 83 static int self_check_ec_hdr(const struct ubi_device *ubi, int pnum, 85 static int self_check_peb_vid_hdr(const struct ubi_device *ubi, int pnum); 86 static int self_check_vid_hdr(const struct ubi_device *ubi, int pnum, 88 static int self_check_write(struct ubi_device *ubi, const void *buf, int pnum, 113 int ubi_io_read(const struct ubi_device *ubi, void *buf, int pnum, int offset, in ubi_io_read() argument 122 ubi_assert(pnum >= 0 && pnum < ubi->peb_count); in ubi_io_read() 123 ubi_assert(offset >= 0 && offset + len <= ubi->peb_size); in ubi_io_read() 126 err = self_check_not_bad(ubi, pnum); in ubi_io_read() [all …]
|
D | vmt.c | 19 static int self_check_volumes(struct ubi_device *ubi); 59 struct ubi_device *ubi = vol->ubi; in vol_attribute_show() local 61 spin_lock(&ubi->volumes_lock); in vol_attribute_show() 62 if (!ubi->volumes[vol->vol_id]) { in vol_attribute_show() 63 spin_unlock(&ubi->volumes_lock); in vol_attribute_show() 68 spin_unlock(&ubi->volumes_lock); in vol_attribute_show() 97 spin_lock(&ubi->volumes_lock); in vol_attribute_show() 100 spin_unlock(&ubi->volumes_lock); in vol_attribute_show() 138 int ubi_create_volume(struct ubi_device *ubi, struct ubi_mkvol_req *req) in ubi_create_volume() argument 145 if (ubi->ro_mode) in ubi_create_volume() [all …]
|
D | vtbl.c | 54 static void self_vtbl_check(const struct ubi_device *ubi); 63 static int ubi_update_layout_vol(struct ubi_device *ubi) in ubi_update_layout_vol() argument 68 layout_vol = ubi->volumes[vol_id2idx(ubi, UBI_LAYOUT_VOLUME_ID)]; in ubi_update_layout_vol() 70 err = ubi_eba_atomic_leb_change(ubi, layout_vol, i, ubi->vtbl, in ubi_update_layout_vol() 71 ubi->vtbl_size); in ubi_update_layout_vol() 90 int ubi_change_vtbl_record(struct ubi_device *ubi, int idx, in ubi_change_vtbl_record() argument 96 ubi_assert(idx >= 0 && idx < ubi->vtbl_slots); in ubi_change_vtbl_record() 105 memcpy(&ubi->vtbl[idx], vtbl_rec, sizeof(struct ubi_vtbl_record)); in ubi_change_vtbl_record() 106 err = ubi_update_layout_vol(ubi); in ubi_change_vtbl_record() 108 self_vtbl_check(ubi); in ubi_change_vtbl_record() [all …]
|
D | eba.c | 71 unsigned long long ubi_next_sqnum(struct ubi_device *ubi) in ubi_next_sqnum() argument 75 spin_lock(&ubi->ltree_lock); in ubi_next_sqnum() 76 sqnum = ubi->global_sqnum++; in ubi_next_sqnum() 77 spin_unlock(&ubi->ltree_lock); in ubi_next_sqnum() 90 static int ubi_get_compat(const struct ubi_device *ubi, int vol_id) in ubi_get_compat() argument 210 static struct ubi_ltree_entry *ltree_lookup(struct ubi_device *ubi, int vol_id, in ltree_lookup() argument 215 p = ubi->ltree.rb_node; in ltree_lookup() 249 static struct ubi_ltree_entry *ltree_add_entry(struct ubi_device *ubi, in ltree_add_entry() argument 263 spin_lock(&ubi->ltree_lock); in ltree_add_entry() 264 le1 = ltree_lookup(ubi, vol_id, lnum); in ltree_add_entry() [all …]
|
D | ubi.h | 43 void ubi_msg(const struct ubi_device *ubi, const char *fmt, ...); 47 void ubi_warn(const struct ubi_device *ubi, const char *fmt, ...); 51 void ubi_err(const struct ubi_device *ubi, const char *fmt, ...); 341 struct ubi_device *ubi; member 803 int (*func)(struct ubi_device *ubi, struct ubi_work *wrk, int shutdown); 825 int ubi_add_to_av(struct ubi_device *ubi, struct ubi_attach_info *ai, int pnum, 831 struct ubi_ainf_peb *ubi_early_get_peb(struct ubi_device *ubi, 833 int ubi_attach(struct ubi_device *ubi, int force_scan); 837 int ubi_change_vtbl_record(struct ubi_device *ubi, int idx, 839 int ubi_vtbl_rename_volumes(struct ubi_device *ubi, [all …]
|
D | fastmap.c | 16 static inline unsigned long *init_seen(struct ubi_device *ubi) in init_seen() argument 20 if (!ubi_dbg_chk_fastmap(ubi)) in init_seen() 23 ret = bitmap_zalloc(ubi->peb_count, GFP_KERNEL); in init_seen() 45 static inline void set_seen(struct ubi_device *ubi, int pnum, unsigned long *seen) in set_seen() argument 47 if (!ubi_dbg_chk_fastmap(ubi) || !seen) in set_seen() 58 static int self_check_seen(struct ubi_device *ubi, unsigned long *seen) in self_check_seen() argument 62 if (!ubi_dbg_chk_fastmap(ubi) || !seen) in self_check_seen() 65 for (pnum = 0; pnum < ubi->peb_count; pnum++) { in self_check_seen() 66 if (!test_bit(pnum, seen) && ubi->lookuptbl[pnum]) { in self_check_seen() 67 ubi_err(ubi, "self-check failed for PEB %d, fastmap didn't see it", pnum); in self_check_seen() [all …]
|
D | kapi.c | 26 void ubi_do_get_device_info(struct ubi_device *ubi, struct ubi_device_info *di) in ubi_do_get_device_info() argument 28 di->ubi_num = ubi->ubi_num; in ubi_do_get_device_info() 29 di->leb_size = ubi->leb_size; in ubi_do_get_device_info() 30 di->leb_start = ubi->leb_start; in ubi_do_get_device_info() 31 di->min_io_size = ubi->min_io_size; in ubi_do_get_device_info() 32 di->max_write_size = ubi->max_write_size; in ubi_do_get_device_info() 33 di->ro_mode = ubi->ro_mode; in ubi_do_get_device_info() 34 di->cdev = ubi->cdev.dev; in ubi_do_get_device_info() 48 struct ubi_device *ubi; in ubi_get_device_info() local 52 ubi = ubi_get_device(ubi_num); in ubi_get_device_info() [all …]
|
D | misc.c | 22 int ubi_calc_data_len(const struct ubi_device *ubi, const void *buf, in ubi_calc_data_len() argument 27 ubi_assert(!(length & (ubi->min_io_size - 1))); in ubi_calc_data_len() 34 length = ALIGN(i + 1, ubi->min_io_size); in ubi_calc_data_len() 48 int ubi_check_volume(struct ubi_device *ubi, int vol_id) in ubi_check_volume() argument 52 struct ubi_volume *vol = ubi->volumes[vol_id]; in ubi_check_volume() 71 err = ubi_eba_read_leb(ubi, vol, i, buf, 0, size, 1); in ubi_check_volume() 92 void ubi_update_reserved(struct ubi_device *ubi) in ubi_update_reserved() argument 94 int need = ubi->beb_rsvd_level - ubi->beb_rsvd_pebs; in ubi_update_reserved() 96 if (need <= 0 || ubi->avail_pebs == 0) in ubi_update_reserved() 99 need = min_t(int, need, ubi->avail_pebs); in ubi_update_reserved() [all …]
|
D | attach.c | 79 static int self_check_ai(struct ubi_device *ubi, struct ubi_attach_info *ai); 330 static int validate_vid_hdr(const struct ubi_device *ubi, in validate_vid_hdr() argument 349 ubi_err(ubi, "inconsistent vol_id"); in validate_vid_hdr() 359 ubi_err(ubi, "inconsistent vol_type"); in validate_vid_hdr() 364 ubi_err(ubi, "inconsistent used_ebs"); in validate_vid_hdr() 369 ubi_err(ubi, "inconsistent data_pad"); in validate_vid_hdr() 377 ubi_err(ubi, "inconsistent VID header at PEB %d", pnum); in validate_vid_hdr() 438 int ubi_compare_lebs(struct ubi_device *ubi, const struct ubi_ainf_peb *aeb, in ubi_compare_lebs() argument 455 ubi_err(ubi, "unsupported on-flash UBI format"); in ubi_compare_lebs() 486 vidb = ubi_alloc_vid_buf(ubi, GFP_KERNEL); in ubi_compare_lebs() [all …]
|
D | debug.h | 11 void ubi_dump_flash(struct ubi_device *ubi, int pnum, int offset, int len); 48 int ubi_self_check_all_ff(struct ubi_device *ubi, int pnum, int offset, 52 int ubi_debugfs_init_dev(struct ubi_device *ubi); 53 void ubi_debugfs_exit_dev(struct ubi_device *ubi); 62 static inline int ubi_dbg_is_bgt_disabled(const struct ubi_device *ubi) in ubi_dbg_is_bgt_disabled() argument 64 return ubi->dbg.disable_bgt; in ubi_dbg_is_bgt_disabled() 73 static inline int ubi_dbg_is_bitflip(const struct ubi_device *ubi) in ubi_dbg_is_bitflip() argument 75 if (ubi->dbg.emulate_bitflips) in ubi_dbg_is_bitflip() 87 static inline int ubi_dbg_is_write_failure(const struct ubi_device *ubi) in ubi_dbg_is_write_failure() argument 89 if (ubi->dbg.emulate_io_failures) in ubi_dbg_is_write_failure() [all …]
|
D | cdev.c | 49 spin_lock(&vol->ubi->volumes_lock); in get_exclusive() 53 ubi_err(vol->ubi, "%d users for volume %d", users, vol->vol_id); in get_exclusive() 61 spin_unlock(&vol->ubi->volumes_lock); in get_exclusive() 75 spin_lock(&vol->ubi->volumes_lock); in revoke_exclusive() 87 spin_unlock(&vol->ubi->volumes_lock); in revoke_exclusive() 123 vol->ubi->ubi_num, vol->vol_id, desc->mode); in vol_cdev_release() 126 ubi_warn(vol->ubi, "update of volume %d not finished, volume is damaged", in vol_cdev_release() 133 vol->upd_received, vol->upd_bytes, vol->ubi->ubi_num, in vol_cdev_release() 150 ubi_err(vol->ubi, "updating"); in vol_cdev_llseek() 161 struct ubi_device *ubi = desc->vol->ubi; in vol_cdev_fsync() local [all …]
|
D | upd.c | 41 static int set_update_marker(struct ubi_device *ubi, struct ubi_volume *vol) in set_update_marker() argument 49 ubi_assert(ubi->vtbl[vol->vol_id].upd_marker); in set_update_marker() 54 vtbl_rec = ubi->vtbl[vol->vol_id]; in set_update_marker() 57 mutex_lock(&ubi->device_mutex); in set_update_marker() 58 err = ubi_change_vtbl_record(ubi, vol->vol_id, &vtbl_rec); in set_update_marker() 60 mutex_unlock(&ubi->device_mutex); in set_update_marker() 74 static int clear_update_marker(struct ubi_device *ubi, struct ubi_volume *vol, in clear_update_marker() argument 82 vtbl_rec = ubi->vtbl[vol->vol_id]; in clear_update_marker() 97 mutex_lock(&ubi->device_mutex); in clear_update_marker() 98 err = ubi_change_vtbl_record(ubi, vol->vol_id, &vtbl_rec); in clear_update_marker() [all …]
|
D | debug.c | 22 void ubi_dump_flash(struct ubi_device *ubi, int pnum, int offset, int len) in ubi_dump_flash() argument 27 loff_t addr = (loff_t)pnum * ubi->peb_size + offset; in ubi_dump_flash() 32 err = mtd_read(ubi->mtd, addr, len, &read, buf); in ubi_dump_flash() 34 ubi_err(ubi, "err %d while reading %d bytes from PEB %d:%d, read %zd bytes", in ubi_dump_flash() 39 ubi_msg(ubi, "dumping %d bytes of data from PEB %d, offset %d", in ubi_dump_flash() 253 struct ubi_device *ubi; in dfs_file_read() local 258 ubi = ubi_get_device(ubi_num); in dfs_file_read() 259 if (!ubi) in dfs_file_read() 261 d = &ubi->dbg; in dfs_file_read() 306 ubi_put_device(ubi); in dfs_file_read() [all …]
|
D | wl.h | 7 static struct ubi_wl_entry *get_peb_for_wl(struct ubi_device *ubi); 8 static struct ubi_wl_entry *next_peb_for_wl(struct ubi_device *ubi); 9 static bool need_wear_leveling(struct ubi_device *ubi); 10 static void ubi_fastmap_close(struct ubi_device *ubi); 11 static inline void ubi_fastmap_init(struct ubi_device *ubi, int *count) in ubi_fastmap_init() argument 14 *count += (ubi->fm_size / ubi->leb_size) * 2; in ubi_fastmap_init() 15 INIT_WORK(&ubi->fm_work, update_fastmap_work_fn); in ubi_fastmap_init() 17 static struct ubi_wl_entry *may_reserve_for_fm(struct ubi_device *ubi, 21 static struct ubi_wl_entry *get_peb_for_wl(struct ubi_device *ubi); 22 static inline void ubi_fastmap_close(struct ubi_device *ubi) { } in ubi_fastmap_close() argument [all …]
|
D | Makefile | 2 obj-$(CONFIG_MTD_UBI) += ubi.o 4 ubi-y += vtbl.o vmt.o upd.o build.o cdev.o kapi.o eba.o io.o wl.o attach.o 5 ubi-y += misc.o debug.o 6 ubi-$(CONFIG_MTD_UBI_FASTMAP) += fastmap.o 7 ubi-$(CONFIG_MTD_UBI_BLOCK) += block.o
|
/drivers/mtd/ |
D | Makefile | 32 obj-$(CONFIG_MTD_UBI) += ubi/
|
D | Kconfig | 221 source "drivers/mtd/ubi/Kconfig"
|