Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 202563
b: refs/heads/master
c: eba042a
h: refs/heads/master
i:
  202561: 9d8429d
  202559: 717de54
v: v3
  • Loading branch information
Borislav Petkov committed Aug 3, 2010
1 parent 1f71665 commit 6fc20f9
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 60 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: bc57117856cf1e581135810b37d3b75f9d1749f5
refs/heads/master: eba042a81edd6baaff44831b2d719b14a6d21e58
6 changes: 3 additions & 3 deletions trunk/drivers/edac/amd64_edac.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ static int amd64_search_set_scrub_rate(struct pci_dev *ctl, u32 new_bw,
return 0;
}

static int amd64_set_scrub_rate(struct mem_ctl_info *mci, u32 *bandwidth)
static int amd64_set_scrub_rate(struct mem_ctl_info *mci, u32 bandwidth)
{
struct amd64_pvt *pvt = mci->pvt_info;
u32 min_scrubrate = 0x0;
Expand All @@ -180,8 +180,8 @@ static int amd64_set_scrub_rate(struct mem_ctl_info *mci, u32 *bandwidth)
amd64_printk(KERN_ERR, "Unsupported family!\n");
return -EINVAL;
}
return amd64_search_set_scrub_rate(pvt->misc_f3_ctl, *bandwidth,
min_scrubrate);
return amd64_search_set_scrub_rate(pvt->misc_f3_ctl, bandwidth,
min_scrubrate);
}

static int amd64_get_scrub_rate(struct mem_ctl_info *mci, u32 *bw)
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/edac/e752x_edac.c
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,7 @@ static void e752x_check(struct mem_ctl_info *mci)
}

/* Program byte/sec bandwidth scrub rate to hardware */
static int set_sdram_scrub_rate(struct mem_ctl_info *mci, u32 *new_bw)
static int set_sdram_scrub_rate(struct mem_ctl_info *mci, u32 new_bw)
{
const struct scrubrate *scrubrates;
struct e752x_pvt *pvt = (struct e752x_pvt *) mci->pvt_info;
Expand All @@ -975,7 +975,7 @@ static int set_sdram_scrub_rate(struct mem_ctl_info *mci, u32 *new_bw)
* desired rate and program the cooresponding register value.
*/
for (i = 0; scrubrates[i].bandwidth != SDRATE_EOT; i++)
if (scrubrates[i].bandwidth >= *new_bw)
if (scrubrates[i].bandwidth >= new_bw)
break;

if (scrubrates[i].bandwidth == SDRATE_EOT)
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/edac/edac_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ struct mem_ctl_info {
internal representation and configures whatever else needs
to be configured.
*/
int (*set_sdram_scrub_rate) (struct mem_ctl_info * mci, u32 * bw);
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
Expand Down
86 changes: 37 additions & 49 deletions trunk/drivers/edac/edac_mc_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,19 +124,6 @@ static const char *edac_caps[] = {
[EDAC_S16ECD16ED] = "S16ECD16ED"
};



static ssize_t memctrl_int_store(void *ptr, const char *buffer, size_t count)
{
int *value = (int *)ptr;

if (isdigit(*buffer))
*value = simple_strtoul(buffer, NULL, 0);

return count;
}


/* EDAC sysfs CSROW data structures and methods
*/

Expand Down Expand Up @@ -450,53 +437,54 @@ static ssize_t mci_reset_counters_store(struct mem_ctl_info *mci,

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

if (mci->set_sdram_scrub_rate) {
if (!mci->set_sdram_scrub_rate) {
edac_printk(KERN_WARNING, EDAC_MC,
"Memory scrub rate setting not implemented!\n");
return -EINVAL;
}

memctrl_int_store(&bandwidth, data, count);
if (strict_strtoul(data, 10, &bandwidth) < 0)
return -EINVAL;

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");
err = mci->set_sdram_scrub_rate(mci, (u32)bandwidth);
if (err) {
edac_printk(KERN_DEBUG, EDAC_MC,
"Failed setting scrub rate to %lu\n", bandwidth);
return -EINVAL;
}
else {
edac_printk(KERN_DEBUG, EDAC_MC,
"Scrub rate set to: %lu\n", bandwidth);
return count;
}
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. */
u32 bandwidth = 0;
int err;

if (!mci->get_sdram_scrub_rate) {
edac_printk(KERN_WARNING, EDAC_MC,
"Memory scrubbing 'get' control is not implemented\n");
"Memory scrub rate reading not implemented\n");
return -EINVAL;
}

err = mci->get_sdram_scrub_rate(mci, &bandwidth);
if (err) {
edac_printk(KERN_DEBUG, EDAC_MC, "Error reading scrub rate\n");
return err;
}
else {
edac_printk(KERN_DEBUG, EDAC_MC,
"Read scrub rate: %d\n", bandwidth);
return sprintf(data, "%d\n", bandwidth);
}
return sprintf(data, "%d\n", bandwidth);
}

/* default attribute files for the MCI object */
Expand Down
7 changes: 3 additions & 4 deletions trunk/drivers/edac/i5100_edac.c
Original file line number Diff line number Diff line change
Expand Up @@ -589,14 +589,13 @@ static void i5100_refresh_scrubbing(struct work_struct *work)
/*
* The bandwidth is based on experimentation, feel free to refine it.
*/
static int i5100_set_scrub_rate(struct mem_ctl_info *mci,
u32 *bandwidth)
static int i5100_set_scrub_rate(struct mem_ctl_info *mci, u32 bandwidth)
{
struct i5100_priv *priv = mci->pvt_info;
u32 dw;

pci_read_config_dword(priv->mc, I5100_MC, &dw);
if (*bandwidth) {
if (bandwidth) {
priv->scrub_enable = 1;
dw |= I5100_MC_SCRBEN_MASK;
schedule_delayed_work(&(priv->i5100_scrubbing),
Expand All @@ -610,7 +609,7 @@ static int i5100_set_scrub_rate(struct mem_ctl_info *mci,

pci_read_config_dword(priv->mc, I5100_MC, &dw);

*bandwidth = 5900000 * i5100_mc_scrben(dw);
bandwidth = 5900000 * i5100_mc_scrben(dw);

return 0;
}
Expand Down

0 comments on commit 6fc20f9

Please sign in to comment.