aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@s-opensource.com>2016-10-26 13:47:55 -0400
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2016-12-15 05:54:52 -0500
commite01aa14cf2e7ff6d39614f8087800d08ba1629b2 (patch)
tree68fb87ed70cd71bfc6a2557797508599ce434c1b /drivers/edac
parentfdaf0b3505f330b8a56ddec4e904049be998d6d1 (diff)
edac: move documentation from edac_mc.c to edac_core.h
Several functions are documented at edac_mc.c. As we'll be including edac_core.h at drivers-api book, move those, in order for the kernel-doc markups be part of the API documentation book. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/edac')
-rw-r--r--drivers/edac/edac_mc.c82
-rw-r--r--drivers/edac/edac_mc.h101
2 files changed, 101 insertions, 82 deletions
diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c
index 4ff5116a90a5..5f2c717f8053 100644
--- a/drivers/edac/edac_mc.c
+++ b/drivers/edac/edac_mc.c
@@ -239,30 +239,6 @@ static void _edac_mc_free(struct mem_ctl_info *mci)
239 kfree(mci); 239 kfree(mci);
240} 240}
241 241
242/**
243 * edac_mc_alloc: Allocate and partially fill a struct mem_ctl_info structure
244 * @mc_num: Memory controller number
245 * @n_layers: Number of MC hierarchy layers
246 * layers: Describes each layer as seen by the Memory Controller
247 * @size_pvt: size of private storage needed
248 *
249 *
250 * Everything is kmalloc'ed as one big chunk - more efficient.
251 * Only can be used if all structures have the same lifetime - otherwise
252 * you have to allocate and initialize your own structures.
253 *
254 * Use edac_mc_free() to free mc structures allocated by this function.
255 *
256 * NOTE: drivers handle multi-rank memories in different ways: in some
257 * drivers, one multi-rank memory stick is mapped as one entry, while, in
258 * others, a single multi-rank memory stick would be mapped into several
259 * entries. Currently, this function will allocate multiple struct dimm_info
260 * on such scenarios, as grouping the multiple ranks require drivers change.
261 *
262 * Returns:
263 * On failure: NULL
264 * On success: struct mem_ctl_info pointer
265 */
266struct mem_ctl_info *edac_mc_alloc(unsigned mc_num, 242struct mem_ctl_info *edac_mc_alloc(unsigned mc_num,
267 unsigned n_layers, 243 unsigned n_layers,
268 struct edac_mc_layer *layers, 244 struct edac_mc_layer *layers,
@@ -460,11 +436,6 @@ error:
460} 436}
461EXPORT_SYMBOL_GPL(edac_mc_alloc); 437EXPORT_SYMBOL_GPL(edac_mc_alloc);
462 438
463/**
464 * edac_mc_free
465 * 'Free' a previously allocated 'mci' structure
466 * @mci: pointer to a struct mem_ctl_info structure
467 */
468void edac_mc_free(struct mem_ctl_info *mci) 439void edac_mc_free(struct mem_ctl_info *mci)
469{ 440{
470 edac_dbg(1, "\n"); 441 edac_dbg(1, "\n");
@@ -646,12 +617,6 @@ static int del_mc_from_global_list(struct mem_ctl_info *mci)
646 return handlers; 617 return handlers;
647} 618}
648 619
649/**
650 * edac_mc_find: Search for a mem_ctl_info structure whose index is 'idx'.
651 *
652 * If found, return a pointer to the structure.
653 * Else return NULL.
654 */
655struct mem_ctl_info *edac_mc_find(int idx) 620struct mem_ctl_info *edac_mc_find(int idx)
656{ 621{
657 struct mem_ctl_info *mci = NULL; 622 struct mem_ctl_info *mci = NULL;
@@ -676,16 +641,6 @@ unlock:
676} 641}
677EXPORT_SYMBOL(edac_mc_find); 642EXPORT_SYMBOL(edac_mc_find);
678 643
679/**
680 * edac_mc_add_mc_with_groups: Insert the 'mci' structure into the mci
681 * global list and create sysfs entries associated with mci structure
682 * @mci: pointer to the mci structure to be added to the list
683 * @groups: optional attribute groups for the driver-specific sysfs entries
684 *
685 * Return:
686 * 0 Success
687 * !0 Failure
688 */
689 644
690/* FIXME - should a warning be printed if no error detection? correction? */ 645/* FIXME - should a warning be printed if no error detection? correction? */
691int edac_mc_add_mc_with_groups(struct mem_ctl_info *mci, 646int edac_mc_add_mc_with_groups(struct mem_ctl_info *mci,
@@ -776,13 +731,6 @@ fail0:
776} 731}
777EXPORT_SYMBOL_GPL(edac_mc_add_mc_with_groups); 732EXPORT_SYMBOL_GPL(edac_mc_add_mc_with_groups);
778 733
779/**
780 * edac_mc_del_mc: Remove sysfs entries for specified mci structure and
781 * remove mci structure from global list
782 * @pdev: Pointer to 'struct device' representing mci structure to remove.
783 *
784 * Return pointer to removed mci structure, or NULL if device not found.
785 */
786struct mem_ctl_info *edac_mc_del_mc(struct device *dev) 734struct mem_ctl_info *edac_mc_del_mc(struct device *dev)
787{ 735{
788 struct mem_ctl_info *mci; 736 struct mem_ctl_info *mci;
@@ -1046,18 +994,6 @@ static void edac_ue_error(struct mem_ctl_info *mci,
1046 edac_inc_ue_error(mci, enable_per_layer_report, pos, error_count); 994 edac_inc_ue_error(mci, enable_per_layer_report, pos, error_count);
1047} 995}
1048 996
1049/**
1050 * edac_raw_mc_handle_error - reports a memory event to userspace without doing
1051 * anything to discover the error location
1052 *
1053 * @type: severity of the error (CE/UE/Fatal)
1054 * @mci: a struct mem_ctl_info pointer
1055 * @e: error description
1056 *
1057 * This raw function is used internally by edac_mc_handle_error(). It should
1058 * only be called directly when the hardware error come directly from BIOS,
1059 * like in the case of APEI GHES driver.
1060 */
1061void edac_raw_mc_handle_error(const enum hw_event_mc_err_type type, 997void edac_raw_mc_handle_error(const enum hw_event_mc_err_type type,
1062 struct mem_ctl_info *mci, 998 struct mem_ctl_info *mci,
1063 struct edac_raw_error_desc *e) 999 struct edac_raw_error_desc *e)
@@ -1087,24 +1023,6 @@ void edac_raw_mc_handle_error(const enum hw_event_mc_err_type type,
1087} 1023}
1088EXPORT_SYMBOL_GPL(edac_raw_mc_handle_error); 1024EXPORT_SYMBOL_GPL(edac_raw_mc_handle_error);
1089 1025
1090/**
1091 * edac_mc_handle_error - reports a memory event to userspace
1092 *
1093 * @type: severity of the error (CE/UE/Fatal)
1094 * @mci: a struct mem_ctl_info pointer
1095 * @error_count: Number of errors of the same type
1096 * @page_frame_number: mem page where the error occurred
1097 * @offset_in_page: offset of the error inside the page
1098 * @syndrome: ECC syndrome
1099 * @top_layer: Memory layer[0] position
1100 * @mid_layer: Memory layer[1] position
1101 * @low_layer: Memory layer[2] position
1102 * @msg: Message meaningful to the end users that
1103 * explains the event
1104 * @other_detail: Technical details about the event that
1105 * may help hardware manufacturers and
1106 * EDAC developers to analyse the event
1107 */
1108void edac_mc_handle_error(const enum hw_event_mc_err_type type, 1026void edac_mc_handle_error(const enum hw_event_mc_err_type type,
1109 struct mem_ctl_info *mci, 1027 struct mem_ctl_info *mci,
1110 const u16 error_count, 1028 const u16 error_count,
diff --git a/drivers/edac/edac_mc.h b/drivers/edac/edac_mc.h
index b62d9bad9859..97ee6a91f633 100644
--- a/drivers/edac/edac_mc.h
+++ b/drivers/edac/edac_mc.h
@@ -93,24 +93,125 @@ do { \
93 93
94#define to_mci(k) container_of(k, struct mem_ctl_info, dev) 94#define to_mci(k) container_of(k, struct mem_ctl_info, dev)
95 95
96/**
97 * edac_mc_alloc: Allocate and partially fill a struct mem_ctl_info structure
98 * @mc_num: Memory controller number
99 * @n_layers: Number of MC hierarchy layers
100 * @layers: Describes each layer as seen by the Memory Controller
101 * @sz_pvt: size of private storage needed
102 *
103 *
104 * Everything is kmalloc'ed as one big chunk - more efficient.
105 * Only can be used if all structures have the same lifetime - otherwise
106 * you have to allocate and initialize your own structures.
107 *
108 * Use edac_mc_free() to free mc structures allocated by this function.
109 *
110 * .. note::
111 *
112 * drivers handle multi-rank memories in different ways: in some
113 * drivers, one multi-rank memory stick is mapped as one entry, while, in
114 * others, a single multi-rank memory stick would be mapped into several
115 * entries. Currently, this function will allocate multiple struct dimm_info
116 * on such scenarios, as grouping the multiple ranks require drivers change.
117 *
118 * Returns:
119 * On failure: NULL
120 * On success: struct mem_ctl_info pointer
121 */
96struct mem_ctl_info *edac_mc_alloc(unsigned mc_num, 122struct mem_ctl_info *edac_mc_alloc(unsigned mc_num,
97 unsigned n_layers, 123 unsigned n_layers,
98 struct edac_mc_layer *layers, 124 struct edac_mc_layer *layers,
99 unsigned sz_pvt); 125 unsigned sz_pvt);
126
127/**
128 * edac_mc_add_mc_with_groups: Insert the 'mci' structure into the mci
129 * global list and create sysfs entries associated with mci structure
130 * @mci: pointer to the mci structure to be added to the list
131 * @groups: optional attribute groups for the driver-specific sysfs entries
132 *
133 * Return:
134 * 0 Success
135 * !0 Failure
136 */
100extern int edac_mc_add_mc_with_groups(struct mem_ctl_info *mci, 137extern int edac_mc_add_mc_with_groups(struct mem_ctl_info *mci,
101 const struct attribute_group **groups); 138 const struct attribute_group **groups);
102#define edac_mc_add_mc(mci) edac_mc_add_mc_with_groups(mci, NULL) 139#define edac_mc_add_mc(mci) edac_mc_add_mc_with_groups(mci, NULL)
140
141/**
142 * edac_mc_free
143 * 'Free' a previously allocated 'mci' structure
144 * @mci: pointer to a struct mem_ctl_info structure
145 */
103extern void edac_mc_free(struct mem_ctl_info *mci); 146extern void edac_mc_free(struct mem_ctl_info *mci);
147
148/**
149 * edac_mc_find: Search for a mem_ctl_info structure whose index is @idx.
150 *
151 * @idx: index to be seek
152 *
153 * If found, return a pointer to the structure.
154 * Else return NULL.
155 *
156 * Caller must hold mem_ctls_mutex.
157 */
104extern struct mem_ctl_info *edac_mc_find(int idx); 158extern struct mem_ctl_info *edac_mc_find(int idx);
159
160/**
161 * find_mci_by_dev
162 *
163 * scan list of controllers looking for the one that manages
164 * the 'dev' device
165 * @dev: pointer to a struct device related with the MCI
166 */
105extern struct mem_ctl_info *find_mci_by_dev(struct device *dev); 167extern struct mem_ctl_info *find_mci_by_dev(struct device *dev);
168
169/**
170 * edac_mc_del_mc: Remove sysfs entries for specified mci structure and
171 * remove mci structure from global list
172 *
173 * @dev: Pointer to struct &device representing mci structure to remove.
174 *
175 * Returns: pointer to removed mci structure, or NULL if device not found.
176 */
106extern struct mem_ctl_info *edac_mc_del_mc(struct device *dev); 177extern struct mem_ctl_info *edac_mc_del_mc(struct device *dev);
107extern int edac_mc_find_csrow_by_page(struct mem_ctl_info *mci, 178extern int edac_mc_find_csrow_by_page(struct mem_ctl_info *mci,
108 unsigned long page); 179 unsigned long page);
109 180
181/**
182 * edac_raw_mc_handle_error - reports a memory event to userspace without doing
183 * anything to discover the error location
184 *
185 * @type: severity of the error (CE/UE/Fatal)
186 * @mci: a struct mem_ctl_info pointer
187 * @e: error description
188 *
189 * This raw function is used internally by edac_mc_handle_error(). It should
190 * only be called directly when the hardware error come directly from BIOS,
191 * like in the case of APEI GHES driver.
192 */
110void edac_raw_mc_handle_error(const enum hw_event_mc_err_type type, 193void edac_raw_mc_handle_error(const enum hw_event_mc_err_type type,
111 struct mem_ctl_info *mci, 194 struct mem_ctl_info *mci,
112 struct edac_raw_error_desc *e); 195 struct edac_raw_error_desc *e);
113 196
197/**
198 * edac_mc_handle_error - reports a memory event to userspace
199 *
200 * @type: severity of the error (CE/UE/Fatal)
201 * @mci: a struct mem_ctl_info pointer
202 * @error_count: Number of errors of the same type
203 * @page_frame_number: mem page where the error occurred
204 * @offset_in_page: offset of the error inside the page
205 * @syndrome: ECC syndrome
206 * @top_layer: Memory layer[0] position
207 * @mid_layer: Memory layer[1] position
208 * @low_layer: Memory layer[2] position
209 * @msg: Message meaningful to the end users that
210 * explains the event
211 * @other_detail: Technical details about the event that
212 * may help hardware manufacturers and
213 * EDAC developers to analyse the event
214 */
114void edac_mc_handle_error(const enum hw_event_mc_err_type type, 215void edac_mc_handle_error(const enum hw_event_mc_err_type type,
115 struct mem_ctl_info *mci, 216 struct mem_ctl_info *mci,
116 const u16 error_count, 217 const u16 error_count,