diff options
author | Adriana Kobylak <anoo@linux.vnet.ibm.com> | 2017-12-12 13:37:03 -0600 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2017-12-13 22:05:06 -0600 |
commit | 0bd6a8c9a4bcefe3c687c5aabfa5cae7234c376c (patch) | |
tree | ff8d77434563f225cd56c94a18409760bc754374 | |
parent | 45a961515be6ef5c58985ac7f2e66b1e8c26016a (diff) | |
download | skiboot-0bd6a8c9a4bcefe3c687c5aabfa5cae7234c376c.zip skiboot-0bd6a8c9a4bcefe3c687c5aabfa5cae7234c376c.tar.gz skiboot-0bd6a8c9a4bcefe3c687c5aabfa5cae7234c376c.tar.bz2 |
pflash: Support for clean_on_ecc_error flag
Add the misc flag clear_on_ecc_error to libflash/pflash. This was
the only missing flag. The generator of the virtual pnor image
relies on libflash/pflash to provide the partition information,
so all flags are needed to build an accurate virtual pnor partition
table.
Signed-off-by: Adriana Kobylak <anoo@linux.vnet.ibm.com>
Reviewed-by: Cyril Bur <cyril.bur@au1.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r-- | external/ffspart/ffspart.c | 3 | ||||
-rw-r--r-- | external/pflash/pflash.c | 16 | ||||
-rw-r--r-- | external/pflash/test/files/01-info.ffs | 1 | ||||
-rw-r--r-- | external/pflash/test/files/06-miscprint.ffs | 1 | ||||
-rw-r--r-- | external/pflash/test/results/01-info.out | 17 | ||||
-rw-r--r-- | external/pflash/test/results/06-miscprint.out | 9 | ||||
-rw-r--r-- | external/pflash/test/tests/06-miscprint | 4 | ||||
-rw-r--r-- | libflash/ffs.h | 1 | ||||
-rw-r--r-- | libflash/libffs.c | 3 | ||||
-rw-r--r-- | libflash/libffs.h | 1 |
10 files changed, 39 insertions, 17 deletions
diff --git a/external/ffspart/ffspart.c b/external/ffspart/ffspart.c index a477018..0fe5840 100644 --- a/external/ffspart/ffspart.c +++ b/external/ffspart/ffspart.c @@ -298,6 +298,9 @@ int main(int argc, char *argv[]) case 'L': user.miscflags |= FFS_MISCFLAGS_VOLATILE; break; + case 'C': + user.miscflags |= FFS_MISCFLAGS_CLEARECC; + break; /* Not sure these are valid */ case 'B': user.miscflags |= FFS_MISCFLAGS_BACKUP; diff --git a/external/pflash/pflash.c b/external/pflash/pflash.c index a5e7bc3..b3ceef0 100644 --- a/external/pflash/pflash.c +++ b/external/pflash/pflash.c @@ -115,13 +115,14 @@ static uint32_t print_ffs_info(struct ffs_handle *ffsh, uint32_t toc) goto out; } - l = asprintf(&flags, "[%c%c%c%c%c%c]", + l = asprintf(&flags, "[%c%c%c%c%c%c%c]", has_ecc(ent) ? 'E' : '-', has_flag(ent, FFS_MISCFLAGS_PRESERVED) ? 'P' : '-', has_flag(ent, FFS_MISCFLAGS_READONLY) ? 'R' : '-', has_flag(ent, FFS_MISCFLAGS_BACKUP) ? 'B' : '-', has_flag(ent, FFS_MISCFLAGS_REPROVISION) ? 'F' : '-', - has_flag(ent, FFS_MISCFLAGS_VOLATILE) ? 'V' : '-'); + has_flag(ent, FFS_MISCFLAGS_VOLATILE) ? 'V' : '-', + has_flag(ent, FFS_MISCFLAGS_CLEARECC) ? 'C' : '-'); if (l < 0) goto out; @@ -168,9 +169,9 @@ static void print_flash_info(struct flash_details *flash) printf("Flash info:\n"); printf("-----------\n"); printf("Name = %s\n", flash->name); - printf("Total size = %" PRIu64 "MB\t Flags E:ECC, P:PRESERVED, R:READONLY\n", - flash->total_size >> 20); - printf("Erase granule = %2d%-13sB:BACKUP, F:REPROVISION, V:VOLATILE\n", + printf("Total size = %" PRIu64 "MB\t Flags E:ECC, P:PRESERVED, R:READONLY, " + "B:BACKUP\n", flash->total_size >> 20); + printf("Erase granule = %2d%-13sF:REPROVISION, V:VOLATILE, C:CLEARECC\n", flash->erase_granule >> 10, "KB"); if (bmc_flash) @@ -581,13 +582,14 @@ static void print_partition_detail(struct ffs_handle *ffsh, uint32_t part_id) printf("Flags:\n"); - l = asprintf(&flags, "%s%s%s%s%s%s", has_ecc(ent) ? "ECC [E]\n" : "", + l = asprintf(&flags, "%s%s%s%s%s%s%s", has_ecc(ent) ? "ECC [E]\n" : "", has_flag(ent, FFS_MISCFLAGS_PRESERVED) ? "PRESERVED [P]\n" : "", has_flag(ent, FFS_MISCFLAGS_READONLY) ? "READONLY [R]\n" : "", has_flag(ent, FFS_MISCFLAGS_BACKUP) ? "BACKUP [B]\n" : "", has_flag(ent, FFS_MISCFLAGS_REPROVISION) ? "REPROVISION [F]\n" : "", - has_flag(ent, FFS_MISCFLAGS_VOLATILE) ? "VOLATILE [V]\n" : ""); + has_flag(ent, FFS_MISCFLAGS_VOLATILE) ? "VOLATILE [V]\n" : "", + has_flag(ent, FFS_MISCFLAGS_CLEARECC) ? "CLEARECC [C]\n" : ""); if (l < 0) { fprintf(stderr, "Memory allocation failure printing flags!\n"); goto out; diff --git a/external/pflash/test/files/01-info.ffs b/external/pflash/test/files/01-info.ffs index 0992b33..9f8ccca 100644 --- a/external/pflash/test/files/01-info.ffs +++ b/external/pflash/test/files/01-info.ffs @@ -3,3 +3,4 @@ TWO,0x00004000,0x00001000,EF,/dev/zero THREE,0x00005000,0x00001000,EF,/dev/zero FOUR,0x00006000,0x00001000,EF,/dev/zero FIVE,0x00007000,0x1000,L,/dev/zero +SIX,0x00008000,0x1000,C,/dev/zero diff --git a/external/pflash/test/files/06-miscprint.ffs b/external/pflash/test/files/06-miscprint.ffs index 461e408..885a6f2 100644 --- a/external/pflash/test/files/06-miscprint.ffs +++ b/external/pflash/test/files/06-miscprint.ffs @@ -3,3 +3,4 @@ READONLY,0x0004000,0x1000,R,/dev/zero REPROVISION,0x5000,0x1000,F,/dev/zero BACKUP,0x000006000,0x1000,B,/dev/zero VOLATILE,0x000007000,0x1000,L,/dev/zero +CLEARECC,0x000008000,0x1000,C,/dev/zero diff --git a/external/pflash/test/results/01-info.out b/external/pflash/test/results/01-info.out index 628ddcc..204d594 100644 --- a/external/pflash/test/results/01-info.out +++ b/external/pflash/test/results/01-info.out @@ -1,14 +1,15 @@ Flash info: ----------- Name = FILE -Total size = 0MB Flags E:ECC, P:PRESERVED, R:READONLY -Erase granule = 0KB B:BACKUP, F:REPROVISION, V:VOLATILE +Total size = 0MB Flags E:ECC, P:PRESERVED, R:READONLY, B:BACKUP +Erase granule = 0KB F:REPROVISION, V:VOLATILE, C:CLEARECC TOC@0x00000000 Partitions: ----------- -ID=00 part 0x00000000..0x00001000 (actual=0x00001000) [------] -ID=01 ONE 0x00003000..0x00004000 (actual=0x00001000) [E-----] -ID=02 TWO 0x00004000..0x00005000 (actual=0x00001000) [E---F-] -ID=03 THREE 0x00005000..0x00006000 (actual=0x00001000) [E---F-] -ID=04 FOUR 0x00006000..0x00007000 (actual=0x00001000) [E---F-] -ID=05 FIVE 0x00007000..0x00008000 (actual=0x00001000) [-----V] +ID=00 part 0x00000000..0x00001000 (actual=0x00001000) [-------] +ID=01 ONE 0x00003000..0x00004000 (actual=0x00001000) [E------] +ID=02 TWO 0x00004000..0x00005000 (actual=0x00001000) [E---F--] +ID=03 THREE 0x00005000..0x00006000 (actual=0x00001000) [E---F--] +ID=04 FOUR 0x00006000..0x00007000 (actual=0x00001000) [E---F--] +ID=05 FIVE 0x00007000..0x00008000 (actual=0x00001000) [-----V-] +ID=06 SIX 0x00008000..0x00009000 (actual=0x00001000) [------C] diff --git a/external/pflash/test/results/06-miscprint.out b/external/pflash/test/results/06-miscprint.out index 9ee2af6..f28057d 100644 --- a/external/pflash/test/results/06-miscprint.out +++ b/external/pflash/test/results/06-miscprint.out @@ -43,3 +43,12 @@ Start End Actual Flags: VOLATILE [V] +Detailed partition information +Name: +CLEARECC (ID=06) + +Start End Actual +0x00008000 0x00009000 0x00001000 + +Flags: +CLEARECC [C] diff --git a/external/pflash/test/tests/06-miscprint b/external/pflash/test/tests/06-miscprint index 858ab2b..2d94966 100644 --- a/external/pflash/test/tests/06-miscprint +++ b/external/pflash/test/tests/06-miscprint @@ -29,6 +29,10 @@ run_binary "./pflash" "--detail=5 -F $DATA_DIR/$CUR_TEST.pnor" if [ "$?" -ne 0 ] ; then fail_test; fi +run_binary "./pflash" "--detail=6 -F $DATA_DIR/$CUR_TEST.pnor" +if [ "$?" -ne 0 ] ; then + fail_test; +fi # The test infrastructure will clean up but lets no chew unnecessarily # though disk space diff --git a/libflash/ffs.h b/libflash/ffs.h index 26cb9d8..433ecac 100644 --- a/libflash/ffs.h +++ b/libflash/ffs.h @@ -77,6 +77,7 @@ enum ffs_type { #define FFS_MISCFLAGS_BACKUP 0x20 #define FFS_MISCFLAGS_REPROVISION 0x10 #define FFS_MISCFLAGS_VOLATILE 0x08 +#define FFS_MISCFLAGS_CLEARECC 0x04 /** * struct __ffs_entry_user - On flash user data entries diff --git a/libflash/libffs.c b/libflash/libffs.c index 87c5197..57dca49 100644 --- a/libflash/libffs.c +++ b/libflash/libffs.c @@ -724,8 +724,7 @@ int ffs_entry_user_set(struct ffs_entry *ent, struct ffs_entry_user *user) return -1; if (user->miscflags & ~(FFS_MISCFLAGS_PRESERVED | FFS_MISCFLAGS_BACKUP | FFS_MISCFLAGS_READONLY | FFS_MISCFLAGS_REPROVISION | - FFS_MISCFLAGS_VOLATILE -)) + FFS_MISCFLAGS_VOLATILE | FFS_MISCFLAGS_CLEARECC)) return -1; memcpy(&ent->user, user, sizeof(*user)); diff --git a/libflash/libffs.h b/libflash/libffs.h index 0610399..47a3808 100644 --- a/libflash/libffs.h +++ b/libflash/libffs.h @@ -89,6 +89,7 @@ struct ffs_entry_user { #define FFS_MISCFLAGS_BACKUP 0x20 #define FFS_MISCFLAGS_REPROVISION 0x10 #define FFS_MISCFLAGS_VOLATILE 0x08 +#define FFS_MISCFLAGS_CLEARECC 0x04 bool has_ecc(struct ffs_entry *ent); |