summaryrefslogtreecommitdiffstats
path: root/external
diff options
context:
space:
mode:
authorStewart Smith <stewart@linux.ibm.com>2018-12-10 17:48:49 +1100
committerStewart Smith <stewart@linux.ibm.com>2018-12-11 22:37:41 -0600
commitf12bdee4d0b1409533a3c0dd12d867ad4acae8b7 (patch)
treeb95824bea8735f20e89c1ed81ff876c537c33222 /external
parent7ac3a779319015a3a1c6b6f6ef9bbb106dcc9223 (diff)
downloadblackbird-skiboot-f12bdee4d0b1409533a3c0dd12d867ad4acae8b7.tar.gz
blackbird-skiboot-f12bdee4d0b1409533a3c0dd12d867ad4acae8b7.zip
ffspart: Support flashing already ECC protected images
We do this by assuming filenames with '.ecc' in them are already ECC protected. This solves a practical problem in transitioning op-build to use ffspart for pnor assembly rather than three perl scripts and a lot of XML. We also update the ffspart tests to take into account ECC requirements. Signed-off-by: Stewart Smith <stewart@linux.ibm.com> Reviewed-by: Samuel Mendoza-Jonas <sam@mendozajonas.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Diffstat (limited to 'external')
-rw-r--r--external/ffspart/ffspart.c16
-rw-r--r--external/ffspart/test/files/04-tiny-pnor2.outbin2560 -> 2560 bytes
-rw-r--r--external/ffspart/test/results/07-big-files.err2
-rw-r--r--external/ffspart/test/tests/04-tiny-pnor22
-rw-r--r--external/ffspart/test/tests/08-small-files2
5 files changed, 17 insertions, 5 deletions
diff --git a/external/ffspart/ffspart.c b/external/ffspart/ffspart.c
index eeee0d4d..bb46a9ea 100644
--- a/external/ffspart/ffspart.c
+++ b/external/ffspart/ffspart.c
@@ -31,6 +31,7 @@
#include <libflash/libflash.h>
#include <libflash/libffs.h>
#include <libflash/blocklevel.h>
+#include <libflash/ecc.h>
#include <common/arch_flash.h>
/*
@@ -250,6 +251,14 @@ static int parse_entry(struct blocklevel_device *bl,
if (*line != '\0' && *(line + 1) != '\0') {
filename = line + 1;
+
+ /*
+ * Support flashing already ecc'd data as this is the case
+ * for POWER8 SBE image binary.
+ */
+ if (has_ecc(new_entry) && !strstr(filename, ".ecc"))
+ blocklevel_ecc_protect(bl, pbase, psize);
+
data_fd = open(filename, O_RDONLY);
if (data_fd == -1) {
fprintf(stderr, "Couldn't open file '%s' for '%s' partition "
@@ -269,9 +278,12 @@ static int parse_entry(struct blocklevel_device *bl,
* Sanity check that the file isn't too large for
* partition
*/
+ if (has_ecc(new_entry) && !strstr(filename, ".ecc"))
+ psize = ecc_buffer_size_minus_ecc(psize);
if (pactual > psize) {
- fprintf(stderr, "File '%s' for partition '%s' is too large\n",
- filename, name);
+ fprintf(stderr, "File '%s' for partition '%s' is too large,"
+ " %u > %u\n",
+ filename, name, pactual, psize);
close(data_fd);
return -1;
}
diff --git a/external/ffspart/test/files/04-tiny-pnor2.out b/external/ffspart/test/files/04-tiny-pnor2.out
index 394edf04..617c4ef4 100644
--- a/external/ffspart/test/files/04-tiny-pnor2.out
+++ b/external/ffspart/test/files/04-tiny-pnor2.out
Binary files differ
diff --git a/external/ffspart/test/results/07-big-files.err b/external/ffspart/test/results/07-big-files.err
index 083bad20..bfb6fa02 100644
--- a/external/ffspart/test/results/07-big-files.err
+++ b/external/ffspart/test/results/07-big-files.err
@@ -1,4 +1,4 @@
WARNING: Attempting to parse a partition line without any TOCs created.
Generating a default TOC at zero
-File 'FILE_ONE' for partition 'ONE' is too large
+File 'FILE_ONE' for partition 'ONE' is too large, 257 > 227
Failed to parse input file 'FILE' at line 1
diff --git a/external/ffspart/test/tests/04-tiny-pnor2 b/external/ffspart/test/tests/04-tiny-pnor2
index a7e79ab5..3db5f1e2 100644
--- a/external/ffspart/test/tests/04-tiny-pnor2
+++ b/external/ffspart/test/tests/04-tiny-pnor2
@@ -4,7 +4,7 @@ touch $DATA_DIR/$CUR_TEST.gen
i=1;
while [ $i -lt 5 ] ; do
j=0;
- while [ $j -lt $((0x100)) ] ; do
+ while [ $j -lt $((0xe0)) ] ; do
echo -n "$i" >> $DATA_DIR/$CUR_TEST.$i;
j=$(expr $j + 1);
done
diff --git a/external/ffspart/test/tests/08-small-files b/external/ffspart/test/tests/08-small-files
index fb2a98b3..1e4f3b3b 100644
--- a/external/ffspart/test/tests/08-small-files
+++ b/external/ffspart/test/tests/08-small-files
@@ -4,7 +4,7 @@ touch $DATA_DIR/$CUR_TEST.gen
i=1;
while [ $i -lt 5 ] ; do
j=0;
- while [ $j -lt $((0xff)) ] ; do
+ while [ $j -lt $((0xe0)) ] ; do
echo -n "$i" >> $DATA_DIR/$CUR_TEST.$i;
j=$(expr $j + 1);
done
OpenPOWER on IntegriCloud