Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 167014
b: refs/heads/master
c: 94baaee
h: refs/heads/master
v: v3
  • Loading branch information
Borislav Petkov committed Oct 7, 2009
1 parent e225da6 commit d82f0b9
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 11 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: 66216a7a15e75d517dddd0ac6514924b15071e4c
refs/heads/master: 94baaee4947d84809b289d5ca03677525ffc6da9
6 changes: 2 additions & 4 deletions trunk/drivers/edac/amd64_edac.h
Original file line number Diff line number Diff line change
Expand Up @@ -372,13 +372,11 @@ enum {

#define SET_NB_DRAM_INJECTION_WRITE(word, bits) \
(BIT(((word) & 0xF) + 20) | \
BIT(17) | \
((bits) & 0xF))
BIT(17) | bits)

#define SET_NB_DRAM_INJECTION_READ(word, bits) \
(BIT(((word) & 0xF) + 20) | \
BIT(16) | \
((bits) & 0xF))
BIT(16) | bits)

#define K8_NBCAP 0xE8
#define K8_NBCAP_CORES (BIT(12)|BIT(13))
Expand Down
49 changes: 43 additions & 6 deletions trunk/drivers/edac/amd64_edac_inj.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#include "amd64_edac.h"

static ssize_t amd64_inject_section_show(struct mem_ctl_info *mci, char *buf)
{
struct amd64_pvt *pvt = mci->pvt_info;
return sprintf(buf, "0x%x\n", pvt->injection.section);
}

/*
* store error injection section value which refers to one of 4 16-byte sections
* within a 64-byte cacheline
Expand All @@ -15,12 +21,26 @@ static ssize_t amd64_inject_section_store(struct mem_ctl_info *mci,

ret = strict_strtoul(data, 10, &value);
if (ret != -EINVAL) {

if (value > 3) {
amd64_printk(KERN_WARNING,
"%s: invalid section 0x%lx\n",
__func__, value);
return -EINVAL;
}

pvt->injection.section = (u32) value;
return count;
}
return ret;
}

static ssize_t amd64_inject_word_show(struct mem_ctl_info *mci, char *buf)
{
struct amd64_pvt *pvt = mci->pvt_info;
return sprintf(buf, "0x%x\n", pvt->injection.word);
}

/*
* store error injection word value which refers to one of 9 16-bit word of the
* 16-byte (128-bit + ECC bits) section
Expand All @@ -37,14 +57,25 @@ static ssize_t amd64_inject_word_store(struct mem_ctl_info *mci,
ret = strict_strtoul(data, 10, &value);
if (ret != -EINVAL) {

value = (value <= 8) ? value : 0;
pvt->injection.word = (u32) value;
if (value > 8) {
amd64_printk(KERN_WARNING,
"%s: invalid word 0x%lx\n",
__func__, value);
return -EINVAL;
}

pvt->injection.word = (u32) value;
return count;
}
return ret;
}

static ssize_t amd64_inject_ecc_vector_show(struct mem_ctl_info *mci, char *buf)
{
struct amd64_pvt *pvt = mci->pvt_info;
return sprintf(buf, "0x%x\n", pvt->injection.bit_map);
}

/*
* store 16 bit error injection vector which enables injecting errors to the
* corresponding bit within the error injection word above. When used during a
Expand All @@ -60,8 +91,14 @@ static ssize_t amd64_inject_ecc_vector_store(struct mem_ctl_info *mci,
ret = strict_strtoul(data, 16, &value);
if (ret != -EINVAL) {

pvt->injection.bit_map = (u32) value & 0xFFFF;
if (value & 0xFFFF0000) {
amd64_printk(KERN_WARNING,
"%s: invalid EccVector: 0x%lx\n",
__func__, value);
return -EINVAL;
}

pvt->injection.bit_map = (u32) value;
return count;
}
return ret;
Expand Down Expand Up @@ -147,23 +184,23 @@ struct mcidev_sysfs_attribute amd64_inj_attrs[] = {
.name = "inject_section",
.mode = (S_IRUGO | S_IWUSR)
},
.show = NULL,
.show = amd64_inject_section_show,
.store = amd64_inject_section_store,
},
{
.attr = {
.name = "inject_word",
.mode = (S_IRUGO | S_IWUSR)
},
.show = NULL,
.show = amd64_inject_word_show,
.store = amd64_inject_word_store,
},
{
.attr = {
.name = "inject_ecc_vector",
.mode = (S_IRUGO | S_IWUSR)
},
.show = NULL,
.show = amd64_inject_ecc_vector_show,
.store = amd64_inject_ecc_vector_store,
},
{
Expand Down

0 comments on commit d82f0b9

Please sign in to comment.