splash: add more options/support
cover splash: add more options/support
This patch series add several options/support for splashscreen feature:
- support raw image from MMC
- get devpart from environment variable
With these changes the user has now more options and can change default configurations through environment variables.
Example: image located in splashscreen partition (MMC as raw)
``` splashsource=mmc_raw splashdevpart=0#splashscreen ```
Julien Masson (2):
splash: support raw image from MMC
splash: get devpart from environment variable
common/splash.c | 6 ++++++ common/splash_source.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+)
Signature · 1 line
2.37.3
PATCH RESEND 1/2 splash: support raw image from MMC
The user has now the choice to specify the splash location in the MMC as a raw storage.
--- common/splash.c | 6 ++++++ common/splash_source.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+)
common/splash.c +6 -0
@@ -39,6 +39,12 @@ static struct splash_location default_splash_locations[] = { .flags = SPLASH_STORAGE_FS, .devpart = "0:1", }, + { + .name = "mmc_raw", + .storage = SPLASH_STORAGE_MMC, + .flags = SPLASH_STORAGE_RAW, + .devpart = "0:1", + }, { .name = "usb_fs", .storage = SPLASH_STORAGE_USB,
common/splash_source.c +29 -0
@@ -65,6 +65,33 @@ static int splash_nand_read_raw(u32 bmp_load_addr, int offset, size_t read_size) }#endif +#ifdef CONFIG_CMD_MMC +static int splash_mmc_read_raw (u32 bmp_load_addr,struct splash_location *location, +size_t read_size) +{ +struct disk_partition partition; +struct blk_desc *desc; +lbaint_t blkcnt; +int ret, n; + + ret =part_get_info_by_dev_and_name_or_num ("mmc" , location->devpart, &desc, + &partition,1 ); +if (ret <0 ) +return ret; + + blkcnt =DIV_ROUND_UP (read_size, partition.blksz); + n =blk_dread (desc, partition.start, blkcnt, (void *)(uintptr_t )bmp_load_addr); + +return (n == blkcnt) ?0 : -EINVAL ; +} +#else +static int splash_mmc_read_raw (u32 bmp_load_addr,int offset,size_t read_size) +{ +debug ("%s: mmc support not available\n" , __func__); +return -ENOSYS ; +} +#endif +static int splash_storage_read_raw (struct splash_location *location,u32 bmp_load_addr,size_t read_size) {
@@ -75,6 +102,8 @@ static int splash_storage_read_raw(struct splash_location *location, offset = location->offset;switch (location->storage) { +case SPLASH_STORAGE_MMC : +return splash_mmc_read_raw (bmp_load_addr, location, read_size);case SPLASH_STORAGE_NAND :return splash_nand_read_raw (bmp_load_addr, offset, read_size);case SPLASH_STORAGE_SF :
Signature · 1 line
2.37.3
Re: [RESEND PATCH 1/2] splash: support raw image from MMC
HI Julien,
Quoted 43 lines · Julien Masson
The user has now the choice to specify the splash location in the MMC as a raw storage.
Signed-off-by Julien Masson <[email protected]>--- common/splash.c | 6 ++++++ common/splash_source.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+)common/splash.c +6
-0@@ -39,6 +39,12 @@ static struct splash_location default_splash_locations[] = { .flags = SPLASH_STORAGE_FS, .devpart = "0:1", }, + { + .name = "mmc_raw", + .storage = SPLASH_STORAGE_MMC, + .flags = SPLASH_STORAGE_RAW, + .devpart = "0:1", + }, { .name = "usb_fs", .storage = SPLASH_STORAGE_USB,common/splash_source.c +8
-0@@ -65,6 +65,33 @@ static int splash_nand_read_raw(u32 bmp_load_addr, int offset, size_t read_size) }#endif +#ifdef CONFIG_CMD_MMC +static int splash_mmc_read_raw (u32 bmp_load_addr,struct splash_location *location, +size_t read_size) +{ +struct disk_partition partition; +struct blk_desc *desc; +lbaint_t blkcnt; +int ret, n;
common/splash_source.c static int splash_nand_read_raw(u32 bmp_load_addr, int offset, size_t read_size) · line 85
Quoted 10 lines
common/splash_source.c +10
-0+ + ret =part_get_info_by_dev_and_name_or_num ("mmc" , location->devpart, &desc, + &partition,1 ); +if (ret <0 ) +return ret; + + blkcnt =DIV_ROUND_UP (read_size, partition.blksz); + n =blk_dread (desc, partition.start, blkcnt, (void *)(uintptr_t )bmp_load_addr); + +return (n == blkcnt) ?0 : -EINVAL ;
-EIO would be better
common/splash_source.c static int splash_nand_read_raw(u32 bmp_load_addr, int offset, size_t read_size) · line 91
Quoted 6 lines
common/splash_source.c +6
-0+} +#else +static int splash_mmc_read_raw (u32 bmp_load_addr,int offset,size_t read_size) +{ +debug ("%s: mmc support not available\n" , __func__); +return -ENOSYS ;
Rather than the #ifdef you should be able to put these two lines in the first function. Does patman not warn you about this sort of thing?
Quoted 16 lines
common/splash_source.c +5
-1+} +#endif +static int splash_storage_read_raw (struct splash_location *location,u32 bmp_load_addr,size_t read_size) {@@ -75,6 +102,8 @@ static int splash_storage_read_raw(struct splash_location *location, offset = location->offset;switch (location->storage) { +case SPLASH_STORAGE_MMC : +return splash_mmc_read_raw (bmp_load_addr, location, read_size);case SPLASH_STORAGE_NAND :return splash_nand_read_raw (bmp_load_addr, offset, read_size);case SPLASH_STORAGE_SF : --
Quoted 2 lines
2.37.3
Regards,
SImon
Re: [RESEND PATCH 1/2] splash: support raw image from MMC
Hi Simon,
Quoted 50 lines · Simon Glass
HI Julien,
Quoted 47 lines · Julien Masson
The user has now the choice to specify the splash location in the MMC as a raw storage.
Signed-off-by Julien Masson <[email protected]>---
common/splash.c| 6 ++++++common/splash_source.c| 29 +++++++++++++++++++++++++++++2 files changed, 35 insertions(+)common/splash.c +6
-0@@ -39,6 +39,12 @@ static struct splash_location default_splash_locations[] = { .flags = SPLASH_STORAGE_FS, .devpart = "0:1", }, + { + .name = "mmc_raw", + .storage = SPLASH_STORAGE_MMC, + .flags = SPLASH_STORAGE_RAW, + .devpart = "0:1", + }, { .name = "usb_fs", .storage = SPLASH_STORAGE_USB,common/splash_source.c +12
-0@@ -65,6 +65,33 @@ static int splash_nand_read_raw(u32 bmp_load_addr, int offset, size_t read_size) }#endif +#ifdef CONFIG_CMD_MMC +static int splash_mmc_read_raw (u32 bmp_load_addr,struct splash_location *location, +size_t read_size) +{ +struct disk_partition partition; +struct blk_desc *desc; +lbaint_t blkcnt; +int ret, n; + + ret =part_get_info_by_dev_and_name_or_num ("mmc" , location->devpart, &desc, + &partition,1 ); +if (ret <0 )
Quoted 8 lines
common/splash_source.c static int splash_nand_read_raw(u32 bmp_load_addr, int offset, size_t read_size) · line 85
Quoted 6 lines
common/splash_source.c +6
-0+return ret; + + blkcnt =DIV_ROUND_UP (read_size, partition.blksz); + n =blk_dread (desc, partition.start, blkcnt, (void *)(uintptr_t )bmp_load_addr); + +return (n == blkcnt) ?0 : -EINVAL ;
-EIOwould be better
Yes I will change this in V2.
Quoted 4 lines
common/splash_source.c static int splash_nand_read_raw(u32 bmp_load_addr, int offset, size_t read_size) · line 88
Quoted 4 lines
common/splash_source.c +3
-0+} +#else +static int splash_mmc_read_raw (u32 bmp_load_addr,int offset,size_t read_size)
I just discovered that my the second argument type is wrong. I will fix that in V2, sorry.
Quoted 6 lines
common/splash_source.c static int splash_nand_read_raw(u32 bmp_load_addr, int offset, size_t read_size) · line 91
Quoted 3 lines
common/splash_source.c +3
-0+{ +debug ("%s: mmc support not available\n" , __func__); +return -ENOSYS ;Rather than the #ifdef you should be able to put these two lines in the first function. Does patman not warn you about this sort of thing?
Yes that is true I can place the #ifdef inside the function but I've "voluntary" done that to stay consistent with other functions:
splash_(sf|nand).*
No I did not use patman, I've run checkpatch first and git send-email:
$ ./scripts/checkpatch.pl --strict --u-boot
But even with patman I don't see the warning you are talking:
$ ./tools/patman/patman -n Cleaned 2 patches 0 errors, 1 warnings, 0 checks for 0002-splash-support-raw-image-from-MMC.patch: common/splash_source.c:68: warning: Use 'if (IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where possible checkpatch.pl found 0 error(s), 1 warning(s), 0 checks(s) Alias 'splash' not found Alias 'splash' not found Not sending emails due to errors/warnings Dry run, so not doing much. But I would do this: ...
What command do you use to have this warning ?
Thanks
Quoted 22 lines
Quoted 13 lines
common/splash_source.c +5
-0+} +#endif +static int splash_storage_read_raw (struct splash_location *location,u32 bmp_load_addr,size_t read_size) {@@ -75,6 +102,8 @@ static int splash_storage_read_raw(struct splash_location *location, offset = location->offset;switch (location->storage) { +case SPLASH_STORAGE_MMC : +return splash_mmc_read_raw (bmp_load_addr, location, read_size);Quoted 6 lines
case
SPLASH_STORAGE_NAND:
returnsplash_nand_read_raw(bmp_load_addr, offset, read_size); caseSPLASH_STORAGE_SF:
--
2.37.3Regards,
SImon
Signature · 1 line
Julien Masson
Re: [RESEND PATCH 1/2] splash: support raw image from MMC
Hi Julien,
Quoted 85 lines · Julien Masson
Hi Simon,
Quoted 50 lines · Simon Glass
HI Julien,
Quoted 47 lines · Julien Masson
The user has now the choice to specify the splash location in the MMC as a raw storage.
Signed-off-by Julien Masson <[email protected]>---
common/splash.c| 6 ++++++common/splash_source.c| 29 +++++++++++++++++++++++++++++2 files changed, 35 insertions(+)common/splash.c +6
-0@@ -39,6 +39,12 @@ static struct splash_location default_splash_locations[] = { .flags = SPLASH_STORAGE_FS, .devpart = "0:1", }, + { + .name = "mmc_raw", + .storage = SPLASH_STORAGE_MMC, + .flags = SPLASH_STORAGE_RAW, + .devpart = "0:1", + }, { .name = "usb_fs", .storage = SPLASH_STORAGE_USB,common/splash_source.c +12
-0@@ -65,6 +65,33 @@ static int splash_nand_read_raw(u32 bmp_load_addr, int offset, size_t read_size) }#endif +#ifdef CONFIG_CMD_MMC +static int splash_mmc_read_raw (u32 bmp_load_addr,struct splash_location *location, +size_t read_size) +{ +struct disk_partition partition; +struct blk_desc *desc; +lbaint_t blkcnt; +int ret, n; + + ret =part_get_info_by_dev_and_name_or_num ("mmc" , location->devpart, &desc, + &partition,1 ); +if (ret <0 )Quoted 8 lines
common/splash_source.c static int splash_nand_read_raw(u32 bmp_load_addr, int offset, size_t read_size) · line 85
Quoted 6 lines
common/splash_source.c +6
-0+return ret; + + blkcnt =DIV_ROUND_UP (read_size, partition.blksz); + n =blk_dread (desc, partition.start, blkcnt, (void *)(uintptr_t )bmp_load_addr); + +return (n == blkcnt) ?0 : -EINVAL ;
-EIOwould be betterYes I will change this in V2.
Quoted 4 lines
common/splash_source.c static int splash_nand_read_raw(u32 bmp_load_addr, int offset, size_t read_size) · line 88
Quoted 4 lines
common/splash_source.c +3
-0+} +#else +static int splash_mmc_read_raw (u32 bmp_load_addr,int offset,size_t read_size)I just discovered that my the second argument type is wrong. I will fix that in V2, sorry.
Quoted 6 lines
common/splash_source.c static int splash_nand_read_raw(u32 bmp_load_addr, int offset, size_t read_size) · line 91
Quoted 3 lines
common/splash_source.c +3
-0+{ +debug ("%s: mmc support not available\n" , __func__); +return -ENOSYS ;Rather than the #ifdef you should be able to put these two lines in the first function. Does patman not warn you about this sort of thing?
Yes that is true I can place the #ifdef inside the function but I've "voluntary" done that to stay consistent with other functions:
splash_(sf|nand).*
Quoted 8 lines
No I did not use patman, I've run checkpatch first and git send-email:
$ ./scripts/checkpatch.pl --strict --u-bootBut even with patman I don't see the warning you are talking:
$ ./tools/patman/patman -n Cleaned 2 patches 0 errors, 1 warnings, 0 checks for 0002-splash-support-raw-image-from-MMC.patch: common/splash_source.c:68: warning: Use 'if (IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where possible
^ That is the warning
Quoted 34 lines
checkpatch.pl found 0 error(s), 1 warning(s), 0 checks(s) Alias 'splash' not found
Alias 'splash' not found
Not sending emails due to errors/warnings
Dry run, so not doing much. But I would do this:
...What command do you use to have this warning ?
Thanks
Quoted 9 lines
Quoted 9 lines
common/splash_source.c +3
-0+} +#endif +static int splash_storage_read_raw (struct splash_location *location,u32 bmp_load_addr,size_t read_size) {@@ -75,6 +102,8 @@ static int splash_storage_read_raw(struct splash_location *location,Quoted 13 lines
Quoted 10 lines
common/splash_source.c +2
-0offset = location->offset;switch (location->storage) { +case SPLASH_STORAGE_MMC : +return splash_mmc_read_raw (bmp_load_addr, location, read_size);case
SPLASH_STORAGE_NAND:
returnsplash_nand_read_raw(bmp_load_addr, offset, read_size); caseSPLASH_STORAGE_SF:
--
2.37.3Regards,
SImon
Quoted 2 lines
--
Julien Masson
Regards,
Simon
PATCH RESEND 2/2 splash: get devpart from environment variable
In reply to Julien MassonBy default several types of splash locations are supported and the user can select one of them through environment var (splashsource).
However the devpart is still hardcoded and we cannot change it from the environment.
This patch add the support of "splashdevpart" which allow the user to set the devpart though this environment variable.
Example: image located in splashscreen partition (MMC as raw)
``` splashsource=mmc_raw splashdevpart=0#splashscreen ```
--- common/splash_source.c | 5 +++++ 1 file changed, 5 insertions(+)
common/splash_source.c +5 -0
@@ -451,6 +451,7 @@ int splash_source_load(struct splash_location *locations, uint size) {struct splash_location *splash_location;char *env_splashimage_value; +char *env_splashdevpart_value;u32 bmp_load_addr; env_splashimage_value =env_get ("splashimage" );
@@ -467,6 +468,10 @@ int splash_source_load(struct splash_location *locations, uint size)if (!splash_location)return -EINVAL ; + env_splashdevpart_value =env_get ("splashdevpart" ); +if (env_splashdevpart_value) + splash_location->devpart = env_splashdevpart_value; +if (splash_location->flags ==SPLASH_STORAGE_RAW )return splash_load_raw (splash_location, bmp_load_addr);else if (splash_location->flags ==SPLASH_STORAGE_FS )
Signature · 1 line
2.37.3
Re: [RESEND PATCH 2/2] splash: get devpart from environment variable
Hi Julien,
Quoted 16 lines · Julien Masson
By default several types of splash locations are supported and the user can select one of them through environment var (splashsource).
However the devpart is still hardcoded and we cannot change it from the environment.
This patch add the support of "splashdevpart" which allow the user to set the devpart though this environment variable.
Example: image located in splashscreen partition (MMC as raw)
``` splashsource=mmc_raw splashdevpart=0#splashscreen ```
Quoted 4 lines
Signed-off-by Julien Masson <[email protected]>--- common/splash_source.c | 5 +++++ 1 file changed, 5 insertions(+)
common/splash_source.c int splash_source_load(struct splash_location *locations, uint size) · line 454
Quoted 10 lines
common/splash_source.c +1
-0@@ -451,6 +451,7 @@ int splash_source_load(struct splash_location *locations, uint size) {struct splash_location *splash_location;char *env_splashimage_value; +char *env_splashdevpart_value;
How about just 'devpar' as it is shorter and easier to read?
Quoted 15 lines
common/splash_source.c +4
-1u32 bmp_load_addr; env_splashimage_value =env_get ("splashimage" );@@ -467,6 +468,10 @@ int splash_source_load(struct splash_location *locations, uint size)if (!splash_location)return -EINVAL ; + env_splashdevpart_value =env_get ("splashdevpart" ); +if (env_splashdevpart_value) + splash_location->devpart = env_splashdevpart_value; +if (splash_location->flags ==SPLASH_STORAGE_RAW )return splash_load_raw (splash_location, bmp_load_addr);else if (splash_location->flags ==SPLASH_STORAGE_FS ) --
Quoted 2 lines
2.37.3
Regards,
Simon
Re: [RESEND PATCH 2/2] splash: get devpart from environment variable
Hi Simon,
Thanks for the review.
Quoted 26 lines · Simon Glass
Hi Julien,
Quoted 16 lines · Julien Masson
By default several types of splash locations are supported and the user can select one of them through environment var (splashsource).
However the devpart is still hardcoded and we cannot change it from the environment.
This patch add the support of "splashdevpart" which allow the user to set the devpart though this environment variable.
Example: image located in splashscreen partition (MMC as raw)
``` splashsource=mmc_raw splashdevpart=0#splashscreen ```Quoted 4 lines
Signed-off-by Julien Masson <[email protected]>---
common/splash_source.c| 5 +++++1 file changed, 5 insertions(+)Reviewed-by Simon Glass <[email protected]>Quoted 1 line
Quoted 12 lines
common/splash_source.c int splash_source_load(struct splash_location *locations, uint size) · line 454
Quoted 9 lines
common/splash_source.c +1
-0@@ -451,6 +451,7 @@ int splash_source_load(struct splash_location *locations, uint size) {struct splash_location *splash_location;char *env_splashimage_value; +char *env_splashdevpart_value;How about just 'devpar' as it is shorter and easier to read?
Yes I initially follow the same "syntax" of splashimage var but I agree it can be shorter, what name would you prefer:
- char *devpart
- char *env_devpart
- char *env_devpart_value
?
Quoted 20 lines
Quoted 15 lines
common/splash_source.c +4
-1u32 bmp_load_addr; env_splashimage_value =env_get ("splashimage" );@@ -467,6 +468,10 @@ int splash_source_load(struct splash_location *locations, uint size)if (!splash_location)return -EINVAL ; + env_splashdevpart_value =env_get ("splashdevpart" ); +if (env_splashdevpart_value) + splash_location->devpart = env_splashdevpart_value; +if (splash_location->flags ==SPLASH_STORAGE_RAW )return splash_load_raw (splash_location, bmp_load_addr);else if (splash_location->flags ==SPLASH_STORAGE_FS ) --Quoted 2 lines
2.37.3
Regards,
Simon
Signature · 1 line
Julien Masson
Re: [RESEND PATCH 2/2] splash: get devpart from environment variable
Hi Julien,
Quoted 46 lines · Julien Masson
Hi Simon,
Thanks for the review.
Quoted 26 lines · Simon Glass
Hi Julien,
Quoted 16 lines · Julien Masson
By default several types of splash locations are supported and the user can select one of them through environment var (splashsource).
However the devpart is still hardcoded and we cannot change it from the environment.
This patch add the support of "splashdevpart" which allow the user to set the devpart though this environment variable.
Example: image located in splashscreen partition (MMC as raw)
``` splashsource=mmc_raw splashdevpart=0#splashscreen ```Quoted 4 lines
Signed-off-by Julien Masson <[email protected]>---
common/splash_source.c| 5 +++++1 file changed, 5 insertions(+)Reviewed-by Simon Glass <[email protected]>Quoted 1 line
Quoted 12 lines
common/splash_source.c int splash_source_load(struct splash_location *locations, uint size) · line 454
Quoted 9 lines
common/splash_source.c +1
-0@@ -451,6 +451,7 @@ int splash_source_load(struct splash_location *locations, uint size) {struct splash_location *splash_location;char *env_splashimage_value; +char *env_splashdevpart_value;How about just 'devpar' as it is shorter and easier to read?
Quoted 6 lines
Yes I initially follow the same "syntax" of splashimage var but I agree it can be shorter, what name would you prefer:
- char *devpart
- char*env_devpart
- char*env_devpart_value
?
devpart seems good to me
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
common/splash_source.c +0
-0u32 bmp_load_addr; env_splashimage_value =env_get ("splashimage" );@@ -467,6 +468,10 @@ int splash_source_load(struct splash_location *locations, uint size)if (!splash_location)return -EINVAL ;
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
common/splash_source.c +4
-1+ env_splashdevpart_value =env_get ("splashdevpart" ); +if (env_splashdevpart_value) + splash_location->devpart = env_splashdevpart_value; +if (splash_location->flags ==SPLASH_STORAGE_RAW )return splash_load_raw (splash_location, bmp_load_addr);else if (splash_location->flags ==SPLASH_STORAGE_FS ) --2.37.3
Regards,
Simon
Re: [RESEND PATCH 2/2] splash: get devpart from environment variable
Hi Simon,
Quoted 50 lines · Simon Glass
Hi Julien,
Quoted 46 lines · Julien Masson
Hi Simon,
Thanks for the review.
Quoted 38 lines · Simon Glass
Hi Julien,
Quoted 16 lines · Julien Masson
By default several types of splash locations are supported and the user can select one of them through environment var (splashsource).
However the devpart is still hardcoded and we cannot change it from the environment.
This patch add the support of "splashdevpart" which allow the user to set the devpart though this environment variable.
Example: image located in splashscreen partition (MMC as raw)
``` splashsource=mmc_raw splashdevpart=0#splashscreen ```Quoted 4 lines
Signed-off-by Julien Masson <[email protected]>---
common/splash_source.c| 5 +++++1 file changed, 5 insertions(+)Reviewed-by Simon Glass <[email protected]>common/splash_source.c int splash_source_load(struct splash_location *locations, uint size) · line 454
Quoted 10 lines
common/splash_source.c +1
-0@@ -451,6 +451,7 @@ int splash_source_load(struct splash_location *locations, uint size) {struct splash_location *splash_location;char *env_splashimage_value; +char *env_splashdevpart_value;How about just 'devpar' as it is shorter and easier to read?
Quoted 8 lines
Quoted 6 lines
Yes I initially follow the same "syntax" of splashimage var but I agree it can be shorter, what name would you prefer:
- char *devpart
- char*env_devpart
- char*env_devpart_value
?devpart seems good to me
Got it thanks, I'll change that in v2.
Quoted 22 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
common/splash_source.c +0
-0u32 bmp_load_addr; env_splashimage_value =env_get ("splashimage" );@@ -467,6 +468,10 @@ int splash_source_load(struct splash_location *locations, uint size)if (!splash_location)return -EINVAL ;Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
common/splash_source.c +4
-1+ env_splashdevpart_value =env_get ("splashdevpart" ); +if (env_splashdevpart_value) + splash_location->devpart = env_splashdevpart_value; +if (splash_location->flags ==SPLASH_STORAGE_RAW )return splash_load_raw (splash_location, bmp_load_addr);else if (splash_location->flags ==SPLASH_STORAGE_FS ) --2.37.3
Regards,
Simon
Signature · 1 line
Julien Masson