aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/redboot.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/redboot.c')
-rw-r--r--drivers/mtd/redboot.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/drivers/mtd/redboot.c b/drivers/mtd/redboot.c
index 7b7ca5ab5ae4..8815c8dbef2d 100644
--- a/drivers/mtd/redboot.c
+++ b/drivers/mtd/redboot.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: redboot.c,v 1.18 2005/11/07 11:14:21 gleixner Exp $ 2 * $Id: redboot.c,v 1.19 2005/12/01 10:03:51 dwmw2 Exp $
3 * 3 *
4 * Parse RedBoot-style Flash Image System (FIS) tables and 4 * Parse RedBoot-style Flash Image System (FIS) tables and
5 * produce a Linux partition array to match. 5 * produce a Linux partition array to match.
@@ -89,8 +89,32 @@ static int parse_redboot_partitions(struct mtd_info *master,
89 i = numslots; 89 i = numslots;
90 break; 90 break;
91 } 91 }
92 if (!memcmp(buf[i].name, "FIS directory", 14)) 92 if (!memcmp(buf[i].name, "FIS directory", 14)) {
93 /* This is apparently the FIS directory entry for the
94 * FIS directory itself. The FIS directory size is
95 * one erase block; if the buf[i].size field is
96 * swab32(erasesize) then we know we are looking at
97 * a byte swapped FIS directory - swap all the entries!
98 * (NOTE: this is 'size' not 'data_length'; size is
99 * the full size of the entry.)
100 */
101 if (swab32(buf[i].size) == master->erasesize) {
102 int j;
103 for (j = 0; j < numslots && buf[j].name[0] != 0xff; ++j) {
104 /* The unsigned long fields were written with the
105 * wrong byte sex, name and pad have no byte sex.
106 */
107 swab32s(&buf[j].flash_base);
108 swab32s(&buf[j].mem_base);
109 swab32s(&buf[j].size);
110 swab32s(&buf[j].entry_point);
111 swab32s(&buf[j].data_length);
112 swab32s(&buf[j].desc_cksum);
113 swab32s(&buf[j].file_cksum);
114 }
115 }
93 break; 116 break;
117 }
94 } 118 }
95 if (i == numslots) { 119 if (i == numslots) {
96 /* Didn't find it */ 120 /* Didn't find it */