diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-07-23 05:57:45 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-05-10 10:44:49 -0400 |
commit | 696e409dbd1ce325129c5030267365619364dfa0 (patch) | |
tree | a47bb1c8513ed35adebf60281d190cb68a343a95 /drivers/edac/edac_mce.c | |
parent | 41fcb7feed70d8076f1591664314ca172fcdff7b (diff) |
edac_mce: Add an interface driver to report mce errors via edac
edac_mce module is an interface module that gets mcelog data and
forwards to any registered edac module that expects to receive data via
mce.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/edac/edac_mce.c')
-rw-r--r-- | drivers/edac/edac_mce.c | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/drivers/edac/edac_mce.c b/drivers/edac/edac_mce.c new file mode 100644 index 000000000000..b1efa8e51921 --- /dev/null +++ b/drivers/edac/edac_mce.c | |||
@@ -0,0 +1,58 @@ | |||
1 | /* Provides edac interface to mcelog events | ||
2 | * | ||
3 | * This file may be distributed under the terms of the | ||
4 | * GNU General Public License version 2. | ||
5 | * | ||
6 | * Copyright (c) 2009 by: | ||
7 | * Mauro Carvalho Chehab <mchehab@redhat.com> | ||
8 | * | ||
9 | * Red Hat Inc. http://www.redhat.com | ||
10 | */ | ||
11 | |||
12 | #include <linux/module.h> | ||
13 | #include <linux/edac_mce.h> | ||
14 | #include <asm/mce.h> | ||
15 | |||
16 | int edac_mce_enabled; | ||
17 | EXPORT_SYMBOL_GPL(edac_mce_enabled); | ||
18 | |||
19 | |||
20 | /* | ||
21 | * Extension interface | ||
22 | */ | ||
23 | |||
24 | static LIST_HEAD(edac_mce_list); | ||
25 | static DEFINE_MUTEX(edac_mce_lock); | ||
26 | |||
27 | int edac_mce_register(struct edac_mce *edac_mce) | ||
28 | { | ||
29 | mutex_lock(&edac_mce_lock); | ||
30 | list_add_tail(&edac_mce->list, &edac_mce_list); | ||
31 | mutex_unlock(&edac_mce_lock); | ||
32 | return 0; | ||
33 | } | ||
34 | EXPORT_SYMBOL(edac_mce_register); | ||
35 | |||
36 | void edac_mce_unregister(struct edac_mce *edac_mce) | ||
37 | { | ||
38 | mutex_lock(&edac_mce_lock); | ||
39 | list_del(&edac_mce->list); | ||
40 | mutex_unlock(&edac_mce_lock); | ||
41 | } | ||
42 | EXPORT_SYMBOL(edac_mce_unregister); | ||
43 | |||
44 | |||
45 | |||
46 | int edac_mce_queue(struct mce *mce) | ||
47 | { | ||
48 | struct edac_mce *edac_mce; | ||
49 | |||
50 | list_for_each_entry(edac_mce, &edac_mce_list, list) { | ||
51 | if (edac_mce->check_error(edac_mce->priv, mce)) | ||
52 | return 1; | ||
53 | } | ||
54 | |||
55 | /* Nobody queued the error */ | ||
56 | return 0; | ||
57 | } | ||
58 | EXPORT_SYMBOL_GPL(edac_mce_queue); | ||