From 36c2f299f51e67c720a86dc5f717eb3eddb4fa42 Mon Sep 17 00:00:00 2001 From: Cyril Bur Date: Wed, 2 Nov 2016 16:43:28 +1100 Subject: core/flash: Use blocklevel accessors to load resources Resource loading uses the flash calls directly which works on hardware as the blocklevel abstraction was initialised with a flash structure. On platforms such as mambo the blocklevel abstraction was initialised with the bogusdisk structure so calling the flash calls directly results in following uninitialised function pointers off into lala land. Functionality is preserved as the blocklevel is told if a flash partition is ECC protected during the call to ffs_init(). Signed-off-by: Cyril Bur Signed-off-by: Stewart Smith --- core/flash.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/core/flash.c b/core/flash.c index 5ab7fc8..55fd668 100644 --- a/core/flash.c +++ b/core/flash.c @@ -540,8 +540,8 @@ static int flash_load_resource(enum resource_id id, uint32_t subid, goto out_free_ffs; } - rc = flash_read_corrected(flash->bl, ffs_part_start, bufp, - SECURE_BOOT_HEADERS_SIZE, ecc); + rc = blocklevel_read(flash->bl, ffs_part_start, bufp, + SECURE_BOOT_HEADERS_SIZE); if (rc) { prerror("FLASH: failed to read the first 0x%x from " "%s partition, rc %d\n", SECURE_BOOT_HEADERS_SIZE, @@ -574,8 +574,8 @@ static int flash_load_resource(enum resource_id id, uint32_t subid, if (ecc) ffs_part_start += ecc_size(SECURE_BOOT_HEADERS_SIZE); - rc = flash_read_corrected(flash->bl, ffs_part_start, bufp, - content_size, ecc); + rc = blocklevel_read(flash->bl, ffs_part_start, bufp, + content_size); if (rc) { prerror("FLASH: failed to read content size %d" " %s partition, rc %d\n", @@ -613,8 +613,8 @@ static int flash_load_resource(enum resource_id id, uint32_t subid, } prlog(PR_DEBUG, "FLASH: computed %s size %u\n", name, content_size); - rc = flash_read_corrected(flash->bl, ffs_part_start, - buf, content_size, ecc); + rc = blocklevel_read(flash->bl, ffs_part_start, + buf, content_size); if (rc) { prerror("FLASH: failed to read content size %d" " %s partition, rc %d\n", @@ -644,8 +644,8 @@ static int flash_load_resource(enum resource_id id, uint32_t subid, * Afterwards, we memmove() things back into place for * the caller. */ - rc = flash_read_corrected(flash->bl, ffs_part_start, - buf, ffs_part_size, ecc); + rc = blocklevel_read(flash->bl, ffs_part_start, + buf, ffs_part_size); bufp += offset; } -- cgit v1.1