Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
edac_mc.c File Reference
#include <linux/module.h>
#include <linux/proc_fs.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/smp.h>
#include <linux/init.h>
#include <linux/sysctl.h>
#include <linux/highmem.h>
#include <linux/timer.h>
#include <linux/slab.h>
#include <linux/jiffies.h>
#include <linux/spinlock.h>
#include <linux/list.h>
#include <linux/ctype.h>
#include <linux/edac.h>
#include <linux/bitops.h>
#include <asm/uaccess.h>
#include <asm/page.h>
#include <asm/edac.h>
#include "edac_core.h"
#include "edac_module.h"
#include <ras/ras_event.h>

Go to the source code of this file.

Macros

#define CREATE_TRACE_POINTS
 
#define TRACE_INCLUDE_PATH   ../../include/ras
 
#define OTHER_LABEL   " or "
 

Functions

unsigned edac_dimm_info_location (struct dimm_info *dimm, char *buf, unsigned len)
 
 EXPORT_SYMBOL_GPL (edac_mem_types)
 
voidedac_align_ptr (void **p, unsigned size, int n_elems)
 
struct mem_ctl_infoedac_mc_alloc (unsigned mc_num, unsigned n_layers, struct edac_mc_layer *layers, unsigned sz_pvt)
 
 EXPORT_SYMBOL_GPL (edac_mc_alloc)
 
void edac_mc_free (struct mem_ctl_info *mci)
 
 EXPORT_SYMBOL_GPL (edac_mc_free)
 
struct mem_ctl_infofind_mci_by_dev (struct device *dev)
 
 EXPORT_SYMBOL_GPL (find_mci_by_dev)
 
void edac_mc_reset_delay_period (int value)
 
struct mem_ctl_infoedac_mc_find (int idx)
 
 EXPORT_SYMBOL (edac_mc_find)
 
int edac_mc_add_mc (struct mem_ctl_info *mci)
 
 EXPORT_SYMBOL_GPL (edac_mc_add_mc)
 
struct mem_ctl_infoedac_mc_del_mc (struct device *dev)
 
 EXPORT_SYMBOL_GPL (edac_mc_del_mc)
 
int edac_mc_find_csrow_by_page (struct mem_ctl_info *mci, unsigned long page)
 
 EXPORT_SYMBOL_GPL (edac_mc_find_csrow_by_page)
 
 EXPORT_SYMBOL_GPL (edac_layer_name)
 
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)
 
 EXPORT_SYMBOL_GPL (edac_mc_handle_error)
 

Variables

const charedac_mem_types []
 
const charedac_layer_name []
 

Macro Definition Documentation

#define CREATE_TRACE_POINTS

Definition at line 37 of file edac_mc.c.

#define OTHER_LABEL   " or "

Definition at line 1051 of file edac_mc.c.

#define TRACE_INCLUDE_PATH   ../../include/ras

Definition at line 38 of file edac_mc.c.

Function Documentation

void* edac_align_ptr ( void **  p,
unsigned  size,
int  n_elems 
)

edac_align_ptr - Prepares the pointer offsets for a single-shot allocation : pointer to a pointer with the memory offset to be used. At return, this will be incremented to point to the next offset : Size of the data structure to be reserved : Number of elements that should be reserved

If 'size' is a constant, the compiler will optimize this whole function down to either a no-op or the addition of a constant to the value of '*p'.

The 'p' pointer is absolutely needed to keep the proper advancing further in memory to the proper offsets when allocating the struct along with its embedded structs, as edac_device_alloc_ctl_info() does it above, for example.

At return, the pointer 'p' will be incremented to be used on a next call to this function.

Definition at line 165 of file edac_mc.c.

unsigned edac_dimm_info_location ( struct dimm_info dimm,
char buf,
unsigned  len 
)

Definition at line 45 of file edac_mc.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.

void edac_mc_reset_delay_period ( int  value)

Definition at line 603 of file edac_mc.c.

EXPORT_SYMBOL ( edac_mc_find  )
EXPORT_SYMBOL_GPL ( edac_mem_types  )
EXPORT_SYMBOL_GPL ( edac_mc_alloc  )
EXPORT_SYMBOL_GPL ( edac_mc_free  )
EXPORT_SYMBOL_GPL ( find_mci_by_dev  )
EXPORT_SYMBOL_GPL ( edac_mc_add_mc  )
EXPORT_SYMBOL_GPL ( edac_mc_del_mc  )
EXPORT_SYMBOL_GPL ( edac_mc_find_csrow_by_page  )
EXPORT_SYMBOL_GPL ( edac_layer_name  )
EXPORT_SYMBOL_GPL ( edac_mc_handle_error  )
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[]
Initial value:
= {
[EDAC_MC_LAYER_BRANCH] = "branch",
[EDAC_MC_LAYER_CHANNEL] = "channel",
[EDAC_MC_LAYER_SLOT] = "slot",
}

Definition at line 905 of file edac_mc.c.

const char* edac_mem_types[]
Initial value:
= {
"Empty csrow",
"Reserved csrow type",
"Unknown csrow type",
"Fast page mode RAM",
"Extended data out RAM",
"Burst Extended data out RAM",
"Single data rate SDRAM",
"Registered single data rate SDRAM",
"Double data rate SDRAM",
"Registered Double data rate SDRAM",
"Rambus DRAM",
"Unbuffered DDR2 RAM",
"Fully buffered DDR2",
"Registered DDR2 RAM",
"Rambus XDR",
"Unbuffered DDR3 RAM",
"Registered DDR3 RAM",
}

Definition at line 126 of file edac_mc.c.