aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.de>2011-03-04 03:54:52 -0500
committerJeff Garzik <jgarzik@pobox.com>2011-04-24 11:31:31 -0400
commit6e5fe5b12cfcd9ed4303c9a4f4a22a694104d28f (patch)
tree96ccfacbf812e6ddbad8e3c1f90b466f3a3458e2 /drivers/ata
parent686c4cbb10fc0e75b29b097290b4f7fc3f010b9e (diff)
ahci: EM supported message type sysfs attribute
This patch adds an sysfs attribute 'em_message_supported' to the ahci host device which prints out the supported enclosure management message types. Signed-off-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/ahci.h4
-rw-r--r--drivers/ata/libahci.c22
2 files changed, 26 insertions, 0 deletions
diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h
index 39865009c251..12c5282e7fca 100644
--- a/drivers/ata/ahci.h
+++ b/drivers/ata/ahci.h
@@ -229,6 +229,10 @@ enum {
229 EM_CTL_ALHD = (1 << 26), /* Activity LED */ 229 EM_CTL_ALHD = (1 << 26), /* Activity LED */
230 EM_CTL_XMT = (1 << 25), /* Transmit Only */ 230 EM_CTL_XMT = (1 << 25), /* Transmit Only */
231 EM_CTL_SMB = (1 << 24), /* Single Message Buffer */ 231 EM_CTL_SMB = (1 << 24), /* Single Message Buffer */
232 EM_CTL_SGPIO = (1 << 19), /* SGPIO messages supported */
233 EM_CTL_SES = (1 << 18), /* SES-2 messages supported */
234 EM_CTL_SAFTE = (1 << 17), /* SAF-TE messages supported */
235 EM_CTL_LED = (1 << 16), /* LED messages supported */
232 236
233 /* em message type */ 237 /* em message type */
234 EM_MSG_TYPE_LED = (1 << 0), /* LED */ 238 EM_MSG_TYPE_LED = (1 << 0), /* LED */
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index 26d452339e98..633159b5152a 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -109,6 +109,8 @@ static ssize_t ahci_read_em_buffer(struct device *dev,
109static ssize_t ahci_store_em_buffer(struct device *dev, 109static ssize_t ahci_store_em_buffer(struct device *dev,
110 struct device_attribute *attr, 110 struct device_attribute *attr,
111 const char *buf, size_t size); 111 const char *buf, size_t size);
112static ssize_t ahci_show_em_supported(struct device *dev,
113 struct device_attribute *attr, char *buf);
112 114
113static DEVICE_ATTR(ahci_host_caps, S_IRUGO, ahci_show_host_caps, NULL); 115static DEVICE_ATTR(ahci_host_caps, S_IRUGO, ahci_show_host_caps, NULL);
114static DEVICE_ATTR(ahci_host_cap2, S_IRUGO, ahci_show_host_cap2, NULL); 116static DEVICE_ATTR(ahci_host_cap2, S_IRUGO, ahci_show_host_cap2, NULL);
@@ -116,6 +118,7 @@ static DEVICE_ATTR(ahci_host_version, S_IRUGO, ahci_show_host_version, NULL);
116static DEVICE_ATTR(ahci_port_cmd, S_IRUGO, ahci_show_port_cmd, NULL); 118static DEVICE_ATTR(ahci_port_cmd, S_IRUGO, ahci_show_port_cmd, NULL);
117static DEVICE_ATTR(em_buffer, S_IWUSR | S_IRUGO, 119static DEVICE_ATTR(em_buffer, S_IWUSR | S_IRUGO,
118 ahci_read_em_buffer, ahci_store_em_buffer); 120 ahci_read_em_buffer, ahci_store_em_buffer);
121static DEVICE_ATTR(em_message_supported, S_IRUGO, ahci_show_em_supported, NULL);
119 122
120struct device_attribute *ahci_shost_attrs[] = { 123struct device_attribute *ahci_shost_attrs[] = {
121 &dev_attr_link_power_management_policy, 124 &dev_attr_link_power_management_policy,
@@ -126,6 +129,7 @@ struct device_attribute *ahci_shost_attrs[] = {
126 &dev_attr_ahci_host_version, 129 &dev_attr_ahci_host_version,
127 &dev_attr_ahci_port_cmd, 130 &dev_attr_ahci_port_cmd,
128 &dev_attr_em_buffer, 131 &dev_attr_em_buffer,
132 &dev_attr_em_message_supported,
129 NULL 133 NULL
130}; 134};
131EXPORT_SYMBOL_GPL(ahci_shost_attrs); 135EXPORT_SYMBOL_GPL(ahci_shost_attrs);
@@ -343,6 +347,24 @@ static ssize_t ahci_store_em_buffer(struct device *dev,
343 return size; 347 return size;
344} 348}
345 349
350static ssize_t ahci_show_em_supported(struct device *dev,
351 struct device_attribute *attr, char *buf)
352{
353 struct Scsi_Host *shost = class_to_shost(dev);
354 struct ata_port *ap = ata_shost_to_port(shost);
355 struct ahci_host_priv *hpriv = ap->host->private_data;
356 void __iomem *mmio = hpriv->mmio;
357 u32 em_ctl;
358
359 em_ctl = readl(mmio + HOST_EM_CTL);
360
361 return sprintf(buf, "%s%s%s%s\n",
362 em_ctl & EM_CTL_LED ? "led " : "",
363 em_ctl & EM_CTL_SAFTE ? "saf-te " : "",
364 em_ctl & EM_CTL_SES ? "ses-2 " : "",
365 em_ctl & EM_CTL_SGPIO ? "sgpio " : "");
366}
367
346/** 368/**
347 * ahci_save_initial_config - Save and fixup initial config values 369 * ahci_save_initial_config - Save and fixup initial config values
348 * @dev: target AHCI device 370 * @dev: target AHCI device