aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyril Bur <cyril.bur@au1.ibm.com>2016-07-26 13:49:31 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2016-07-27 18:24:16 +1000
commitd7ce0ac42b49d274c40fe8edf73b10a640116479 (patch)
tree8e3ff3749dd4461b34e4564d473b458412094d28
parenta2d630bc2bdd0007f06d1552361d08ef9d313a1a (diff)
downloadskiboot-d7ce0ac42b49d274c40fe8edf73b10a640116479.zip
skiboot-d7ce0ac42b49d274c40fe8edf73b10a640116479.tar.gz
skiboot-d7ce0ac42b49d274c40fe8edf73b10a640116479.tar.bz2
nvram: Add extra debug printing when NVRAM needs formatting
Be more verbose (at debug level) when formatting the NVRAM, this can help catch errors at other levels of the stack. Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r--core/nvram-format.c12
-rw-r--r--core/nvram.c3
2 files changed, 11 insertions, 4 deletions
diff --git a/core/nvram-format.c b/core/nvram-format.c
index 899fab4..1c164d4 100644
--- a/core/nvram-format.c
+++ b/core/nvram-format.c
@@ -65,7 +65,7 @@ int nvram_format(void *nvram_image, uint32_t nvram_size)
struct chrp_nvram_hdr *h;
unsigned int offset = 0;
- prerror("NVRAM: Re-initializing\n");
+ prerror("NVRAM: Re-initializing (size: 0x%08x)\n", nvram_size);
memset(nvram_image, 0, nvram_size);
/* Create private partition */
@@ -76,6 +76,8 @@ int nvram_format(void *nvram_image, uint32_t nvram_size)
h->len = NVRAM_SIZE_FW_PRIV >> 4;
strcpy(h->name, NVRAM_NAME_FW_PRIV);
h->cksum = chrp_nv_cksum(h);
+ prlog(PR_DEBUG, "NVRAM: Created '%s' partition at 0x%08x for size 0x%08x"
+ " with cksum 0x%02x\n", NVRAM_NAME_FW_PRIV, offset, h->len, h->cksum);
offset += NVRAM_SIZE_FW_PRIV;
/* Create common partition */
@@ -86,6 +88,8 @@ int nvram_format(void *nvram_image, uint32_t nvram_size)
h->len = NVRAM_SIZE_COMMON >> 4;
strcpy(h->name, NVRAM_NAME_COMMON);
h->cksum = chrp_nv_cksum(h);
+ prlog(PR_DEBUG, "NVRAM: Created '%s' partition at 0x%08x for size 0x%08x"
+ " with cksum 0x%02x\n", NVRAM_NAME_COMMON, offset, h->len, h->cksum);
offset += NVRAM_SIZE_COMMON;
/* Create free space partition */
@@ -97,7 +101,8 @@ int nvram_format(void *nvram_image, uint32_t nvram_size)
/* We have the full 12 bytes here */
memcpy(h->name, NVRAM_NAME_FREE, 12);
h->cksum = chrp_nv_cksum(h);
-
+ prlog(PR_DEBUG, "NVRAM: Created '%s' partition at 0x%08x for size 0x%08x"
+ " with cksum 0x%02x\n", NVRAM_NAME_FREE, offset, h->len, h->cksum);
return 0;
}
@@ -117,7 +122,8 @@ int nvram_check(void *nvram_image, const uint32_t nvram_size)
if (chrp_nv_cksum(h) != h->cksum) {
prerror("NVRAM: Partition at offset 0x%x"
- " has bad checksum\n", offset);
+ " has bad checksum: 0x%02x vs 0x%02x\n",
+ offset, h->cksum, chrp_nv_cksum(h));
goto failed;
}
if (h->len < 1) {
diff --git a/core/nvram.c b/core/nvram.c
index bde2dce..38babcc 100644
--- a/core/nvram.c
+++ b/core/nvram.c
@@ -64,7 +64,8 @@ void nvram_read_complete(bool success)
/* Check and maybe format nvram */
if (nvram_check(nvram_image, nvram_size)) {
- nvram_format(nvram_image, nvram_size);
+ if (nvram_format(nvram_image, nvram_size))
+ prerror("NVRAM: Failed to format NVRAM!\n");
/* Write the whole thing back */
if (platform.nvram_write)