diff options
Diffstat (limited to 'drivers/acpi/apei/einj.c')
-rw-r--r-- | drivers/acpi/apei/einj.c | 43 |
1 files changed, 26 insertions, 17 deletions
diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c index f74b2ea11f21..589b96c38704 100644 --- a/drivers/acpi/apei/einj.c +++ b/drivers/acpi/apei/einj.c | |||
@@ -46,7 +46,8 @@ | |||
46 | * Some BIOSes allow parameters to the SET_ERROR_TYPE entries in the | 46 | * Some BIOSes allow parameters to the SET_ERROR_TYPE entries in the |
47 | * EINJ table through an unpublished extension. Use with caution as | 47 | * EINJ table through an unpublished extension. Use with caution as |
48 | * most will ignore the parameter and make their own choice of address | 48 | * most will ignore the parameter and make their own choice of address |
49 | * for error injection. | 49 | * for error injection. This extension is used only if |
50 | * param_extension module parameter is specified. | ||
50 | */ | 51 | */ |
51 | struct einj_parameter { | 52 | struct einj_parameter { |
52 | u64 type; | 53 | u64 type; |
@@ -65,6 +66,9 @@ struct einj_parameter { | |||
65 | ((struct acpi_whea_header *)((char *)(tab) + \ | 66 | ((struct acpi_whea_header *)((char *)(tab) + \ |
66 | sizeof(struct acpi_table_einj))) | 67 | sizeof(struct acpi_table_einj))) |
67 | 68 | ||
69 | static bool param_extension; | ||
70 | module_param(param_extension, bool, 0); | ||
71 | |||
68 | static struct acpi_table_einj *einj_tab; | 72 | static struct acpi_table_einj *einj_tab; |
69 | 73 | ||
70 | static struct apei_resources einj_resources; | 74 | static struct apei_resources einj_resources; |
@@ -285,7 +289,7 @@ static int __einj_error_inject(u32 type, u64 param1, u64 param2) | |||
285 | 289 | ||
286 | einj_exec_ctx_init(&ctx); | 290 | einj_exec_ctx_init(&ctx); |
287 | 291 | ||
288 | rc = apei_exec_run(&ctx, ACPI_EINJ_BEGIN_OPERATION); | 292 | rc = apei_exec_run_optional(&ctx, ACPI_EINJ_BEGIN_OPERATION); |
289 | if (rc) | 293 | if (rc) |
290 | return rc; | 294 | return rc; |
291 | apei_exec_ctx_set_input(&ctx, type); | 295 | apei_exec_ctx_set_input(&ctx, type); |
@@ -323,7 +327,7 @@ static int __einj_error_inject(u32 type, u64 param1, u64 param2) | |||
323 | rc = __einj_error_trigger(trigger_paddr); | 327 | rc = __einj_error_trigger(trigger_paddr); |
324 | if (rc) | 328 | if (rc) |
325 | return rc; | 329 | return rc; |
326 | rc = apei_exec_run(&ctx, ACPI_EINJ_END_OPERATION); | 330 | rc = apei_exec_run_optional(&ctx, ACPI_EINJ_END_OPERATION); |
327 | 331 | ||
328 | return rc; | 332 | return rc; |
329 | } | 333 | } |
@@ -489,14 +493,6 @@ static int __init einj_init(void) | |||
489 | einj_debug_dir, NULL, &error_type_fops); | 493 | einj_debug_dir, NULL, &error_type_fops); |
490 | if (!fentry) | 494 | if (!fentry) |
491 | goto err_cleanup; | 495 | goto err_cleanup; |
492 | fentry = debugfs_create_x64("param1", S_IRUSR | S_IWUSR, | ||
493 | einj_debug_dir, &error_param1); | ||
494 | if (!fentry) | ||
495 | goto err_cleanup; | ||
496 | fentry = debugfs_create_x64("param2", S_IRUSR | S_IWUSR, | ||
497 | einj_debug_dir, &error_param2); | ||
498 | if (!fentry) | ||
499 | goto err_cleanup; | ||
500 | fentry = debugfs_create_file("error_inject", S_IWUSR, | 496 | fentry = debugfs_create_file("error_inject", S_IWUSR, |
501 | einj_debug_dir, NULL, &error_inject_fops); | 497 | einj_debug_dir, NULL, &error_inject_fops); |
502 | if (!fentry) | 498 | if (!fentry) |
@@ -513,12 +509,23 @@ static int __init einj_init(void) | |||
513 | rc = apei_exec_pre_map_gars(&ctx); | 509 | rc = apei_exec_pre_map_gars(&ctx); |
514 | if (rc) | 510 | if (rc) |
515 | goto err_release; | 511 | goto err_release; |
516 | param_paddr = einj_get_parameter_address(); | 512 | if (param_extension) { |
517 | if (param_paddr) { | 513 | param_paddr = einj_get_parameter_address(); |
518 | einj_param = ioremap(param_paddr, sizeof(*einj_param)); | 514 | if (param_paddr) { |
519 | rc = -ENOMEM; | 515 | einj_param = ioremap(param_paddr, sizeof(*einj_param)); |
520 | if (!einj_param) | 516 | rc = -ENOMEM; |
521 | goto err_unmap; | 517 | if (!einj_param) |
518 | goto err_unmap; | ||
519 | fentry = debugfs_create_x64("param1", S_IRUSR | S_IWUSR, | ||
520 | einj_debug_dir, &error_param1); | ||
521 | if (!fentry) | ||
522 | goto err_unmap; | ||
523 | fentry = debugfs_create_x64("param2", S_IRUSR | S_IWUSR, | ||
524 | einj_debug_dir, &error_param2); | ||
525 | if (!fentry) | ||
526 | goto err_unmap; | ||
527 | } else | ||
528 | pr_warn(EINJ_PFX "Parameter extension is not supported.\n"); | ||
522 | } | 529 | } |
523 | 530 | ||
524 | pr_info(EINJ_PFX "Error INJection is initialized.\n"); | 531 | pr_info(EINJ_PFX "Error INJection is initialized.\n"); |
@@ -526,6 +533,8 @@ static int __init einj_init(void) | |||
526 | return 0; | 533 | return 0; |
527 | 534 | ||
528 | err_unmap: | 535 | err_unmap: |
536 | if (einj_param) | ||
537 | iounmap(einj_param); | ||
529 | apei_exec_post_unmap_gars(&ctx); | 538 | apei_exec_post_unmap_gars(&ctx); |
530 | err_release: | 539 | err_release: |
531 | apei_resources_release(&einj_resources); | 540 | apei_resources_release(&einj_resources); |