All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] spl: fit: Fix the number of bytes read in raw mode
@ 2016-07-19  9:26 Lokesh Vutla
  2016-07-20  2:21 ` Tom Rini
  2016-07-23  0:13 ` [U-Boot] " Tom Rini
  0 siblings, 2 replies; 3+ messages in thread
From: Lokesh Vutla @ 2016-07-19  9:26 UTC (permalink / raw)
  To: u-boot

In raw mode a full sector is to be read even if image covers part of
a sector. Number of sectors are calculated as ROUND_UP(size)/sec_size by FIT
framework. This calculation assumes that image is at the 0th offset of a sector,
which is not true always in FIT case. So, include the image offset while
calculating number of sectors.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
---
 common/spl/spl_fit.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
index 069e94d..be86072 100644
--- a/common/spl/spl_fit.c
+++ b/common/spl/spl_fit.c
@@ -115,8 +115,10 @@ static int get_aligned_image_overhead(struct spl_load_info *info, int offset)
 static int get_aligned_image_size(struct spl_load_info *info, int data_size,
 				  int offset)
 {
+	data_size = data_size + get_aligned_image_overhead(info, offset);
+
 	if (info->filename)
-		return data_size + get_aligned_image_overhead(info, offset);
+		return data_size;
 
 	return (data_size + info->bl_len - 1) / info->bl_len;
 }
-- 
2.9.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] spl: fit: Fix the number of bytes read in raw mode
  2016-07-19  9:26 [U-Boot] [PATCH] spl: fit: Fix the number of bytes read in raw mode Lokesh Vutla
@ 2016-07-20  2:21 ` Tom Rini
  2016-07-23  0:13 ` [U-Boot] " Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2016-07-20  2:21 UTC (permalink / raw)
  To: u-boot

On Tue, Jul 19, 2016 at 02:56:14PM +0530, Lokesh Vutla wrote:

> In raw mode a full sector is to be read even if image covers part of
> a sector. Number of sectors are calculated as ROUND_UP(size)/sec_size by FIT
> framework. This calculation assumes that image is at the 0th offset of a sector,
> which is not true always in FIT case. So, include the image offset while
> calculating number of sectors.
> 
> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>

Reviewed-by: Tom Rini <trini@konsulko.com>

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160719/7465cd8d/attachment.sig>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] spl: fit: Fix the number of bytes read in raw mode
  2016-07-19  9:26 [U-Boot] [PATCH] spl: fit: Fix the number of bytes read in raw mode Lokesh Vutla
  2016-07-20  2:21 ` Tom Rini
@ 2016-07-23  0:13 ` Tom Rini
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2016-07-23  0:13 UTC (permalink / raw)
  To: u-boot

On Tue, Jul 19, 2016 at 02:56:14PM +0530, Lokesh Vutla wrote:

> In raw mode a full sector is to be read even if image covers part of
> a sector. Number of sectors are calculated as ROUND_UP(size)/sec_size by FIT
> framework. This calculation assumes that image is at the 0th offset of a sector,
> which is not true always in FIT case. So, include the image offset while
> calculating number of sectors.
> 
> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160722/c608f406/attachment.sig>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-07-23  0:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-19  9:26 [U-Boot] [PATCH] spl: fit: Fix the number of bytes read in raw mode Lokesh Vutla
2016-07-20  2:21 ` Tom Rini
2016-07-23  0:13 ` [U-Boot] " Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.