linux/drivers/edac/edac_mce.c
<<
>>
Prefs
   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
  16int edac_mce_enabled;
  17EXPORT_SYMBOL_GPL(edac_mce_enabled);
  18
  19
  20/*
  21 * Extension interface
  22 */
  23
  24static LIST_HEAD(edac_mce_list);
  25static DEFINE_MUTEX(edac_mce_lock);
  26
  27int 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}
  34EXPORT_SYMBOL(edac_mce_register);
  35
  36void 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}
  42EXPORT_SYMBOL(edac_mce_unregister);
  43
  44int 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}
  56EXPORT_SYMBOL_GPL(edac_mce_parse);
  57
  58MODULE_LICENSE("GPL");
  59MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
  60MODULE_AUTHOR("Red Hat Inc. (http://www.redhat.com)");
  61MODULE_DESCRIPTION("EDAC Driver for mcelog captured errors");
  62