Mauro Carvalho Chehab | 696e409 | 2009-07-23 06:57:45 -0300 | [diff] [blame] | 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 | |
Mauro Carvalho Chehab | d538164 | 2009-07-09 22:06:41 -0300 | [diff] [blame] | 44 | int edac_mce_parse(struct mce *mce) |
Mauro Carvalho Chehab | 696e409 | 2009-07-23 06:57:45 -0300 | [diff] [blame] | 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 | } |
Mauro Carvalho Chehab | d538164 | 2009-07-09 22:06:41 -0300 | [diff] [blame] | 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"); |