Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 47952
b: refs/heads/master
c: 4f423dd
h: refs/heads/master
v: v3
  • Loading branch information
Frithiof Jensen authored and Linus Torvalds committed Feb 12, 2007
1 parent 4eaf522 commit cd27906
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 84db003f249ddbcde1666376b4e3bbe9ee2c7c0c
refs/heads/master: 4f423ddf56e5ecb1fb2eac83b8e228e3d0aae0f6
16 changes: 15 additions & 1 deletion trunk/Documentation/drivers/edac/edac.txt
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,21 @@ Device Symlink:

'device'

Symlink to the memory controller device
Symlink to the memory controller device.

Sdram memory scrubbing rate:

'sdram_scrub_rate'

Read/Write attribute file that controls memory scrubbing. The scrubbing
rate is set by writing a minimum bandwith in bytes/sec to the attribute
file. The rate will be translated to an internal value that gives at
least the specified rate.

Reading the file will return the actual scrubbing rate employed.

If configuration fails or memory scrubbing is not implemented, the value
of the attribute file will be -1.



Expand Down
55 changes: 55 additions & 0 deletions trunk/drivers/edac/edac_mc.c
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,57 @@ static ssize_t mci_reset_counters_store(struct mem_ctl_info *mci,
return count;
}

/* memory scrubbing */
static ssize_t mci_sdram_scrub_rate_store(struct mem_ctl_info *mci,
const char *data, size_t count)
{
u32 bandwidth = -1;

if (mci->set_sdram_scrub_rate) {

memctrl_int_store(&bandwidth, data, count);

if (!(*mci->set_sdram_scrub_rate)(mci, &bandwidth)) {
edac_printk(KERN_DEBUG, EDAC_MC,
"Scrub rate set successfully, applied: %d\n",
bandwidth);
} else {
/* FIXME: error codes maybe? */
edac_printk(KERN_DEBUG, EDAC_MC,
"Scrub rate set FAILED, could not apply: %d\n",
bandwidth);
}
} else {
/* FIXME: produce "not implemented" ERROR for user-side. */
edac_printk(KERN_WARNING, EDAC_MC,
"Memory scrubbing 'set'control is not implemented!\n");
}
return count;
}

static ssize_t mci_sdram_scrub_rate_show(struct mem_ctl_info *mci, char *data)
{
u32 bandwidth = -1;

if (mci->get_sdram_scrub_rate) {
if (!(*mci->get_sdram_scrub_rate)(mci, &bandwidth)) {
edac_printk(KERN_DEBUG, EDAC_MC,
"Scrub rate successfully, fetched: %d\n",
bandwidth);
} else {
/* FIXME: error codes maybe? */
edac_printk(KERN_DEBUG, EDAC_MC,
"Scrub rate fetch FAILED, got: %d\n",
bandwidth);
}
} else {
/* FIXME: produce "not implemented" ERROR for user-side. */
edac_printk(KERN_WARNING, EDAC_MC,
"Memory scrubbing 'get' control is not implemented!\n");
}
return sprintf(data, "%d\n", bandwidth);
}

/* default attribute files for the MCI object */
static ssize_t mci_ue_count_show(struct mem_ctl_info *mci, char *data)
{
Expand Down Expand Up @@ -1033,6 +1084,9 @@ MCIDEV_ATTR(ce_noinfo_count,S_IRUGO,mci_ce_noinfo_show,NULL);
MCIDEV_ATTR(ue_count,S_IRUGO,mci_ue_count_show,NULL);
MCIDEV_ATTR(ce_count,S_IRUGO,mci_ce_count_show,NULL);

/* memory scrubber attribute file */
MCIDEV_ATTR(sdram_scrub_rate,S_IRUGO|S_IWUSR,mci_sdram_scrub_rate_show,mci_sdram_scrub_rate_store);

static struct mcidev_attribute *mci_attr[] = {
&mci_attr_reset_counters,
&mci_attr_mc_name,
Expand All @@ -1042,6 +1096,7 @@ static struct mcidev_attribute *mci_attr[] = {
&mci_attr_ce_noinfo_count,
&mci_attr_ue_count,
&mci_attr_ce_count,
&mci_attr_sdram_scrub_rate,
NULL
};

Expand Down
12 changes: 12 additions & 0 deletions trunk/drivers/edac/edac_mc.h
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,18 @@ struct mem_ctl_info {
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
bandwith in bytes/sec.
*/
int (*get_sdram_scrub_rate) (struct mem_ctl_info *mci, u32 *bw);

/* pointer to edac checking routine */
void (*edac_check) (struct mem_ctl_info * mci);
/*
Expand Down

0 comments on commit cd27906

Please sign in to comment.