summaryrefslogtreecommitdiff
path: root/bootloader/x1000
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2022-06-07 19:34:08 +0100
committerAidan MacDonald <amachronic@protonmail.com>2022-07-19 13:15:26 +0100
commit45e2d5d641016d6c39c66e10fda874379f3c7fa0 (patch)
tree23dbe80d8f767947dc017f980c7deb1e7ef83f85 /bootloader/x1000
parent5901ac87566f78185b330b5eb39005c9c7886803 (diff)
downloadrockbox-45e2d5d641016d6c39c66e10fda874379f3c7fa0.tar.gz
rockbox-45e2d5d641016d6c39c66e10fda874379f3c7fa0.zip
x1000: check for ECC failures in bootloader uimage reader
Update the uimage reader's bad block handling to treat an ECC uncorrectable error on the first page of the block as a bad block. Change-Id: Id3aa7a338fcc36c0e2381063b119efe41f957122
Diffstat (limited to 'bootloader/x1000')
-rw-r--r--bootloader/x1000/utils.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/bootloader/x1000/utils.c b/bootloader/x1000/utils.c
index 46624b0d1d..a1d90dedbb 100644
--- a/bootloader/x1000/utils.c
+++ b/bootloader/x1000/utils.c
@@ -189,6 +189,15 @@ static ssize_t uimage_nand_reader(void* buf, size_t count, void* rctx)
189 189
190 while(d->page < d->end_page && read_count < count) { 190 while(d->page < d->end_page && read_count < count) {
191 rc = nand_page_read(ndrv, d->page, ndrv->page_buf); 191 rc = nand_page_read(ndrv, d->page, ndrv->page_buf);
192
193 /* Ignore ECC errors on the first page of a block. This may
194 * indicate a bad block. */
195 if(rc == NAND_ERR_ECC_FAIL &&
196 d->page % ndrv->ppb == 0 && d->offset == 0) {
197 d->page += ndrv->ppb;
198 continue;
199 }
200
192 if(rc < 0) 201 if(rc < 0)
193 return -1; 202 return -1;
194 203