diff options
| author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-22 10:38:37 -0500 |
|---|---|---|
| committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-22 10:38:37 -0500 |
| commit | fcc9d2e5a6c89d22b8b773a64fb4ad21ac318446 (patch) | |
| tree | a57612d1888735a2ec7972891b68c1ac5ec8faea /drivers/edac | |
| parent | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (diff) | |
Diffstat (limited to 'drivers/edac')
| -rw-r--r-- | drivers/edac/edac_mce.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/drivers/edac/edac_mce.c b/drivers/edac/edac_mce.c new file mode 100644 index 00000000000..9ccdc5b140e --- /dev/null +++ b/drivers/edac/edac_mce.c | |||
| @@ -0,0 +1,61 @@ | |||
| 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 | int edac_mce_parse(struct mce *mce) | ||
| 45 | { | ||
| 46 | struct edac_mce *edac_mce; | ||
| 47 | |||
| 48 | list_for_each_entry(edac_mce, &edac_mce_list, list) { | ||
| 49 | if (edac_mce->check_error(edac_mce->priv, mce)) | ||
| 50 | return 1; | ||
| 51 | } | ||
| 52 | |||
| 53 | /* Nobody queued the error */ | ||
| 54 | return 0; | ||
| 55 | } | ||
| 56 | EXPORT_SYMBOL_GPL(edac_mce_parse); | ||
| 57 | |||
| 58 | MODULE_LICENSE("GPL"); | ||
| 59 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
| 60 | MODULE_AUTHOR("Red Hat Inc. (http://www.redhat.com)"); | ||
| 61 | MODULE_DESCRIPTION("EDAC Driver for mcelog captured errors"); | ||
