diff options
Diffstat (limited to 'include/linux/edac.h')
-rw-r--r-- | include/linux/edac.h | 79 |
1 files changed, 76 insertions, 3 deletions
diff --git a/include/linux/edac.h b/include/linux/edac.h index 1b8c02b36f76..4fd4999ccb5b 100644 --- a/include/linux/edac.h +++ b/include/linux/edac.h | |||
@@ -14,7 +14,6 @@ | |||
14 | 14 | ||
15 | #include <linux/atomic.h> | 15 | #include <linux/atomic.h> |
16 | #include <linux/device.h> | 16 | #include <linux/device.h> |
17 | #include <linux/kobject.h> | ||
18 | #include <linux/completion.h> | 17 | #include <linux/completion.h> |
19 | #include <linux/workqueue.h> | 18 | #include <linux/workqueue.h> |
20 | #include <linux/debugfs.h> | 19 | #include <linux/debugfs.h> |
@@ -48,8 +47,17 @@ static inline void opstate_init(void) | |||
48 | return; | 47 | return; |
49 | } | 48 | } |
50 | 49 | ||
50 | /* Max length of a DIMM label*/ | ||
51 | #define EDAC_MC_LABEL_LEN 31 | 51 | #define EDAC_MC_LABEL_LEN 31 |
52 | #define MC_PROC_NAME_MAX_LEN 7 | 52 | |
53 | /* Maximum size of the location string */ | ||
54 | #define LOCATION_SIZE 80 | ||
55 | |||
56 | /* Defines the maximum number of labels that can be reported */ | ||
57 | #define EDAC_MAX_LABELS 8 | ||
58 | |||
59 | /* String used to join two or more labels */ | ||
60 | #define OTHER_LABEL " or " | ||
53 | 61 | ||
54 | /** | 62 | /** |
55 | * enum dev_type - describe the type of memory DRAM chips used at the stick | 63 | * enum dev_type - describe the type of memory DRAM chips used at the stick |
@@ -101,8 +109,24 @@ enum hw_event_mc_err_type { | |||
101 | HW_EVENT_ERR_CORRECTED, | 109 | HW_EVENT_ERR_CORRECTED, |
102 | HW_EVENT_ERR_UNCORRECTED, | 110 | HW_EVENT_ERR_UNCORRECTED, |
103 | HW_EVENT_ERR_FATAL, | 111 | HW_EVENT_ERR_FATAL, |
112 | HW_EVENT_ERR_INFO, | ||
104 | }; | 113 | }; |
105 | 114 | ||
115 | static inline char *mc_event_error_type(const unsigned int err_type) | ||
116 | { | ||
117 | switch (err_type) { | ||
118 | case HW_EVENT_ERR_CORRECTED: | ||
119 | return "Corrected"; | ||
120 | case HW_EVENT_ERR_UNCORRECTED: | ||
121 | return "Uncorrected"; | ||
122 | case HW_EVENT_ERR_FATAL: | ||
123 | return "Fatal"; | ||
124 | default: | ||
125 | case HW_EVENT_ERR_INFO: | ||
126 | return "Info"; | ||
127 | } | ||
128 | } | ||
129 | |||
106 | /** | 130 | /** |
107 | * enum mem_type - memory types. For a more detailed reference, please see | 131 | * enum mem_type - memory types. For a more detailed reference, please see |
108 | * http://en.wikipedia.org/wiki/DRAM | 132 | * http://en.wikipedia.org/wiki/DRAM |
@@ -376,6 +400,9 @@ enum scrub_type { | |||
376 | * @EDAC_MC_LAYER_CHANNEL: memory layer is named "channel" | 400 | * @EDAC_MC_LAYER_CHANNEL: memory layer is named "channel" |
377 | * @EDAC_MC_LAYER_SLOT: memory layer is named "slot" | 401 | * @EDAC_MC_LAYER_SLOT: memory layer is named "slot" |
378 | * @EDAC_MC_LAYER_CHIP_SELECT: memory layer is named "chip select" | 402 | * @EDAC_MC_LAYER_CHIP_SELECT: memory layer is named "chip select" |
403 | * @EDAC_MC_LAYER_ALL_MEM: memory layout is unknown. All memory is mapped | ||
404 | * as a single memory area. This is used when | ||
405 | * retrieving errors from a firmware driven driver. | ||
379 | * | 406 | * |
380 | * This enum is used by the drivers to tell edac_mc_sysfs what name should | 407 | * This enum is used by the drivers to tell edac_mc_sysfs what name should |
381 | * be used when describing a memory stick location. | 408 | * be used when describing a memory stick location. |
@@ -385,6 +412,7 @@ enum edac_mc_layer_type { | |||
385 | EDAC_MC_LAYER_CHANNEL, | 412 | EDAC_MC_LAYER_CHANNEL, |
386 | EDAC_MC_LAYER_SLOT, | 413 | EDAC_MC_LAYER_SLOT, |
387 | EDAC_MC_LAYER_CHIP_SELECT, | 414 | EDAC_MC_LAYER_CHIP_SELECT, |
415 | EDAC_MC_LAYER_ALL_MEM, | ||
388 | }; | 416 | }; |
389 | 417 | ||
390 | /** | 418 | /** |
@@ -551,6 +579,46 @@ struct errcount_attribute_data { | |||
551 | int layer0, layer1, layer2; | 579 | int layer0, layer1, layer2; |
552 | }; | 580 | }; |
553 | 581 | ||
582 | /** | ||
583 | * edac_raw_error_desc - Raw error report structure | ||
584 | * @grain: minimum granularity for an error report, in bytes | ||
585 | * @error_count: number of errors of the same type | ||
586 | * @top_layer: top layer of the error (layer[0]) | ||
587 | * @mid_layer: middle layer of the error (layer[1]) | ||
588 | * @low_layer: low layer of the error (layer[2]) | ||
589 | * @page_frame_number: page where the error happened | ||
590 | * @offset_in_page: page offset | ||
591 | * @syndrome: syndrome of the error (or 0 if unknown or if | ||
592 | * the syndrome is not applicable) | ||
593 | * @msg: error message | ||
594 | * @location: location of the error | ||
595 | * @label: label of the affected DIMM(s) | ||
596 | * @other_detail: other driver-specific detail about the error | ||
597 | * @enable_per_layer_report: if false, the error affects all layers | ||
598 | * (typically, a memory controller error) | ||
599 | */ | ||
600 | struct edac_raw_error_desc { | ||
601 | /* | ||
602 | * NOTE: everything before grain won't be cleaned by | ||
603 | * edac_raw_error_desc_clean() | ||
604 | */ | ||
605 | char location[LOCATION_SIZE]; | ||
606 | char label[(EDAC_MC_LABEL_LEN + 1 + sizeof(OTHER_LABEL)) * EDAC_MAX_LABELS]; | ||
607 | long grain; | ||
608 | |||
609 | /* the vars below and grain will be cleaned on every new error report */ | ||
610 | u16 error_count; | ||
611 | int top_layer; | ||
612 | int mid_layer; | ||
613 | int low_layer; | ||
614 | unsigned long page_frame_number; | ||
615 | unsigned long offset_in_page; | ||
616 | unsigned long syndrome; | ||
617 | const char *msg; | ||
618 | const char *other_detail; | ||
619 | bool enable_per_layer_report; | ||
620 | }; | ||
621 | |||
554 | /* MEMORY controller information structure | 622 | /* MEMORY controller information structure |
555 | */ | 623 | */ |
556 | struct mem_ctl_info { | 624 | struct mem_ctl_info { |
@@ -630,7 +698,6 @@ struct mem_ctl_info { | |||
630 | const char *mod_ver; | 698 | const char *mod_ver; |
631 | const char *ctl_name; | 699 | const char *ctl_name; |
632 | const char *dev_name; | 700 | const char *dev_name; |
633 | char proc_name[MC_PROC_NAME_MAX_LEN + 1]; | ||
634 | void *pvt_info; | 701 | void *pvt_info; |
635 | unsigned long start_time; /* mci load start time (in jiffies) */ | 702 | unsigned long start_time; /* mci load start time (in jiffies) */ |
636 | 703 | ||
@@ -659,6 +726,12 @@ struct mem_ctl_info { | |||
659 | /* work struct for this MC */ | 726 | /* work struct for this MC */ |
660 | struct delayed_work work; | 727 | struct delayed_work work; |
661 | 728 | ||
729 | /* | ||
730 | * Used to report an error - by being at the global struct | ||
731 | * makes the memory allocated by the EDAC core | ||
732 | */ | ||
733 | struct edac_raw_error_desc error_desc; | ||
734 | |||
662 | /* the internal state of this controller instance */ | 735 | /* the internal state of this controller instance */ |
663 | int op_state; | 736 | int op_state; |
664 | 737 | ||