diff mbox

[1/4] external/pflash: report if a flash partition is ECC protected

Message ID 1431071915-3917-2-git-send-email-cyril.bur@au1.ibm.com
State Changes Requested
Headers show

Commit Message

Cyril Bur May 8, 2015, 7:58 a.m. UTC
Currently pflash doesn't display if a flash partition contains ECC bits or not
when dumping the flash layout.  libffs has all this information it's just that
pflash doesn't relay it.

Trivial change to add to the information pflash prints about each partition

Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com>
---
 external/pflash/pflash.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

Comments

Benjamin Herrenschmidt May 12, 2015, 4:27 a.m. UTC | #1
On Fri, 2015-05-08 at 17:58 +1000, Cyril Bur wrote:
> Currently pflash doesn't display if a flash partition contains ECC bits or not
> when dumping the flash layout.  libffs has all this information it's just that
> pflash doesn't relay it.
> 
> Trivial change to add to the information pflash prints about each partition
> 
> Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com>

When-below-fixed-Acked-by: Benjamin Herrenschmidt
<benh@kernel.crashing.org>

> ---
>  external/pflash/pflash.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/external/pflash/pflash.c b/external/pflash/pflash.c
> index fb783a2..d6f46d3 100644
> --- a/external/pflash/pflash.c
> +++ b/external/pflash/pflash.c
> @@ -99,9 +99,10 @@ static void print_flash_info(void)
>  
>  	for (i = 0;; i++) {
>  		uint32_t start, size, act, end;
> +		bool ecc;
>  		char *name;
>  
> -		rc = ffs_part_info(ffsh, i, &name, &start, &size, &act, NULL);
> +		rc = ffs_part_info(ffsh, i, &name, &start, &size, &act, &ecc);
>  		if (rc == FFS_ERR_PART_NOT_FOUND)
>  			break;
>  		if (rc) {
> @@ -109,8 +110,12 @@ static void print_flash_info(void)
>  			break;
>  		}
>  		end = start + size;
> -		printf("ID=%02d %15s %08x..%08x (actual=%08x)\n",
> -		       i, name, start, end, act);
> +		printf("ID=%02d %15s %08x..%08x (actual=%08x) %s\n",
> +		       i, name, start, end, act, ecc ? "[ECC]" : "");
> +
> +		if (strcmp(name, "OTHER_SIDE") == 0)
> +			other_side_offset = start;
> +

This hunk should be in the next patch :-)

>  		free(name);
>  	}
>  }
diff mbox

Patch

diff --git a/external/pflash/pflash.c b/external/pflash/pflash.c
index fb783a2..d6f46d3 100644
--- a/external/pflash/pflash.c
+++ b/external/pflash/pflash.c
@@ -99,9 +99,10 @@  static void print_flash_info(void)
 
 	for (i = 0;; i++) {
 		uint32_t start, size, act, end;
+		bool ecc;
 		char *name;
 
-		rc = ffs_part_info(ffsh, i, &name, &start, &size, &act, NULL);
+		rc = ffs_part_info(ffsh, i, &name, &start, &size, &act, &ecc);
 		if (rc == FFS_ERR_PART_NOT_FOUND)
 			break;
 		if (rc) {
@@ -109,8 +110,12 @@  static void print_flash_info(void)
 			break;
 		}
 		end = start + size;
-		printf("ID=%02d %15s %08x..%08x (actual=%08x)\n",
-		       i, name, start, end, act);
+		printf("ID=%02d %15s %08x..%08x (actual=%08x) %s\n",
+		       i, name, start, end, act, ecc ? "[ECC]" : "");
+
+		if (strcmp(name, "OTHER_SIDE") == 0)
+			other_side_offset = start;
+
 		free(name);
 	}
 }