Merge tag 'libnvdimm-for-4.7' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm...
[linux-2.6-block.git] / drivers / edac / edac_stub.c
CommitLineData
c0d12172
DJ
1/*
2 * common EDAC components that must be in kernel
3 *
4 * Author: Dave Jiang <djiang@mvista.com>
5 *
30e1f7a8
BP
6 * 2007 (c) MontaVista Software, Inc.
7 * 2010 (c) Advanced Micro Devices Inc.
43aff26c 8 * Borislav Petkov <bp@alien8.de>
30e1f7a8
BP
9 *
10 * This file is licensed under the terms of the GNU General Public
11 * License version 2. This program is licensed "as is" without any
12 * warranty of any kind, whether express or implied.
c0d12172
DJ
13 *
14 */
15#include <linux/module.h>
16#include <linux/edac.h>
60063497 17#include <linux/atomic.h>
51990e82 18#include <linux/device.h>
c0d12172
DJ
19
20int edac_op_state = EDAC_OPSTATE_INVAL;
fb3fb206 21EXPORT_SYMBOL_GPL(edac_op_state);
c0d12172
DJ
22
23atomic_t edac_handlers = ATOMIC_INIT(0);
fb3fb206 24EXPORT_SYMBOL_GPL(edac_handlers);
c0d12172 25
66ee2f94 26int edac_err_assert = 0;
fb3fb206 27EXPORT_SYMBOL_GPL(edac_err_assert);
c0d12172 28
c700f013
CG
29int edac_report_status = EDAC_REPORTING_ENABLED;
30EXPORT_SYMBOL_GPL(edac_report_status);
31
32static int __init edac_report_setup(char *str)
33{
34 if (!str)
35 return -EINVAL;
36
37 if (!strncmp(str, "on", 2))
38 set_edac_report_status(EDAC_REPORTING_ENABLED);
39 else if (!strncmp(str, "off", 3))
40 set_edac_report_status(EDAC_REPORTING_DISABLED);
41 else if (!strncmp(str, "force", 5))
42 set_edac_report_status(EDAC_REPORTING_FORCE);
43
44 return 0;
45}
46__setup("edac_report=", edac_report_setup);
47
fb3fb206
DT
48/*
49 * called to determine if there is an EDAC driver interested in
50 * knowing an event (such as NMI) occurred
51 */
52int edac_handler_set(void)
c0d12172
DJ
53{
54 if (edac_op_state == EDAC_OPSTATE_POLL)
55 return 0;
56
57 return atomic_read(&edac_handlers);
58}
fb3fb206 59EXPORT_SYMBOL_GPL(edac_handler_set);
c0d12172
DJ
60
61/*
62 * handler for NMI type of interrupts to assert error
63 */
fb3fb206 64void edac_atomic_assert_error(void)
c0d12172 65{
66ee2f94 66 edac_err_assert++;
c0d12172 67}
fb3fb206 68EXPORT_SYMBOL_GPL(edac_atomic_assert_error);