summaryrefslogtreecommitdiff
path: root/arch/powerpc/kernel/nvram_64.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2010-07-29 17:22:34 +1000
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2010-11-30 15:32:10 +1100
commitcef0d5ad62ec6e0c8456b8f58e898aa3219311a5 (patch)
treebbb294bb1a2c638193839398388012409beb5548 /arch/powerpc/kernel/nvram_64.c
parent578914cffc283b907777796420148d582072cbae (diff)
downloadlwn-cef0d5ad62ec6e0c8456b8f58e898aa3219311a5.tar.gz
lwn-cef0d5ad62ec6e0c8456b8f58e898aa3219311a5.zip
powerpc/nvram: Completely clear a new partition
When creating a partition, we clear it entirely rather than just the first two words since the previous code was rather specific to the pseries log partition format. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel/nvram_64.c')
-rw-r--r--arch/powerpc/kernel/nvram_64.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/arch/powerpc/kernel/nvram_64.c b/arch/powerpc/kernel/nvram_64.c
index f7538820c03d..02737e687559 100644
--- a/arch/powerpc/kernel/nvram_64.c
+++ b/arch/powerpc/kernel/nvram_64.c
@@ -320,7 +320,7 @@ static int __init nvram_create_partition(const char *name, int sig,
struct nvram_partition *part;
struct nvram_partition *new_part;
struct nvram_partition *free_part = NULL;
- int seq_init[2] = { 0, 0 };
+ static char nv_init_vals[16];
loff_t tmp_index;
long size = 0;
int rc;
@@ -379,14 +379,15 @@ static int __init nvram_create_partition(const char *name, int sig,
return rc;
}
- /* make sure and initialize to zero the sequence number and the error
- type logged */
- tmp_index = new_part->index + NVRAM_HEADER_LEN;
- rc = ppc_md.nvram_write((char *)&seq_init, sizeof(seq_init), &tmp_index);
- if (rc <= 0) {
- printk(KERN_ERR "nvram_create_os_partition: nvram_write "
- "failed (%d)\n", rc);
- return rc;
+ /* Clear the partition */
+ for (tmp_index = new_part->index + NVRAM_HEADER_LEN;
+ tmp_index < ((size - 1) * NVRAM_BLOCK_LEN);
+ tmp_index += NVRAM_BLOCK_LEN) {
+ rc = ppc_md.nvram_write(nv_init_vals, NVRAM_BLOCK_LEN, &tmp_index);
+ if (rc <= 0) {
+ pr_err("nvram_create_partition: nvram_write failed (%d)\n", rc);
+ return rc;
+ }
}
nvram_error_log_index = new_part->index + NVRAM_HEADER_LEN;