Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
edac_core.h File Reference
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/module.h>
#include <linux/spinlock.h>
#include <linux/smp.h>
#include <linux/pci.h>
#include <linux/time.h>
#include <linux/nmi.h>
#include <linux/rcupdate.h>
#include <linux/completion.h>
#include <linux/kobject.h>
#include <linux/platform_device.h>
#include <linux/workqueue.h>
#include <linux/edac.h>

Go to the source code of this file.

Data Structures

struct  edac_device_counter
 
struct  edac_dev_sysfs_attribute
 
struct  edac_dev_sysfs_block_attribute
 
struct  edac_device_block
 
struct  edac_device_instance
 
struct  edac_device_ctl_info
 

Macros

#define EDAC_DEVICE_NAME_LEN   31
 
#define EDAC_ATTRIB_VALUE_LEN   15
 
#define PAGES_TO_MiB(pages)   ((pages) >> (20 - PAGE_SHIFT))
 
#define MiB_TO_PAGES(mb)   ((mb) << (20 - PAGE_SHIFT))
 
#define edac_printk(level, prefix, fmt, arg...)   printk(level "EDAC " prefix ": " fmt, ##arg)
 
#define edac_mc_printk(mci, level, fmt, arg...)   printk(level "EDAC MC%d: " fmt, mci->mc_idx, ##arg)
 
#define edac_mc_chipset_printk(mci, level, prefix, fmt, arg...)   printk(level "EDAC " prefix " MC%d: " fmt, mci->mc_idx, ##arg)
 
#define edac_device_printk(ctl, level, fmt, arg...)   printk(level "EDAC DEVICE%d: " fmt, ctl->dev_idx, ##arg)
 
#define edac_pci_printk(ctl, level, fmt, arg...)   printk(level "EDAC PCI%d: " fmt, ctl->pci_idx, ##arg)
 
#define EDAC_MC   "MC"
 
#define EDAC_PCI   "PCI"
 
#define EDAC_DEBUG   "DEBUG"
 
#define edac_dbg(level, fmt,...)
 
#define PCI_VEND_DEV(vend, dev)
 
#define edac_dev_name(dev)   (dev)->dev_name
 
#define to_edac_mem_ctl_work(w)   container_of(w, struct mem_ctl_info, work)
 
#define to_edac_device_ctl_work(w)   container_of(w,struct edac_device_ctl_info,work)
 
#define BLOCK_OFFSET_VALUE_OFF   ((unsigned) -1)
 

Functions

struct edac_device_ctl_infoedac_device_alloc_ctl_info (unsigned sizeof_private, char *edac_device_name, unsigned nr_instances, char *edac_block_name, unsigned nr_blocks, unsigned offset_value, struct edac_dev_sysfs_block_attribute *block_attributes, unsigned nr_attribs, int device_index)
 
void edac_device_free_ctl_info (struct edac_device_ctl_info *ctl_info)
 
struct mem_ctl_infoedac_mc_alloc (unsigned mc_num, unsigned n_layers, struct edac_mc_layer *layers, unsigned sz_pvt)
 
int edac_mc_add_mc (struct mem_ctl_info *mci)
 
void edac_mc_free (struct mem_ctl_info *mci)
 
struct mem_ctl_infoedac_mc_find (int idx)
 
struct mem_ctl_infofind_mci_by_dev (struct device *dev)
 
struct mem_ctl_infoedac_mc_del_mc (struct device *dev)
 
int edac_mc_find_csrow_by_page (struct mem_ctl_info *mci, unsigned long page)
 
void edac_mc_handle_error (const enum hw_event_mc_err_type type, struct mem_ctl_info *mci, const u16 error_count, const unsigned long page_frame_number, const unsigned long offset_in_page, const unsigned long syndrome, const int top_layer, const int mid_layer, const int low_layer, const char *msg, const char *other_detail)
 
int edac_device_add_device (struct edac_device_ctl_info *edac_dev)
 
struct edac_device_ctl_infoedac_device_del_device (struct device *dev)
 
void edac_device_handle_ue (struct edac_device_ctl_info *edac_dev, int inst_nr, int block_nr, const char *msg)
 
void edac_device_handle_ce (struct edac_device_ctl_info *edac_dev, int inst_nr, int block_nr, const char *msg)
 
int edac_device_alloc_index (void)
 
struct edac_pci_ctl_info * edac_pci_alloc_ctl_info (unsigned int sz_pvt, const char *edac_pci_name)
 
void edac_pci_free_ctl_info (struct edac_pci_ctl_info *pci)
 
void edac_pci_reset_delay_period (struct edac_pci_ctl_info *pci, unsigned long value)
 
int edac_pci_alloc_index (void)
 
int edac_pci_add_device (struct edac_pci_ctl_info *pci, int edac_idx)
 
struct edac_pci_ctl_info * edac_pci_del_device (struct device *dev)
 
struct edac_pci_ctl_info * edac_pci_create_generic_ctl (struct device *dev, const char *mod_name)
 
void edac_pci_release_generic_ctl (struct edac_pci_ctl_info *pci)
 
int edac_pci_create_sysfs (struct edac_pci_ctl_info *pci)
 
void edac_pci_remove_sysfs (struct edac_pci_ctl_info *pci)
 
charedac_op_state_to_string (int op_state)
 

Variables

const charedac_mem_types []
 
const charedac_layer_name []
 

Macro Definition Documentation

#define BLOCK_OFFSET_VALUE_OFF   ((unsigned) -1)

Definition at line 318 of file edac_core.h.

#define EDAC_ATTRIB_VALUE_LEN   15

Definition at line 39 of file edac_core.h.

#define edac_dbg (   level,
  fmt,
  ... 
)
Value:
do { \
if (0) \
edac_printk(KERN_DEBUG, EDAC_DEBUG, \
"%s: " fmt, __func__, ##__VA_ARGS__); \
} while (0)

Definition at line 83 of file edac_core.h.

#define EDAC_DEBUG   "DEBUG"

Definition at line 67 of file edac_core.h.

#define edac_dev_name (   dev)    (dev)->dev_name

Definition at line 95 of file edac_core.h.

#define EDAC_DEVICE_NAME_LEN   31

Definition at line 38 of file edac_core.h.

#define edac_device_printk (   ctl,
  level,
  fmt,
  arg... 
)    printk(level "EDAC DEVICE%d: " fmt, ctl->dev_idx, ##arg)

Definition at line 58 of file edac_core.h.

#define EDAC_MC   "MC"

Definition at line 65 of file edac_core.h.

#define edac_mc_chipset_printk (   mci,
  level,
  prefix,
  fmt,
  arg... 
)    printk(level "EDAC " prefix " MC%d: " fmt, mci->mc_idx, ##arg)

Definition at line 55 of file edac_core.h.

#define edac_mc_printk (   mci,
  level,
  fmt,
  arg... 
)    printk(level "EDAC MC%d: " fmt, mci->mc_idx, ##arg)

Definition at line 52 of file edac_core.h.

#define EDAC_PCI   "PCI"

Definition at line 66 of file edac_core.h.

#define edac_pci_printk (   ctl,
  level,
  fmt,
  arg... 
)    printk(level "EDAC PCI%d: " fmt, ctl->pci_idx, ##arg)

Definition at line 61 of file edac_core.h.

#define edac_printk (   level,
  prefix,
  fmt,
  arg... 
)    printk(level "EDAC " prefix ": " fmt, ##arg)

Definition at line 49 of file edac_core.h.

#define MiB_TO_PAGES (   mb)    ((mb) << (20 - PAGE_SHIFT))

Definition at line 43 of file edac_core.h.

#define PAGES_TO_MiB (   pages)    ((pages) >> (20 - PAGE_SHIFT))

Definition at line 42 of file edac_core.h.

#define PCI_VEND_DEV (   vend,
  dev 
)
Value:
PCI_VENDOR_ID_ ## vend, \
PCI_DEVICE_ID_ ## vend ## _ ## dev

Definition at line 92 of file edac_core.h.

#define to_edac_device_ctl_work (   w)    container_of(w,struct edac_device_ctl_info,work)

Definition at line 295 of file edac_core.h.

#define to_edac_mem_ctl_work (   w)    container_of(w, struct mem_ctl_info, work)

Definition at line 292 of file edac_core.h.

Function Documentation

int edac_device_add_device ( struct edac_device_ctl_info edac_dev)

edac_device_add_device: Insert the 'edac_dev' structure into the edac_device global list and create sysfs entries associated with edac_device structure. : pointer to the edac_device structure to be added to the list 'edac_device' structure.

Return: 0 Success !0 Failure

Definition at line 494 of file edac_device.c.

struct edac_device_ctl_info* edac_device_alloc_ctl_info ( unsigned  sizeof_private,
char edac_device_name,
unsigned  nr_instances,
char edac_block_name,
unsigned  nr_blocks,
unsigned  offset_value,
struct edac_dev_sysfs_block_attribute block_attributes,
unsigned  nr_attribs,
int  device_index 
)
read

Definition at line 68 of file edac_device.c.

int edac_device_alloc_index ( void  )

Definition at line 475 of file edac_device.c.

struct edac_device_ctl_info* edac_device_del_device ( struct device dev)
read

edac_device_del_device: Remove sysfs entries for specified edac_device structure and then remove edac_device structure from global list

: Pointer to 'struct device' representing edac_device structure to remove.

Return: Pointer to removed edac_device structure, OR NULL if device not found.

Definition at line 566 of file edac_device.c.

void edac_device_free_ctl_info ( struct edac_device_ctl_info ctl_info)

Definition at line 252 of file edac_device.c.

void edac_device_handle_ce ( struct edac_device_ctl_info edac_dev,
int  inst_nr,
int  block_nr,
const char msg 
)

Definition at line 624 of file edac_device.c.

void edac_device_handle_ue ( struct edac_device_ctl_info edac_dev,
int  inst_nr,
int  block_nr,
const char msg 
)

Definition at line 670 of file edac_device.c.

int edac_mc_add_mc ( struct mem_ctl_info mci)

edac_mc_add_mc: Insert the 'mci' structure into the mci global list and create sysfs entries associated with mci structure : pointer to the mci structure to be added to the list

Return: 0 Success !0 Failure

Definition at line 720 of file edac_mc.c.

struct mem_ctl_info* edac_mc_alloc ( unsigned  mc_num,
unsigned  n_layers,
struct edac_mc_layer layers,
unsigned  sz_pvt 
)
read

edac_mc_alloc: Allocate and partially fill a struct mem_ctl_info structure : Memory controller number : Number of MC hierarchy layers layers: Describes each layer as seen by the Memory Controller : size of private storage needed

Everything is kmalloc'ed as one big chunk - more efficient. Only can be used if all structures have the same lifetime - otherwise you have to allocate and initialize your own structures.

Use edac_mc_free() to free mc structures allocated by this function.

NOTE: drivers handle multi-rank memories in different ways: in some drivers, one multi-rank memory stick is mapped as one entry, while, in others, a single multi-rank memory stick would be mapped into several entries. Currently, this function will allocate multiple struct dimm_info on such scenarios, as grouping the multiple ranks require drivers change.

Returns: On failure: NULL On success: struct mem_ctl_info pointer

Definition at line 256 of file edac_mc.c.

struct mem_ctl_info* edac_mc_del_mc ( struct device dev)
read

edac_mc_del_mc: Remove sysfs entries for specified mci structure and remove mci structure from global list : Pointer to 'struct device' representing mci structure to remove.

Return pointer to removed mci structure, or NULL if device not found.

Definition at line 797 of file edac_mc.c.

struct mem_ctl_info* edac_mc_find ( int  idx)
read

edac_mc_find: Search for a mem_ctl_info structure whose index is 'idx'.

If found, return a pointer to the structure. Else return NULL.

Caller must hold mem_ctls_mutex.

Definition at line 689 of file edac_mc.c.

int edac_mc_find_csrow_by_page ( struct mem_ctl_info mci,
unsigned long  page 
)

Definition at line 864 of file edac_mc.c.

void edac_mc_free ( struct mem_ctl_info mci)

edac_mc_free 'Free' a previously allocated 'mci' structure : pointer to a struct mem_ctl_info structure

Definition at line 465 of file edac_mc.c.

void edac_mc_handle_error ( const enum hw_event_mc_err_type  type,
struct mem_ctl_info mci,
const u16  error_count,
const unsigned long  page_frame_number,
const unsigned long  offset_in_page,
const unsigned long  syndrome,
const int  top_layer,
const int  mid_layer,
const int  low_layer,
const char msg,
const char other_detail 
)

edac_mc_handle_error - reports a memory event to userspace

: severity of the error (CE/UE/Fatal) : a struct mem_ctl_info pointer : Number of errors of the same type : mem page where the error occurred : offset of the error inside the page : ECC syndrome : Memory layer[0] position : Memory layer[1] position : Memory layer[2] position : Message meaningful to the end users that explains the event : Technical details about the event that may help hardware manufacturers and EDAC developers to analyse the event

Definition at line 1071 of file edac_mc.c.

char* edac_op_state_to_string ( int  op_state)

Definition at line 32 of file edac_module.c.

int edac_pci_add_device ( struct edac_pci_ctl_info *  pci,
int  edac_idx 
)

Definition at line 334 of file edac_pci.c.

struct edac_pci_ctl_info* edac_pci_alloc_ctl_info ( unsigned int  sz_pvt,
const char edac_pci_name 
)
read

Definition at line 41 of file edac_pci.c.

int edac_pci_alloc_index ( void  )

Definition at line 316 of file edac_pci.c.

struct edac_pci_ctl_info* edac_pci_create_generic_ctl ( struct device dev,
const char mod_name 
)
read

Definition at line 456 of file edac_pci.c.

int edac_pci_create_sysfs ( struct edac_pci_ctl_info *  pci)
struct edac_pci_ctl_info* edac_pci_del_device ( struct device dev)
read

Definition at line 392 of file edac_pci.c.

void edac_pci_free_ctl_info ( struct edac_pci_ctl_info *  pci)

Definition at line 81 of file edac_pci.c.

void edac_pci_release_generic_ctl ( struct edac_pci_ctl_info *  pci)

Definition at line 492 of file edac_pci.c.

void edac_pci_remove_sysfs ( struct edac_pci_ctl_info *  pci)
void edac_pci_reset_delay_period ( struct edac_pci_ctl_info *  pci,
unsigned long  value 
)

Definition at line 293 of file edac_pci.c.

struct mem_ctl_info* find_mci_by_dev ( struct device dev)
read

find_mci_by_dev

scan list of controllers looking for the one that manages the 'dev' device : pointer to a struct device related with the MCI

Definition at line 490 of file edac_mc.c.

Variable Documentation

const char* edac_layer_name[]

Definition at line 905 of file edac_mc.c.

const char* edac_mem_types[]

Definition at line 126 of file edac_mc.c.