aboutsummaryrefslogtreecommitdiffstats
path: root/fs/pstore/ram.c
diff options
context:
space:
mode:
authorAnton Vorontsov <anton.vorontsov@linaro.org>2012-07-09 20:03:19 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-07-17 12:46:52 -0400
commit5ca5d4e61d0cac15f36160ab48425c6e43bf2e2f (patch)
tree7e35f66cc7863798f32e96fb2062b6006352dc04 /fs/pstore/ram.c
parent4a53ffae6afc94bab803087245b3b45e712c21c8 (diff)
pstore/ram: Make ECC size configurable
This is now pretty straightforward: instead of using bool, just pass an integer. For backwards compatibility ramoops.ecc=1 means 16 bytes ECC (using 1 byte for ECC isn't much of use anyway). Suggested-by: Arve Hjønnevåg <arve@android.com> Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org> Acked-by: Kees Cook <keescook@chromium.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/pstore/ram.c')
-rw-r--r--fs/pstore/ram.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index 58b93fbd117e..b39aebbaeb89 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -63,7 +63,9 @@ MODULE_PARM_DESC(dump_oops,
63static int ramoops_ecc; 63static int ramoops_ecc;
64module_param_named(ecc, ramoops_ecc, int, 0600); 64module_param_named(ecc, ramoops_ecc, int, 0600);
65MODULE_PARM_DESC(ramoops_ecc, 65MODULE_PARM_DESC(ramoops_ecc,
66 "set to 1 to enable ECC support"); 66 "if non-zero, the option enables ECC support and specifies "
67 "ECC buffer size in bytes (1 is a special value, means 16 "
68 "bytes ECC)");
67 69
68struct ramoops_context { 70struct ramoops_context {
69 struct persistent_ram_zone **przs; 71 struct persistent_ram_zone **przs;
@@ -73,7 +75,7 @@ struct ramoops_context {
73 size_t record_size; 75 size_t record_size;
74 size_t console_size; 76 size_t console_size;
75 int dump_oops; 77 int dump_oops;
76 bool ecc; 78 int ecc_size;
77 unsigned int max_dump_cnt; 79 unsigned int max_dump_cnt;
78 unsigned int dump_write_cnt; 80 unsigned int dump_write_cnt;
79 unsigned int dump_read_cnt; 81 unsigned int dump_read_cnt;
@@ -288,7 +290,7 @@ static int ramoops_init_przs(struct device *dev, struct ramoops_context *cxt,
288 for (i = 0; i < cxt->max_dump_cnt; i++) { 290 for (i = 0; i < cxt->max_dump_cnt; i++) {
289 size_t sz = cxt->record_size; 291 size_t sz = cxt->record_size;
290 292
291 cxt->przs[i] = persistent_ram_new(*paddr, sz, cxt->ecc); 293 cxt->przs[i] = persistent_ram_new(*paddr, sz, cxt->ecc_size);
292 if (IS_ERR(cxt->przs[i])) { 294 if (IS_ERR(cxt->przs[i])) {
293 err = PTR_ERR(cxt->przs[i]); 295 err = PTR_ERR(cxt->przs[i]);
294 dev_err(dev, "failed to request mem region (0x%zx@0x%llx): %d\n", 296 dev_err(dev, "failed to request mem region (0x%zx@0x%llx): %d\n",
@@ -314,7 +316,7 @@ static int ramoops_init_prz(struct device *dev, struct ramoops_context *cxt,
314 if (*paddr + sz > *paddr + cxt->size) 316 if (*paddr + sz > *paddr + cxt->size)
315 return -ENOMEM; 317 return -ENOMEM;
316 318
317 *prz = persistent_ram_new(*paddr, sz, cxt->ecc); 319 *prz = persistent_ram_new(*paddr, sz, cxt->ecc_size);
318 if (IS_ERR(*prz)) { 320 if (IS_ERR(*prz)) {
319 int err = PTR_ERR(*prz); 321 int err = PTR_ERR(*prz);
320 322
@@ -361,7 +363,7 @@ static int __devinit ramoops_probe(struct platform_device *pdev)
361 cxt->record_size = pdata->record_size; 363 cxt->record_size = pdata->record_size;
362 cxt->console_size = pdata->console_size; 364 cxt->console_size = pdata->console_size;
363 cxt->dump_oops = pdata->dump_oops; 365 cxt->dump_oops = pdata->dump_oops;
364 cxt->ecc = pdata->ecc; 366 cxt->ecc_size = pdata->ecc_size;
365 367
366 paddr = cxt->phys_addr; 368 paddr = cxt->phys_addr;
367 369
@@ -411,9 +413,9 @@ static int __devinit ramoops_probe(struct platform_device *pdev)
411 record_size = pdata->record_size; 413 record_size = pdata->record_size;
412 dump_oops = pdata->dump_oops; 414 dump_oops = pdata->dump_oops;
413 415
414 pr_info("attached 0x%lx@0x%llx, ecc: %s\n", 416 pr_info("attached 0x%lx@0x%llx, ecc: %d\n",
415 cxt->size, (unsigned long long)cxt->phys_addr, 417 cxt->size, (unsigned long long)cxt->phys_addr,
416 ramoops_ecc ? "on" : "off"); 418 cxt->ecc_size);
417 419
418 return 0; 420 return 0;
419 421
@@ -478,7 +480,11 @@ static void ramoops_register_dummy(void)
478 dummy_data->record_size = record_size; 480 dummy_data->record_size = record_size;
479 dummy_data->console_size = ramoops_console_size; 481 dummy_data->console_size = ramoops_console_size;
480 dummy_data->dump_oops = dump_oops; 482 dummy_data->dump_oops = dump_oops;
481 dummy_data->ecc = ramoops_ecc; 483 /*
484 * For backwards compatibility ramoops.ecc=1 means 16 bytes ECC
485 * (using 1 byte for ECC isn't much of use anyway).
486 */
487 dummy_data->ecc_size = ramoops_ecc == 1 ? 16 : ramoops_ecc;
482 488
483 dummy = platform_device_register_data(NULL, "ramoops", -1, 489 dummy = platform_device_register_data(NULL, "ramoops", -1,
484 dummy_data, sizeof(struct ramoops_platform_data)); 490 dummy_data, sizeof(struct ramoops_platform_data));