aboutsummaryrefslogtreecommitdiff
path: root/core/flash.c
diff options
context:
space:
mode:
authorCyril Bur <cyril.bur@au1.ibm.com>2016-07-26 13:49:34 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2016-10-11 14:42:43 +1100
commitadebaf3e0e621240c2041ed8f1ce91f70795cfa9 (patch)
tree63cffdedac9f134e091e3d8ea91b93885a1a5818 /core/flash.c
parenta452b83cd9eac584073fa19eb76e133de913ef52 (diff)
downloadskiboot-adebaf3e0e621240c2041ed8f1ce91f70795cfa9.zip
skiboot-adebaf3e0e621240c2041ed8f1ce91f70795cfa9.tar.gz
skiboot-adebaf3e0e621240c2041ed8f1ce91f70795cfa9.tar.bz2
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 <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'core/flash.c')
-rw-r--r--core/flash.c5
1 files changed, 3 insertions, 2 deletions
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;