aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2012-03-21 16:13:24 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-06-11 12:23:43 -0400
commit8ad6c78a69ac5c74e8f4e8c78cdb86772face433 (patch)
tree902da8ecdd71ee842645f1c0d1b009e79ce2065f
parent199747106934c4dc9cf90d37538f989e29420833 (diff)
edac: add a sysfs node to report the maximum location for the system
The userspace tools need to know what's the maximum location on each system, as it helps to create nice maps showing how the memory was filled at the system. Reviewed-by: Aristeu Rozanski <arozansk@redhat.com> Cc: Doug Thompson <norsk5@yahoo.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/edac/edac_mc_sysfs.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c
index 86da1767f86..87fb396bc55 100644
--- a/drivers/edac/edac_mc_sysfs.c
+++ b/drivers/edac/edac_mc_sysfs.c
@@ -766,6 +766,23 @@ static ssize_t mci_size_mb_show(struct device *dev,
766 return sprintf(data, "%u\n", PAGES_TO_MiB(total_pages)); 766 return sprintf(data, "%u\n", PAGES_TO_MiB(total_pages));
767} 767}
768 768
769static ssize_t mci_max_location_show(struct device *dev,
770 struct device_attribute *mattr,
771 char *data)
772{
773 struct mem_ctl_info *mci = to_mci(dev);
774 int i;
775 char *p = data;
776
777 for (i = 0; i < mci->n_layers; i++) {
778 p += sprintf(p, "%s %d ",
779 edac_layer_name[mci->layers[i].type],
780 mci->layers[i].size - 1);
781 }
782
783 return p - data;
784}
785
769/* default Control file */ 786/* default Control file */
770DEVICE_ATTR(reset_counters, S_IWUSR, NULL, mci_reset_counters_store); 787DEVICE_ATTR(reset_counters, S_IWUSR, NULL, mci_reset_counters_store);
771 788
@@ -777,6 +794,7 @@ DEVICE_ATTR(ue_noinfo_count, S_IRUGO, mci_ue_noinfo_show, NULL);
777DEVICE_ATTR(ce_noinfo_count, S_IRUGO, mci_ce_noinfo_show, NULL); 794DEVICE_ATTR(ce_noinfo_count, S_IRUGO, mci_ce_noinfo_show, NULL);
778DEVICE_ATTR(ue_count, S_IRUGO, mci_ue_count_show, NULL); 795DEVICE_ATTR(ue_count, S_IRUGO, mci_ue_count_show, NULL);
779DEVICE_ATTR(ce_count, S_IRUGO, mci_ce_count_show, NULL); 796DEVICE_ATTR(ce_count, S_IRUGO, mci_ce_count_show, NULL);
797DEVICE_ATTR(max_location, S_IRUGO, mci_max_location_show, NULL);
780 798
781/* memory scrubber attribute file */ 799/* memory scrubber attribute file */
782DEVICE_ATTR(sdram_scrub_rate, S_IRUGO | S_IWUSR, mci_sdram_scrub_rate_show, 800DEVICE_ATTR(sdram_scrub_rate, S_IRUGO | S_IWUSR, mci_sdram_scrub_rate_show,
@@ -792,6 +810,7 @@ static struct attribute *mci_attrs[] = {
792 &dev_attr_ue_count.attr, 810 &dev_attr_ue_count.attr,
793 &dev_attr_ce_count.attr, 811 &dev_attr_ce_count.attr,
794 &dev_attr_sdram_scrub_rate.attr, 812 &dev_attr_sdram_scrub_rate.attr,
813 &dev_attr_max_location.attr,
795 NULL 814 NULL
796}; 815};
797 816