From patchwork Tue Mar 24 16:14:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?C=C3=A9dric_Le_Goater?= X-Patchwork-Id: 453941 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id D84D51400D5 for ; Wed, 25 Mar 2015 03:14:58 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id BE4801A0606 for ; Wed, 25 Mar 2015 03:14:58 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from e06smtp17.uk.ibm.com (e06smtp17.uk.ibm.com [195.75.94.113]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 90D0F1A033E for ; Wed, 25 Mar 2015 03:14:53 +1100 (AEDT) Received: from /spool/local by e06smtp17.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 24 Mar 2015 16:14:48 -0000 Received: from d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp17.uk.ibm.com (192.168.101.147) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 24 Mar 2015 16:14:45 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 327A61B0805F for ; Tue, 24 Mar 2015 16:15:11 +0000 (GMT) Received: from d06av12.portsmouth.uk.ibm.com (d06av12.portsmouth.uk.ibm.com [9.149.37.247]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t2OGEjI410027308 for ; Tue, 24 Mar 2015 16:14:45 GMT Received: from d06av12.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av12.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t2OGEiGR015571 for ; Tue, 24 Mar 2015 10:14:45 -0600 Received: from [9.101.4.42] (hermes.lab.toulouse-stg.fr.ibm.com [9.101.4.42]) by d06av12.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t2OGEhCc015512; Tue, 24 Mar 2015 10:14:43 -0600 Message-ID: <55118D73.5010207@fr.ibm.com> Date: Tue, 24 Mar 2015 17:14:43 +0100 From: Cedric Le Goater User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.5.0 MIME-Version: 1.0 To: Stewart Smith , skiboot@lists.ozlabs.org, joel@jms.id.au References: <1427167877-19573-1-git-send-email-stewart@linux.vnet.ibm.com> <1427167877-19573-2-git-send-email-stewart@linux.vnet.ibm.com> In-Reply-To: <1427167877-19573-2-git-send-email-stewart@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15032416-0029-0000-0000-000003EBB291 Subject: Re: [Skiboot] [PATCH 1/2] Change load_resource() API to be all about preloading. X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" 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 > --- > 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 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 --- 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; }