9
0
Fork 0

ubi: bump ubi-media.h to newest version

Needed for ubiformat, we are interested in image_seq especially.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Wolfram Sang 2012-12-17 16:48:27 +01:00 committed by Sascha Hauer
parent 52e60618d6
commit 68e00c165c
1 changed files with 30 additions and 25 deletions

View File

@ -11,7 +11,6 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
* the GNU General Public License for more details. * the GNU General Public License for more details.
* *
*
* Authors: Artem Bityutskiy (Битюцкий Артём) * Authors: Artem Bityutskiy (Битюцкий Артём)
* Thomas Gleixner * Thomas Gleixner
* Frank Haverkamp * Frank Haverkamp
@ -95,10 +94,11 @@ enum {
* Compatibility constants used by internal volumes. * Compatibility constants used by internal volumes.
* *
* @UBI_COMPAT_DELETE: delete this internal volume before anything is written * @UBI_COMPAT_DELETE: delete this internal volume before anything is written
* to the flash * to the flash
* @UBI_COMPAT_RO: attach this device in read-only mode * @UBI_COMPAT_RO: attach this device in read-only mode
* @UBI_COMPAT_PRESERVE: preserve this internal volume - do not touch its * @UBI_COMPAT_PRESERVE: preserve this internal volume - do not touch its
* physical eraseblocks, don't allow the wear-leveling unit to move them * physical eraseblocks, don't allow the wear-leveling
* sub-system to move them
* @UBI_COMPAT_REJECT: reject this UBI image * @UBI_COMPAT_REJECT: reject this UBI image
*/ */
enum { enum {
@ -120,18 +120,19 @@ enum {
* struct ubi_ec_hdr - UBI erase counter header. * struct ubi_ec_hdr - UBI erase counter header.
* @magic: erase counter header magic number (%UBI_EC_HDR_MAGIC) * @magic: erase counter header magic number (%UBI_EC_HDR_MAGIC)
* @version: version of UBI implementation which is supposed to accept this * @version: version of UBI implementation which is supposed to accept this
* UBI image * UBI image
* @padding1: reserved for future, zeroes * @padding1: reserved for future, zeroes
* @ec: the erase counter * @ec: the erase counter
* @vid_hdr_offset: where the VID header starts * @vid_hdr_offset: where the VID header starts
* @data_offset: where the user data start * @data_offset: where the user data start
* @image_seq: image sequence number
* @padding2: reserved for future, zeroes * @padding2: reserved for future, zeroes
* @hdr_crc: erase counter header CRC checksum * @hdr_crc: erase counter header CRC checksum
* *
* The erase counter header takes 64 bytes and has a plenty of unused space for * The erase counter header takes 64 bytes and has a plenty of unused space for
* future usage. The unused fields are zeroed. The @version field is used to * future usage. The unused fields are zeroed. The @version field is used to
* indicate the version of UBI implementation which is supposed to be able to * indicate the version of UBI implementation which is supposed to be able to
* work with this UBI image. If @version is greater then the current UBI * work with this UBI image. If @version is greater than the current UBI
* version, the image is rejected. This may be useful in future if something * version, the image is rejected. This may be useful in future if something
* is changed radically. This field is duplicated in the volume identifier * is changed radically. This field is duplicated in the volume identifier
* header. * header.
@ -140,6 +141,14 @@ enum {
* volume identifier header and user data, relative to the beginning of the * volume identifier header and user data, relative to the beginning of the
* physical eraseblock. These values have to be the same for all physical * physical eraseblock. These values have to be the same for all physical
* eraseblocks. * eraseblocks.
*
* The @image_seq field is used to validate a UBI image that has been prepared
* for a UBI device. The @image_seq value can be any value, but it must be the
* same on all eraseblocks. UBI will ensure that all new erase counter headers
* also contain this value, and will check the value when scanning at start-up.
* One way to make use of @image_seq is to increase its value by one every time
* an image is flashed over an existing image, then, if the flashing does not
* complete, UBI will detect the error when scanning.
*/ */
struct ubi_ec_hdr { struct ubi_ec_hdr {
__be32 magic; __be32 magic;
@ -148,7 +157,8 @@ struct ubi_ec_hdr {
__be64 ec; /* Warning: the current limit is 31-bit anyway! */ __be64 ec; /* Warning: the current limit is 31-bit anyway! */
__be32 vid_hdr_offset; __be32 vid_hdr_offset;
__be32 data_offset; __be32 data_offset;
__u8 padding2[36]; __be32 image_seq;
__u8 padding2[32];
__be32 hdr_crc; __be32 hdr_crc;
} __attribute__ ((packed)); } __attribute__ ((packed));
@ -156,24 +166,23 @@ struct ubi_ec_hdr {
* struct ubi_vid_hdr - on-flash UBI volume identifier header. * struct ubi_vid_hdr - on-flash UBI volume identifier header.
* @magic: volume identifier header magic number (%UBI_VID_HDR_MAGIC) * @magic: volume identifier header magic number (%UBI_VID_HDR_MAGIC)
* @version: UBI implementation version which is supposed to accept this UBI * @version: UBI implementation version which is supposed to accept this UBI
* image (%UBI_VERSION) * image (%UBI_VERSION)
* @vol_type: volume type (%UBI_VID_DYNAMIC or %UBI_VID_STATIC) * @vol_type: volume type (%UBI_VID_DYNAMIC or %UBI_VID_STATIC)
* @copy_flag: if this logical eraseblock was copied from another physical * @copy_flag: if this logical eraseblock was copied from another physical
* eraseblock (for wear-leveling reasons) * eraseblock (for wear-leveling reasons)
* @compat: compatibility of this volume (%0, %UBI_COMPAT_DELETE, * @compat: compatibility of this volume (%0, %UBI_COMPAT_DELETE,
* %UBI_COMPAT_IGNORE, %UBI_COMPAT_PRESERVE, or %UBI_COMPAT_REJECT) * %UBI_COMPAT_IGNORE, %UBI_COMPAT_PRESERVE, or %UBI_COMPAT_REJECT)
* @vol_id: ID of this volume * @vol_id: ID of this volume
* @lnum: logical eraseblock number * @lnum: logical eraseblock number
* @leb_ver: version of this logical eraseblock (IMPORTANT: obsolete, to be * @padding1: reserved for future, zeroes
* removed, kept only for not breaking older UBI users)
* @data_size: how many bytes of data this logical eraseblock contains * @data_size: how many bytes of data this logical eraseblock contains
* @used_ebs: total number of used logical eraseblocks in this volume * @used_ebs: total number of used logical eraseblocks in this volume
* @data_pad: how many bytes at the end of this physical eraseblock are not * @data_pad: how many bytes at the end of this physical eraseblock are not
* used * used
* @data_crc: CRC checksum of the data stored in this logical eraseblock * @data_crc: CRC checksum of the data stored in this logical eraseblock
* @padding1: reserved for future, zeroes
* @sqnum: sequence number
* @padding2: reserved for future, zeroes * @padding2: reserved for future, zeroes
* @sqnum: sequence number
* @padding3: reserved for future, zeroes
* @hdr_crc: volume identifier header CRC checksum * @hdr_crc: volume identifier header CRC checksum
* *
* The @sqnum is the value of the global sequence counter at the time when this * The @sqnum is the value of the global sequence counter at the time when this
@ -184,7 +193,7 @@ struct ubi_ec_hdr {
* (sequence number) is used to distinguish between older and newer versions of * (sequence number) is used to distinguish between older and newer versions of
* logical eraseblocks. * logical eraseblocks.
* *
* There are 2 situations when there may be more then one physical eraseblock * There are 2 situations when there may be more than one physical eraseblock
* corresponding to the same logical eraseblock, i.e., having the same @vol_id * corresponding to the same logical eraseblock, i.e., having the same @vol_id
* and @lnum values in the volume identifier header. Suppose we have a logical * and @lnum values in the volume identifier header. Suppose we have a logical
* eraseblock L and it is mapped to the physical eraseblock P. * eraseblock L and it is mapped to the physical eraseblock P.
@ -221,10 +230,6 @@ struct ubi_ec_hdr {
* checksum is correct, this physical eraseblock is selected (P1). Otherwise * checksum is correct, this physical eraseblock is selected (P1). Otherwise
* the older one (P) is selected. * the older one (P) is selected.
* *
* Note, there is an obsolete @leb_ver field which was used instead of @sqnum
* in the past. But it is not used anymore and we keep it in order to be able
* to deal with old UBI images. It will be removed at some point.
*
* There are 2 sorts of volumes in UBI: user volumes and internal volumes. * There are 2 sorts of volumes in UBI: user volumes and internal volumes.
* Internal volumes are not seen from outside and are used for various internal * Internal volumes are not seen from outside and are used for various internal
* UBI purposes. In this implementation there is only one internal volume - the * UBI purposes. In this implementation there is only one internal volume - the
@ -245,9 +250,9 @@ struct ubi_ec_hdr {
* The @data_crc field contains the CRC checksum of the contents of the logical * The @data_crc field contains the CRC checksum of the contents of the logical
* eraseblock if this is a static volume. In case of dynamic volumes, it does * eraseblock if this is a static volume. In case of dynamic volumes, it does
* not contain the CRC checksum as a rule. The only exception is when the * not contain the CRC checksum as a rule. The only exception is when the
* data of the physical eraseblock was moved by the wear-leveling unit, then * data of the physical eraseblock was moved by the wear-leveling sub-system,
* the wear-leveling unit calculates the data CRC and stores it in the * then the wear-leveling sub-system calculates the data CRC and stores it in
* @data_crc field. And of course, the @copy_flag is %in this case. * the @data_crc field. And of course, the @copy_flag is %in this case.
* *
* The @data_size field is used only for static volumes because UBI has to know * The @data_size field is used only for static volumes because UBI has to know
* how many bytes of data are stored in this eraseblock. For dynamic volumes, * how many bytes of data are stored in this eraseblock. For dynamic volumes,
@ -274,14 +279,14 @@ struct ubi_vid_hdr {
__u8 compat; __u8 compat;
__be32 vol_id; __be32 vol_id;
__be32 lnum; __be32 lnum;
__be32 leb_ver; /* obsolete, to be removed, don't use */ __be32 leb_ver;
__be32 data_size; __be32 data_size;
__be32 used_ebs; __be32 used_ebs;
__be32 data_pad; __be32 data_pad;
__be32 data_crc; __be32 data_crc;
__u8 padding1[4]; __u8 padding2[4];
__be64 sqnum; __be64 sqnum;
__u8 padding2[12]; __u8 padding3[12];
__be32 hdr_crc; __be32 hdr_crc;
} __attribute__ ((packed)); } __attribute__ ((packed));