/openbmc/u-boot/doc/ |
H A D | README.ubi | 2 UBI usage in U-Boot 5 UBI support in U-Boot is broken down into five separate commands. 6 The first is the ubi command, which has six subcommands: 8 => help ubi 9 ubi - ubi commands 12 ubi part [part] [offset] 14 ubi info [l[ayout]] - Display volume and ubi layout information 15 ubi create[vol] volume [size] [type] - create volume name with size 16 ubi write[vol] address volume size - Write volume from address with size 17 ubi write.part address volume size [fullsize] [all …]
|
/openbmc/linux/drivers/mtd/ubi/ |
H A D | build.c | 11 * This file includes UBI initialization and building of UBI devices. 13 * When UBI is initialized, it attaches all the MTD devices specified as the 15 * specified, UBI does not attach any MTD device, but it is possible to do 16 * later using the "UBI control device". 32 #include "ubi.h" 53 * @ubi_num: UBI number 72 /* UBI module parameter to enable fastmap automatically on non-fastmap images */ 80 /* UBI control character device */ 87 /* All UBI devices in system */ 90 /* Serializes UBI devices creations and removals */ [all …]
|
H A 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() 51 * @ubi: UBI device description object 54 static void return_unused_pool_pebs(struct ubi_device *ubi, in return_unused_pool_pebs() argument [all …]
|
H A D | wl.c | 9 * UBI wear-leveling sub-system. 23 * done asynchronously in context of the per-UBI device background thread, 37 * As it was said, for the UBI sub-system all physical eraseblocks are either 92 #include "ubi.h" 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, 137 * the @ubi->used and @ubi->free RB-trees. 169 * @ubi: UBI device description object 175 static void wl_entry_destroy(struct ubi_device *ubi, struct ubi_wl_entry *e) in wl_entry_destroy() argument [all …]
|
H A D | vmt.c | 17 #include "ubi.h" 19 static int self_check_volumes(struct ubi_device *ubi); 24 /* Device attributes corresponding to files in '/<sysfs>/class/ubi/ubiX_Y' */ 43 * "Show" method for files in '/<sysfs>/class/ubi/ubiX_Y/'. 47 * /<sysfs>/class/ubi/ubiX_Y/reserved_ebs; 49 * C. process 1 starts reading the /<sysfs>/class/ubi/ubiX_Y/reserved_ebs file; 52 * out that the volume was removed from the @ubi->volumes array. 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() [all …]
|
H A D | io.c | 10 * UBI input/output sub-system. 14 * writing UBI headers. 26 * changed. For example, for different reasons (e.g., optimization) UBI may be 28 * offset. Of course, if the offset of the VID header is unaligned, UBI adds 32 * About minimal I/O units. In general, UBI assumes flash device model where 35 * @ubi->mtd->writesize field. But as an exception, UBI admits use of another 40 * write operations to one NAND page. In this case UBI can fit EC and VID 41 * headers at one NAND page. Thus, UBI may use "sub-page" size as the minimal 42 * I/O unit for the headers (the @ubi->hdrs_min_io_size field). But it still 43 * reports NAND page size (@ubi->min_io_size) as a minimal I/O unit for the UBI [all …]
|
H A D | fastmap.c | 10 #include "ubi.h" 14 * @ubi: UBI device description object 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() 32 * @seen: integer array of @ubi->peb_count size 41 * @ubi: UBI device description object 43 * @seen: integer array of @ubi->peb_count size 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() [all …]
|
H A D | vtbl.c | 29 * In this UBI implementation the on-flash volume table does not contain any 52 #include "ubi.h" 54 static void self_vtbl_check(const struct ubi_device *ubi); 61 * @ubi: UBI device description object 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() 81 * @ubi: UBI device description object 90 int ubi_change_vtbl_record(struct ubi_device *ubi, int idx, in ubi_change_vtbl_record() argument [all …]
|
H A D | eba.c | 9 * The UBI Eraseblock Association (EBA) sub-system. 34 #include "ubi.h" 65 * @ubi: UBI device description object 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() 84 * @ubi: UBI device description object 90 static int ubi_get_compat(const struct ubi_device *ubi, int vol_id) in ubi_get_compat() argument 202 * @ubi: UBI device description object [all …]
|
H A D | misc.c | 8 /* Here we keep miscellaneous functions which are used all over the UBI code */ 10 #include "ubi.h" 14 * @ubi: UBI device description object 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() 40 * @ubi: UBI device description object 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() [all …]
|
H A D | kapi.c | 8 /* This file mostly implements UBI kernel API functions */ 16 #include "ubi.h" 19 * ubi_do_get_device_info - get information about UBI device. 20 * @ubi: UBI device description object 23 * This function is the same as 'ubi_get_device_info()', but it assumes the UBI 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() [all …]
|
/openbmc/u-boot/drivers/mtd/ubi/ |
H A D | build.c | 11 * This file includes UBI initialization and building of UBI devices. 13 * When UBI is initialized, it attaches all the MTD devices specified as the 15 * specified, UBI does not attach any MTD device, but it is possible to do 16 * later using the "UBI control device". 39 #include "ubi.h" 57 #error Malloc area too small for UBI, increase CONFIG_SYS_MALLOC_LEN to >= 512k 81 /* UBI module parameter to enable fastmap automatically on non-fastmap images */ 102 /* UBI control character device */ 110 /* All UBI devices in system */ 118 /* Serializes UBI devices creations and removals */ [all …]
|
H A D | wl.c | 9 * UBI wear-leveling sub-system. 23 * done asynchronously in context of the per-UBI device background thread, 37 * As it was said, for the UBI sub-system all physical eraseblocks are either 97 #include "ubi.h" 130 static int self_check_ec(struct ubi_device *ubi, int pnum, int ec); 131 static int self_check_in_wl_tree(const struct ubi_device *ubi, 133 static int self_check_in_pq(const struct ubi_device *ubi, 142 * the @ubi->used and @ubi->free RB-trees. 174 * @ubi: UBI device description object 180 static void wl_entry_destroy(struct ubi_device *ubi, struct ubi_wl_entry *e) in wl_entry_destroy() argument [all …]
|
H A D | fastmap-wl.c | 16 void update_fastmap_work_fn(struct ubi_device *ubi) in update_fastmap_work_fn() 20 struct ubi_device *ubi = container_of(wrk, struct ubi_device, fm_work); in update_fastmap_work_fn() local 23 ubi_update_fastmap(ubi); in update_fastmap_work_fn() 24 spin_lock(&ubi->wl_lock); in update_fastmap_work_fn() 25 ubi->fm_work_scheduled = 0; in update_fastmap_work_fn() 26 spin_unlock(&ubi->wl_lock); in update_fastmap_work_fn() 51 * @ubi: UBI device description object 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() 62 wl_tree_add(e, &ubi->free); in return_unused_pool_pebs() [all …]
|
H A D | vmt.c | 23 #include "ubi.h" 25 static int self_check_volumes(struct ubi_device *ubi); 31 /* Device attributes corresponding to files in '/<sysfs>/class/ubi/ubiX_Y' */ 50 * "Show" method for files in '/<sysfs>/class/ubi/ubiX_Y/'. 54 * /<sysfs>/class/ubi/ubiX_Y/reserved_ebs; 56 * C. process 1 starts reading the /<sysfs>/class/ubi/ubiX_Y/reserved_ebs file; 59 * out that the volume was removed from the @ubi->volumes array. 66 struct ubi_device *ubi; in vol_attribute_show() local 68 ubi = ubi_get_device(vol->ubi->ubi_num); in vol_attribute_show() 69 if (!ubi) in vol_attribute_show() [all …]
|
H A D | eba.c | 9 * The UBI Eraseblock Association (EBA) sub-system. 39 #include "ubi.h" 46 * @ubi: UBI device description object 52 unsigned long long ubi_next_sqnum(struct ubi_device *ubi) in ubi_next_sqnum() argument 56 spin_lock(&ubi->ltree_lock); in ubi_next_sqnum() 57 sqnum = ubi->global_sqnum++; in ubi_next_sqnum() 58 spin_unlock(&ubi->ltree_lock); in ubi_next_sqnum() 65 * @ubi: UBI device description object 71 static int ubi_get_compat(const struct ubi_device *ubi, int vol_id) in ubi_get_compat() argument 80 * @ubi: UBI device description object [all …]
|
H A D | io.c | 10 * UBI input/output sub-system. 14 * writing UBI headers. 26 * changed. For example, for different reasons (e.g., optimization) UBI may be 28 * offset. Of course, if the offset of the VID header is unaligned, UBI adds 32 * About minimal I/O units. In general, UBI assumes flash device model where 35 * @ubi->mtd->writesize field. But as an exception, UBI admits of using another 40 * write operations to one NAND page. In this case UBI can fit EC and VID 41 * headers at one NAND page. Thus, UBI may use "sub-page" size as the minimal 42 * I/O unit for the headers (the @ubi->hdrs_min_io_size field). But it still 43 * reports NAND page size (@ubi->min_io_size) as a minimal I/O unit for the UBI [all …]
|
H A D | fastmap.c | 19 #include "ubi.h" 23 * @ubi: UBI device description object 25 static inline int *init_seen(struct ubi_device *ubi) in init_seen() argument 29 if (!ubi_dbg_chk_fastmap(ubi)) in init_seen() 32 ret = kcalloc(ubi->peb_count, sizeof(int), GFP_KERNEL); in init_seen() 41 * @seen: integer array of @ubi->peb_count size 50 * @ubi: UBI device description object 52 * @seen: integer array of @ubi->peb_count size 54 static inline void set_seen(struct ubi_device *ubi, int pnum, int *seen) in set_seen() argument 56 if (!ubi_dbg_chk_fastmap(ubi) || !seen) in set_seen() [all …]
|
H A D | vtbl.c | 29 * In this UBI implementation the on-flash volume table does not contain any 58 #include "ubi.h" 60 static void self_vtbl_check(const struct ubi_device *ubi); 67 * @ubi: UBI device description object 69 static int ubi_update_layout_vol(struct ubi_device *ubi) in ubi_update_layout_vol() argument 74 layout_vol = ubi->volumes[vol_id2idx(ubi, UBI_LAYOUT_VOLUME_ID)]; in ubi_update_layout_vol() 76 err = ubi_eba_atomic_leb_change(ubi, layout_vol, i, ubi->vtbl, in ubi_update_layout_vol() 77 ubi->vtbl_size); in ubi_update_layout_vol() 87 * @ubi: UBI device description object 96 int ubi_change_vtbl_record(struct ubi_device *ubi, int idx, in ubi_change_vtbl_record() argument [all …]
|
H A D | kapi.c | 8 /* This file mostly implements UBI kernel API functions */ 21 #include "ubi.h" 24 * ubi_do_get_device_info - get information about UBI device. 25 * @ubi: UBI device description object 28 * This function is the same as 'ubi_get_device_info()', but it assumes the UBI 31 void ubi_do_get_device_info(struct ubi_device *ubi, struct ubi_device_info *di) in ubi_do_get_device_info() argument 33 di->ubi_num = ubi->ubi_num; in ubi_do_get_device_info() 34 di->leb_size = ubi->leb_size; in ubi_do_get_device_info() 35 di->leb_start = ubi->leb_start; in ubi_do_get_device_info() 36 di->min_io_size = ubi->min_io_size; in ubi_do_get_device_info() [all …]
|
H A D | misc.c | 8 /* Here we keep miscellaneous functions which are used all over the UBI code */ 11 #include "ubi.h" 15 * @ubi: UBI device description object 23 int ubi_calc_data_len(const struct ubi_device *ubi, const void *buf, in ubi_calc_data_len() argument 28 ubi_assert(!(length & (ubi->min_io_size - 1))); in ubi_calc_data_len() 35 length = ALIGN(i + 1, ubi->min_io_size); in ubi_calc_data_len() 41 * @ubi: UBI device description object 49 int ubi_check_volume(struct ubi_device *ubi, int vol_id) in ubi_check_volume() argument 53 struct ubi_volume *vol = ubi->volumes[vol_id]; in ubi_check_volume() 72 err = ubi_eba_read_leb(ubi, vol, i, buf, 0, size, 1); in ubi_check_volume() [all …]
|
H A D | ubi.h | 33 #include <linux/mtd/ubi.h> 34 #include "ubi-media.h" 35 #include <mtd/ubi-user.h> 37 /* Maximum number of supported UBI devices */ 40 /* UBI name used for character devices, sysfs, etc */ 41 #define UBI_NAME_STR "ubi" 43 /* Normal UBI messages */ 45 #define ubi_msg(ubi, fmt, ...) argument 47 #define ubi_msg(ubi, fmt, ...) printk(UBI_NAME_STR "%d: " fmt "\n", \ argument 48 ubi->ubi_num, ##__VA_ARGS__) [all …]
|
/openbmc/linux/Documentation/ABI/stable/ |
H A D | sysfs-class-ubi | 1 What: /sys/class/ubi/ 6 The ubi/ class sub-directory belongs to the UBI subsystem and 7 provides general UBI information, per-UBI device information 8 and per-UBI volume information. 10 What: /sys/class/ubi/version 15 This file contains version of the latest supported UBI on-media 17 However, if in the future UBI needs on-flash format changes 29 UBI devices (UBI device 0, 1, etc). They contain general UBI 30 device information and per UBI volume information (each UBI 31 device may have many UBI volumes) [all …]
|
/openbmc/u-boot/drivers/mtd/ubispl/ |
H A D | ubispl.c | 19 * ubi_calc_fm_size - calculates the fastmap size in bytes for an UBI device. 20 * @ubi: UBI device description object 22 static size_t ubi_calc_fm_size(struct ubi_scan_info *ubi) in ubi_calc_fm_size() argument 30 (ubi->peb_count * sizeof(struct ubi_fm_ec)) + in ubi_calc_fm_size() 32 (ubi->peb_count * sizeof(__be32))) + in ubi_calc_fm_size() 34 return roundup(size, ubi->leb_size); in ubi_calc_fm_size() 37 static int ubi_io_read(struct ubi_scan_info *ubi, void *buf, int pnum, in ubi_io_read() argument 40 return ubi->read(pnum + ubi->peb_offset, from, len, buf); in ubi_io_read() 43 static int ubi_io_is_bad(struct ubi_scan_info *ubi, int peb) in ubi_io_is_bad() argument 45 return peb >= ubi->peb_count || peb < 0; in ubi_io_is_bad() [all …]
|
/openbmc/u-boot/cmd/ |
H A D | ubi.c | 29 #define ubi_msg(fmt, ...) printf("UBI: " fmt "\n", ##__VA_ARGS__) 32 static struct ubi_device *ubi; variable 38 static void display_volume_info(struct ubi_device *ubi) in display_volume_info() argument 42 for (i = 0; i < (ubi->vtbl_slots + 1); i++) { in display_volume_info() 43 if (!ubi->volumes[i]) in display_volume_info() 45 ubi_dump_vol_info(ubi->volumes[i]); in display_volume_info() 49 static void display_ubi_info(struct ubi_device *ubi) in display_ubi_info() argument 51 ubi_msg("MTD device name: \"%s\"", ubi->mtd->name); in display_ubi_info() 52 ubi_msg("MTD device size: %llu MiB", ubi->flash_size >> 20); in display_ubi_info() 54 ubi->peb_size, ubi->peb_size >> 10); in display_ubi_info() [all …]
|