Blame view

drivers/edac/edac_core.h 14.3 KB
7c9281d76   Douglas Thompson   drivers/edac: spl...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
  /*
   * Defines, structures, APIs for edac_core module
   *
   * (C) 2007 Linux Networx (http://lnxi.com)
   * This file may be distributed under the terms of the
   * GNU General Public License.
   *
   * Written by Thayne Harbaugh
   * Based on work by Dan Hollis <goemon at anime dot net> and others.
   *	http://www.anime.net/~goemon/linux-ecc/
   *
   * NMI handling support added by
   *     Dave Peterson <dsp@llnl.gov> <dave_peterson@pobox.com>
   *
   * Refactored for multi-source files:
   *	Doug Thompson <norsk5@xmission.com>
   *
   */
  
  #ifndef _EDAC_CORE_H_
  #define _EDAC_CORE_H_
  
  #include <linux/kernel.h>
  #include <linux/types.h>
  #include <linux/module.h>
  #include <linux/spinlock.h>
  #include <linux/smp.h>
  #include <linux/pci.h>
  #include <linux/time.h>
  #include <linux/nmi.h>
  #include <linux/rcupdate.h>
  #include <linux/completion.h>
  #include <linux/kobject.h>
  #include <linux/platform_device.h>
e27e3dac6   Douglas Thompson   drivers/edac: add...
35
  #include <linux/workqueue.h>
ddeb3547d   Mauro Carvalho Chehab   edac: Move edac m...
36
  #include <linux/edac.h>
7c9281d76   Douglas Thompson   drivers/edac: spl...
37

e27e3dac6   Douglas Thompson   drivers/edac: add...
38
39
  #define EDAC_DEVICE_NAME_LEN	31
  #define EDAC_ATTRIB_VALUE_LEN	15
7c9281d76   Douglas Thompson   drivers/edac: spl...
40
41
  
  #if PAGE_SHIFT < 20
76f04f259   Andrei Konovalov   EDAC: Correct MiB...
42
43
  #define PAGES_TO_MiB(pages)	((pages) >> (20 - PAGE_SHIFT))
  #define MiB_TO_PAGES(mb)	((mb) << (20 - PAGE_SHIFT))
7c9281d76   Douglas Thompson   drivers/edac: spl...
44
  #else				/* PAGE_SHIFT > 20 */
76f04f259   Andrei Konovalov   EDAC: Correct MiB...
45
  #define PAGES_TO_MiB(pages)	((pages) << (PAGE_SHIFT - 20))
e9144601d   Mauro Carvalho Chehab   i7core_edac: move...
46
  #define MiB_TO_PAGES(mb)	((mb) >> (PAGE_SHIFT - 20))
7c9281d76   Douglas Thompson   drivers/edac: spl...
47
48
49
50
51
52
53
54
55
56
  #endif
  
  #define edac_printk(level, prefix, fmt, arg...) \
  	printk(level "EDAC " prefix ": " fmt, ##arg)
  
  #define edac_mc_printk(mci, level, fmt, arg...) \
  	printk(level "EDAC MC%d: " fmt, mci->mc_idx, ##arg)
  
  #define edac_mc_chipset_printk(mci, level, prefix, fmt, arg...) \
  	printk(level "EDAC " prefix " MC%d: " fmt, mci->mc_idx, ##arg)
e27e3dac6   Douglas Thompson   drivers/edac: add...
57
58
  #define edac_device_printk(ctl, level, fmt, arg...) \
  	printk(level "EDAC DEVICE%d: " fmt, ctl->dev_idx, ##arg)
91b99041c   Dave Jiang   drivers/edac: upd...
59
60
  #define edac_pci_printk(ctl, level, fmt, arg...) \
  	printk(level "EDAC PCI%d: " fmt, ctl->pci_idx, ##arg)
7c9281d76   Douglas Thompson   drivers/edac: spl...
61
62
63
64
  /* prefixes for edac_printk() and edac_mc_printk() */
  #define EDAC_MC "MC"
  #define EDAC_PCI "PCI"
  #define EDAC_DEBUG "DEBUG"
f4ce6eca7   Borislav Petkov   EDAC: Fix mem_typ...
65
  extern const char * const edac_mem_types[];
24f9a7fe3   Borislav Petkov   amd64_edac: Rewor...
66

7c9281d76   Douglas Thompson   drivers/edac: spl...
67
68
  #ifdef CONFIG_EDAC_DEBUG
  extern int edac_debug_level;
956b9ba15   Joe Perches   edac: Convert deb...
69
  #define edac_dbg(level, fmt, ...)					\
7e881856e   Joe Perches   edac: Use more no...
70
71
72
73
74
  do {									\
  	if (level <= edac_debug_level)					\
  		edac_printk(KERN_DEBUG, EDAC_DEBUG,			\
  			    "%s: " fmt, __func__, ##__VA_ARGS__);	\
  } while (0)
7c9281d76   Douglas Thompson   drivers/edac: spl...
75

079708b91   Douglas Thompson   drivers/edac: cor...
76
  #else				/* !CONFIG_EDAC_DEBUG */
7c9281d76   Douglas Thompson   drivers/edac: spl...
77

956b9ba15   Joe Perches   edac: Convert deb...
78
  #define edac_dbg(level, fmt, ...)					\
7e881856e   Joe Perches   edac: Use more no...
79
80
81
82
83
  do {									\
  	if (0)								\
  		edac_printk(KERN_DEBUG, EDAC_DEBUG,			\
  			    "%s: " fmt, __func__, ##__VA_ARGS__);	\
  } while (0)
7c9281d76   Douglas Thompson   drivers/edac: spl...
84

079708b91   Douglas Thompson   drivers/edac: cor...
85
  #endif				/* !CONFIG_EDAC_DEBUG */
7c9281d76   Douglas Thompson   drivers/edac: spl...
86

7c9281d76   Douglas Thompson   drivers/edac: spl...
87
88
  #define PCI_VEND_DEV(vend, dev) PCI_VENDOR_ID_ ## vend, \
  	PCI_DEVICE_ID_ ## vend ## _ ## dev
17aa7e034   Stephen Rothwell   dev_name introduc...
89
  #define edac_dev_name(dev) (dev)->dev_name
7c9281d76   Douglas Thompson   drivers/edac: spl...
90

7ac8bf9bc   Borislav Petkov   EDAC: Carve out d...
91
  #define to_mci(k) container_of(k, struct mem_ctl_info, dev)
e27e3dac6   Douglas Thompson   drivers/edac: add...
92
  /*
42a8e397a   Douglas Thompson   drivers/edac: add...
93
   * The following are the structures to provide for a generic
e27e3dac6   Douglas Thompson   drivers/edac: add...
94
95
96
97
98
99
   * or abstract 'edac_device'. This set of structures and the
   * code that implements the APIs for the same, provide for
   * registering EDAC type devices which are NOT standard memory.
   *
   * CPU caches (L1 and L2)
   * DMA engines
15ed103a9   David Mackey   edac: Fix spellin...
100
   * Core CPU switches
e27e3dac6   Douglas Thompson   drivers/edac: add...
101
102
103
104
105
   * Fabric switch units
   * PCIe interface controllers
   * other EDAC/ECC type devices that can be monitored for
   * errors, etc.
   *
15ed103a9   David Mackey   edac: Fix spellin...
106
   * It allows for a 2 level set of hierarchy. For example:
e27e3dac6   Douglas Thompson   drivers/edac: add...
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
   *
   * cache could be composed of L1, L2 and L3 levels of cache.
   * Each CPU core would have its own L1 cache, while sharing
   * L2 and maybe L3 caches.
   *
   * View them arranged, via the sysfs presentation:
   * /sys/devices/system/edac/..
   *
   *	mc/		<existing memory device directory>
   *	cpu/cpu0/..	<L1 and L2 block directory>
   *		/L1-cache/ce_count
   *			 /ue_count
   *		/L2-cache/ce_count
   *			 /ue_count
   *	cpu/cpu1/..	<L1 and L2 block directory>
   *		/L1-cache/ce_count
   *			 /ue_count
   *		/L2-cache/ce_count
   *			 /ue_count
   *	...
   *
   *	the L1 and L2 directories would be "edac_device_block's"
   */
  
  struct edac_device_counter {
079708b91   Douglas Thompson   drivers/edac: cor...
132
133
  	u32 ue_count;
  	u32 ce_count;
e27e3dac6   Douglas Thompson   drivers/edac: add...
134
  };
fd309a9d8   Douglas Thompson   drivers/edac: fix...
135
136
137
  /* forward reference */
  struct edac_device_ctl_info;
  struct edac_device_block;
e27e3dac6   Douglas Thompson   drivers/edac: add...
138

fd309a9d8   Douglas Thompson   drivers/edac: fix...
139
140
141
142
143
144
145
146
147
  /* edac_dev_sysfs_attribute structure
   *	used for driver sysfs attributes in mem_ctl_info
   *	for extra controls and attributes:
   *		like high level error Injection controls
   */
  struct edac_dev_sysfs_attribute {
  	struct attribute attr;
  	ssize_t (*show)(struct edac_device_ctl_info *, char *);
  	ssize_t (*store)(struct edac_device_ctl_info *, const char *, size_t);
e27e3dac6   Douglas Thompson   drivers/edac: add...
148
  };
fd309a9d8   Douglas Thompson   drivers/edac: fix...
149
  /* edac_dev_sysfs_block_attribute structure
b2a4ac0c2   Doug Thompson   drivers/edac: fix...
150
   *
fd309a9d8   Douglas Thompson   drivers/edac: fix...
151
   *	used in leaf 'block' nodes for adding controls/attributes
b2a4ac0c2   Doug Thompson   drivers/edac: fix...
152
153
154
155
156
157
158
159
   *
   *	each block in each instance of the containing control structure
   *	can have an array of the following. The show and store functions
   *	will be filled in with the show/store function in the
   *	low level driver.
   *
   *	The 'value' field will be the actual value field used for
   *	counting
e27e3dac6   Douglas Thompson   drivers/edac: add...
160
   */
fd309a9d8   Douglas Thompson   drivers/edac: fix...
161
162
163
164
165
166
  struct edac_dev_sysfs_block_attribute {
  	struct attribute attr;
  	ssize_t (*show)(struct kobject *, struct attribute *, char *);
  	ssize_t (*store)(struct kobject *, struct attribute *,
  			const char *, size_t);
  	struct edac_device_block *block;
fd309a9d8   Douglas Thompson   drivers/edac: fix...
167
  	unsigned int value;
e27e3dac6   Douglas Thompson   drivers/edac: add...
168
169
170
171
172
  };
  
  /* device block control structure */
  struct edac_device_block {
  	struct edac_device_instance *instance;	/* Up Pointer */
079708b91   Douglas Thompson   drivers/edac: cor...
173
  	char name[EDAC_DEVICE_NAME_LEN + 1];
e27e3dac6   Douglas Thompson   drivers/edac: add...
174
175
  
  	struct edac_device_counter counters;	/* basic UE and CE counters */
079708b91   Douglas Thompson   drivers/edac: cor...
176
  	int nr_attribs;		/* how many attributes */
fd309a9d8   Douglas Thompson   drivers/edac: fix...
177
178
179
  
  	/* this block's attributes, could be NULL */
  	struct edac_dev_sysfs_block_attribute *block_attributes;
e27e3dac6   Douglas Thompson   drivers/edac: add...
180
181
182
  
  	/* edac sysfs device control */
  	struct kobject kobj;
e27e3dac6   Douglas Thompson   drivers/edac: add...
183
184
185
186
187
188
189
190
  };
  
  /* device instance control structure */
  struct edac_device_instance {
  	struct edac_device_ctl_info *ctl;	/* Up pointer */
  	char name[EDAC_DEVICE_NAME_LEN + 4];
  
  	struct edac_device_counter counters;	/* instance counters */
079708b91   Douglas Thompson   drivers/edac: cor...
191
  	u32 nr_blocks;		/* how many blocks */
e27e3dac6   Douglas Thompson   drivers/edac: add...
192
193
194
195
  	struct edac_device_block *blocks;	/* block array */
  
  	/* edac sysfs device control */
  	struct kobject kobj;
e27e3dac6   Douglas Thompson   drivers/edac: add...
196
  };
42a8e397a   Douglas Thompson   drivers/edac: add...
197

e27e3dac6   Douglas Thompson   drivers/edac: add...
198
199
200
201
202
203
204
  /*
   * Abstract edac_device control info structure
   *
   */
  struct edac_device_ctl_info {
  	/* for global list of edac_device_ctl_info structs */
  	struct list_head link;
1c3631ff1   Douglas Thompson   drivers/edac: fix...
205
  	struct module *owner;	/* Module owner of this control struct */
e27e3dac6   Douglas Thompson   drivers/edac: add...
206
207
208
209
210
211
212
213
  	int dev_idx;
  
  	/* Per instance controls for this edac_device */
  	int log_ue;		/* boolean for logging UEs */
  	int log_ce;		/* boolean for logging CEs */
  	int panic_on_ue;	/* boolean for panic'ing on an UE */
  	unsigned poll_msec;	/* number of milliseconds to poll interval */
  	unsigned long delay;	/* number of jiffies for poll_msec */
42a8e397a   Douglas Thompson   drivers/edac: add...
214
215
216
217
218
219
220
221
222
223
224
  	/* Additional top controller level attributes, but specified
  	 * by the low level driver.
  	 *
  	 * Set by the low level driver to provide attributes at the
  	 * controller level, same level as 'ue_count' and 'ce_count' above.
  	 * An array of structures, NULL terminated
  	 *
  	 * If attributes are desired, then set to array of attributes
  	 * If no attributes are desired, leave NULL
  	 */
  	struct edac_dev_sysfs_attribute *sysfs_attributes;
fe5ff8b84   Kay Sievers   edac: convert sys...
225
226
  	/* pointer to main 'edac' subsys in sysfs */
  	struct bus_type *edac_subsys;
e27e3dac6   Douglas Thompson   drivers/edac: add...
227
228
229
  
  	/* the internal state of this controller instance */
  	int op_state;
e27e3dac6   Douglas Thompson   drivers/edac: add...
230
  	/* work struct for this instance */
e27e3dac6   Douglas Thompson   drivers/edac: add...
231
  	struct delayed_work work;
e27e3dac6   Douglas Thompson   drivers/edac: add...
232
233
  
  	/* pointer to edac polling checking routine:
079708b91   Douglas Thompson   drivers/edac: cor...
234
235
236
  	 *      If NOT NULL: points to polling check routine
  	 *      If NULL: Then assumes INTERRUPT operation, where
  	 *              MC driver will receive events
e27e3dac6   Douglas Thompson   drivers/edac: add...
237
238
239
240
241
242
243
  	 */
  	void (*edac_check) (struct edac_device_ctl_info * edac_dev);
  
  	struct device *dev;	/* pointer to device structure */
  
  	const char *mod_name;	/* module name */
  	const char *ctl_name;	/* edac controller  name */
c4192705f   Dave Jiang   drivers/edac: add...
244
  	const char *dev_name;	/* pci/platform/etc... name */
e27e3dac6   Douglas Thompson   drivers/edac: add...
245
246
  
  	void *pvt_info;		/* pointer to 'private driver' info */
079708b91   Douglas Thompson   drivers/edac: cor...
247
  	unsigned long start_time;	/* edac_device load start time (jiffies) */
e27e3dac6   Douglas Thompson   drivers/edac: add...
248

1c3631ff1   Douglas Thompson   drivers/edac: fix...
249
  	struct completion removal_complete;
e27e3dac6   Douglas Thompson   drivers/edac: add...
250
251
252
  
  	/* sysfs top name under 'edac' directory
  	 * and instance name:
079708b91   Douglas Thompson   drivers/edac: cor...
253
254
255
256
  	 *      cpu/cpu0/...
  	 *      cpu/cpu1/...
  	 *      cpu/cpu2/...
  	 *      ...
e27e3dac6   Douglas Thompson   drivers/edac: add...
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
  	 */
  	char name[EDAC_DEVICE_NAME_LEN + 1];
  
  	/* Number of instances supported on this control structure
  	 * and the array of those instances
  	 */
  	u32 nr_instances;
  	struct edac_device_instance *instances;
  
  	/* Event counters for the this whole EDAC Device */
  	struct edac_device_counter counters;
  
  	/* edac sysfs device control for the 'name'
  	 * device this structure controls
  	 */
  	struct kobject kobj;
e27e3dac6   Douglas Thompson   drivers/edac: add...
273
274
275
  };
  
  /* To get from the instance's wq to the beginning of the ctl structure */
81d87cb13   Dave Jiang   drivers/edac: mod...
276
277
  #define to_edac_mem_ctl_work(w) \
  		container_of(w, struct mem_ctl_info, work)
e27e3dac6   Douglas Thompson   drivers/edac: add...
278
279
  #define to_edac_device_ctl_work(w) \
  		container_of(w,struct edac_device_ctl_info,work)
e27e3dac6   Douglas Thompson   drivers/edac: add...
280
281
282
283
284
285
  /*
   * The alloc() and free() functions for the 'edac_device' control info
   * structure. A MC driver will allocate one of these for each edac_device
   * it is going to control/register with the EDAC CORE.
   */
  extern struct edac_device_ctl_info *edac_device_alloc_ctl_info(
079708b91   Douglas Thompson   drivers/edac: cor...
286
  		unsigned sizeof_private,
fd309a9d8   Douglas Thompson   drivers/edac: fix...
287
288
  		char *edac_device_name, unsigned nr_instances,
  		char *edac_block_name, unsigned nr_blocks,
079708b91   Douglas Thompson   drivers/edac: cor...
289
  		unsigned offset_value,
fd309a9d8   Douglas Thompson   drivers/edac: fix...
290
  		struct edac_dev_sysfs_block_attribute *block_attributes,
d45e7823b   Doug Thompson   drivers/edac: fix...
291
292
  		unsigned nr_attribs,
  		int device_index);
e27e3dac6   Douglas Thompson   drivers/edac: add...
293
294
295
296
297
298
299
300
  
  /* The offset value can be:
   *	-1 indicating no offset value
   *	0 for zero-based block numbers
   *	1 for 1-based block number
   *	other for other-based block number
   */
  #define	BLOCK_OFFSET_VALUE_OFF	((unsigned) -1)
079708b91   Douglas Thompson   drivers/edac: cor...
301
  extern void edac_device_free_ctl_info(struct edac_device_ctl_info *ctl_info);
e27e3dac6   Douglas Thompson   drivers/edac: add...
302

7c9281d76   Douglas Thompson   drivers/edac: spl...
303
  #ifdef CONFIG_PCI
91b99041c   Dave Jiang   drivers/edac: upd...
304
  struct edac_pci_counter {
079708b91   Douglas Thompson   drivers/edac: cor...
305
306
  	atomic_t pe_count;
  	atomic_t npe_count;
91b99041c   Dave Jiang   drivers/edac: upd...
307
308
309
310
311
312
313
314
315
316
317
  };
  
  /*
   * Abstract edac_pci control info structure
   *
   */
  struct edac_pci_ctl_info {
  	/* for global list of edac_pci_ctl_info structs */
  	struct list_head link;
  
  	int pci_idx;
fe5ff8b84   Kay Sievers   edac: convert sys...
318
  	struct bus_type *edac_subsys;	/* pointer to subsystem */
91b99041c   Dave Jiang   drivers/edac: upd...
319
320
321
322
  
  	/* the internal state of this controller instance */
  	int op_state;
  	/* work struct for this instance */
91b99041c   Dave Jiang   drivers/edac: upd...
323
  	struct delayed_work work;
91b99041c   Dave Jiang   drivers/edac: upd...
324
325
  
  	/* pointer to edac polling checking routine:
079708b91   Douglas Thompson   drivers/edac: cor...
326
327
328
  	 *      If NOT NULL: points to polling check routine
  	 *      If NULL: Then assumes INTERRUPT operation, where
  	 *              MC driver will receive events
91b99041c   Dave Jiang   drivers/edac: upd...
329
330
331
332
333
334
335
336
337
338
  	 */
  	void (*edac_check) (struct edac_pci_ctl_info * edac_dev);
  
  	struct device *dev;	/* pointer to device structure */
  
  	const char *mod_name;	/* module name */
  	const char *ctl_name;	/* edac controller  name */
  	const char *dev_name;	/* pci/platform/etc... name */
  
  	void *pvt_info;		/* pointer to 'private driver' info */
079708b91   Douglas Thompson   drivers/edac: cor...
339
  	unsigned long start_time;	/* edac_pci load start time (jiffies) */
91b99041c   Dave Jiang   drivers/edac: upd...
340

91b99041c   Dave Jiang   drivers/edac: upd...
341
342
343
344
  	struct completion complete;
  
  	/* sysfs top name under 'edac' directory
  	 * and instance name:
079708b91   Douglas Thompson   drivers/edac: cor...
345
346
347
348
  	 *      cpu/cpu0/...
  	 *      cpu/cpu1/...
  	 *      cpu/cpu2/...
  	 *      ...
91b99041c   Dave Jiang   drivers/edac: upd...
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
  	 */
  	char name[EDAC_DEVICE_NAME_LEN + 1];
  
  	/* Event counters for the this whole EDAC Device */
  	struct edac_pci_counter counters;
  
  	/* edac sysfs device control for the 'name'
  	 * device this structure controls
  	 */
  	struct kobject kobj;
  	struct completion kobj_complete;
  };
  
  #define to_edac_pci_ctl_work(w) \
  		container_of(w, struct edac_pci_ctl_info,work)
7c9281d76   Douglas Thompson   drivers/edac: spl...
364
365
  /* write all or some bits in a byte-register*/
  static inline void pci_write_bits8(struct pci_dev *pdev, int offset, u8 value,
079708b91   Douglas Thompson   drivers/edac: cor...
366
  				   u8 mask)
7c9281d76   Douglas Thompson   drivers/edac: spl...
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
  {
  	if (mask != 0xff) {
  		u8 buf;
  
  		pci_read_config_byte(pdev, offset, &buf);
  		value &= mask;
  		buf &= ~mask;
  		value |= buf;
  	}
  
  	pci_write_config_byte(pdev, offset, value);
  }
  
  /* write all or some bits in a word-register*/
  static inline void pci_write_bits16(struct pci_dev *pdev, int offset,
079708b91   Douglas Thompson   drivers/edac: cor...
382
  				    u16 value, u16 mask)
7c9281d76   Douglas Thompson   drivers/edac: spl...
383
384
385
386
387
388
389
390
391
392
393
394
  {
  	if (mask != 0xffff) {
  		u16 buf;
  
  		pci_read_config_word(pdev, offset, &buf);
  		value &= mask;
  		buf &= ~mask;
  		value |= buf;
  	}
  
  	pci_write_config_word(pdev, offset, value);
  }
e6da46b27   Jeff Haran   edac: fix local p...
395
396
397
398
399
400
401
402
403
  /*
   * pci_write_bits32
   *
   * edac local routine to do pci_write_config_dword, but adds
   * a mask parameter. If mask is all ones, ignore the mask.
   * Otherwise utilize the mask to isolate specified bits
   *
   * write all or some bits in a dword-register
   */
7c9281d76   Douglas Thompson   drivers/edac: spl...
404
  static inline void pci_write_bits32(struct pci_dev *pdev, int offset,
079708b91   Douglas Thompson   drivers/edac: cor...
405
  				    u32 value, u32 mask)
7c9281d76   Douglas Thompson   drivers/edac: spl...
406
  {
e6da46b27   Jeff Haran   edac: fix local p...
407
  	if (mask != 0xffffffff) {
7c9281d76   Douglas Thompson   drivers/edac: spl...
408
409
410
411
412
413
414
415
416
417
  		u32 buf;
  
  		pci_read_config_dword(pdev, offset, &buf);
  		value &= mask;
  		buf &= ~mask;
  		value |= buf;
  	}
  
  	pci_write_config_dword(pdev, offset, value);
  }
079708b91   Douglas Thompson   drivers/edac: cor...
418
  #endif				/* CONFIG_PCI */
7c9281d76   Douglas Thompson   drivers/edac: spl...
419

ca0907b9e   Mauro Carvalho Chehab   edac: Remove the ...
420
  struct mem_ctl_info *edac_mc_alloc(unsigned mc_num,
4275be635   Mauro Carvalho Chehab   edac: Change inte...
421
422
423
  				   unsigned n_layers,
  				   struct edac_mc_layer *layers,
  				   unsigned sz_pvt);
4e8d230de   Takashi Iwai   EDAC: Allow to pa...
424
425
426
  extern int edac_mc_add_mc_with_groups(struct mem_ctl_info *mci,
  				      const struct attribute_group **groups);
  #define edac_mc_add_mc(mci)	edac_mc_add_mc_with_groups(mci, NULL)
b8f6f9755   Doug Thompson   drivers/edac: fix...
427
  extern void edac_mc_free(struct mem_ctl_info *mci);
079708b91   Douglas Thompson   drivers/edac: cor...
428
  extern struct mem_ctl_info *edac_mc_find(int idx);
939747bd6   Mauro Carvalho Chehab   i7core_edac: Be s...
429
  extern struct mem_ctl_info *find_mci_by_dev(struct device *dev);
079708b91   Douglas Thompson   drivers/edac: cor...
430
  extern struct mem_ctl_info *edac_mc_del_mc(struct device *dev);
7c9281d76   Douglas Thompson   drivers/edac: spl...
431
  extern int edac_mc_find_csrow_by_page(struct mem_ctl_info *mci,
079708b91   Douglas Thompson   drivers/edac: cor...
432
  				      unsigned long page);
e7e248304   Mauro Carvalho Chehab   edac: add support...
433
434
435
436
  
  void edac_raw_mc_handle_error(const enum hw_event_mc_err_type type,
  			      struct mem_ctl_info *mci,
  			      struct edac_raw_error_desc *e);
4275be635   Mauro Carvalho Chehab   edac: Change inte...
437
438
  void edac_mc_handle_error(const enum hw_event_mc_err_type type,
  			  struct mem_ctl_info *mci,
9eb07a7fb   Mauro Carvalho Chehab   edac: edac_mc_han...
439
  			  const u16 error_count,
4275be635   Mauro Carvalho Chehab   edac: Change inte...
440
441
442
  			  const unsigned long page_frame_number,
  			  const unsigned long offset_in_page,
  			  const unsigned long syndrome,
53f2d0289   Mauro Carvalho Chehab   RAS: Add a tracep...
443
444
445
  			  const int top_layer,
  			  const int mid_layer,
  			  const int low_layer,
4275be635   Mauro Carvalho Chehab   edac: Change inte...
446
  			  const char *msg,
03f7eae80   Mauro Carvalho Chehab   edac: remove arch...
447
  			  const char *other_detail);
7c9281d76   Douglas Thompson   drivers/edac: spl...
448
449
  
  /*
e27e3dac6   Douglas Thompson   drivers/edac: add...
450
   * edac_device APIs
7c9281d76   Douglas Thompson   drivers/edac: spl...
451
   */
d45e7823b   Doug Thompson   drivers/edac: fix...
452
  extern int edac_device_add_device(struct edac_device_ctl_info *edac_dev);
079708b91   Douglas Thompson   drivers/edac: cor...
453
  extern struct edac_device_ctl_info *edac_device_del_device(struct device *dev);
e27e3dac6   Douglas Thompson   drivers/edac: add...
454
  extern void edac_device_handle_ue(struct edac_device_ctl_info *edac_dev,
b8f6f9755   Doug Thompson   drivers/edac: fix...
455
  				int inst_nr, int block_nr, const char *msg);
e27e3dac6   Douglas Thompson   drivers/edac: add...
456
  extern void edac_device_handle_ce(struct edac_device_ctl_info *edac_dev,
b8f6f9755   Doug Thompson   drivers/edac: fix...
457
  				int inst_nr, int block_nr, const char *msg);
1dc9b70d7   Harry Ciao   edac: add edac_de...
458
  extern int edac_device_alloc_index(void);
4275be635   Mauro Carvalho Chehab   edac: Change inte...
459
  extern const char *edac_layer_name[];
e27e3dac6   Douglas Thompson   drivers/edac: add...
460

91b99041c   Dave Jiang   drivers/edac: upd...
461
462
463
  /*
   * edac_pci APIs
   */
b8f6f9755   Doug Thompson   drivers/edac: fix...
464
465
  extern struct edac_pci_ctl_info *edac_pci_alloc_ctl_info(unsigned int sz_pvt,
  				const char *edac_pci_name);
91b99041c   Dave Jiang   drivers/edac: upd...
466
467
  
  extern void edac_pci_free_ctl_info(struct edac_pci_ctl_info *pci);
b8f6f9755   Doug Thompson   drivers/edac: fix...
468
469
  extern void edac_pci_reset_delay_period(struct edac_pci_ctl_info *pci,
  				unsigned long value);
91b99041c   Dave Jiang   drivers/edac: upd...
470

8641a3845   Harry Ciao   edac: Add edac_pc...
471
  extern int edac_pci_alloc_index(void);
91b99041c   Dave Jiang   drivers/edac: upd...
472
  extern int edac_pci_add_device(struct edac_pci_ctl_info *pci, int edac_idx);
079708b91   Douglas Thompson   drivers/edac: cor...
473
  extern struct edac_pci_ctl_info *edac_pci_del_device(struct device *dev);
91b99041c   Dave Jiang   drivers/edac: upd...
474

b8f6f9755   Doug Thompson   drivers/edac: fix...
475
476
477
  extern struct edac_pci_ctl_info *edac_pci_create_generic_ctl(
  				struct device *dev,
  				const char *mod_name);
91b99041c   Dave Jiang   drivers/edac: upd...
478
479
480
481
482
483
484
485
  
  extern void edac_pci_release_generic_ctl(struct edac_pci_ctl_info *pci);
  extern int edac_pci_create_sysfs(struct edac_pci_ctl_info *pci);
  extern void edac_pci_remove_sysfs(struct edac_pci_ctl_info *pci);
  
  /*
   * edac misc APIs
   */
494d0d55b   Douglas Thompson   drivers/edac: mod...
486
  extern char *edac_op_state_to_string(int op_state);
7c9281d76   Douglas Thompson   drivers/edac: spl...
487
488
  
  #endif				/* _EDAC_CORE_H_ */