[Skiboot] [PATCH 09/16] libffs: Add ecc parameter on ffs_part_info()

Michael Neuling mikey at neuling.org
Fri Feb 20 11:37:52 AEDT 2015


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 <mikey at neuling.org>
---
 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);
-- 
2.1.0



More information about the Skiboot mailing list