blob: 4709c60798482e1e0b276ef35d810a30801111d4 [file] [log] [blame]
Doug Thompsonfd3d6782009-04-27 19:50:23 +02001#include "amd64_edac.h"
2
Borislav Petkov9cdeb402010-09-02 18:33:24 +02003#define EDAC_DCT_ATTR_SHOW(reg) \
Mauro Carvalho Chehabc5608752012-03-21 14:00:44 -03004static ssize_t amd64_##reg##_show(struct device *dev, \
5 struct device_attribute *mattr, \
6 char *data) \
Borislav Petkov9cdeb402010-09-02 18:33:24 +02007{ \
Mauro Carvalho Chehabc5608752012-03-21 14:00:44 -03008 struct mem_ctl_info *mci = to_mci(dev); \
Borislav Petkov9cdeb402010-09-02 18:33:24 +02009 struct amd64_pvt *pvt = mci->pvt_info; \
10 return sprintf(data, "0x%016llx\n", (u64)pvt->reg); \
Doug Thompsonfd3d6782009-04-27 19:50:23 +020011}
12
Borislav Petkov9cdeb402010-09-02 18:33:24 +020013EDAC_DCT_ATTR_SHOW(dhar);
14EDAC_DCT_ATTR_SHOW(dbam0);
15EDAC_DCT_ATTR_SHOW(top_mem);
16EDAC_DCT_ATTR_SHOW(top_mem2);
Doug Thompsonfd3d6782009-04-27 19:50:23 +020017
Mauro Carvalho Chehabc5608752012-03-21 14:00:44 -030018static ssize_t amd64_hole_show(struct device *dev,
19 struct device_attribute *mattr,
20 char *data)
Doug Thompsonfd3d6782009-04-27 19:50:23 +020021{
Mauro Carvalho Chehabc5608752012-03-21 14:00:44 -030022 struct mem_ctl_info *mci = to_mci(dev);
23
Doug Thompsonfd3d6782009-04-27 19:50:23 +020024 u64 hole_base = 0;
25 u64 hole_offset = 0;
26 u64 hole_size = 0;
27
28 amd64_get_dram_hole_info(mci, &hole_base, &hole_offset, &hole_size);
29
30 return sprintf(data, "%llx %llx %llx\n", hole_base, hole_offset,
31 hole_size);
32}
33
34/*
35 * update NUM_DBG_ATTRS in case you add new members
36 */
Mauro Carvalho Chehabc5608752012-03-21 14:00:44 -030037static DEVICE_ATTR(dhar, S_IRUGO, amd64_dhar_show, NULL);
38static DEVICE_ATTR(dbam, S_IRUGO, amd64_dbam0_show, NULL);
39static DEVICE_ATTR(topmem, S_IRUGO, amd64_top_mem_show, NULL);
40static DEVICE_ATTR(topmem2, S_IRUGO, amd64_top_mem2_show, NULL);
41static DEVICE_ATTR(dram_hole, S_IRUGO, amd64_hole_show, NULL);
Doug Thompsonfd3d6782009-04-27 19:50:23 +020042
Takashi Iwaie339f1e2015-02-04 11:48:53 +010043static struct attribute *amd64_edac_dbg_attrs[] = {
44 &dev_attr_dhar.attr,
45 &dev_attr_dbam.attr,
46 &dev_attr_topmem.attr,
47 &dev_attr_topmem2.attr,
48 &dev_attr_dram_hole.attr,
49 NULL
50};
Mauro Carvalho Chehabc5608752012-03-21 14:00:44 -030051
Takashi Iwaie339f1e2015-02-04 11:48:53 +010052const struct attribute_group amd64_edac_dbg_group = {
53 .attrs = amd64_edac_dbg_attrs,
54};