linux/drivers/edac/edac_pci_sysfs.c

/*
 * (C) 2005, 2006 Linux Networx (http://lnxi.com)
 * This file may be distributed under the terms of the
 * GNU General Public License.
 *
 * Written Doug Thompson <[email protected]>
 *
 */
#include <linux/module.h>
#include <linux/edac.h>
#include <linux/slab.h>
#include <linux/ctype.h>

#include "edac_pci.h"
#include "edac_module.h"

#define EDAC_PCI_SYMLINK

/* data variables exported via sysfs */
static int check_pci_errors;		/* default NO check PCI parity */
static int edac_pci_panic_on_pe;	/* default NO panic on PCI Parity */
static int edac_pci_log_pe =;		/* log PCI parity errors */
static int edac_pci_log_npe =;	/* log PCI non-parity error errors */
static int edac_pci_poll_msec =;	/* one second workq period */

static atomic_t pci_parity_count =;
static atomic_t pci_nonparity_count =;

static struct kobject *edac_pci_top_main_kobj;
static atomic_t edac_pci_sysfs_refcount =;

/* getter functions for the data variables */
int edac_pci_get_check_errors(void)
{}

static int edac_pci_get_log_pe(void)
{}

static int edac_pci_get_log_npe(void)
{}

static int edac_pci_get_panic_on_pe(void)
{}

int edac_pci_get_poll_msec(void)
{}

/**************************** EDAC PCI sysfs instance *******************/
static ssize_t instance_pe_count_show(struct edac_pci_ctl_info *pci, char *data)
{}

static ssize_t instance_npe_count_show(struct edac_pci_ctl_info *pci,
				char *data)
{}

#define to_instance(k)
#define to_instance_attr(a)

/* DEVICE instance kobject release() function */
static void edac_pci_instance_release(struct kobject *kobj)
{}

/* instance specific attribute structure */
struct instance_attribute {};

/* Function to 'show' fields from the edac_pci 'instance' structure */
static ssize_t edac_pci_instance_show(struct kobject *kobj,
				struct attribute *attr, char *buffer)
{}

/* Function to 'store' fields into the edac_pci 'instance' structure */
static ssize_t edac_pci_instance_store(struct kobject *kobj,
				struct attribute *attr,
				const char *buffer, size_t count)
{}

/* fs_ops table */
static const struct sysfs_ops pci_instance_ops =;

#define INSTANCE_ATTR(_name, _mode, _show, _store)

INSTANCE_ATTR(pe_count, S_IRUGO, instance_pe_count_show, NULL);
INSTANCE_ATTR(npe_count, S_IRUGO, instance_npe_count_show, NULL);

/* pci instance attributes */
static struct attribute *pci_instance_attrs[] =;
ATTRIBUTE_GROUPS();

/* the ktype for a pci instance */
static struct kobj_type ktype_pci_instance =;

/*
 * edac_pci_create_instance_kobj
 *
 *	construct one EDAC PCI instance's kobject for use
 */
static int edac_pci_create_instance_kobj(struct edac_pci_ctl_info *pci, int idx)
{}

/*
 * edac_pci_unregister_sysfs_instance_kobj
 *
 *	unregister the kobj for the EDAC PCI instance
 */
static void edac_pci_unregister_sysfs_instance_kobj(
			struct edac_pci_ctl_info *pci)
{}

/***************************** EDAC PCI sysfs root **********************/
#define to_edacpci(k)
#define to_edacpci_attr(a)

/* simple show/store functions for attributes */
static ssize_t edac_pci_int_show(void *ptr, char *buffer)
{}

static ssize_t edac_pci_int_store(void *ptr, const char *buffer, size_t count)
{}

struct edac_pci_dev_attribute {};

/* Set of show/store abstract level functions for PCI Parity object */
static ssize_t edac_pci_dev_show(struct kobject *kobj, struct attribute *attr,
				 char *buffer)
{}

static ssize_t edac_pci_dev_store(struct kobject *kobj,
				struct attribute *attr, const char *buffer,
				size_t count)
{}

static const struct sysfs_ops edac_pci_sysfs_ops =;

#define EDAC_PCI_ATTR(_name,_mode,_show,_store)

#define EDAC_PCI_STRING_ATTR(_name,_data,_mode,_show,_store)

/* PCI Parity control files */
EDAC_PCI_ATTR(check_pci_errors, S_IRUGO | S_IWUSR, edac_pci_int_show,
	edac_pci_int_store);
EDAC_PCI_ATTR(edac_pci_log_pe, S_IRUGO | S_IWUSR, edac_pci_int_show,
	edac_pci_int_store);
EDAC_PCI_ATTR(edac_pci_log_npe, S_IRUGO | S_IWUSR, edac_pci_int_show,
	edac_pci_int_store);
EDAC_PCI_ATTR(edac_pci_panic_on_pe, S_IRUGO | S_IWUSR, edac_pci_int_show,
	edac_pci_int_store);
EDAC_PCI_ATTR(pci_parity_count, S_IRUGO, edac_pci_int_show, NULL);
EDAC_PCI_ATTR(pci_nonparity_count, S_IRUGO, edac_pci_int_show, NULL);

/* Base Attributes of the memory ECC object */
static struct attribute *edac_pci_attrs[] =;
ATTRIBUTE_GROUPS();

/*
 * edac_pci_release_main_kobj
 *
 *	This release function is called when the reference count to the
 *	passed kobj goes to zero.
 *
 *	This kobj is the 'main' kobject that EDAC PCI instances
 *	link to, and thus provide for proper nesting counts
 */
static void edac_pci_release_main_kobj(struct kobject *kobj)
{}

/* ktype struct for the EDAC PCI main kobj */
static struct kobj_type ktype_edac_pci_main_kobj =;

/**
 * edac_pci_main_kobj_setup: Setup the sysfs for EDAC PCI attributes.
 */
static int edac_pci_main_kobj_setup(void)
{}

/*
 * edac_pci_main_kobj_teardown()
 *
 *	if no longer linked (needed) remove the top level EDAC PCI
 *	kobject with its controls and attributes
 */
static void edac_pci_main_kobj_teardown(void)
{}

int edac_pci_create_sysfs(struct edac_pci_ctl_info *pci)
{}

void edac_pci_remove_sysfs(struct edac_pci_ctl_info *pci)
{}

/************************ PCI error handling *************************/
static u16 get_pci_parity_status(struct pci_dev *dev, int secondary)
{}


/* Clear any PCI parity errors logged by this device. */
static void edac_pci_dev_parity_clear(struct pci_dev *dev)
{}

/*
 *  PCI Parity polling
 *
 *	Function to retrieve the current parity status
 *	and decode it
 *
 */
static void edac_pci_dev_parity_test(struct pci_dev *dev)
{}

/* reduce some complexity in definition of the iterator */
pci_parity_check_fn_t;

/*
 * pci_dev parity list iterator
 *
 *	Scan the PCI device list looking for SERRORs, Master Parity ERRORS or
 *	Parity ERRORs on primary or secondary devices.
 */
static inline void edac_pci_dev_parity_iterator(pci_parity_check_fn_t fn)
{}

/*
 * edac_pci_do_parity_check
 *
 *	performs the actual PCI parity check operation
 */
void edac_pci_do_parity_check(void)
{}

/*
 * edac_pci_clear_parity_errors
 *
 *	function to perform an iteration over the PCI devices
 *	and clearn their current status
 */
void edac_pci_clear_parity_errors(void)
{}

/*
 * edac_pci_handle_pe
 *
 *	Called to handle a PARITY ERROR event
 */
void edac_pci_handle_pe(struct edac_pci_ctl_info *pci, const char *msg)
{}
EXPORT_SYMBOL_GPL();


/*
 * edac_pci_handle_npe
 *
 *	Called to handle a NON-PARITY ERROR event
 */
void edac_pci_handle_npe(struct edac_pci_ctl_info *pci, const char *msg)
{}
EXPORT_SYMBOL_GPL();

/*
 * Define the PCI parameter to the module
 */
module_param(check_pci_errors, int, 0644);
MODULE_PARM_DESC();
module_param(edac_pci_panic_on_pe, int, 0644);
MODULE_PARM_DESC();