From adebaf3e0e621240c2041ed8f1ce91f70795cfa9 Mon Sep 17 00:00:00 2001 From: Cyril Bur Date: Tue, 26 Jul 2016 13:49:34 +1000 Subject: flash: Size NVRAM based on ECC for OpenPOWER platforms 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 Signed-off-by: Stewart Smith --- core/flash.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'core/flash.c') diff --git a/core/flash.c b/core/flash.c index 9b07aa3..de7895c 100644 --- a/core/flash.c +++ b/core/flash.c @@ -149,6 +149,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"); @@ -160,7 +161,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 @@ -175,7 +176,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; -- cgit v1.1