summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Haverkamp <haver@vnet.ibm.com>2007-11-24 11:04:51 +0100
committerFrank Haverkamp <haver@vnet.ibm.com>2007-11-24 11:04:51 +0100
commit636524b9c8fa81d0c07f1f0bbf3ac9e5f6287247 (patch)
treee46cd01ea64fb89eef7ca52b25ede977eac29a56
parent26c965bc654d67881fc54f4b24a552600752dadd (diff)
ubi-utils: unubi add physical erase block number for analysis
The number is usefull to analyze cards with broken flash content. Signed-off-by: Frank Haverkamp <haver@vnet.ibm.com>
-rw-r--r--ubi-utils/src/eb_chain.c17
-rw-r--r--ubi-utils/src/unubi.c1
-rw-r--r--ubi-utils/src/unubi_analyze.h1
3 files changed, 12 insertions, 7 deletions
diff --git a/ubi-utils/src/eb_chain.c b/ubi-utils/src/eb_chain.c
index 8f6e327..471efad 100644
--- a/ubi-utils/src/eb_chain.c
+++ b/ubi-utils/src/eb_chain.c
@@ -188,6 +188,8 @@ eb_chain_position(struct eb_info **head, uint32_t vol_id, uint32_t *lnum,
* chain, starting at head;
* this is intended for debuging purposes;
* always returns 0;
+ *
+ * FIXME I do not like the double list traversion ...
**/
int
eb_chain_print(FILE* stream, struct eb_info *head)
@@ -201,13 +203,13 @@ eb_chain_print(FILE* stream, struct eb_info *head)
fprintf(stream, "EMPTY\n");
return 0;
}
- /* 012345678012345678012345678012301230123 01234567 0123457 01234567*/
- fprintf(stream, "VOL_ID LNUM LEB_VER EC VID DAT PADDR DSIZE EC\n");
+ /* 012345678012345678012345678012301230123 0123 01234567 0123457 01234567*/
+ fprintf(stream, "VOL_ID LNUM LEB_VER EC VID DAT PBLK PADDR DSIZE EC\n");
cur = head;
while (cur != NULL) {
struct eb_info *hist;
- fprintf(stream, "%08x %-8u %-8u %-4s%-4s",
+ fprintf(stream, "%08x %-8u %08x %-4s%-4s",
ubi32_to_cpu(cur->vid.vol_id),
ubi32_to_cpu(cur->vid.lnum),
ubi32_to_cpu(cur->vid.leb_ver),
@@ -216,13 +218,13 @@ eb_chain_print(FILE* stream, struct eb_info *head)
if (cur->vid.vol_type == UBI_VID_STATIC)
fprintf(stream, "%-4s", cur->data_crc_ok ? "ok":"bad");
else fprintf(stream, "%-4s", cur->data_crc_ok ? "ok":"ign");
- fprintf(stream, " %08x %-8u %-8llu\n", cur->phys_addr,
- ubi32_to_cpu(cur->vid.data_size),
+ fprintf(stream, " %-4d %08x %-8u %-8llu\n", cur->phys_block,
+ cur->phys_addr, ubi32_to_cpu(cur->vid.data_size),
ubi64_to_cpu(cur->ec.ec));
hist = cur->older;
while (hist != NULL) {
- fprintf(stream, "%08x %-8u %-8u %-4s%-4s",
+ fprintf(stream, "%08x %-8u %08x %-4s%-4s",
ubi32_to_cpu(hist->vid.vol_id),
ubi32_to_cpu(hist->vid.lnum),
ubi32_to_cpu(hist->vid.leb_ver),
@@ -231,7 +233,8 @@ eb_chain_print(FILE* stream, struct eb_info *head)
if (hist->vid.vol_type == UBI_VID_STATIC)
fprintf(stream, "%-4s", hist->data_crc_ok ? "ok":"bad");
else fprintf(stream, "%-4s", hist->data_crc_ok ? "ok":"ign");
- fprintf(stream, " %08x %-8u %-8llu (*)\n", hist->phys_addr,
+ fprintf(stream, " %-4d %08x %-8u %-8llu (*)\n",
+ hist->phys_block, hist->phys_addr,
ubi32_to_cpu(hist->vid.data_size),
ubi64_to_cpu(hist->ec.ec));
diff --git a/ubi-utils/src/unubi.c b/ubi-utils/src/unubi.c
index 6ca9405..a50eff6 100644
--- a/ubi-utils/src/unubi.c
+++ b/ubi-utils/src/unubi.c
@@ -661,6 +661,7 @@ unubi_volumes(FILE* fpin, uint32_t *vols, size_t vc, struct args *a)
uint32_t crc;
cur->phys_addr = ftell(fpin);
+ cur->phys_block = cur->phys_addr / a->bsize;
cur->data_crc_ok = 0;
cur->ec_crc_ok = 0;
cur->vid_crc_ok = 0;
diff --git a/ubi-utils/src/unubi_analyze.h b/ubi-utils/src/unubi_analyze.h
index 243ea58..8588219 100644
--- a/ubi-utils/src/unubi_analyze.h
+++ b/ubi-utils/src/unubi_analyze.h
@@ -66,6 +66,7 @@ struct eb_info {
int vid_crc_ok;
int data_crc_ok;
uint32_t phys_addr;
+ int phys_block;
struct eb_info *next;
struct eb_info *older;