From patchwork Fri Feb 20 00:37:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Neuling X-Patchwork-Id: 441811 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id B14551400EA for ; Fri, 20 Feb 2015 11:38:46 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 90E211A0EA2 for ; Fri, 20 Feb 2015 11:38:46 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from ozlabs.org (ozlabs.org [103.22.144.67]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 7EF061A0E00 for ; Fri, 20 Feb 2015 11:38:20 +1100 (AEDT) Received: from localhost.localdomain (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 1C8CF140291; Fri, 20 Feb 2015 11:38:20 +1100 (AEDT) Received: by localhost.localdomain (Postfix, from userid 1000) id 089D4D47040; Fri, 20 Feb 2015 11:38:20 +1100 (AEDT) From: Michael Neuling To: stewart@linux.vnet.ibm.com Date: Fri, 20 Feb 2015 11:37:52 +1100 Message-Id: <1424392679-27859-9-git-send-email-mikey@neuling.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1424392679-27859-1-git-send-email-mikey@neuling.org> References: <1424392679-27859-1-git-send-email-mikey@neuling.org> Cc: imunsie@au.ibm.com, grimm@linux.vnet.ibm.com, skiboot@lists.ozlabs.org Subject: [Skiboot] [PATCH 09/16] libffs: Add ecc parameter on ffs_part_info() 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: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Add ecc parmenter to ffs_part_info() to indicate if the partition is ECC protected or not. Fix all call sites. Signed-off-by: Michael Neuling --- core/flash.c | 6 +++--- external/pflash/pflash.c | 4 ++-- libflash/libffs.c | 5 ++++- libflash/libffs.h | 2 +- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/core/flash.c b/core/flash.c index a256252..e107aaf 100644 --- a/core/flash.c +++ b/core/flash.c @@ -117,7 +117,7 @@ static int flash_nvram_probe(struct flash *flash, struct ffs_handle *ffs) } rc = ffs_part_info(ffs, part, NULL, - &start, &size, NULL); + &start, &size, NULL, NULL); if (rc) { prlog(PR_ERR, "FLASH: Can't parse ffs info for NVRAM\n"); return OPAL_HARDWARE; @@ -172,7 +172,7 @@ static void flash_add_dt_node(struct flash *flash, int id, char *name; int rc; - rc = ffs_part_info(ffs, i, &name, &start, NULL, &size); + rc = ffs_part_info(ffs, i, &name, &start, NULL, &size, NULL); if (rc) break; @@ -483,7 +483,7 @@ bool flash_load_resource(enum resource_id id, uint32_t subid, goto out_free_ffs; } rc = ffs_part_info(ffs, part_num, NULL, - &part_start, &part_size, NULL); + &part_start, &part_size, NULL, NULL); if (rc) { prerror("FLASH: Failed to get %s partition info\n", name); goto out_free_ffs; diff --git a/external/pflash/pflash.c b/external/pflash/pflash.c index 908a41d..fb783a2 100644 --- a/external/pflash/pflash.c +++ b/external/pflash/pflash.c @@ -101,7 +101,7 @@ static void print_flash_info(void) uint32_t start, size, act, end; char *name; - rc = ffs_part_info(ffsh, i, &name, &start, &size, &act); + rc = ffs_part_info(ffsh, i, &name, &start, &size, &act, NULL); if (rc == FFS_ERR_PART_NOT_FOUND) break; if (rc) { @@ -723,7 +723,7 @@ int main(int argc, char *argv[]) int rc; rc = ffs_part_info(ffsh, ffs_index, NULL, - &pstart, &pmaxsz, &pactsize); + &pstart, &pmaxsz, &pactsize, NULL); if (rc) { fprintf(stderr,"Failed to get partition info\n"); exit(1); diff --git a/libflash/libffs.c b/libflash/libffs.c index dbe618c..cfd5456 100644 --- a/libflash/libffs.c +++ b/libflash/libffs.c @@ -215,7 +215,7 @@ int ffs_lookup_part(struct ffs_handle *ffs, const char *name, int ffs_part_info(struct ffs_handle *ffs, uint32_t part_idx, char **name, uint32_t *start, - uint32_t *total_size, uint32_t *act_size) + uint32_t *total_size, uint32_t *act_size, bool *ecc) { struct ffs_entry *raw_ent; struct ffs_entry ent; @@ -240,6 +240,9 @@ int ffs_part_info(struct ffs_handle *ffs, uint32_t part_idx, *total_size = ent.size * ffs->hdr.block_size; if (act_size) *act_size = ent.actual; + if (ecc) + *ecc = ((ent.user.datainteg & FFS_ENRY_INTEG_ECC) != 0); + if (name) { n = malloc(PART_NAME_MAX + 1); memset(n, 0, PART_NAME_MAX + 1); diff --git a/libflash/libffs.h b/libflash/libffs.h index 5a3ff40..69e44bb 100644 --- a/libflash/libffs.h +++ b/libflash/libffs.h @@ -47,7 +47,7 @@ int ffs_lookup_part(struct ffs_handle *ffs, const char *name, int ffs_part_info(struct ffs_handle *ffs, uint32_t part_idx, char **name, uint32_t *start, - uint32_t *total_size, uint32_t *act_size); + uint32_t *total_size, uint32_t *act_size, bool *ecc); int ffs_update_act_size(struct ffs_handle *ffs, uint32_t part_idx, uint32_t act_size);