#include <spl.h>
#include <image.h>
#include <fs.h>
+#include <asm/cache.h>
#include <asm/io.h>
struct blk_dev {
debug("Found FIT\n");
load.read = spl_fit_read;
- load.bl_len = 1;
+ load.bl_len = ARCH_DMA_MINALIGN;
load.filename = (void *)filename;
load.priv = &dev;
debug("Found FIT\n");
load.read = spl_fit_read;
- load.bl_len = 1;
+ load.bl_len = ARCH_DMA_MINALIGN;
load.filename = (void *)filename;
return spl_load_simple_fit(spl_image, &load, 0, header);
#include <mapmem.h>
#include <spl.h>
#include <sysinfo.h>
-#include <asm/cache.h>
#include <asm/global_data.h>
#include <asm/io.h>
#include <linux/libfdt.h>
static int get_aligned_image_offset(struct spl_load_info *info, int offset)
{
- /*
- * If it is a FS read, get the first address before offset which is
- * aligned to ARCH_DMA_MINALIGN. If it is raw read return the
- * block number to which offset belongs.
- */
- if (info->filename)
- return offset & ~(ARCH_DMA_MINALIGN - 1);
-
return ALIGN_DOWN(offset, info->bl_len);
}
static int get_aligned_image_overhead(struct spl_load_info *info, int offset)
{
- /*
- * If it is a FS read, get the difference between the offset and
- * the first address before offset which is aligned to
- * ARCH_DMA_MINALIGN. If it is raw read return the offset within the
- * block.
- */
- if (info->filename)
- return offset & (ARCH_DMA_MINALIGN - 1);
-
return offset & (info->bl_len - 1);
}
{
data_size = data_size + get_aligned_image_overhead(info, offset);
- if (info->filename)
- return data_size;
-
return ALIGN(data_size, info->bl_len);
}
if (info->read(info,
fit_offset +
get_aligned_image_offset(info, offset), size,
- src_ptr) != size)
+ src_ptr) < length)
return -EIO;
debug("External data: dst=%p, offset=%x, size=%lx\n",
container, offset, size);
if (info->read(info, offset, size,
map_sysmem(images[image_index].dst - overhead,
- images[image_index].size)) != size) {
+ images[image_index].size)) <
+ images[image_index].size) {
printf("%s wrong\n", __func__);
return NULL;
}
debug("%s: container: %p offset: %lu size: %u\n", __func__,
container, offset, size);
- if (info->read(info, offset, size, container) != size) {
+ if (info->read(info, offset, size, container) <
+ CONTAINER_HDR_ALIGNMENT) {
ret = -EIO;
goto end;
}
debug("%s: container: %p offset: %lu size: %u\n",
__func__, container, offset, size);
- if (info->read(info, offset, size, container) != size) {
+ if (info->read(info, offset, size, container) < length) {
ret = -EIO;
goto end;
}