1 #include "amd64_edac.h"
4 * accept a hex value and store it into the virtual error register file, field:
5 * nbeal and nbeah. Assume virtual error values have already been set for: NBSL,
6 * NBSH and NBCFG. Then proceed to map the error values to a MC, CSROW and
9 static ssize_t amd64_nbea_store(struct mem_ctl_info *mci, const char *data,
12 struct amd64_pvt *pvt = mci->pvt_info;
13 unsigned long long value;
16 ret = strict_strtoull(data, 16, &value);
18 debugf0("received NBEA= 0x%llx\n", value);
20 /* place the value into the virtual error packet */
21 pvt->ctl_error_info.nbeal = (u32) value;
23 pvt->ctl_error_info.nbeah = (u32) value;
25 /* Process the Mapping request */
26 /* TODO: Add race prevention */
27 amd64_process_error_info(mci, &pvt->ctl_error_info, 1);
34 /* display back what the last NBEA (MCA NB Address (MC4_ADDR)) was written */
35 static ssize_t amd64_nbea_show(struct mem_ctl_info *mci, char *data)
37 struct amd64_pvt *pvt = mci->pvt_info;
40 value = pvt->ctl_error_info.nbeah;
42 value |= pvt->ctl_error_info.nbeal;
44 return sprintf(data, "%llx\n", value);
47 /* store the NBSL (MCA NB Status Low (MC4_STATUS)) value user desires */
48 static ssize_t amd64_nbsl_store(struct mem_ctl_info *mci, const char *data,
51 struct amd64_pvt *pvt = mci->pvt_info;
55 ret = strict_strtoul(data, 16, &value);
57 debugf0("received NBSL= 0x%lx\n", value);
59 pvt->ctl_error_info.nbsl = (u32) value;
66 /* display back what the last NBSL value written */
67 static ssize_t amd64_nbsl_show(struct mem_ctl_info *mci, char *data)
69 struct amd64_pvt *pvt = mci->pvt_info;
72 value = pvt->ctl_error_info.nbsl;
74 return sprintf(data, "%x\n", value);
77 /* store the NBSH (MCA NB Status High) value user desires */
78 static ssize_t amd64_nbsh_store(struct mem_ctl_info *mci, const char *data,
81 struct amd64_pvt *pvt = mci->pvt_info;
85 ret = strict_strtoul(data, 16, &value);
87 debugf0("received NBSH= 0x%lx\n", value);
89 pvt->ctl_error_info.nbsh = (u32) value;
96 /* display back what the last NBSH value written */
97 static ssize_t amd64_nbsh_show(struct mem_ctl_info *mci, char *data)
99 struct amd64_pvt *pvt = mci->pvt_info;
102 value = pvt->ctl_error_info.nbsh;
104 return sprintf(data, "%x\n", value);
107 /* accept and store the NBCFG (MCA NB Configuration) value user desires */
108 static ssize_t amd64_nbcfg_store(struct mem_ctl_info *mci,
109 const char *data, size_t count)
111 struct amd64_pvt *pvt = mci->pvt_info;
115 ret = strict_strtoul(data, 16, &value);
116 if (ret != -EINVAL) {
117 debugf0("received NBCFG= 0x%lx\n", value);
119 pvt->ctl_error_info.nbcfg = (u32) value;
126 /* various show routines for the controls of a MCI */
127 static ssize_t amd64_nbcfg_show(struct mem_ctl_info *mci, char *data)
129 struct amd64_pvt *pvt = mci->pvt_info;
131 return sprintf(data, "%x\n", pvt->ctl_error_info.nbcfg);
135 static ssize_t amd64_dhar_show(struct mem_ctl_info *mci, char *data)
137 struct amd64_pvt *pvt = mci->pvt_info;
139 return sprintf(data, "%x\n", pvt->dhar);
143 static ssize_t amd64_dbam_show(struct mem_ctl_info *mci, char *data)
145 struct amd64_pvt *pvt = mci->pvt_info;
147 return sprintf(data, "%x\n", pvt->dbam0);
151 static ssize_t amd64_topmem_show(struct mem_ctl_info *mci, char *data)
153 struct amd64_pvt *pvt = mci->pvt_info;
155 return sprintf(data, "%llx\n", pvt->top_mem);
159 static ssize_t amd64_topmem2_show(struct mem_ctl_info *mci, char *data)
161 struct amd64_pvt *pvt = mci->pvt_info;
163 return sprintf(data, "%llx\n", pvt->top_mem2);
166 static ssize_t amd64_hole_show(struct mem_ctl_info *mci, char *data)
172 amd64_get_dram_hole_info(mci, &hole_base, &hole_offset, &hole_size);
174 return sprintf(data, "%llx %llx %llx\n", hole_base, hole_offset,
179 * update NUM_DBG_ATTRS in case you add new members
181 struct mcidev_sysfs_attribute amd64_dbg_attrs[] = {
186 .mode = (S_IRUGO | S_IWUSR)
188 .show = amd64_nbea_show,
189 .store = amd64_nbea_store,
194 .mode = (S_IRUGO | S_IWUSR)
196 .show = amd64_nbsl_show,
197 .store = amd64_nbsl_store,
202 .mode = (S_IRUGO | S_IWUSR)
204 .show = amd64_nbsh_show,
205 .store = amd64_nbsh_store,
210 .mode = (S_IRUGO | S_IWUSR)
212 .show = amd64_nbcfg_show,
213 .store = amd64_nbcfg_store,
220 .show = amd64_dhar_show,
228 .show = amd64_dbam_show,
236 .show = amd64_topmem_show,
244 .show = amd64_topmem2_show,
252 .show = amd64_hole_show,