Skip to contentSkip to conversation

spl: spi: Support full fitImage handling

PATCH In review Marek Vasut 3 participants 5 messages May 31, 2018 – Jul 11, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spl: spi: Support full fitImage handling

Handle the case where the full fitImage support is enabled. In this case, the whole fitImage must be loaded up front as some parts of the fitImage code require memory-mapped access to the entire fitImage.

Cc Pantelis Antoniou <[email protected]>
Cc Simon Glass <[email protected]>
---
 common/spl/spl_spi.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
common/spl/spl_spi.c +11 -2
index df46046729..ba60a3a3c5 100644
@@ -110,8 +110,17 @@ static int spl_spi_load_image(struct spl_image_info *spl_image,
 			return err;
 		}
 
-		if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) &&
-			image_get_magic(header) == FDT_MAGIC) {
+		if (IS_ENABLED(CONFIG_SPL_LOAD_FIT_FULL) &&
+		    image_get_magic(header) == FDT_MAGIC) {
+			err = spi_flash_read(flash, payload_offs,
+					     roundup(fdt_totalsize(header), 4),
+					     (void *)CONFIG_SYS_LOAD_ADDR);
+			if (err)
+				return err;
+			err = spl_parse_image_header(spl_image,
+					(struct image_header *)CONFIG_SYS_LOAD_ADDR);
+		} else if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) &&
+			   image_get_magic(header) == FDT_MAGIC) {
 			struct spl_load_info load;
 
 			debug("Found FIT\n");
Signature · 1 line
2.16.2
#1 lore raw

PATCH 1/1 spl: spi: Support full fitImage handling

Hi Marek,

Quoted 16 lines · Marek Vasut

Handle the case where the full fitImage support is enabled. In this case, the whole fitImage must be loaded up front as some parts of the fitImage code require memory-mapped access to the entire fitImage.

Cc Pantelis Antoniou <[email protected]>
Cc Simon Glass <[email protected]>
---
 common/spl/spl_spi.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
common/spl/spl_spi.c +0 -0
index df46046729..ba60a3a3c5 100644

common/spl/spl_spi.c static int spl_spi_load_image(struct spl_image_info *spl_image, · line 117

Quoted 10 lines
common/spl/spl_spi.c +5 -2
@@ -110,8 +110,17 @@ static int spl_spi_load_image(struct spl_image_info *spl_image,
                        return err;
                }
 
-               if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) &&
-                       image_get_magic(header) == FDT_MAGIC) {
+               if (IS_ENABLED(CONFIG_SPL_LOAD_FIT_FULL) &&
+                   image_get_magic(header) == FDT_MAGIC) {
+                       err = spi_flash_read(flash, payload_offs,
+                                            roundup(fdt_totalsize(header), 4),
+                                            (void *)CONFIG_SYS_LOAD_ADDR);

map_sysmem(CONFIG_SYS_LOAD_ADDR, fdt_totalsize(header))

otherwise your sandbox test won't work

common/spl/spl_spi.c static int spl_spi_load_image(struct spl_image_info *spl_image, · line 121

Quoted 4 lines
common/spl/spl_spi.c +4 -0
+                       if (err)
+                               return err;
+                       err = spl_parse_image_header(spl_image,
+                                       (struct image_header *)CONFIG_SYS_LOAD_ADDR);

Same here

Quoted 8 lines
common/spl/spl_spi.c +2 -1
+               } else if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) &&
+                          image_get_magic(header) == FDT_MAGIC) {
                        struct spl_load_info load;
 
                        debug("Found FIT\n");
--

2.16.2

Regards,
Simon

#2 lore raw

PATCH 1/1 spl: spi: Support full fitImage handling

Quoted 31 lines · Simon Glass

Hi Marek,

Quoted 16 lines · Marek Vasut

Handle the case where the full fitImage support is enabled. In this case, the whole fitImage must be loaded up front as some parts of the fitImage code require memory-mapped access to the entire fitImage.

Cc Pantelis Antoniou <[email protected]>
Cc Simon Glass <[email protected]>
---
 common/spl/spl_spi.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
common/spl/spl_spi.c +0 -0
index df46046729..ba60a3a3c5 100644

common/spl/spl_spi.c static int spl_spi_load_image(struct spl_image_info *spl_image, · line 117

Quoted 10 lines
common/spl/spl_spi.c +5 -2
@@ -110,8 +110,17 @@ static int spl_spi_load_image(struct spl_image_info *spl_image,
                        return err;
                }
 
-               if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) &&
-                       image_get_magic(header) == FDT_MAGIC) {
+               if (IS_ENABLED(CONFIG_SPL_LOAD_FIT_FULL) &&
+                   image_get_magic(header) == FDT_MAGIC) {
+                       err = spi_flash_read(flash, payload_offs,
+                                            roundup(fdt_totalsize(header), 4),
+                                            (void *)CONFIG_SYS_LOAD_ADDR);

map_sysmem(CONFIG_SYS_LOAD_ADDR, fdt_totalsize(header))

Quoted 1 line

otherwise your sandbox test won't work

Is this map_sysmem stuff explained anywhere ?

Signature · 2 lines
Best regards,
Marek Vasut
#3 lore raw

PATCH 1/1 spl: spi: Support full fitImage handling

Hi Marek,

Quoted 32 lines · Marek Vasut
Quoted 31 lines · Simon Glass

Hi Marek,

Quoted 16 lines · Marek Vasut

Handle the case where the full fitImage support is enabled. In this case, the whole fitImage must be loaded up front as some parts of the fitImage code require memory-mapped access to the entire fitImage.

Cc Pantelis Antoniou <[email protected]>
Cc Simon Glass <[email protected]>
---
 common/spl/spl_spi.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
common/spl/spl_spi.c +0 -0
index df46046729..ba60a3a3c5 100644

common/spl/spl_spi.c static int spl_spi_load_image(struct spl_image_info *spl_image, · line 117

Quoted 10 lines
common/spl/spl_spi.c +5 -2
@@ -110,8 +110,17 @@ static int spl_spi_load_image(struct spl_image_info *spl_image,
                        return err;
                }
 
-               if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) &&
-                       image_get_magic(header) == FDT_MAGIC) {
+               if (IS_ENABLED(CONFIG_SPL_LOAD_FIT_FULL) &&
+                   image_get_magic(header) == FDT_MAGIC) {
+                       err = spi_flash_read(flash, payload_offs,
+                                            roundup(fdt_totalsize(header), 4),
+                                            (void *)CONFIG_SYS_LOAD_ADDR);

map_sysmem(CONFIG_SYS_LOAD_ADDR, fdt_totalsize(header))

Quoted 3 lines
Quoted 1 line

otherwise your sandbox test won't work

Is this map_sysmem stuff explained anywhere ?

Yes, see board/sandbox/README.sandbox

Regards,
Simon

#4 lore raw
In reply to Marek Vasut
Quoted 7 lines · Marek Vasut

Handle the case where the full fitImage support is enabled. In this case, the whole fitImage must be loaded up front as some parts of the fitImage code require memory-mapped access to the entire fitImage.

Cc Pantelis Antoniou <[email protected]>
Cc Simon Glass <[email protected]>

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180711/5769a8ec/attachment.sig>