Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 263788
b: refs/heads/master
c: 3a7bda8
h: refs/heads/master
v: v3
  • Loading branch information
Dave Jiang authored and James Bottomley committed Aug 24, 2011
1 parent c4342ae commit 44a2c63
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 19 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4ac13e177904280a2502c27029a72e3fd2957cde
refs/heads/master: 3a7bda830fad427768ed71c0ebf3448849c006b5
13 changes: 13 additions & 0 deletions trunk/Documentation/ABI/testing/sysfs-class-scsi_host
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
What: /sys/class/scsi_host/hostX/isci_id
Date: June 2011
Contact: Dave Jiang <dave.jiang@intel.com>
Description:
This file contains the enumerated host ID for the Intel
SCU controller. The Intel(R) C600 Series Chipset SATA/SAS
Storage Control Unit embeds up to two 4-port controllers in
a single PCI device. The controllers are enumerated in order
which usually means the lowest number scsi_host corresponds
with the first controller, but this association is not
guaranteed. The 'isci_id' attribute unambiguously identifies
the controller index: '0' for the first controller,
'1' for the second.
36 changes: 18 additions & 18 deletions trunk/drivers/scsi/isci/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
#include <linux/firmware.h>
#include <linux/efi.h>
#include <asm/string.h>
#include <scsi/scsi_host.h>
#include "isci.h"
#include "task.h"
#include "probe_roms.h"
Expand Down Expand Up @@ -113,6 +114,22 @@ unsigned char max_concurr_spinup = 1;
module_param(max_concurr_spinup, byte, 0);
MODULE_PARM_DESC(max_concurr_spinup, "Max concurrent device spinup");

static ssize_t isci_show_id(struct device *dev, struct device_attribute *attr, char *buf)
{
struct Scsi_Host *shost = container_of(dev, typeof(*shost), shost_dev);
struct sas_ha_struct *sas_ha = SHOST_TO_SAS_HA(shost);
struct isci_host *ihost = container_of(sas_ha, typeof(*ihost), sas_ha);

return snprintf(buf, PAGE_SIZE, "%d\n", ihost->id);
}

static DEVICE_ATTR(isci_id, S_IRUGO, isci_show_id, NULL);

struct device_attribute *isci_host_attrs[] = {
&dev_attr_isci_id,
NULL
};

static struct scsi_host_template isci_sht = {

.module = THIS_MODULE,
Expand All @@ -138,6 +155,7 @@ static struct scsi_host_template isci_sht = {
.slave_alloc = sas_slave_alloc,
.target_destroy = sas_target_destroy,
.ioctl = sas_ioctl,
.shost_attrs = isci_host_attrs,
};

static struct sas_domain_function_template isci_transport_ops = {
Expand Down Expand Up @@ -232,17 +250,6 @@ static int isci_register_sas_ha(struct isci_host *isci_host)
return 0;
}

static ssize_t isci_show_id(struct device *dev, struct device_attribute *attr, char *buf)
{
struct Scsi_Host *shost = container_of(dev, typeof(*shost), shost_dev);
struct sas_ha_struct *sas_ha = SHOST_TO_SAS_HA(shost);
struct isci_host *ihost = container_of(sas_ha, typeof(*ihost), sas_ha);

return snprintf(buf, PAGE_SIZE, "%d\n", ihost->id);
}

static DEVICE_ATTR(isci_id, S_IRUGO, isci_show_id, NULL);

static void isci_unregister(struct isci_host *isci_host)
{
struct Scsi_Host *shost;
Expand All @@ -251,7 +258,6 @@ static void isci_unregister(struct isci_host *isci_host)
return;

shost = isci_host->shost;
device_remove_file(&shost->shost_dev, &dev_attr_isci_id);

sas_unregister_ha(&isci_host->sas_ha);

Expand Down Expand Up @@ -415,14 +421,8 @@ static struct isci_host *isci_host_alloc(struct pci_dev *pdev, int id)
if (err)
goto err_shost_remove;

err = device_create_file(&shost->shost_dev, &dev_attr_isci_id);
if (err)
goto err_unregister_ha;

return isci_host;

err_unregister_ha:
sas_unregister_ha(&(isci_host->sas_ha));
err_shost_remove:
scsi_remove_host(shost);
err_shost:
Expand Down

0 comments on commit 44a2c63

Please sign in to comment.