[Skiboot] [PATCH 1/2] Change load_resource() API to be all about preloading.

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Mon Mar 30 22:44:49 AEDT 2015


On 03/24/2015 09:01 AM, Stewart Smith wrote:
> No functional changes in what happens, just have two calls, one for
> queueing preload the other for waiting until it has loaded.
> 
> future patches will introduce platform specific queueing.
> 
> Signed-off-by: Stewart Smith <stewart at linux.vnet.ibm.com>
> ---
>  core/flash.c                |    4 ++--
>  core/init.c                 |   26 +++++++++++++++++++-------
>  core/platform.c             |   33 ++++++++++++++++++++++++++++-----
>  hw/fsp/fsp.c                |   14 +++++++-------
>  hw/phb3.c                   |   10 +++++++++-
>  include/fsp.h               |    4 ++--
>  include/platform.h          |   29 +++++++++++++++++++++++------
>  include/skiboot.h           |    4 ++--
>  platforms/astbmc/habanero.c |    2 +-
>  platforms/astbmc/palmetto.c |    2 +-
>  platforms/ibm-fsp/apollo.c  |    2 +-
>  platforms/ibm-fsp/firenze.c |    2 +-
>  12 files changed, 96 insertions(+), 36 deletions(-)
> 
> diff --git a/core/flash.c b/core/flash.c
> index f2d7501..270e6fc 100644
> --- a/core/flash.c
> +++ b/core/flash.c
> @@ -522,8 +522,8 @@ end:
>   * load a resource from FLASH
>   * buf and len shouldn't account for ECC even if partition is ECCed.
>   */
> -bool flash_load_resource(enum resource_id id, uint32_t subid,
> -		void *buf, size_t *len)
> +int flash_start_preload_resource(enum resource_id id, uint32_t subid,
> +				 void *buf, size_t *len)
>  {
>  	int i, rc, part_num, part_size, part_start, size;
>  	struct ffs_handle *ffs;
> diff --git a/core/init.c b/core/init.c
> index 1fd8d2e..f15ae5d 100644
> --- a/core/init.c
> +++ b/core/init.c
> @@ -290,12 +290,19 @@ static bool load_kernel(void)
>  {
>  	struct elf_hdr *kh;
>  	size_t ksize;
> +	int loaded;
>  
>  	/* Try to load an external kernel payload through the platform hooks */
>  	ksize = KERNEL_LOAD_SIZE;
> -	if (!load_resource(RESOURCE_ID_KERNEL, RESOURCE_SUBID_NONE,
> -			   KERNEL_LOAD_BASE,
> -			   &ksize)) {
> +	loaded = start_preload_resource(RESOURCE_ID_KERNEL,
> +					RESOURCE_SUBID_NONE,
> +					KERNEL_LOAD_BASE,
> +					&ksize);
> +	if (loaded == OPAL_SUCCESS)
> +		loaded = wait_for_resource_loaded(RESOURCE_ID_KERNEL,
> +						  RESOURCE_SUBID_NONE);
> +
> +	if (loaded != OPAL_SUCCESS) {
>  		printf("INIT: platform kernel load failed\n");
>  		ksize = 0;
>  	}
> @@ -332,13 +339,18 @@ static bool load_kernel(void)
>  static void load_initramfs(void)
>  {
>  	size_t size;
> -	bool loaded;
> +	int loaded;
>  
>  	size = INITRAMFS_LOAD_SIZE;
> -	loaded = load_resource(RESOURCE_ID_INITRAMFS, RESOURCE_SUBID_NONE,
> -			       INITRAMFS_LOAD_BASE, &size);
> +	loaded = start_preload_resource(RESOURCE_ID_INITRAMFS,
> +					RESOURCE_SUBID_NONE,
> +					INITRAMFS_LOAD_BASE, &size);
>  
> -	if (!loaded || !size)
> +	if (loaded == OPAL_SUCCESS)
> +		loaded = wait_for_resource_loaded(RESOURCE_ID_INITRAMFS,
> +						  RESOURCE_SUBID_NONE);
> +
> +	if (loaded != OPAL_SUCCESS || !size)
>  		return;


Looks like we are continuing even initrd fails ..Do we really want to continue
or abort?


-Vasant



More information about the Skiboot mailing list