diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2022-06-07 19:34:08 +0100 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2022-07-19 13:15:26 +0100 |
commit | 45e2d5d641016d6c39c66e10fda874379f3c7fa0 (patch) | |
tree | 23dbe80d8f767947dc017f980c7deb1e7ef83f85 | |
parent | 5901ac87566f78185b330b5eb39005c9c7886803 (diff) | |
download | rockbox-45e2d5d641.tar.gz rockbox-45e2d5d641.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
-rw-r--r-- | bootloader/x1000/utils.c | 9 |
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) while(d->page < d->end_page && read_count < count) { rc = nand_page_read(ndrv, d->page, ndrv->page_buf); + + /* Ignore ECC errors on the first page of a block. This may + * indicate a bad block. */ + if(rc == NAND_ERR_ECC_FAIL && + d->page % ndrv->ppb == 0 && d->offset == 0) { + d->page += ndrv->ppb; + continue; + } + if(rc < 0) return -1; |