• Home
  • Raw
  • Download

Lines Matching +full:fis +full:- +full:index +full:- +full:block

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Parse RedBoot-style Flash Image System (FIS) tables and
7 * Copyright © 2001-2010 David Woodhouse <dwmw2@infradead.org>
26 unsigned char _pad[256-(16+7*sizeof(uint32_t))];
60 ret = of_property_read_u32(npart, "fis-index-block", &dirblock); in parse_redboot_of()
66 * Assign the block found in the device tree to the local in parse_redboot_of()
67 * directory block pointer. in parse_redboot_of()
95 offset = master->size + directory * master->erasesize; in parse_redboot_partitions()
99 printk(KERN_NOTICE "Failed to find a non-bad block to check for RedBoot partition table\n"); in parse_redboot_partitions()
100 return -EIO; in parse_redboot_partitions()
102 offset -= master->erasesize; in parse_redboot_partitions()
105 offset = directory * master->erasesize; in parse_redboot_partitions()
107 offset += master->erasesize; in parse_redboot_partitions()
108 if (offset == master->size) in parse_redboot_partitions()
112 buf = vmalloc(master->erasesize); in parse_redboot_partitions()
115 return -ENOMEM; in parse_redboot_partitions()
118 master->name, offset); in parse_redboot_partitions()
120 ret = mtd_read(master, offset, master->erasesize, &retlen, in parse_redboot_partitions()
126 if (retlen != master->erasesize) { in parse_redboot_partitions()
127 ret = -EIO; in parse_redboot_partitions()
131 numslots = (master->erasesize / sizeof(struct fis_image_desc)); in parse_redboot_partitions()
133 if (!memcmp(buf[i].name, "FIS directory", 14)) { in parse_redboot_partitions()
134 /* This is apparently the FIS directory entry for the in parse_redboot_partitions()
135 * FIS directory itself. The FIS directory size is in parse_redboot_partitions()
136 * one erase block; if the buf[i].size field is in parse_redboot_partitions()
138 * a byte swapped FIS directory - swap all the entries! in parse_redboot_partitions()
143 /* RedBoot can combine the FIS directory and in parse_redboot_partitions()
145 we assume wrong-endian if either the swapped in parse_redboot_partitions()
149 if (swab32(buf[i].size) == master->erasesize || in parse_redboot_partitions()
150 (buf[i].size > master->erasesize in parse_redboot_partitions()
151 && swab32(buf[i].size) < master->erasesize)) { in parse_redboot_partitions()
153 /* Update numslots based on actual FIS directory size */ in parse_redboot_partitions()
179 } else if (buf[i].size < master->erasesize) { in parse_redboot_partitions()
180 /* Update numslots based on actual FIS directory size */ in parse_redboot_partitions()
189 master->name); in parse_redboot_partitions()
210 ret = -ENOMEM; in parse_redboot_partitions()
213 new_fl->img = &buf[i]; in parse_redboot_partitions()
214 if (data && data->origin) in parse_redboot_partitions()
215 buf[i].flash_base -= data->origin; in parse_redboot_partitions()
217 buf[i].flash_base &= master->size-1; in parse_redboot_partitions()
223 while(*prev && (*prev)->img->flash_base < new_fl->img->flash_base) in parse_redboot_partitions()
224 prev = &(*prev)->next; in parse_redboot_partitions()
225 new_fl->next = *prev; in parse_redboot_partitions()
231 if (fl->img->flash_base) { in parse_redboot_partitions()
236 for (tmp_fl = fl; tmp_fl->next; tmp_fl = tmp_fl->next) { in parse_redboot_partitions()
237 …if (tmp_fl->img->flash_base + tmp_fl->img->size + master->erasesize <= tmp_fl->next->img->flash_ba… in parse_redboot_partitions()
246 ret = -ENOMEM; in parse_redboot_partitions()
261 if (fl->img->flash_base) { in parse_redboot_partitions()
263 parts[0].size = fl->img->flash_base; in parse_redboot_partitions()
269 parts[i].size = fl->img->size; in parse_redboot_partitions()
270 parts[i].offset = fl->img->flash_base; in parse_redboot_partitions()
273 strcpy(names, fl->img->name); in parse_redboot_partitions()
277 !memcmp(names, "FIS directory", 14)) { in parse_redboot_partitions()
284 …if(fl->next && fl->img->flash_base + fl->img->size + master->erasesize <= fl->next->img->flash_bas… in parse_redboot_partitions()
286 parts[i].offset = parts[i-1].size + parts[i-1].offset; in parse_redboot_partitions()
287 parts[i].size = fl->next->img->flash_base - parts[i].offset; in parse_redboot_partitions()
292 fl = fl->next; in parse_redboot_partitions()
300 fl = fl->next; in parse_redboot_partitions()
308 { .compatible = "redboot-fis" },
324 MODULE_DESCRIPTION("Parsing code for RedBoot Flash Image System (FIS) tables");