[Skiboot] [PATCH 1/2] core/flash: Use blocklevel accessors to load resources

Cyril Bur cyril.bur at au1.ibm.com
Wed Nov 2 16:43:28 AEDT 2016


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 <cyril.bur at au1.ibm.com>
---
 core/flash.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/core/flash.c b/core/flash.c
index 83cd6c8..f243987 100644
--- a/core/flash.c
+++ b/core/flash.c
@@ -539,8 +539,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, name, rc);
@@ -572,8 +572,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",
@@ -611,8 +611,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",
@@ -640,8 +640,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;
 	}
-- 
2.10.1



More information about the Skiboot mailing list