aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ata/ahci.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 7a3124a9abc6..be4c39f8ab81 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -329,10 +329,24 @@ static ssize_t ahci_activity_store(struct ata_device *dev,
329 enum sw_activity val); 329 enum sw_activity val);
330static void ahci_init_sw_activity(struct ata_link *link); 330static void ahci_init_sw_activity(struct ata_link *link);
331 331
332static ssize_t ahci_show_host_caps(struct device *dev,
333 struct device_attribute *attr, char *buf);
334static ssize_t ahci_show_host_version(struct device *dev,
335 struct device_attribute *attr, char *buf);
336static ssize_t ahci_show_port_cmd(struct device *dev,
337 struct device_attribute *attr, char *buf);
338
339DEVICE_ATTR(ahci_host_caps, S_IRUGO, ahci_show_host_caps, NULL);
340DEVICE_ATTR(ahci_host_version, S_IRUGO, ahci_show_host_version, NULL);
341DEVICE_ATTR(ahci_port_cmd, S_IRUGO, ahci_show_port_cmd, NULL);
342
332static struct device_attribute *ahci_shost_attrs[] = { 343static struct device_attribute *ahci_shost_attrs[] = {
333 &dev_attr_link_power_management_policy, 344 &dev_attr_link_power_management_policy,
334 &dev_attr_em_message_type, 345 &dev_attr_em_message_type,
335 &dev_attr_em_message, 346 &dev_attr_em_message,
347 &dev_attr_ahci_host_caps,
348 &dev_attr_ahci_host_version,
349 &dev_attr_ahci_port_cmd,
336 NULL 350 NULL
337}; 351};
338 352
@@ -702,6 +716,36 @@ static void ahci_enable_ahci(void __iomem *mmio)
702 WARN_ON(1); 716 WARN_ON(1);
703} 717}
704 718
719static ssize_t ahci_show_host_caps(struct device *dev,
720 struct device_attribute *attr, char *buf)
721{
722 struct Scsi_Host *shost = class_to_shost(dev);
723 struct ata_port *ap = ata_shost_to_port(shost);
724 struct ahci_host_priv *hpriv = ap->host->private_data;
725
726 return sprintf(buf, "%x\n", hpriv->cap);
727}
728
729static ssize_t ahci_show_host_version(struct device *dev,
730 struct device_attribute *attr, char *buf)
731{
732 struct Scsi_Host *shost = class_to_shost(dev);
733 struct ata_port *ap = ata_shost_to_port(shost);
734 void __iomem *mmio = ap->host->iomap[AHCI_PCI_BAR];
735
736 return sprintf(buf, "%x\n", readl(mmio + HOST_VERSION));
737}
738
739static ssize_t ahci_show_port_cmd(struct device *dev,
740 struct device_attribute *attr, char *buf)
741{
742 struct Scsi_Host *shost = class_to_shost(dev);
743 struct ata_port *ap = ata_shost_to_port(shost);
744 void __iomem *port_mmio = ahci_port_base(ap);
745
746 return sprintf(buf, "%x\n", readl(port_mmio + PORT_CMD));
747}
748
705/** 749/**
706 * ahci_save_initial_config - Save and fixup initial config values 750 * ahci_save_initial_config - Save and fixup initial config values
707 * @pdev: target PCI device 751 * @pdev: target PCI device