2 * APEI Error INJection support
4 * EINJ provides a hardware error injection mechanism, this is useful
5 * for debugging and testing of other APEI and RAS features.
7 * For more information about EINJ, please refer to ACPI Specification
8 * version 4.0, section 17.5.
10 * Copyright 2009-2010 Intel Corp.
11 * Author: Huang Ying <ying.huang@intel.com>
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License version
15 * 2 as published by the Free Software Foundation.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
23 #include <linux/kernel.h>
24 #include <linux/module.h>
25 #include <linux/init.h>
27 #include <linux/debugfs.h>
28 #include <linux/seq_file.h>
29 #include <linux/nmi.h>
30 #include <linux/delay.h>
32 #include <asm/unaligned.h>
34 #include "apei-internal.h"
37 #define pr_fmt(fmt) "EINJ: " fmt
39 #define SPIN_UNIT 100 /* 100ns */
40 /* Firmware should respond within 1 milliseconds */
41 #define FIRMWARE_TIMEOUT (1 * NSEC_PER_MSEC)
42 #define ACPI5_VENDOR_BIT BIT(31)
43 #define MEM_ERROR_MASK (ACPI_EINJ_MEMORY_CORRECTABLE | \
44 ACPI_EINJ_MEMORY_UNCORRECTABLE | \
45 ACPI_EINJ_MEMORY_FATAL)
48 * ACPI version 5 provides a SET_ERROR_TYPE_WITH_ADDRESS action.
52 struct set_error_type_with_address
{
58 u64 memory_address_range
;
62 SETWA_FLAGS_APICID
= 1,
64 SETWA_FLAGS_PCIE_SBDF
= 4,
68 * Vendor extensions for platform specific operations
70 struct vendor_error_type_extension
{
81 static u32 vendor_flags
;
82 static struct debugfs_blob_wrapper vendor_blob
;
83 static char vendor_dev
[64];
86 * Some BIOSes allow parameters to the SET_ERROR_TYPE entries in the
87 * EINJ table through an unpublished extension. Use with caution as
88 * most will ignore the parameter and make their own choice of address
89 * for error injection. This extension is used only if
90 * param_extension module parameter is specified.
92 struct einj_parameter
{
100 #define EINJ_OP_BUSY 0x1
101 #define EINJ_STATUS_SUCCESS 0x0
102 #define EINJ_STATUS_FAIL 0x1
103 #define EINJ_STATUS_INVAL 0x2
105 #define EINJ_TAB_ENTRY(tab) \
106 ((struct acpi_whea_header *)((char *)(tab) + \
107 sizeof(struct acpi_table_einj)))
109 static bool param_extension
;
110 module_param(param_extension
, bool, 0);
112 static struct acpi_table_einj
*einj_tab
;
114 static struct apei_resources einj_resources
;
116 static struct apei_exec_ins_type einj_ins_type
[] = {
117 [ACPI_EINJ_READ_REGISTER
] = {
118 .flags
= APEI_EXEC_INS_ACCESS_REGISTER
,
119 .run
= apei_exec_read_register
,
121 [ACPI_EINJ_READ_REGISTER_VALUE
] = {
122 .flags
= APEI_EXEC_INS_ACCESS_REGISTER
,
123 .run
= apei_exec_read_register_value
,
125 [ACPI_EINJ_WRITE_REGISTER
] = {
126 .flags
= APEI_EXEC_INS_ACCESS_REGISTER
,
127 .run
= apei_exec_write_register
,
129 [ACPI_EINJ_WRITE_REGISTER_VALUE
] = {
130 .flags
= APEI_EXEC_INS_ACCESS_REGISTER
,
131 .run
= apei_exec_write_register_value
,
135 .run
= apei_exec_noop
,
140 * Prevent EINJ interpreter to run simultaneously, because the
141 * corresponding firmware implementation may not work properly when
142 * invoked simultaneously.
144 static DEFINE_MUTEX(einj_mutex
);
146 static void *einj_param
;
148 static void einj_exec_ctx_init(struct apei_exec_context
*ctx
)
150 apei_exec_ctx_init(ctx
, einj_ins_type
, ARRAY_SIZE(einj_ins_type
),
151 EINJ_TAB_ENTRY(einj_tab
), einj_tab
->entries
);
154 static int __einj_get_available_error_type(u32
*type
)
156 struct apei_exec_context ctx
;
159 einj_exec_ctx_init(&ctx
);
160 rc
= apei_exec_run(&ctx
, ACPI_EINJ_GET_ERROR_TYPE
);
163 *type
= apei_exec_ctx_get_output(&ctx
);
168 /* Get error injection capabilities of the platform */
169 static int einj_get_available_error_type(u32
*type
)
173 mutex_lock(&einj_mutex
);
174 rc
= __einj_get_available_error_type(type
);
175 mutex_unlock(&einj_mutex
);
180 static int einj_timedout(u64
*t
)
182 if ((s64
)*t
< SPIN_UNIT
) {
183 pr_warning(FW_WARN
"Firmware does not respond in time\n");
188 touch_nmi_watchdog();
192 static void check_vendor_extension(u64 paddr
,
193 struct set_error_type_with_address
*v5param
)
195 int offset
= v5param
->vendor_extension
;
196 struct vendor_error_type_extension
*v
;
201 v
= acpi_os_map_iomem(paddr
+ offset
, sizeof(*v
));
205 sprintf(vendor_dev
, "%x:%x:%x.%x vendor_id=%x device_id=%x rev_id=%x\n",
206 sbdf
>> 24, (sbdf
>> 16) & 0xff,
207 (sbdf
>> 11) & 0x1f, (sbdf
>> 8) & 0x7,
208 v
->vendor_id
, v
->device_id
, v
->rev_id
);
209 acpi_os_unmap_iomem(v
, sizeof(*v
));
212 static void *einj_get_parameter_address(void)
215 u64 pa_v4
= 0, pa_v5
= 0;
216 struct acpi_whea_header
*entry
;
218 entry
= EINJ_TAB_ENTRY(einj_tab
);
219 for (i
= 0; i
< einj_tab
->entries
; i
++) {
220 if (entry
->action
== ACPI_EINJ_SET_ERROR_TYPE
&&
221 entry
->instruction
== ACPI_EINJ_WRITE_REGISTER
&&
222 entry
->register_region
.space_id
==
223 ACPI_ADR_SPACE_SYSTEM_MEMORY
)
224 pa_v4
= get_unaligned(&entry
->register_region
.address
);
225 if (entry
->action
== ACPI_EINJ_SET_ERROR_TYPE_WITH_ADDRESS
&&
226 entry
->instruction
== ACPI_EINJ_WRITE_REGISTER
&&
227 entry
->register_region
.space_id
==
228 ACPI_ADR_SPACE_SYSTEM_MEMORY
)
229 pa_v5
= get_unaligned(&entry
->register_region
.address
);
233 struct set_error_type_with_address
*v5param
;
235 v5param
= acpi_os_map_iomem(pa_v5
, sizeof(*v5param
));
238 check_vendor_extension(pa_v5
, v5param
);
242 if (param_extension
&& pa_v4
) {
243 struct einj_parameter
*v4param
;
245 v4param
= acpi_os_map_iomem(pa_v4
, sizeof(*v4param
));
248 if (v4param
->reserved1
|| v4param
->reserved2
) {
249 acpi_os_unmap_iomem(v4param
, sizeof(*v4param
));
258 /* do sanity check to trigger table */
259 static int einj_check_trigger_header(struct acpi_einj_trigger
*trigger_tab
)
261 if (trigger_tab
->header_size
!= sizeof(struct acpi_einj_trigger
))
263 if (trigger_tab
->table_size
> PAGE_SIZE
||
264 trigger_tab
->table_size
< trigger_tab
->header_size
)
266 if (trigger_tab
->entry_count
!=
267 (trigger_tab
->table_size
- trigger_tab
->header_size
) /
268 sizeof(struct acpi_einj_entry
))
274 static struct acpi_generic_address
*einj_get_trigger_parameter_region(
275 struct acpi_einj_trigger
*trigger_tab
, u64 param1
, u64 param2
)
278 struct acpi_whea_header
*entry
;
280 entry
= (struct acpi_whea_header
*)
281 ((char *)trigger_tab
+ sizeof(struct acpi_einj_trigger
));
282 for (i
= 0; i
< trigger_tab
->entry_count
; i
++) {
283 if (entry
->action
== ACPI_EINJ_TRIGGER_ERROR
&&
284 entry
->instruction
== ACPI_EINJ_WRITE_REGISTER_VALUE
&&
285 entry
->register_region
.space_id
==
286 ACPI_ADR_SPACE_SYSTEM_MEMORY
&&
287 (entry
->register_region
.address
& param2
) == (param1
& param2
))
288 return &entry
->register_region
;
294 /* Execute instructions in trigger error action table */
295 static int __einj_error_trigger(u64 trigger_paddr
, u32 type
,
296 u64 param1
, u64 param2
)
298 struct acpi_einj_trigger
*trigger_tab
= NULL
;
299 struct apei_exec_context trigger_ctx
;
300 struct apei_resources trigger_resources
;
301 struct acpi_whea_header
*trigger_entry
;
305 struct acpi_generic_address
*trigger_param_region
= NULL
;
307 r
= request_mem_region(trigger_paddr
, sizeof(*trigger_tab
),
308 "APEI EINJ Trigger Table");
310 pr_err("Can not request [mem %#010llx-%#010llx] for Trigger table\n",
311 (unsigned long long)trigger_paddr
,
312 (unsigned long long)trigger_paddr
+
313 sizeof(*trigger_tab
) - 1);
316 trigger_tab
= ioremap_cache(trigger_paddr
, sizeof(*trigger_tab
));
318 pr_err("Failed to map trigger table!\n");
321 rc
= einj_check_trigger_header(trigger_tab
);
323 pr_warning(FW_BUG
"Invalid trigger error action table.\n");
327 /* No action structures in the TRIGGER_ERROR table, nothing to do */
328 if (!trigger_tab
->entry_count
)
332 table_size
= trigger_tab
->table_size
;
333 r
= request_mem_region(trigger_paddr
+ sizeof(*trigger_tab
),
334 table_size
- sizeof(*trigger_tab
),
335 "APEI EINJ Trigger Table");
337 pr_err("Can not request [mem %#010llx-%#010llx] for Trigger Table Entry\n",
338 (unsigned long long)trigger_paddr
+ sizeof(*trigger_tab
),
339 (unsigned long long)trigger_paddr
+ table_size
- 1);
342 iounmap(trigger_tab
);
343 trigger_tab
= ioremap_cache(trigger_paddr
, table_size
);
345 pr_err("Failed to map trigger table!\n");
348 trigger_entry
= (struct acpi_whea_header
*)
349 ((char *)trigger_tab
+ sizeof(struct acpi_einj_trigger
));
350 apei_resources_init(&trigger_resources
);
351 apei_exec_ctx_init(&trigger_ctx
, einj_ins_type
,
352 ARRAY_SIZE(einj_ins_type
),
353 trigger_entry
, trigger_tab
->entry_count
);
354 rc
= apei_exec_collect_resources(&trigger_ctx
, &trigger_resources
);
357 rc
= apei_resources_sub(&trigger_resources
, &einj_resources
);
361 * Some firmware will access target address specified in
362 * param1 to trigger the error when injecting memory error.
363 * This will cause resource conflict with regular memory. So
364 * remove it from trigger table resources.
366 if ((param_extension
|| acpi5
) && (type
& MEM_ERROR_MASK
) && param2
) {
367 struct apei_resources addr_resources
;
368 apei_resources_init(&addr_resources
);
369 trigger_param_region
= einj_get_trigger_parameter_region(
370 trigger_tab
, param1
, param2
);
371 if (trigger_param_region
) {
372 rc
= apei_resources_add(&addr_resources
,
373 trigger_param_region
->address
,
374 trigger_param_region
->bit_width
/8, true);
377 rc
= apei_resources_sub(&trigger_resources
,
380 apei_resources_fini(&addr_resources
);
384 rc
= apei_resources_request(&trigger_resources
, "APEI EINJ Trigger");
387 rc
= apei_exec_pre_map_gars(&trigger_ctx
);
391 rc
= apei_exec_run(&trigger_ctx
, ACPI_EINJ_TRIGGER_ERROR
);
393 apei_exec_post_unmap_gars(&trigger_ctx
);
395 apei_resources_release(&trigger_resources
);
397 apei_resources_fini(&trigger_resources
);
399 release_mem_region(trigger_paddr
+ sizeof(*trigger_tab
),
400 table_size
- sizeof(*trigger_tab
));
402 release_mem_region(trigger_paddr
, sizeof(*trigger_tab
));
405 iounmap(trigger_tab
);
410 static int __einj_error_inject(u32 type
, u32 flags
, u64 param1
, u64 param2
,
411 u64 param3
, u64 param4
)
413 struct apei_exec_context ctx
;
414 u64 val
, trigger_paddr
, timeout
= FIRMWARE_TIMEOUT
;
417 einj_exec_ctx_init(&ctx
);
419 rc
= apei_exec_run_optional(&ctx
, ACPI_EINJ_BEGIN_OPERATION
);
422 apei_exec_ctx_set_input(&ctx
, type
);
424 struct set_error_type_with_address
*v5param
= einj_param
;
426 v5param
->type
= type
;
427 if (type
& ACPI5_VENDOR_BIT
) {
428 switch (vendor_flags
) {
429 case SETWA_FLAGS_APICID
:
430 v5param
->apicid
= param1
;
432 case SETWA_FLAGS_MEM
:
433 v5param
->memory_address
= param1
;
434 v5param
->memory_address_range
= param2
;
436 case SETWA_FLAGS_PCIE_SBDF
:
437 v5param
->pcie_sbdf
= param1
;
440 v5param
->flags
= vendor_flags
;
442 v5param
->flags
= flags
;
443 v5param
->memory_address
= param1
;
444 v5param
->memory_address_range
= param2
;
445 v5param
->apicid
= param3
;
446 v5param
->pcie_sbdf
= param4
;
449 case ACPI_EINJ_PROCESSOR_CORRECTABLE
:
450 case ACPI_EINJ_PROCESSOR_UNCORRECTABLE
:
451 case ACPI_EINJ_PROCESSOR_FATAL
:
452 v5param
->apicid
= param1
;
453 v5param
->flags
= SETWA_FLAGS_APICID
;
455 case ACPI_EINJ_MEMORY_CORRECTABLE
:
456 case ACPI_EINJ_MEMORY_UNCORRECTABLE
:
457 case ACPI_EINJ_MEMORY_FATAL
:
458 v5param
->memory_address
= param1
;
459 v5param
->memory_address_range
= param2
;
460 v5param
->flags
= SETWA_FLAGS_MEM
;
462 case ACPI_EINJ_PCIX_CORRECTABLE
:
463 case ACPI_EINJ_PCIX_UNCORRECTABLE
:
464 case ACPI_EINJ_PCIX_FATAL
:
465 v5param
->pcie_sbdf
= param1
;
466 v5param
->flags
= SETWA_FLAGS_PCIE_SBDF
;
471 rc
= apei_exec_run(&ctx
, ACPI_EINJ_SET_ERROR_TYPE
);
475 struct einj_parameter
*v4param
= einj_param
;
476 v4param
->param1
= param1
;
477 v4param
->param2
= param2
;
480 rc
= apei_exec_run(&ctx
, ACPI_EINJ_EXECUTE_OPERATION
);
484 rc
= apei_exec_run(&ctx
, ACPI_EINJ_CHECK_BUSY_STATUS
);
487 val
= apei_exec_ctx_get_output(&ctx
);
488 if (!(val
& EINJ_OP_BUSY
))
490 if (einj_timedout(&timeout
))
493 rc
= apei_exec_run(&ctx
, ACPI_EINJ_GET_COMMAND_STATUS
);
496 val
= apei_exec_ctx_get_output(&ctx
);
497 if (val
!= EINJ_STATUS_SUCCESS
)
500 rc
= apei_exec_run(&ctx
, ACPI_EINJ_GET_TRIGGER_TABLE
);
503 trigger_paddr
= apei_exec_ctx_get_output(&ctx
);
504 if (notrigger
== 0) {
505 rc
= __einj_error_trigger(trigger_paddr
, type
, param1
, param2
);
509 rc
= apei_exec_run_optional(&ctx
, ACPI_EINJ_END_OPERATION
);
514 /* Inject the specified hardware error */
515 static int einj_error_inject(u32 type
, u32 flags
, u64 param1
, u64 param2
,
516 u64 param3
, u64 param4
)
521 /* If user manually set "flags", make sure it is legal */
522 if (flags
&& (flags
&
523 ~(SETWA_FLAGS_APICID
|SETWA_FLAGS_MEM
|SETWA_FLAGS_PCIE_SBDF
)))
527 * We need extra sanity checks for memory errors.
528 * Other types leap directly to injection.
531 /* ensure param1/param2 existed */
532 if (!(param_extension
|| acpi5
))
535 /* ensure injection is memory related */
536 if (type
& ACPI5_VENDOR_BIT
) {
537 if (vendor_flags
!= SETWA_FLAGS_MEM
)
539 } else if (!(type
& MEM_ERROR_MASK
) && !(flags
& SETWA_FLAGS_MEM
))
543 * Disallow crazy address masks that give BIOS leeway to pick
544 * injection address almost anywhere. Insist on page or
545 * better granularity and that target address is normal RAM or
548 base_addr
= param1
& param2
;
551 if (((param2
& PAGE_MASK
) != PAGE_MASK
) ||
552 ((region_intersects(base_addr
, size
, IORESOURCE_SYSTEM_RAM
, IORES_DESC_NONE
)
553 != REGION_INTERSECTS
) &&
554 (region_intersects(base_addr
, size
, IORESOURCE_MEM
, IORES_DESC_PERSISTENT_MEMORY
)
555 != REGION_INTERSECTS
)))
559 mutex_lock(&einj_mutex
);
560 rc
= __einj_error_inject(type
, flags
, param1
, param2
, param3
, param4
);
561 mutex_unlock(&einj_mutex
);
566 static u32 error_type
;
567 static u32 error_flags
;
568 static u64 error_param1
;
569 static u64 error_param2
;
570 static u64 error_param3
;
571 static u64 error_param4
;
572 static struct dentry
*einj_debug_dir
;
574 static int available_error_type_show(struct seq_file
*m
, void *v
)
577 u32 available_error_type
= 0;
579 rc
= einj_get_available_error_type(&available_error_type
);
582 if (available_error_type
& 0x0001)
583 seq_printf(m
, "0x00000001\tProcessor Correctable\n");
584 if (available_error_type
& 0x0002)
585 seq_printf(m
, "0x00000002\tProcessor Uncorrectable non-fatal\n");
586 if (available_error_type
& 0x0004)
587 seq_printf(m
, "0x00000004\tProcessor Uncorrectable fatal\n");
588 if (available_error_type
& 0x0008)
589 seq_printf(m
, "0x00000008\tMemory Correctable\n");
590 if (available_error_type
& 0x0010)
591 seq_printf(m
, "0x00000010\tMemory Uncorrectable non-fatal\n");
592 if (available_error_type
& 0x0020)
593 seq_printf(m
, "0x00000020\tMemory Uncorrectable fatal\n");
594 if (available_error_type
& 0x0040)
595 seq_printf(m
, "0x00000040\tPCI Express Correctable\n");
596 if (available_error_type
& 0x0080)
597 seq_printf(m
, "0x00000080\tPCI Express Uncorrectable non-fatal\n");
598 if (available_error_type
& 0x0100)
599 seq_printf(m
, "0x00000100\tPCI Express Uncorrectable fatal\n");
600 if (available_error_type
& 0x0200)
601 seq_printf(m
, "0x00000200\tPlatform Correctable\n");
602 if (available_error_type
& 0x0400)
603 seq_printf(m
, "0x00000400\tPlatform Uncorrectable non-fatal\n");
604 if (available_error_type
& 0x0800)
605 seq_printf(m
, "0x00000800\tPlatform Uncorrectable fatal\n");
610 static int available_error_type_open(struct inode
*inode
, struct file
*file
)
612 return single_open(file
, available_error_type_show
, NULL
);
615 static const struct file_operations available_error_type_fops
= {
616 .open
= available_error_type_open
,
619 .release
= single_release
,
622 static int error_type_get(void *data
, u64
*val
)
629 static int error_type_set(void *data
, u64 val
)
632 u32 available_error_type
= 0;
636 * Vendor defined types have 0x80000000 bit set, and
637 * are not enumerated by ACPI_EINJ_GET_ERROR_TYPE
639 vendor
= val
& ACPI5_VENDOR_BIT
;
640 tval
= val
& 0x7fffffff;
642 /* Only one error type can be specified */
643 if (tval
& (tval
- 1))
646 rc
= einj_get_available_error_type(&available_error_type
);
649 if (!(val
& available_error_type
))
657 DEFINE_SIMPLE_ATTRIBUTE(error_type_fops
, error_type_get
,
658 error_type_set
, "0x%llx\n");
660 static int error_inject_set(void *data
, u64 val
)
665 return einj_error_inject(error_type
, error_flags
, error_param1
, error_param2
,
666 error_param3
, error_param4
);
669 DEFINE_SIMPLE_ATTRIBUTE(error_inject_fops
, NULL
,
670 error_inject_set
, "%llu\n");
672 static int einj_check_table(struct acpi_table_einj
*einj_tab
)
674 if ((einj_tab
->header_length
!=
675 (sizeof(struct acpi_table_einj
) - sizeof(einj_tab
->header
)))
676 && (einj_tab
->header_length
!= sizeof(struct acpi_table_einj
)))
678 if (einj_tab
->header
.length
< sizeof(struct acpi_table_einj
))
680 if (einj_tab
->entries
!=
681 (einj_tab
->header
.length
- sizeof(struct acpi_table_einj
)) /
682 sizeof(struct acpi_einj_entry
))
688 static int __init
einj_init(void)
692 struct dentry
*fentry
;
693 struct apei_exec_context ctx
;
696 pr_warn("ACPI disabled.\n");
700 status
= acpi_get_table(ACPI_SIG_EINJ
, 0,
701 (struct acpi_table_header
**)&einj_tab
);
702 if (status
== AE_NOT_FOUND
) {
703 pr_warn("EINJ table not found.\n");
706 else if (ACPI_FAILURE(status
)) {
707 pr_err("Failed to get EINJ table: %s\n",
708 acpi_format_exception(status
));
712 rc
= einj_check_table(einj_tab
);
714 pr_warn(FW_BUG
"Invalid EINJ table.n");
719 einj_debug_dir
= debugfs_create_dir("einj", apei_get_debugfs_dir());
720 if (!einj_debug_dir
) {
721 pr_err("Error creating debugfs node.\n");
725 fentry
= debugfs_create_file("available_error_type", S_IRUSR
,
726 einj_debug_dir
, NULL
,
727 &available_error_type_fops
);
731 fentry
= debugfs_create_file("error_type", S_IRUSR
| S_IWUSR
,
732 einj_debug_dir
, NULL
, &error_type_fops
);
735 fentry
= debugfs_create_file("error_inject", S_IWUSR
,
736 einj_debug_dir
, NULL
, &error_inject_fops
);
740 apei_resources_init(&einj_resources
);
741 einj_exec_ctx_init(&ctx
);
742 rc
= apei_exec_collect_resources(&ctx
, &einj_resources
);
744 pr_err("Error collecting EINJ resources.\n");
748 rc
= apei_resources_request(&einj_resources
, "APEI EINJ");
750 pr_err("Error requesting memory/port resources.\n");
754 rc
= apei_exec_pre_map_gars(&ctx
);
756 pr_err("Error pre-mapping GARs.\n");
761 einj_param
= einj_get_parameter_address();
762 if ((param_extension
|| acpi5
) && einj_param
) {
763 fentry
= debugfs_create_x32("flags", S_IRUSR
| S_IWUSR
,
764 einj_debug_dir
, &error_flags
);
767 fentry
= debugfs_create_x64("param1", S_IRUSR
| S_IWUSR
,
768 einj_debug_dir
, &error_param1
);
771 fentry
= debugfs_create_x64("param2", S_IRUSR
| S_IWUSR
,
772 einj_debug_dir
, &error_param2
);
775 fentry
= debugfs_create_x64("param3", S_IRUSR
| S_IWUSR
,
776 einj_debug_dir
, &error_param3
);
779 fentry
= debugfs_create_x64("param4", S_IRUSR
| S_IWUSR
,
780 einj_debug_dir
, &error_param4
);
784 fentry
= debugfs_create_x32("notrigger", S_IRUSR
| S_IWUSR
,
785 einj_debug_dir
, ¬rigger
);
791 vendor_blob
.data
= vendor_dev
;
792 vendor_blob
.size
= strlen(vendor_dev
);
793 fentry
= debugfs_create_blob("vendor", S_IRUSR
,
794 einj_debug_dir
, &vendor_blob
);
797 fentry
= debugfs_create_x32("vendor_flags", S_IRUSR
| S_IWUSR
,
798 einj_debug_dir
, &vendor_flags
);
803 pr_info("Error INJection is initialized.\n");
809 acpi_size size
= (acpi5
) ?
810 sizeof(struct set_error_type_with_address
) :
811 sizeof(struct einj_parameter
);
813 acpi_os_unmap_iomem(einj_param
, size
);
814 pr_err("Error creating param extension debugfs nodes.\n");
816 apei_exec_post_unmap_gars(&ctx
);
818 apei_resources_release(&einj_resources
);
820 apei_resources_fini(&einj_resources
);
822 pr_err("Error creating primary debugfs nodes.\n");
823 debugfs_remove_recursive(einj_debug_dir
);
828 static void __exit
einj_exit(void)
830 struct apei_exec_context ctx
;
833 acpi_size size
= (acpi5
) ?
834 sizeof(struct set_error_type_with_address
) :
835 sizeof(struct einj_parameter
);
837 acpi_os_unmap_iomem(einj_param
, size
);
839 einj_exec_ctx_init(&ctx
);
840 apei_exec_post_unmap_gars(&ctx
);
841 apei_resources_release(&einj_resources
);
842 apei_resources_fini(&einj_resources
);
843 debugfs_remove_recursive(einj_debug_dir
);
846 module_init(einj_init
);
847 module_exit(einj_exit
);
849 MODULE_AUTHOR("Huang Ying");
850 MODULE_DESCRIPTION("APEI Error INJection support");
851 MODULE_LICENSE("GPL");