diff options
author | Samuel Mendoza-Jonas <sam@mendozajonas.com> | 2018-11-21 17:16:01 +1100 |
---|---|---|
committer | Stewart Smith <stewart@linux.ibm.com> | 2018-11-21 21:55:53 -0600 |
commit | e247710814227a7122915ff44474e0c8aa26fd3a (patch) | |
tree | dd03b6b3ac9940a982e5bd8c9a67e0839bbbdcac /libflash/test | |
parent | 4b92a1b80f6dd27195ab50ab8370c7915a4a9b17 (diff) | |
download | skiboot-e247710814227a7122915ff44474e0c8aa26fd3a.zip skiboot-e247710814227a7122915ff44474e0c8aa26fd3a.tar.gz skiboot-e247710814227a7122915ff44474e0c8aa26fd3a.tar.bz2 |
libflash: Don't merge ECC-protected ranges
Libflash currently merges contiguous ECC-protected ranges, but doesn't
check that the ECC bytes at the end of the first and start of the second
range actually match sanely. More importantly, if blocklevel_read() is
called with a position at the start of a partition that is contained
somewhere within a region that has been merged it will update the
position assuming ECC wasn't being accounted for. This results in the
position being somewhere well after the actual start of the partition
which is incorrect.
For now, remove the code merging ranges. This means more ranges must be
held and checked however it prevents incorrectly reading ECC-correct
regions like below:
[ 174.334119453,7] FLASH: CAPP partition has ECC
[ 174.437349574,3] ECC: uncorrectable error: ffffffffffffffff ff
[ 174.437426306,3] FLASH: failed to read the first 0x1000 from CAPP partition, rc 14
[ 174.439919343,3] CAPP: Error loading ucode lid. index=201d1
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Diffstat (limited to 'libflash/test')
-rw-r--r-- | libflash/test/test-blocklevel.c | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/libflash/test/test-blocklevel.c b/libflash/test/test-blocklevel.c index 42ad146..a67f588 100644 --- a/libflash/test/test-blocklevel.c +++ b/libflash/test/test-blocklevel.c @@ -289,24 +289,6 @@ int main(void) ERR("Failed to blocklevel_ecc_protect(0x6200, 0x100)\n"); return 1; } - /*This addition should cause this one to merge the other two together*/ - if (blocklevel_ecc_protect(bl, 0x6100, 0x100)) { - ERR("Failed to blocklevel_ecc_protect(0x6100, 0x100)\n"); - return 1; - } - /* Make sure we trigger the merging code */ - for (i = bl->ecc_prot.n_prot; i < bl->ecc_prot.total_prot; i++) - blocklevel_ecc_protect(bl, 0x10000 + i * 0x200, 0x10); - /* Check that the region merging works */ - for (i = 0; i < bl->ecc_prot.n_prot - 1; i++) { - if (bl->ecc_prot.prot[i].start + bl->ecc_prot.prot[i].len == bl->ecc_prot.prot[i + 1].start || - bl->ecc_prot.prot[i + 1].start + bl->ecc_prot.prot[i + 1].len == bl->ecc_prot.prot[i].start) { - ERR("Problem with protection range merge code, region starting at 0x%08lx for 0x%08lx appears " - "to touch region 0x%lx for 0x%lx\n", bl->ecc_prot.prot[i].start, bl->ecc_prot.prot[i].len, - bl->ecc_prot.prot[i + 1].start, bl->ecc_prot.prot[i + 1].len); - return 1; - } - } /* Test ECC reading and writing being 100% transparent to the * caller */ |