2007-07-19 16:49:46 +08:00
|
|
|
/*
|
|
|
|
* Generic EDAC defs
|
|
|
|
*
|
|
|
|
* Author: Dave Jiang <djiang@mvista.com>
|
|
|
|
*
|
2008-04-29 16:03:18 +08:00
|
|
|
* 2006-2008 (c) MontaVista Software, Inc. This file is licensed under
|
2007-07-19 16:49:46 +08:00
|
|
|
* the terms of the GNU General Public License version 2. This program
|
|
|
|
* is licensed "as is" without any warranty of any kind, whether express
|
|
|
|
* or implied.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#ifndef _LINUX_EDAC_H_
|
|
|
|
#define _LINUX_EDAC_H_
|
|
|
|
|
2011-07-27 07:09:06 +08:00
|
|
|
#include <linux/atomic.h>
|
2012-01-31 00:46:54 +08:00
|
|
|
#include <linux/kobject.h>
|
|
|
|
#include <linux/completion.h>
|
|
|
|
#include <linux/workqueue.h>
|
|
|
|
|
|
|
|
struct device;
|
2007-07-19 16:49:46 +08:00
|
|
|
|
|
|
|
#define EDAC_OPSTATE_INVAL -1
|
|
|
|
#define EDAC_OPSTATE_POLL 0
|
|
|
|
#define EDAC_OPSTATE_NMI 1
|
|
|
|
#define EDAC_OPSTATE_INT 2
|
|
|
|
|
|
|
|
extern int edac_op_state;
|
2007-07-19 16:49:54 +08:00
|
|
|
extern int edac_err_assert;
|
2007-07-19 16:49:46 +08:00
|
|
|
extern atomic_t edac_handlers;
|
2011-12-15 07:21:07 +08:00
|
|
|
extern struct bus_type edac_subsys;
|
2007-07-19 16:49:46 +08:00
|
|
|
|
|
|
|
extern int edac_handler_set(void);
|
|
|
|
extern void edac_atomic_assert_error(void);
|
2011-12-15 07:21:07 +08:00
|
|
|
extern struct bus_type *edac_get_sysfs_subsys(void);
|
|
|
|
extern void edac_put_sysfs_subsys(void);
|
2007-07-19 16:49:46 +08:00
|
|
|
|
2008-04-29 16:03:18 +08:00
|
|
|
static inline void opstate_init(void)
|
|
|
|
{
|
|
|
|
switch (edac_op_state) {
|
|
|
|
case EDAC_OPSTATE_POLL:
|
|
|
|
case EDAC_OPSTATE_NMI:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
edac_op_state = EDAC_OPSTATE_POLL;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-03-05 02:11:29 +08:00
|
|
|
#define EDAC_MC_LABEL_LEN 31
|
|
|
|
#define MC_PROC_NAME_MAX_LEN 7
|
|
|
|
|
|
|
|
/* memory devices */
|
|
|
|
enum dev_type {
|
|
|
|
DEV_UNKNOWN = 0,
|
|
|
|
DEV_X1,
|
|
|
|
DEV_X2,
|
|
|
|
DEV_X4,
|
|
|
|
DEV_X8,
|
|
|
|
DEV_X16,
|
|
|
|
DEV_X32, /* Do these parts exist? */
|
|
|
|
DEV_X64 /* Do these parts exist? */
|
|
|
|
};
|
|
|
|
|
|
|
|
#define DEV_FLAG_UNKNOWN BIT(DEV_UNKNOWN)
|
|
|
|
#define DEV_FLAG_X1 BIT(DEV_X1)
|
|
|
|
#define DEV_FLAG_X2 BIT(DEV_X2)
|
|
|
|
#define DEV_FLAG_X4 BIT(DEV_X4)
|
|
|
|
#define DEV_FLAG_X8 BIT(DEV_X8)
|
|
|
|
#define DEV_FLAG_X16 BIT(DEV_X16)
|
|
|
|
#define DEV_FLAG_X32 BIT(DEV_X32)
|
|
|
|
#define DEV_FLAG_X64 BIT(DEV_X64)
|
|
|
|
|
2012-02-04 00:17:48 +08:00
|
|
|
/**
|
|
|
|
* enum mem_type - memory types. For a more detailed reference, please see
|
|
|
|
* http://en.wikipedia.org/wiki/DRAM
|
|
|
|
*
|
|
|
|
* @MEM_EMPTY Empty csrow
|
|
|
|
* @MEM_RESERVED: Reserved csrow type
|
|
|
|
* @MEM_UNKNOWN: Unknown csrow type
|
|
|
|
* @MEM_FPM: FPM - Fast Page Mode, used on systems up to 1995.
|
|
|
|
* @MEM_EDO: EDO - Extended data out, used on systems up to 1998.
|
|
|
|
* @MEM_BEDO: BEDO - Burst Extended data out, an EDO variant.
|
|
|
|
* @MEM_SDR: SDR - Single data rate SDRAM
|
|
|
|
* http://en.wikipedia.org/wiki/Synchronous_dynamic_random-access_memory
|
|
|
|
* They use 3 pins for chip select: Pins 0 and 2 are
|
|
|
|
* for rank 0; pins 1 and 3 are for rank 1, if the memory
|
|
|
|
* is dual-rank.
|
|
|
|
* @MEM_RDR: Registered SDR SDRAM
|
|
|
|
* @MEM_DDR: Double data rate SDRAM
|
|
|
|
* http://en.wikipedia.org/wiki/DDR_SDRAM
|
|
|
|
* @MEM_RDDR: Registered Double data rate SDRAM
|
|
|
|
* This is a variant of the DDR memories.
|
|
|
|
* A registered memory has a buffer inside it, hiding
|
|
|
|
* part of the memory details to the memory controller.
|
|
|
|
* @MEM_RMBS: Rambus DRAM, used on a few Pentium III/IV controllers.
|
|
|
|
* @MEM_DDR2: DDR2 RAM, as described at JEDEC JESD79-2F.
|
|
|
|
* Those memories are labed as "PC2-" instead of "PC" to
|
|
|
|
* differenciate from DDR.
|
|
|
|
* @MEM_FB_DDR2: Fully-Buffered DDR2, as described at JEDEC Std No. 205
|
|
|
|
* and JESD206.
|
|
|
|
* Those memories are accessed per DIMM slot, and not by
|
|
|
|
* a chip select signal.
|
|
|
|
* @MEM_RDDR2: Registered DDR2 RAM
|
|
|
|
* This is a variant of the DDR2 memories.
|
|
|
|
* @MEM_XDR: Rambus XDR
|
|
|
|
* It is an evolution of the original RAMBUS memories,
|
|
|
|
* created to compete with DDR2. Weren't used on any
|
|
|
|
* x86 arch, but cell_edac PPC memory controller uses it.
|
|
|
|
* @MEM_DDR3: DDR3 RAM
|
|
|
|
* @MEM_RDDR3: Registered DDR3 RAM
|
|
|
|
* This is a variant of the DDR3 memories.
|
|
|
|
*/
|
2011-03-05 02:11:29 +08:00
|
|
|
enum mem_type {
|
2012-02-04 00:17:48 +08:00
|
|
|
MEM_EMPTY = 0,
|
|
|
|
MEM_RESERVED,
|
|
|
|
MEM_UNKNOWN,
|
|
|
|
MEM_FPM,
|
|
|
|
MEM_EDO,
|
|
|
|
MEM_BEDO,
|
|
|
|
MEM_SDR,
|
|
|
|
MEM_RDR,
|
|
|
|
MEM_DDR,
|
|
|
|
MEM_RDDR,
|
|
|
|
MEM_RMBS,
|
|
|
|
MEM_DDR2,
|
|
|
|
MEM_FB_DDR2,
|
|
|
|
MEM_RDDR2,
|
|
|
|
MEM_XDR,
|
|
|
|
MEM_DDR3,
|
|
|
|
MEM_RDDR3,
|
2011-03-05 02:11:29 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#define MEM_FLAG_EMPTY BIT(MEM_EMPTY)
|
|
|
|
#define MEM_FLAG_RESERVED BIT(MEM_RESERVED)
|
|
|
|
#define MEM_FLAG_UNKNOWN BIT(MEM_UNKNOWN)
|
|
|
|
#define MEM_FLAG_FPM BIT(MEM_FPM)
|
|
|
|
#define MEM_FLAG_EDO BIT(MEM_EDO)
|
|
|
|
#define MEM_FLAG_BEDO BIT(MEM_BEDO)
|
|
|
|
#define MEM_FLAG_SDR BIT(MEM_SDR)
|
|
|
|
#define MEM_FLAG_RDR BIT(MEM_RDR)
|
|
|
|
#define MEM_FLAG_DDR BIT(MEM_DDR)
|
|
|
|
#define MEM_FLAG_RDDR BIT(MEM_RDDR)
|
|
|
|
#define MEM_FLAG_RMBS BIT(MEM_RMBS)
|
|
|
|
#define MEM_FLAG_DDR2 BIT(MEM_DDR2)
|
|
|
|
#define MEM_FLAG_FB_DDR2 BIT(MEM_FB_DDR2)
|
|
|
|
#define MEM_FLAG_RDDR2 BIT(MEM_RDDR2)
|
|
|
|
#define MEM_FLAG_XDR BIT(MEM_XDR)
|
|
|
|
#define MEM_FLAG_DDR3 BIT(MEM_DDR3)
|
|
|
|
#define MEM_FLAG_RDDR3 BIT(MEM_RDDR3)
|
|
|
|
|
|
|
|
/* chipset Error Detection and Correction capabilities and mode */
|
|
|
|
enum edac_type {
|
|
|
|
EDAC_UNKNOWN = 0, /* Unknown if ECC is available */
|
|
|
|
EDAC_NONE, /* Doesn't support ECC */
|
|
|
|
EDAC_RESERVED, /* Reserved ECC type */
|
|
|
|
EDAC_PARITY, /* Detects parity errors */
|
|
|
|
EDAC_EC, /* Error Checking - no correction */
|
|
|
|
EDAC_SECDED, /* Single bit error correction, Double detection */
|
|
|
|
EDAC_S2ECD2ED, /* Chipkill x2 devices - do these exist? */
|
|
|
|
EDAC_S4ECD4ED, /* Chipkill x4 devices */
|
|
|
|
EDAC_S8ECD8ED, /* Chipkill x8 devices */
|
|
|
|
EDAC_S16ECD16ED, /* Chipkill x16 devices */
|
|
|
|
};
|
|
|
|
|
|
|
|
#define EDAC_FLAG_UNKNOWN BIT(EDAC_UNKNOWN)
|
|
|
|
#define EDAC_FLAG_NONE BIT(EDAC_NONE)
|
|
|
|
#define EDAC_FLAG_PARITY BIT(EDAC_PARITY)
|
|
|
|
#define EDAC_FLAG_EC BIT(EDAC_EC)
|
|
|
|
#define EDAC_FLAG_SECDED BIT(EDAC_SECDED)
|
|
|
|
#define EDAC_FLAG_S2ECD2ED BIT(EDAC_S2ECD2ED)
|
|
|
|
#define EDAC_FLAG_S4ECD4ED BIT(EDAC_S4ECD4ED)
|
|
|
|
#define EDAC_FLAG_S8ECD8ED BIT(EDAC_S8ECD8ED)
|
|
|
|
#define EDAC_FLAG_S16ECD16ED BIT(EDAC_S16ECD16ED)
|
|
|
|
|
|
|
|
/* scrubbing capabilities */
|
|
|
|
enum scrub_type {
|
|
|
|
SCRUB_UNKNOWN = 0, /* Unknown if scrubber is available */
|
|
|
|
SCRUB_NONE, /* No scrubber */
|
|
|
|
SCRUB_SW_PROG, /* SW progressive (sequential) scrubbing */
|
|
|
|
SCRUB_SW_SRC, /* Software scrub only errors */
|
|
|
|
SCRUB_SW_PROG_SRC, /* Progressive software scrub from an error */
|
|
|
|
SCRUB_SW_TUNABLE, /* Software scrub frequency is tunable */
|
|
|
|
SCRUB_HW_PROG, /* HW progressive (sequential) scrubbing */
|
|
|
|
SCRUB_HW_SRC, /* Hardware scrub only errors */
|
|
|
|
SCRUB_HW_PROG_SRC, /* Progressive hardware scrub from an error */
|
|
|
|
SCRUB_HW_TUNABLE /* Hardware scrub frequency is tunable */
|
|
|
|
};
|
|
|
|
|
|
|
|
#define SCRUB_FLAG_SW_PROG BIT(SCRUB_SW_PROG)
|
|
|
|
#define SCRUB_FLAG_SW_SRC BIT(SCRUB_SW_SRC)
|
|
|
|
#define SCRUB_FLAG_SW_PROG_SRC BIT(SCRUB_SW_PROG_SRC)
|
|
|
|
#define SCRUB_FLAG_SW_TUN BIT(SCRUB_SW_SCRUB_TUNABLE)
|
|
|
|
#define SCRUB_FLAG_HW_PROG BIT(SCRUB_HW_PROG)
|
|
|
|
#define SCRUB_FLAG_HW_SRC BIT(SCRUB_HW_SRC)
|
|
|
|
#define SCRUB_FLAG_HW_PROG_SRC BIT(SCRUB_HW_PROG_SRC)
|
|
|
|
#define SCRUB_FLAG_HW_TUN BIT(SCRUB_HW_TUNABLE)
|
|
|
|
|
|
|
|
/* FIXME - should have notify capabilities: NMI, LOG, PROC, etc */
|
|
|
|
|
|
|
|
/* EDAC internal operation states */
|
|
|
|
#define OP_ALLOC 0x100
|
|
|
|
#define OP_RUNNING_POLL 0x201
|
|
|
|
#define OP_RUNNING_INTERRUPT 0x202
|
|
|
|
#define OP_RUNNING_POLL_INTR 0x203
|
|
|
|
#define OP_OFFLINE 0x300
|
|
|
|
|
|
|
|
/*
|
2012-02-04 00:17:48 +08:00
|
|
|
* Concepts used at the EDAC subsystem
|
2011-03-05 02:11:29 +08:00
|
|
|
*
|
2012-02-04 00:17:48 +08:00
|
|
|
* There are several things to be aware of that aren't at all obvious:
|
2011-03-05 02:11:29 +08:00
|
|
|
*
|
|
|
|
* SOCKETS, SOCKET SETS, BANKS, ROWS, CHIP-SELECT ROWS, CHANNELS, etc..
|
|
|
|
*
|
|
|
|
* These are some of the many terms that are thrown about that don't always
|
|
|
|
* mean what people think they mean (Inconceivable!). In the interest of
|
|
|
|
* creating a common ground for discussion, terms and their definitions
|
|
|
|
* will be established.
|
|
|
|
*
|
2012-02-04 00:17:48 +08:00
|
|
|
* Memory devices: The individual DRAM chips on a memory stick. These
|
|
|
|
* devices commonly output 4 and 8 bits each (x4, x8).
|
|
|
|
* Grouping several of these in parallel provides the
|
|
|
|
* number of bits that the memory controller expects:
|
|
|
|
* typically 72 bits, in order to provide 64 bits +
|
|
|
|
* 8 bits of ECC data.
|
2011-03-05 02:11:29 +08:00
|
|
|
*
|
|
|
|
* Memory Stick: A printed circuit board that aggregates multiple
|
2012-02-04 00:17:48 +08:00
|
|
|
* memory devices in parallel. In general, this is the
|
|
|
|
* Field Replaceable Unit (FRU) which gets replaced, in
|
|
|
|
* the case of excessive errors. Most often it is also
|
|
|
|
* called DIMM (Dual Inline Memory Module).
|
|
|
|
*
|
|
|
|
* Memory Socket: A physical connector on the motherboard that accepts
|
|
|
|
* a single memory stick. Also called as "slot" on several
|
|
|
|
* datasheets.
|
2011-03-05 02:11:29 +08:00
|
|
|
*
|
2012-02-04 00:17:48 +08:00
|
|
|
* Channel: A memory controller channel, responsible to communicate
|
|
|
|
* with a group of DIMMs. Each channel has its own
|
|
|
|
* independent control (command) and data bus, and can
|
|
|
|
* be used independently or grouped with other channels.
|
2011-03-05 02:11:29 +08:00
|
|
|
*
|
2012-02-04 00:17:48 +08:00
|
|
|
* Branch: It is typically the highest hierarchy on a
|
|
|
|
* Fully-Buffered DIMM memory controller.
|
|
|
|
* Typically, it contains two channels.
|
|
|
|
* Two channels at the same branch can be used in single
|
|
|
|
* mode or in lockstep mode.
|
|
|
|
* When lockstep is enabled, the cacheline is doubled,
|
|
|
|
* but it generally brings some performance penalty.
|
|
|
|
* Also, it is generally not possible to point to just one
|
|
|
|
* memory stick when an error occurs, as the error
|
|
|
|
* correction code is calculated using two DIMMs instead
|
|
|
|
* of one. Due to that, it is capable of correcting more
|
|
|
|
* errors than on single mode.
|
2011-03-05 02:11:29 +08:00
|
|
|
*
|
2012-02-04 00:17:48 +08:00
|
|
|
* Single-channel: The data accessed by the memory controller is contained
|
|
|
|
* into one dimm only. E. g. if the data is 64 bits-wide,
|
|
|
|
* the data flows to the CPU using one 64 bits parallel
|
|
|
|
* access.
|
|
|
|
* Typically used with SDR, DDR, DDR2 and DDR3 memories.
|
|
|
|
* FB-DIMM and RAMBUS use a different concept for channel,
|
|
|
|
* so this concept doesn't apply there.
|
|
|
|
*
|
|
|
|
* Double-channel: The data size accessed by the memory controller is
|
|
|
|
* interlaced into two dimms, accessed at the same time.
|
|
|
|
* E. g. if the DIMM is 64 bits-wide (72 bits with ECC),
|
|
|
|
* the data flows to the CPU using a 128 bits parallel
|
|
|
|
* access.
|
|
|
|
*
|
|
|
|
* Chip-select row: This is the name of the DRAM signal used to select the
|
|
|
|
* DRAM ranks to be accessed. Common chip-select rows for
|
|
|
|
* single channel are 64 bits, for dual channel 128 bits.
|
|
|
|
* It may not be visible by the memory controller, as some
|
|
|
|
* DIMM types have a memory buffer that can hide direct
|
|
|
|
* access to it from the Memory Controller.
|
2011-03-05 02:11:29 +08:00
|
|
|
*
|
|
|
|
* Single-Ranked stick: A Single-ranked stick has 1 chip-select row of memory.
|
|
|
|
* Motherboards commonly drive two chip-select pins to
|
|
|
|
* a memory stick. A single-ranked stick, will occupy
|
|
|
|
* only one of those rows. The other will be unused.
|
|
|
|
*
|
|
|
|
* Double-Ranked stick: A double-ranked stick has two chip-select rows which
|
|
|
|
* access different sets of memory devices. The two
|
|
|
|
* rows cannot be accessed concurrently.
|
|
|
|
*
|
|
|
|
* Double-sided stick: DEPRECATED TERM, see Double-Ranked stick.
|
|
|
|
* A double-sided stick has two chip-select rows which
|
2012-02-04 00:17:48 +08:00
|
|
|
* access different sets of memory devices. The two
|
|
|
|
* rows cannot be accessed concurrently. "Double-sided"
|
2011-03-05 02:11:29 +08:00
|
|
|
* is irrespective of the memory devices being mounted
|
|
|
|
* on both sides of the memory stick.
|
|
|
|
*
|
|
|
|
* Socket set: All of the memory sticks that are required for
|
|
|
|
* a single memory access or all of the memory sticks
|
|
|
|
* spanned by a chip-select row. A single socket set
|
|
|
|
* has two chip-select rows and if double-sided sticks
|
|
|
|
* are used these will occupy those chip-select rows.
|
|
|
|
*
|
|
|
|
* Bank: This term is avoided because it is unclear when
|
|
|
|
* needing to distinguish between chip-select rows and
|
|
|
|
* socket sets.
|
|
|
|
*
|
|
|
|
* Controller pages:
|
|
|
|
*
|
|
|
|
* Physical pages:
|
|
|
|
*
|
|
|
|
* Virtual pages:
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* STRUCTURE ORGANIZATION AND CHOICES
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* PS - I enjoyed writing all that about as much as you enjoyed reading it.
|
|
|
|
*/
|
|
|
|
|
edac: Create a dimm struct and move the labels into it
The way a DIMM is currently represented implies that they're
linked into a per-csrow struct. However, some drivers don't see
csrows, as they're ridden behind some chip like the AMB's
on FBDIMM's, for example.
This forced drivers to fake^Wvirtualize a csrow struct, and to create
a mess under csrow/channel original's concept.
Move the DIMM labels into a per-DIMM struct, and add there
the real location of the socket, in terms of csrow/channel.
Latter patches will modify the location to properly represent the
memory architecture.
All other drivers will use a per-csrow type of location.
Some of those drivers will require a latter conversion, as
they also fake the csrows internally.
TODO: While this patch doesn't change the existing behavior, on
csrows-based memory controllers, a csrow/channel pair points to a memory
rank. There's a known bug at the EDAC core that allows having different
labels for the same DIMM, if it has more than one rank. A latter patch
is need to merge the several ranks for a DIMM into the same dimm_info
struct, in order to avoid having different labels for the same DIMM.
The edac_mc_alloc() will now contain a per-dimm initialization loop that
will be changed by latter patches in order to match other types of
memory architectures.
Reviewed-by: Aristeu Rozanski <arozansk@redhat.com>
Reviewed-by: Borislav Petkov <borislav.petkov@amd.com>
Cc: Doug Thompson <norsk5@yahoo.com>
Cc: Ranganathan Desikan <ravi@jetztechnologies.com>
Cc: "Arvind R." <arvino55@gmail.com>
Cc: "Niklas Söderlund" <niklas.soderlund@ericsson.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-28 01:12:32 +08:00
|
|
|
/* FIXME: add a per-dimm ce error count */
|
|
|
|
struct dimm_info {
|
|
|
|
char label[EDAC_MC_LABEL_LEN + 1]; /* DIMM label on motherboard */
|
|
|
|
unsigned memory_controller;
|
|
|
|
unsigned csrow;
|
|
|
|
unsigned csrow_channel;
|
2012-01-28 05:38:08 +08:00
|
|
|
|
|
|
|
u32 grain; /* granularity of reported error in bytes */
|
|
|
|
enum dev_type dtype; /* memory device type */
|
|
|
|
enum mem_type mtype; /* memory dimm type */
|
|
|
|
enum edac_type edac_mode; /* EDAC mode for this dimm */
|
|
|
|
|
2012-01-28 20:09:38 +08:00
|
|
|
u32 nr_pages; /* number of pages in csrow */
|
|
|
|
|
2012-01-28 05:38:08 +08:00
|
|
|
u32 ce_count; /* Correctable Errors for this dimm */
|
edac: Create a dimm struct and move the labels into it
The way a DIMM is currently represented implies that they're
linked into a per-csrow struct. However, some drivers don't see
csrows, as they're ridden behind some chip like the AMB's
on FBDIMM's, for example.
This forced drivers to fake^Wvirtualize a csrow struct, and to create
a mess under csrow/channel original's concept.
Move the DIMM labels into a per-DIMM struct, and add there
the real location of the socket, in terms of csrow/channel.
Latter patches will modify the location to properly represent the
memory architecture.
All other drivers will use a per-csrow type of location.
Some of those drivers will require a latter conversion, as
they also fake the csrows internally.
TODO: While this patch doesn't change the existing behavior, on
csrows-based memory controllers, a csrow/channel pair points to a memory
rank. There's a known bug at the EDAC core that allows having different
labels for the same DIMM, if it has more than one rank. A latter patch
is need to merge the several ranks for a DIMM into the same dimm_info
struct, in order to avoid having different labels for the same DIMM.
The edac_mc_alloc() will now contain a per-dimm initialization loop that
will be changed by latter patches in order to match other types of
memory architectures.
Reviewed-by: Aristeu Rozanski <arozansk@redhat.com>
Reviewed-by: Borislav Petkov <borislav.petkov@amd.com>
Cc: Doug Thompson <norsk5@yahoo.com>
Cc: Ranganathan Desikan <ravi@jetztechnologies.com>
Cc: "Arvind R." <arvino55@gmail.com>
Cc: "Niklas Söderlund" <niklas.soderlund@ericsson.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-28 01:12:32 +08:00
|
|
|
};
|
|
|
|
|
edac: rename channel_info to rank_info
What it is pointed by a csrow/channel vector is a rank information, and
not a channel information.
On a traditional architecture, the memory controller directly access the
memory ranks, via chip select rows. Different ranks at the same DIMM is
selected via different chip select rows. So, typically, one
csrow/channel pair means one different DIMM.
On FB-DIMMs, there's a microcontroller chip at the DIMM, called Advanced
Memory Buffer (AMB) that serves as the interface between the memory
controller and the memory chips.
The AMB selection is via the DIMM slot, and not via a csrow.
It is up to the AMB to talk with the csrows of the DRAM chips.
So, the FB-DIMM memory controllers see the DIMM slot, and not the DIMM
rank. RAMBUS is similar.
Newer memory controllers, like the ones found on Intel Sandy Bridge and
Nehalem, even working with normal DDR3 DIMM's, don't use the usual
channel A/channel B interleaving schema to provide 128 bits data access.
Instead, they have more channels (3 or 4 channels), and they can use
several interleaving schemas. Such memory controllers see the DIMMs
directly on their registers, instead of the ranks, which is better for
the driver, as its main usageis to point to a broken DIMM stick (the
Field Repleceable Unit), and not to point to a broken DRAM chip.
The drivers that support such such newer memory architecture models
currently need to fake information and to abuse on EDAC structures, as
the subsystem was conceived with the idea that the csrow would always be
visible by the CPU.
To make things a little worse, those drivers don't currently fake
csrows/channels on a consistent way, as the concepts there don't apply
to the memory controllers they're talking with. So, each driver author
interpreted the concepts using a different logic.
In order to fix it, let's rename the data structure that points into a
DIMM rank to "rank_info", in order to be clearer about what's stored
there.
Latter patches will provide a better way to represent the memory
hierarchy for the other types of memory controller.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-27 21:26:13 +08:00
|
|
|
/**
|
|
|
|
* struct rank_info - contains the information for one DIMM rank
|
|
|
|
*
|
|
|
|
* @chan_idx: channel number where the rank is (typically, 0 or 1)
|
|
|
|
* @ce_count: number of correctable errors for this rank
|
|
|
|
* @csrow: A pointer to the chip select row structure (the parent
|
|
|
|
* structure). The location of the rank is given by
|
|
|
|
* the (csrow->csrow_idx, chan_idx) vector.
|
edac: Create a dimm struct and move the labels into it
The way a DIMM is currently represented implies that they're
linked into a per-csrow struct. However, some drivers don't see
csrows, as they're ridden behind some chip like the AMB's
on FBDIMM's, for example.
This forced drivers to fake^Wvirtualize a csrow struct, and to create
a mess under csrow/channel original's concept.
Move the DIMM labels into a per-DIMM struct, and add there
the real location of the socket, in terms of csrow/channel.
Latter patches will modify the location to properly represent the
memory architecture.
All other drivers will use a per-csrow type of location.
Some of those drivers will require a latter conversion, as
they also fake the csrows internally.
TODO: While this patch doesn't change the existing behavior, on
csrows-based memory controllers, a csrow/channel pair points to a memory
rank. There's a known bug at the EDAC core that allows having different
labels for the same DIMM, if it has more than one rank. A latter patch
is need to merge the several ranks for a DIMM into the same dimm_info
struct, in order to avoid having different labels for the same DIMM.
The edac_mc_alloc() will now contain a per-dimm initialization loop that
will be changed by latter patches in order to match other types of
memory architectures.
Reviewed-by: Aristeu Rozanski <arozansk@redhat.com>
Reviewed-by: Borislav Petkov <borislav.petkov@amd.com>
Cc: Doug Thompson <norsk5@yahoo.com>
Cc: Ranganathan Desikan <ravi@jetztechnologies.com>
Cc: "Arvind R." <arvino55@gmail.com>
Cc: "Niklas Söderlund" <niklas.soderlund@ericsson.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-28 01:12:32 +08:00
|
|
|
* @dimm: A pointer to the DIMM structure, where the DIMM label
|
|
|
|
* information is stored.
|
|
|
|
*
|
|
|
|
* FIXME: Currently, the EDAC core model will assume one DIMM per rank.
|
|
|
|
* This is a bad assumption, but it makes this patch easier. Later
|
|
|
|
* patches in this series will fix this issue.
|
edac: rename channel_info to rank_info
What it is pointed by a csrow/channel vector is a rank information, and
not a channel information.
On a traditional architecture, the memory controller directly access the
memory ranks, via chip select rows. Different ranks at the same DIMM is
selected via different chip select rows. So, typically, one
csrow/channel pair means one different DIMM.
On FB-DIMMs, there's a microcontroller chip at the DIMM, called Advanced
Memory Buffer (AMB) that serves as the interface between the memory
controller and the memory chips.
The AMB selection is via the DIMM slot, and not via a csrow.
It is up to the AMB to talk with the csrows of the DRAM chips.
So, the FB-DIMM memory controllers see the DIMM slot, and not the DIMM
rank. RAMBUS is similar.
Newer memory controllers, like the ones found on Intel Sandy Bridge and
Nehalem, even working with normal DDR3 DIMM's, don't use the usual
channel A/channel B interleaving schema to provide 128 bits data access.
Instead, they have more channels (3 or 4 channels), and they can use
several interleaving schemas. Such memory controllers see the DIMMs
directly on their registers, instead of the ranks, which is better for
the driver, as its main usageis to point to a broken DIMM stick (the
Field Repleceable Unit), and not to point to a broken DRAM chip.
The drivers that support such such newer memory architecture models
currently need to fake information and to abuse on EDAC structures, as
the subsystem was conceived with the idea that the csrow would always be
visible by the CPU.
To make things a little worse, those drivers don't currently fake
csrows/channels on a consistent way, as the concepts there don't apply
to the memory controllers they're talking with. So, each driver author
interpreted the concepts using a different logic.
In order to fix it, let's rename the data structure that points into a
DIMM rank to "rank_info", in order to be clearer about what's stored
there.
Latter patches will provide a better way to represent the memory
hierarchy for the other types of memory controller.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-27 21:26:13 +08:00
|
|
|
*/
|
|
|
|
struct rank_info {
|
|
|
|
int chan_idx;
|
|
|
|
u32 ce_count;
|
edac: Create a dimm struct and move the labels into it
The way a DIMM is currently represented implies that they're
linked into a per-csrow struct. However, some drivers don't see
csrows, as they're ridden behind some chip like the AMB's
on FBDIMM's, for example.
This forced drivers to fake^Wvirtualize a csrow struct, and to create
a mess under csrow/channel original's concept.
Move the DIMM labels into a per-DIMM struct, and add there
the real location of the socket, in terms of csrow/channel.
Latter patches will modify the location to properly represent the
memory architecture.
All other drivers will use a per-csrow type of location.
Some of those drivers will require a latter conversion, as
they also fake the csrows internally.
TODO: While this patch doesn't change the existing behavior, on
csrows-based memory controllers, a csrow/channel pair points to a memory
rank. There's a known bug at the EDAC core that allows having different
labels for the same DIMM, if it has more than one rank. A latter patch
is need to merge the several ranks for a DIMM into the same dimm_info
struct, in order to avoid having different labels for the same DIMM.
The edac_mc_alloc() will now contain a per-dimm initialization loop that
will be changed by latter patches in order to match other types of
memory architectures.
Reviewed-by: Aristeu Rozanski <arozansk@redhat.com>
Reviewed-by: Borislav Petkov <borislav.petkov@amd.com>
Cc: Doug Thompson <norsk5@yahoo.com>
Cc: Ranganathan Desikan <ravi@jetztechnologies.com>
Cc: "Arvind R." <arvino55@gmail.com>
Cc: "Niklas Söderlund" <niklas.soderlund@ericsson.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-28 01:12:32 +08:00
|
|
|
struct csrow_info *csrow;
|
|
|
|
struct dimm_info *dimm;
|
2011-03-05 02:11:29 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct csrow_info {
|
2012-01-28 20:09:38 +08:00
|
|
|
/* Used only by edac_mc_find_csrow_by_page() */
|
2012-01-28 05:38:08 +08:00
|
|
|
unsigned long first_page; /* first page number in csrow */
|
|
|
|
unsigned long last_page; /* last page number in csrow */
|
2011-03-05 02:11:29 +08:00
|
|
|
unsigned long page_mask; /* used for interleaving -
|
2012-01-28 20:09:38 +08:00
|
|
|
* 0UL for non intlv */
|
|
|
|
|
2012-01-28 05:38:08 +08:00
|
|
|
int csrow_idx; /* the chip-select row */
|
|
|
|
|
2011-03-05 02:11:29 +08:00
|
|
|
u32 ue_count; /* Uncorrectable Errors for this csrow */
|
|
|
|
u32 ce_count; /* Correctable Errors for this csrow */
|
2012-01-28 05:38:08 +08:00
|
|
|
|
2011-03-05 02:11:29 +08:00
|
|
|
struct mem_ctl_info *mci; /* the parent */
|
|
|
|
|
|
|
|
struct kobject kobj; /* sysfs kobject for this csrow */
|
|
|
|
|
|
|
|
/* channel information for this csrow */
|
|
|
|
u32 nr_channels;
|
edac: rename channel_info to rank_info
What it is pointed by a csrow/channel vector is a rank information, and
not a channel information.
On a traditional architecture, the memory controller directly access the
memory ranks, via chip select rows. Different ranks at the same DIMM is
selected via different chip select rows. So, typically, one
csrow/channel pair means one different DIMM.
On FB-DIMMs, there's a microcontroller chip at the DIMM, called Advanced
Memory Buffer (AMB) that serves as the interface between the memory
controller and the memory chips.
The AMB selection is via the DIMM slot, and not via a csrow.
It is up to the AMB to talk with the csrows of the DRAM chips.
So, the FB-DIMM memory controllers see the DIMM slot, and not the DIMM
rank. RAMBUS is similar.
Newer memory controllers, like the ones found on Intel Sandy Bridge and
Nehalem, even working with normal DDR3 DIMM's, don't use the usual
channel A/channel B interleaving schema to provide 128 bits data access.
Instead, they have more channels (3 or 4 channels), and they can use
several interleaving schemas. Such memory controllers see the DIMMs
directly on their registers, instead of the ranks, which is better for
the driver, as its main usageis to point to a broken DIMM stick (the
Field Repleceable Unit), and not to point to a broken DRAM chip.
The drivers that support such such newer memory architecture models
currently need to fake information and to abuse on EDAC structures, as
the subsystem was conceived with the idea that the csrow would always be
visible by the CPU.
To make things a little worse, those drivers don't currently fake
csrows/channels on a consistent way, as the concepts there don't apply
to the memory controllers they're talking with. So, each driver author
interpreted the concepts using a different logic.
In order to fix it, let's rename the data structure that points into a
DIMM rank to "rank_info", in order to be clearer about what's stored
there.
Latter patches will provide a better way to represent the memory
hierarchy for the other types of memory controller.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-27 21:26:13 +08:00
|
|
|
struct rank_info *channels;
|
2011-03-05 02:11:29 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct mcidev_sysfs_group {
|
|
|
|
const char *name; /* group name */
|
|
|
|
const struct mcidev_sysfs_attribute *mcidev_attr; /* group attributes */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct mcidev_sysfs_group_kobj {
|
|
|
|
struct list_head list; /* list for all instances within a mc */
|
|
|
|
|
|
|
|
struct kobject kobj; /* kobj for the group */
|
|
|
|
|
|
|
|
const struct mcidev_sysfs_group *grp; /* group description table */
|
|
|
|
struct mem_ctl_info *mci; /* the parent */
|
|
|
|
};
|
|
|
|
|
|
|
|
/* mcidev_sysfs_attribute structure
|
|
|
|
* used for driver sysfs attributes and in mem_ctl_info
|
|
|
|
* sysfs top level entries
|
|
|
|
*/
|
|
|
|
struct mcidev_sysfs_attribute {
|
|
|
|
/* It should use either attr or grp */
|
|
|
|
struct attribute attr;
|
|
|
|
const struct mcidev_sysfs_group *grp; /* Points to a group of attributes */
|
|
|
|
|
|
|
|
/* Ops for show/store values at the attribute - not used on group */
|
|
|
|
ssize_t (*show)(struct mem_ctl_info *,char *);
|
|
|
|
ssize_t (*store)(struct mem_ctl_info *, const char *,size_t);
|
|
|
|
};
|
|
|
|
|
|
|
|
/* MEMORY controller information structure
|
|
|
|
*/
|
|
|
|
struct mem_ctl_info {
|
|
|
|
struct list_head link; /* for global list of mem_ctl_info structs */
|
|
|
|
|
|
|
|
struct module *owner; /* Module owner of this control struct */
|
|
|
|
|
|
|
|
unsigned long mtype_cap; /* memory types supported by mc */
|
|
|
|
unsigned long edac_ctl_cap; /* Mem controller EDAC capabilities */
|
|
|
|
unsigned long edac_cap; /* configuration capabilities - this is
|
|
|
|
* closely related to edac_ctl_cap. The
|
|
|
|
* difference is that the controller may be
|
|
|
|
* capable of s4ecd4ed which would be listed
|
|
|
|
* in edac_ctl_cap, but if channels aren't
|
|
|
|
* capable of s4ecd4ed then the edac_cap would
|
|
|
|
* not have that capability.
|
|
|
|
*/
|
|
|
|
unsigned long scrub_cap; /* chipset scrub capabilities */
|
|
|
|
enum scrub_type scrub_mode; /* current scrub mode */
|
|
|
|
|
|
|
|
/* Translates sdram memory scrub rate given in bytes/sec to the
|
|
|
|
internal representation and configures whatever else needs
|
|
|
|
to be configured.
|
|
|
|
*/
|
|
|
|
int (*set_sdram_scrub_rate) (struct mem_ctl_info * mci, u32 bw);
|
|
|
|
|
|
|
|
/* Get the current sdram memory scrub rate from the internal
|
|
|
|
representation and converts it to the closest matching
|
|
|
|
bandwidth in bytes/sec.
|
|
|
|
*/
|
|
|
|
int (*get_sdram_scrub_rate) (struct mem_ctl_info * mci);
|
|
|
|
|
|
|
|
|
|
|
|
/* pointer to edac checking routine */
|
|
|
|
void (*edac_check) (struct mem_ctl_info * mci);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Remaps memory pages: controller pages to physical pages.
|
|
|
|
* For most MC's, this will be NULL.
|
|
|
|
*/
|
|
|
|
/* FIXME - why not send the phys page to begin with? */
|
|
|
|
unsigned long (*ctl_page_to_phys) (struct mem_ctl_info * mci,
|
|
|
|
unsigned long page);
|
|
|
|
int mc_idx;
|
|
|
|
int nr_csrows;
|
|
|
|
struct csrow_info *csrows;
|
edac: Create a dimm struct and move the labels into it
The way a DIMM is currently represented implies that they're
linked into a per-csrow struct. However, some drivers don't see
csrows, as they're ridden behind some chip like the AMB's
on FBDIMM's, for example.
This forced drivers to fake^Wvirtualize a csrow struct, and to create
a mess under csrow/channel original's concept.
Move the DIMM labels into a per-DIMM struct, and add there
the real location of the socket, in terms of csrow/channel.
Latter patches will modify the location to properly represent the
memory architecture.
All other drivers will use a per-csrow type of location.
Some of those drivers will require a latter conversion, as
they also fake the csrows internally.
TODO: While this patch doesn't change the existing behavior, on
csrows-based memory controllers, a csrow/channel pair points to a memory
rank. There's a known bug at the EDAC core that allows having different
labels for the same DIMM, if it has more than one rank. A latter patch
is need to merge the several ranks for a DIMM into the same dimm_info
struct, in order to avoid having different labels for the same DIMM.
The edac_mc_alloc() will now contain a per-dimm initialization loop that
will be changed by latter patches in order to match other types of
memory architectures.
Reviewed-by: Aristeu Rozanski <arozansk@redhat.com>
Reviewed-by: Borislav Petkov <borislav.petkov@amd.com>
Cc: Doug Thompson <norsk5@yahoo.com>
Cc: Ranganathan Desikan <ravi@jetztechnologies.com>
Cc: "Arvind R." <arvino55@gmail.com>
Cc: "Niklas Söderlund" <niklas.soderlund@ericsson.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2012-01-28 01:12:32 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* DIMM info. Will eventually remove the entire csrows_info some day
|
|
|
|
*/
|
|
|
|
unsigned nr_dimms;
|
|
|
|
struct dimm_info *dimms;
|
|
|
|
|
2011-03-05 02:11:29 +08:00
|
|
|
/*
|
|
|
|
* FIXME - what about controllers on other busses? - IDs must be
|
|
|
|
* unique. dev pointer should be sufficiently unique, but
|
|
|
|
* BUS:SLOT.FUNC numbers may not be unique.
|
|
|
|
*/
|
|
|
|
struct device *dev;
|
|
|
|
const char *mod_name;
|
|
|
|
const char *mod_ver;
|
|
|
|
const char *ctl_name;
|
|
|
|
const char *dev_name;
|
|
|
|
char proc_name[MC_PROC_NAME_MAX_LEN + 1];
|
|
|
|
void *pvt_info;
|
|
|
|
u32 ue_noinfo_count; /* Uncorrectable Errors w/o info */
|
|
|
|
u32 ce_noinfo_count; /* Correctable Errors w/o info */
|
|
|
|
u32 ue_count; /* Total Uncorrectable Errors for this MC */
|
|
|
|
u32 ce_count; /* Total Correctable Errors for this MC */
|
|
|
|
unsigned long start_time; /* mci load start time (in jiffies) */
|
|
|
|
|
|
|
|
struct completion complete;
|
|
|
|
|
|
|
|
/* edac sysfs device control */
|
|
|
|
struct kobject edac_mci_kobj;
|
|
|
|
|
|
|
|
/* list for all grp instances within a mc */
|
|
|
|
struct list_head grp_kobj_list;
|
|
|
|
|
|
|
|
/* Additional top controller level attributes, but specified
|
|
|
|
* by the low level driver.
|
|
|
|
*
|
|
|
|
* Set by the low level driver to provide attributes at the
|
|
|
|
* controller level, same level as 'ue_count' and 'ce_count' above.
|
|
|
|
* An array of structures, NULL terminated
|
|
|
|
*
|
|
|
|
* If attributes are desired, then set to array of attributes
|
|
|
|
* If no attributes are desired, leave NULL
|
|
|
|
*/
|
|
|
|
const struct mcidev_sysfs_attribute *mc_driver_sysfs_attributes;
|
|
|
|
|
|
|
|
/* work struct for this MC */
|
|
|
|
struct delayed_work work;
|
|
|
|
|
|
|
|
/* the internal state of this controller instance */
|
|
|
|
int op_state;
|
|
|
|
};
|
|
|
|
|
2007-07-19 16:49:46 +08:00
|
|
|
#endif
|