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

Cedric Le Goater clg at fr.ibm.com
Wed Mar 25 03:14:43 AEDT 2015


On 03/24/2015 04:31 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;
>  	}


The above fails on open power platform. Here is a fix.

Cheers,

C.


From: Cédric Le Goater <clg at fr.ibm.com>
Subject: [PATCH] core/flash: fix return value of flash_load_resource 
Date: Tue, 24 Mar 2015 17:00:37 +0100

The start_preload_resource() platform operation needs a int. 

Signed-off-by: Cédric Le Goater <clg at fr.ibm.com>
---
 core/flash.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Index: skiboot.git/core/flash.c
===================================================================
--- skiboot.git.orig/core/flash.c
+++ skiboot.git/core/flash.c
@@ -530,7 +530,8 @@ int flash_load_resource(enum resource_id
 	struct flash *flash;
 	const char *name;
 	bool status, ecc;
-
+
+	rc = OPAL_RESOURCE;
 	status = false;
 
 	lock(&flash_lock);
@@ -560,7 +561,7 @@ int flash_load_resource(enum resource_id
 	if ((part_name_map[i].subid == RESOURCE_SUBID_NONE) &&
 	    (subid != RESOURCE_SUBID_NONE)) {
 		prerror("PLAT: Partition %s doesn't have subindex\n", name);
-		return false;
+		goto out_unlock;
 	}
 
 	rc = ffs_open_flash(flash->chip, 0, flash->size, &ffs);
@@ -626,5 +627,5 @@ out_free_ffs:
 	ffs_close(ffs);
 out_unlock:
 	unlock(&flash_lock);
-	return status;
+	return status ? OPAL_SUCCESS : rc;
 }



More information about the Skiboot mailing list