2 * The parts taken from the kernel implementation are:
4 * Copyright (c) International Business Machines Corp., 2006
6 * UBISPL specific defines:
8 * Copyright (c) Thomas Gleixner <tglx@linutronix.de>
10 * SPDX-License-Identifier: GPL 2.0+ BSD-3-Clause
14 * Contains various defines copy&pasted from ubi.h and ubi-user.h to make
15 * the upstream fastboot code happy.
17 #ifndef __UBOOT_UBI_WRAPPER_H
18 #define __UBOOT_UBI_WRAPPER_H
21 * Error codes returned by the I/O sub-system.
23 * UBI_IO_FF: the read region of flash contains only 0xFFs
24 * UBI_IO_FF_BITFLIPS: the same as %UBI_IO_FF, but also also there was a data
25 * integrity error reported by the MTD driver
26 * (uncorrectable ECC error in case of NAND)
27 * UBI_IO_BAD_HDR: the EC or VID header is corrupted (bad magic or CRC)
28 * UBI_IO_BAD_HDR_EBADMSG: the same as %UBI_IO_BAD_HDR, but also there was a
29 * data integrity error reported by the MTD driver
30 * (uncorrectable ECC error in case of NAND)
31 * UBI_IO_BITFLIPS: bit-flips were detected and corrected
33 * UBI_FASTMAP_ANCHOR: u-boot SPL add on to tell the caller that the fastmap
34 * anchor block has been found
36 * Note, it is probably better to have bit-flip and ebadmsg as flags which can
37 * be or'ed with other error code. But this is a big change because there are
38 * may callers, so it does not worth the risk of introducing a bug
44 UBI_IO_BAD_HDR_EBADMSG,
50 * UBI volume type constants.
52 * @UBI_DYNAMIC_VOLUME: dynamic volume
53 * @UBI_STATIC_VOLUME: static volume
56 UBI_DYNAMIC_VOLUME = 3,
57 UBI_STATIC_VOLUME = 4,
61 * Return codes of the fastmap sub-system
63 * UBI_NO_FASTMAP: No fastmap super block was found
64 * UBI_BAD_FASTMAP: A fastmap was found but it's unusable
72 * struct ubi_fastmap_layout - in-memory fastmap data structure.
73 * @e: PEBs used by the current fastmap
74 * @to_be_tortured: if non-zero tortured this PEB
75 * @used_blocks: number of used PEBs
76 * @max_pool_size: maximal size of the user pool
77 * @max_wl_pool_size: maximal size of the pool used by the WL sub-system
79 struct ubi_fastmap_layout {
80 struct ubi_wl_entry *e[UBI_FM_MAX_BLOCKS];
81 int to_be_tortured[UBI_FM_MAX_BLOCKS];
88 * struct ubi_fm_pool - in-memory fastmap pool
89 * @pebs: PEBs in this pool
90 * @used: number of used PEBs
91 * @size: total number of PEBs in this pool
92 * @max_size: maximal size of the pool
94 * A pool gets filled with up to max_size.
95 * If all PEBs within the pool are used a new fastmap will be written
96 * to the flash and the pool gets refilled with empty PEBs.
100 int pebs[UBI_FM_MAX_POOL_SIZE];