
Hi, On 18 September 2016 at 13:44, Simon Glass sjg@chromium.org wrote:
At present the SPL code uses a global spl_image variable which is shared amongst lots of files, some in common/spl and some elsewhere. There is no need for this to be global, and in fact a parameter makes it easier to understand what information the functions act on. It also reduces the BSS use in the SPL (at the expense of stack) which is useful on boards which don't have BSS available early on.
There are many global functions for loading images from each boot device type, like spl_mmc_load_image() and spl_spi_load_image(). Mostly these take the same parameters (none or a u32). There are various rules for compiling in calls to these functions and in some cases somewhat different rules for compiling in the functions themselves. For example, spl_spi_load_image() is called if either of CONFIG_SPL_SPI_SUPPORT or CONFIG_SPL_SPI__FLASHSUPPORT is enabled, but included in the image if CONFIG_SPL_SPI_LOAD is enabled.
Unfortunately there is a missing memset() in this series which can cause booting to fail because the spl_image flags can be non-zero.
I'll send v2 after allowing time for more comments, but in the meantime if you want to test it, see u-boot-dm/spl-working.
Regards, Simon