edac_device.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  1. /*
  2. * edac_device.c
  3. * (C) 2007 www.douglaskthompson.com
  4. *
  5. * This file may be distributed under the terms of the
  6. * GNU General Public License.
  7. *
  8. * Written by Doug Thompson <norsk5@xmission.com>
  9. *
  10. * edac_device API implementation
  11. * 19 Jan 2007
  12. */
  13. #include <asm/page.h>
  14. #include <linux/uaccess.h>
  15. #include <linux/ctype.h>
  16. #include <linux/highmem.h>
  17. #include <linux/init.h>
  18. #include <linux/jiffies.h>
  19. #include <linux/module.h>
  20. #include <linux/slab.h>
  21. #include <linux/smp.h>
  22. #include <linux/spinlock.h>
  23. #include <linux/sysctl.h>
  24. #include <linux/timer.h>
  25. #include "edac_device.h"
  26. #include "edac_module.h"
  27. /* lock for the list: 'edac_device_list', manipulation of this list
  28. * is protected by the 'device_ctls_mutex' lock
  29. */
  30. static DEFINE_MUTEX(device_ctls_mutex);
  31. static LIST_HEAD(edac_device_list);
  32. #ifdef CONFIG_EDAC_DEBUG
  33. static void edac_device_dump_device(struct edac_device_ctl_info *edac_dev)
  34. {
  35. edac_dbg(3, "\tedac_dev = %p dev_idx=%d\n",
  36. edac_dev, edac_dev->dev_idx);
  37. edac_dbg(4, "\tedac_dev->edac_check = %p\n", edac_dev->edac_check);
  38. edac_dbg(3, "\tdev = %p\n", edac_dev->dev);
  39. edac_dbg(3, "\tmod_name:ctl_name = %s:%s\n",
  40. edac_dev->mod_name, edac_dev->ctl_name);
  41. edac_dbg(3, "\tpvt_info = %p\n\n", edac_dev->pvt_info);
  42. }
  43. #endif /* CONFIG_EDAC_DEBUG */
  44. struct edac_device_ctl_info *edac_device_alloc_ctl_info(
  45. unsigned sz_private,
  46. char *edac_device_name, unsigned nr_instances,
  47. char *edac_block_name, unsigned nr_blocks,
  48. unsigned offset_value, /* zero, 1, or other based offset */
  49. struct edac_dev_sysfs_block_attribute *attrib_spec, unsigned nr_attrib,
  50. int device_index)
  51. {
  52. struct edac_device_ctl_info *dev_ctl;
  53. struct edac_device_instance *dev_inst, *inst;
  54. struct edac_device_block *dev_blk, *blk_p, *blk;
  55. struct edac_dev_sysfs_block_attribute *dev_attrib, *attrib_p, *attrib;
  56. unsigned total_size;
  57. unsigned count;
  58. unsigned instance, block, attr;
  59. void *pvt, *p;
  60. int err;
  61. edac_dbg(4, "instances=%d blocks=%d\n", nr_instances, nr_blocks);
  62. /* Calculate the size of memory we need to allocate AND
  63. * determine the offsets of the various item arrays
  64. * (instance,block,attrib) from the start of an allocated structure.
  65. * We want the alignment of each item (instance,block,attrib)
  66. * to be at least as stringent as what the compiler would
  67. * provide if we could simply hardcode everything into a single struct.
  68. */
  69. p = NULL;
  70. dev_ctl = edac_align_ptr(&p, sizeof(*dev_ctl), 1);
  71. /* Calc the 'end' offset past end of ONE ctl_info structure
  72. * which will become the start of the 'instance' array
  73. */
  74. dev_inst = edac_align_ptr(&p, sizeof(*dev_inst), nr_instances);
  75. /* Calc the 'end' offset past the instance array within the ctl_info
  76. * which will become the start of the block array
  77. */
  78. count = nr_instances * nr_blocks;
  79. dev_blk = edac_align_ptr(&p, sizeof(*dev_blk), count);
  80. /* Calc the 'end' offset past the dev_blk array
  81. * which will become the start of the attrib array, if any.
  82. */
  83. /* calc how many nr_attrib we need */
  84. if (nr_attrib > 0)
  85. count *= nr_attrib;
  86. dev_attrib = edac_align_ptr(&p, sizeof(*dev_attrib), count);
  87. /* Calc the 'end' offset past the attributes array */
  88. pvt = edac_align_ptr(&p, sz_private, 1);
  89. /* 'pvt' now points to where the private data area is.
  90. * At this point 'pvt' (like dev_inst,dev_blk and dev_attrib)
  91. * is baselined at ZERO
  92. */
  93. total_size = ((unsigned long)pvt) + sz_private;
  94. /* Allocate the amount of memory for the set of control structures */
  95. dev_ctl = kzalloc(total_size, GFP_KERNEL);
  96. if (dev_ctl == NULL)
  97. return NULL;
  98. /* Adjust pointers so they point within the actual memory we
  99. * just allocated rather than an imaginary chunk of memory
  100. * located at address 0.
  101. * 'dev_ctl' points to REAL memory, while the others are
  102. * ZERO based and thus need to be adjusted to point within
  103. * the allocated memory.
  104. */
  105. dev_inst = (struct edac_device_instance *)
  106. (((char *)dev_ctl) + ((unsigned long)dev_inst));
  107. dev_blk = (struct edac_device_block *)
  108. (((char *)dev_ctl) + ((unsigned long)dev_blk));
  109. dev_attrib = (struct edac_dev_sysfs_block_attribute *)
  110. (((char *)dev_ctl) + ((unsigned long)dev_attrib));
  111. pvt = sz_private ? (((char *)dev_ctl) + ((unsigned long)pvt)) : NULL;
  112. /* Begin storing the information into the control info structure */
  113. dev_ctl->dev_idx = device_index;
  114. dev_ctl->nr_instances = nr_instances;
  115. dev_ctl->instances = dev_inst;
  116. dev_ctl->pvt_info = pvt;
  117. /* Default logging of CEs and UEs */
  118. dev_ctl->log_ce = 1;
  119. dev_ctl->log_ue = 1;
  120. /* Name of this edac device */
  121. snprintf(dev_ctl->name,sizeof(dev_ctl->name),"%s",edac_device_name);
  122. edac_dbg(4, "edac_dev=%p next after end=%p\n",
  123. dev_ctl, pvt + sz_private);
  124. /* Initialize every Instance */
  125. for (instance = 0; instance < nr_instances; instance++) {
  126. inst = &dev_inst[instance];
  127. inst->ctl = dev_ctl;
  128. inst->nr_blocks = nr_blocks;
  129. blk_p = &dev_blk[instance * nr_blocks];
  130. inst->blocks = blk_p;
  131. /* name of this instance */
  132. snprintf(inst->name, sizeof(inst->name),
  133. "%s%u", edac_device_name, instance);
  134. /* Initialize every block in each instance */
  135. for (block = 0; block < nr_blocks; block++) {
  136. blk = &blk_p[block];
  137. blk->instance = inst;
  138. snprintf(blk->name, sizeof(blk->name),
  139. "%s%d", edac_block_name, block+offset_value);
  140. edac_dbg(4, "instance=%d inst_p=%p block=#%d block_p=%p name='%s'\n",
  141. instance, inst, block, blk, blk->name);
  142. /* if there are NO attributes OR no attribute pointer
  143. * then continue on to next block iteration
  144. */
  145. if ((nr_attrib == 0) || (attrib_spec == NULL))
  146. continue;
  147. /* setup the attribute array for this block */
  148. blk->nr_attribs = nr_attrib;
  149. attrib_p = &dev_attrib[block*nr_instances*nr_attrib];
  150. blk->block_attributes = attrib_p;
  151. edac_dbg(4, "THIS BLOCK_ATTRIB=%p\n",
  152. blk->block_attributes);
  153. /* Initialize every user specified attribute in this
  154. * block with the data the caller passed in
  155. * Each block gets its own copy of pointers,
  156. * and its unique 'value'
  157. */
  158. for (attr = 0; attr < nr_attrib; attr++) {
  159. attrib = &attrib_p[attr];
  160. /* populate the unique per attrib
  161. * with the code pointers and info
  162. */
  163. attrib->attr = attrib_spec[attr].attr;
  164. attrib->show = attrib_spec[attr].show;
  165. attrib->store = attrib_spec[attr].store;
  166. attrib->block = blk; /* up link */
  167. edac_dbg(4, "alloc-attrib=%p attrib_name='%s' attrib-spec=%p spec-name=%s\n",
  168. attrib, attrib->attr.name,
  169. &attrib_spec[attr],
  170. attrib_spec[attr].attr.name
  171. );
  172. }
  173. }
  174. }
  175. /* Mark this instance as merely ALLOCATED */
  176. dev_ctl->op_state = OP_ALLOC;
  177. /*
  178. * Initialize the 'root' kobj for the edac_device controller
  179. */
  180. err = edac_device_register_sysfs_main_kobj(dev_ctl);
  181. if (err) {
  182. kfree(dev_ctl);
  183. return NULL;
  184. }
  185. /* at this point, the root kobj is valid, and in order to
  186. * 'free' the object, then the function:
  187. * edac_device_unregister_sysfs_main_kobj() must be called
  188. * which will perform kobj unregistration and the actual free
  189. * will occur during the kobject callback operation
  190. */
  191. return dev_ctl;
  192. }
  193. EXPORT_SYMBOL_GPL(edac_device_alloc_ctl_info);
  194. void edac_device_free_ctl_info(struct edac_device_ctl_info *ctl_info)
  195. {
  196. edac_device_unregister_sysfs_main_kobj(ctl_info);
  197. }
  198. EXPORT_SYMBOL_GPL(edac_device_free_ctl_info);
  199. /*
  200. * find_edac_device_by_dev
  201. * scans the edac_device list for a specific 'struct device *'
  202. *
  203. * lock to be held prior to call: device_ctls_mutex
  204. *
  205. * Return:
  206. * pointer to control structure managing 'dev'
  207. * NULL if not found on list
  208. */
  209. static struct edac_device_ctl_info *find_edac_device_by_dev(struct device *dev)
  210. {
  211. struct edac_device_ctl_info *edac_dev;
  212. struct list_head *item;
  213. edac_dbg(0, "\n");
  214. list_for_each(item, &edac_device_list) {
  215. edac_dev = list_entry(item, struct edac_device_ctl_info, link);
  216. if (edac_dev->dev == dev)
  217. return edac_dev;
  218. }
  219. return NULL;
  220. }
  221. /*
  222. * add_edac_dev_to_global_list
  223. * Before calling this function, caller must
  224. * assign a unique value to edac_dev->dev_idx.
  225. *
  226. * lock to be held prior to call: device_ctls_mutex
  227. *
  228. * Return:
  229. * 0 on success
  230. * 1 on failure.
  231. */
  232. static int add_edac_dev_to_global_list(struct edac_device_ctl_info *edac_dev)
  233. {
  234. struct list_head *item, *insert_before;
  235. struct edac_device_ctl_info *rover;
  236. insert_before = &edac_device_list;
  237. /* Determine if already on the list */
  238. rover = find_edac_device_by_dev(edac_dev->dev);
  239. if (unlikely(rover != NULL))
  240. goto fail0;
  241. /* Insert in ascending order by 'dev_idx', so find position */
  242. list_for_each(item, &edac_device_list) {
  243. rover = list_entry(item, struct edac_device_ctl_info, link);
  244. if (rover->dev_idx >= edac_dev->dev_idx) {
  245. if (unlikely(rover->dev_idx == edac_dev->dev_idx))
  246. goto fail1;
  247. insert_before = item;
  248. break;
  249. }
  250. }
  251. list_add_tail_rcu(&edac_dev->link, insert_before);
  252. return 0;
  253. fail0:
  254. edac_printk(KERN_WARNING, EDAC_MC,
  255. "%s (%s) %s %s already assigned %d\n",
  256. dev_name(rover->dev), edac_dev_name(rover),
  257. rover->mod_name, rover->ctl_name, rover->dev_idx);
  258. return 1;
  259. fail1:
  260. edac_printk(KERN_WARNING, EDAC_MC,
  261. "bug in low-level driver: attempt to assign\n"
  262. " duplicate dev_idx %d in %s()\n", rover->dev_idx,
  263. __func__);
  264. return 1;
  265. }
  266. /*
  267. * del_edac_device_from_global_list
  268. */
  269. static void del_edac_device_from_global_list(struct edac_device_ctl_info
  270. *edac_device)
  271. {
  272. list_del_rcu(&edac_device->link);
  273. /* these are for safe removal of devices from global list while
  274. * NMI handlers may be traversing list
  275. */
  276. synchronize_rcu();
  277. INIT_LIST_HEAD(&edac_device->link);
  278. }
  279. /*
  280. * edac_device_workq_function
  281. * performs the operation scheduled by a workq request
  282. *
  283. * this workq is embedded within an edac_device_ctl_info
  284. * structure, that needs to be polled for possible error events.
  285. *
  286. * This operation is to acquire the list mutex lock
  287. * (thus preventing insertation or deletion)
  288. * and then call the device's poll function IFF this device is
  289. * running polled and there is a poll function defined.
  290. */
  291. static void edac_device_workq_function(struct work_struct *work_req)
  292. {
  293. struct delayed_work *d_work = to_delayed_work(work_req);
  294. struct edac_device_ctl_info *edac_dev = to_edac_device_ctl_work(d_work);
  295. mutex_lock(&device_ctls_mutex);
  296. /* If we are being removed, bail out immediately */
  297. if (edac_dev->op_state == OP_OFFLINE) {
  298. mutex_unlock(&device_ctls_mutex);
  299. return;
  300. }
  301. /* Only poll controllers that are running polled and have a check */
  302. if ((edac_dev->op_state == OP_RUNNING_POLL) &&
  303. (edac_dev->edac_check != NULL)) {
  304. edac_dev->edac_check(edac_dev);
  305. }
  306. mutex_unlock(&device_ctls_mutex);
  307. /* Reschedule the workq for the next time period to start again
  308. * if the number of msec is for 1 sec, then adjust to the next
  309. * whole one second to save timers firing all over the period
  310. * between integral seconds
  311. */
  312. if (edac_dev->poll_msec == 1000)
  313. edac_queue_work(&edac_dev->work, round_jiffies_relative(edac_dev->delay));
  314. else
  315. edac_queue_work(&edac_dev->work, edac_dev->delay);
  316. }
  317. /*
  318. * edac_device_workq_setup
  319. * initialize a workq item for this edac_device instance
  320. * passing in the new delay period in msec
  321. */
  322. static void edac_device_workq_setup(struct edac_device_ctl_info *edac_dev,
  323. unsigned msec)
  324. {
  325. edac_dbg(0, "\n");
  326. /* take the arg 'msec' and set it into the control structure
  327. * to used in the time period calculation
  328. * then calc the number of jiffies that represents
  329. */
  330. edac_dev->poll_msec = msec;
  331. edac_dev->delay = msecs_to_jiffies(msec);
  332. INIT_DELAYED_WORK(&edac_dev->work, edac_device_workq_function);
  333. /* optimize here for the 1 second case, which will be normal value, to
  334. * fire ON the 1 second time event. This helps reduce all sorts of
  335. * timers firing on sub-second basis, while they are happy
  336. * to fire together on the 1 second exactly
  337. */
  338. if (edac_dev->poll_msec == 1000)
  339. edac_queue_work(&edac_dev->work, round_jiffies_relative(edac_dev->delay));
  340. else
  341. edac_queue_work(&edac_dev->work, edac_dev->delay);
  342. }
  343. /*
  344. * edac_device_workq_teardown
  345. * stop the workq processing on this edac_dev
  346. */
  347. static void edac_device_workq_teardown(struct edac_device_ctl_info *edac_dev)
  348. {
  349. if (!edac_dev->edac_check)
  350. return;
  351. edac_dev->op_state = OP_OFFLINE;
  352. edac_stop_work(&edac_dev->work);
  353. }
  354. /*
  355. * edac_device_reset_delay_period
  356. *
  357. * need to stop any outstanding workq queued up at this time
  358. * because we will be resetting the sleep time.
  359. * Then restart the workq on the new delay
  360. */
  361. void edac_device_reset_delay_period(struct edac_device_ctl_info *edac_dev,
  362. unsigned long value)
  363. {
  364. unsigned long jiffs = msecs_to_jiffies(value);
  365. if (value == 1000)
  366. jiffs = round_jiffies_relative(value);
  367. edac_dev->poll_msec = value;
  368. edac_dev->delay = jiffs;
  369. edac_mod_work(&edac_dev->work, jiffs);
  370. }
  371. int edac_device_alloc_index(void)
  372. {
  373. static atomic_t device_indexes = ATOMIC_INIT(0);
  374. return atomic_inc_return(&device_indexes) - 1;
  375. }
  376. EXPORT_SYMBOL_GPL(edac_device_alloc_index);
  377. int edac_device_add_device(struct edac_device_ctl_info *edac_dev)
  378. {
  379. edac_dbg(0, "\n");
  380. #ifdef CONFIG_EDAC_DEBUG
  381. if (edac_debug_level >= 3)
  382. edac_device_dump_device(edac_dev);
  383. #endif
  384. mutex_lock(&device_ctls_mutex);
  385. if (add_edac_dev_to_global_list(edac_dev))
  386. goto fail0;
  387. /* set load time so that error rate can be tracked */
  388. edac_dev->start_time = jiffies;
  389. /* create this instance's sysfs entries */
  390. if (edac_device_create_sysfs(edac_dev)) {
  391. edac_device_printk(edac_dev, KERN_WARNING,
  392. "failed to create sysfs device\n");
  393. goto fail1;
  394. }
  395. /* If there IS a check routine, then we are running POLLED */
  396. if (edac_dev->edac_check != NULL) {
  397. /* This instance is NOW RUNNING */
  398. edac_dev->op_state = OP_RUNNING_POLL;
  399. /*
  400. * enable workq processing on this instance,
  401. * default = 1000 msec
  402. */
  403. edac_device_workq_setup(edac_dev, 1000);
  404. } else {
  405. edac_dev->op_state = OP_RUNNING_INTERRUPT;
  406. }
  407. /* Report action taken */
  408. edac_device_printk(edac_dev, KERN_INFO,
  409. "Giving out device to module %s controller %s: DEV %s (%s)\n",
  410. edac_dev->mod_name, edac_dev->ctl_name, edac_dev->dev_name,
  411. edac_op_state_to_string(edac_dev->op_state));
  412. mutex_unlock(&device_ctls_mutex);
  413. return 0;
  414. fail1:
  415. /* Some error, so remove the entry from the lsit */
  416. del_edac_device_from_global_list(edac_dev);
  417. fail0:
  418. mutex_unlock(&device_ctls_mutex);
  419. return 1;
  420. }
  421. EXPORT_SYMBOL_GPL(edac_device_add_device);
  422. struct edac_device_ctl_info *edac_device_del_device(struct device *dev)
  423. {
  424. struct edac_device_ctl_info *edac_dev;
  425. edac_dbg(0, "\n");
  426. mutex_lock(&device_ctls_mutex);
  427. /* Find the structure on the list, if not there, then leave */
  428. edac_dev = find_edac_device_by_dev(dev);
  429. if (edac_dev == NULL) {
  430. mutex_unlock(&device_ctls_mutex);
  431. return NULL;
  432. }
  433. /* mark this instance as OFFLINE */
  434. edac_dev->op_state = OP_OFFLINE;
  435. /* deregister from global list */
  436. del_edac_device_from_global_list(edac_dev);
  437. mutex_unlock(&device_ctls_mutex);
  438. /* clear workq processing on this instance */
  439. edac_device_workq_teardown(edac_dev);
  440. /* Tear down the sysfs entries for this instance */
  441. edac_device_remove_sysfs(edac_dev);
  442. edac_printk(KERN_INFO, EDAC_MC,
  443. "Removed device %d for %s %s: DEV %s\n",
  444. edac_dev->dev_idx,
  445. edac_dev->mod_name, edac_dev->ctl_name, edac_dev_name(edac_dev));
  446. return edac_dev;
  447. }
  448. EXPORT_SYMBOL_GPL(edac_device_del_device);
  449. static inline int edac_device_get_log_ce(struct edac_device_ctl_info *edac_dev)
  450. {
  451. return edac_dev->log_ce;
  452. }
  453. static inline int edac_device_get_log_ue(struct edac_device_ctl_info *edac_dev)
  454. {
  455. return edac_dev->log_ue;
  456. }
  457. static inline int edac_device_get_panic_on_ue(struct edac_device_ctl_info
  458. *edac_dev)
  459. {
  460. return edac_dev->panic_on_ue;
  461. }
  462. void edac_device_handle_ce(struct edac_device_ctl_info *edac_dev,
  463. int inst_nr, int block_nr, const char *msg)
  464. {
  465. struct edac_device_instance *instance;
  466. struct edac_device_block *block = NULL;
  467. if ((inst_nr >= edac_dev->nr_instances) || (inst_nr < 0)) {
  468. edac_device_printk(edac_dev, KERN_ERR,
  469. "INTERNAL ERROR: 'instance' out of range "
  470. "(%d >= %d)\n", inst_nr,
  471. edac_dev->nr_instances);
  472. return;
  473. }
  474. instance = edac_dev->instances + inst_nr;
  475. if ((block_nr >= instance->nr_blocks) || (block_nr < 0)) {
  476. edac_device_printk(edac_dev, KERN_ERR,
  477. "INTERNAL ERROR: instance %d 'block' "
  478. "out of range (%d >= %d)\n",
  479. inst_nr, block_nr,
  480. instance->nr_blocks);
  481. return;
  482. }
  483. if (instance->nr_blocks > 0) {
  484. block = instance->blocks + block_nr;
  485. block->counters.ce_count++;
  486. }
  487. /* Propagate the count up the 'totals' tree */
  488. instance->counters.ce_count++;
  489. edac_dev->counters.ce_count++;
  490. if (edac_device_get_log_ce(edac_dev))
  491. edac_device_printk(edac_dev, KERN_WARNING,
  492. "CE: %s instance: %s block: %s '%s'\n",
  493. edac_dev->ctl_name, instance->name,
  494. block ? block->name : "N/A", msg);
  495. }
  496. EXPORT_SYMBOL_GPL(edac_device_handle_ce);
  497. void edac_device_handle_ue(struct edac_device_ctl_info *edac_dev,
  498. int inst_nr, int block_nr, const char *msg)
  499. {
  500. struct edac_device_instance *instance;
  501. struct edac_device_block *block = NULL;
  502. if ((inst_nr >= edac_dev->nr_instances) || (inst_nr < 0)) {
  503. edac_device_printk(edac_dev, KERN_ERR,
  504. "INTERNAL ERROR: 'instance' out of range "
  505. "(%d >= %d)\n", inst_nr,
  506. edac_dev->nr_instances);
  507. return;
  508. }
  509. instance = edac_dev->instances + inst_nr;
  510. if ((block_nr >= instance->nr_blocks) || (block_nr < 0)) {
  511. edac_device_printk(edac_dev, KERN_ERR,
  512. "INTERNAL ERROR: instance %d 'block' "
  513. "out of range (%d >= %d)\n",
  514. inst_nr, block_nr,
  515. instance->nr_blocks);
  516. return;
  517. }
  518. if (instance->nr_blocks > 0) {
  519. block = instance->blocks + block_nr;
  520. block->counters.ue_count++;
  521. }
  522. /* Propagate the count up the 'totals' tree */
  523. instance->counters.ue_count++;
  524. edac_dev->counters.ue_count++;
  525. if (edac_device_get_log_ue(edac_dev))
  526. edac_device_printk(edac_dev, KERN_EMERG,
  527. "UE: %s instance: %s block: %s '%s'\n",
  528. edac_dev->ctl_name, instance->name,
  529. block ? block->name : "N/A", msg);
  530. if (edac_device_get_panic_on_ue(edac_dev))
  531. panic("EDAC %s: UE instance: %s block %s '%s'\n",
  532. edac_dev->ctl_name, instance->name,
  533. block ? block->name : "N/A", msg);
  534. }
  535. EXPORT_SYMBOL_GPL(edac_device_handle_ue);