[Skiboot] [PATCH 5/6] flash: Size NVRAM based on ECC for OpenPOWER platforms

Cyril Bur cyril.bur at au1.ibm.com
Tue Jul 26 13:49:34 AEST 2016


If NVRAM has ECC (as per the ffs header) then the actual size of the
partition is less than reported by the ffs header in the PNOR then the
actual size of the partition is less than reported by the ffs header.

Signed-off-by: Cyril Bur <cyril.bur at au1.ibm.com>
---
 core/flash.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/core/flash.c b/core/flash.c
index ca9cca7..c0fba88 100644
--- a/core/flash.c
+++ b/core/flash.c
@@ -148,6 +148,7 @@ out:
 static int flash_nvram_probe(struct flash *flash, struct ffs_handle *ffs)
 {
 	uint32_t start, size, part;
+	bool ecc;
 	int rc;
 
 	prlog(PR_INFO, "FLASH: probing for NVRAM\n");
@@ -159,7 +160,7 @@ static int flash_nvram_probe(struct flash *flash, struct ffs_handle *ffs)
 	}
 
 	rc = ffs_part_info(ffs, part, NULL,
-			   &start, &size, NULL, NULL);
+			   &start, &size, NULL, &ecc);
 	if (rc) {
 		/**
 		 * @fwts-label NVRAMNoPartition
@@ -174,7 +175,7 @@ static int flash_nvram_probe(struct flash *flash, struct ffs_handle *ffs)
 
 	nvram_flash = flash;
 	nvram_offset = start;
-	nvram_size = size;
+	nvram_size = ecc ? ecc_buffer_size_minus_ecc(size) : size;
 
 	platform.nvram_info = flash_nvram_info;
 	platform.nvram_start_read = flash_nvram_start_read;
-- 
2.9.0



More information about the Skiboot mailing list