diff options
author | Christoph Hellwig <hch@lst.de> | 2006-02-16 07:31:47 -0500 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2006-02-27 23:55:13 -0500 |
commit | a012564136a665f8d63443c057ba368572b483df (patch) | |
tree | bc70eb34b786be000b3465d16e8729f1644ea5a5 /drivers/scsi/scsi_transport_sas.c | |
parent | e3094447e013a59ccedcf60f6055f18225bd8465 (diff) |
[SCSI] sas: add support for enclosure and bad ID rphy attributes
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/scsi_transport_sas.c')
-rw-r--r-- | drivers/scsi/scsi_transport_sas.c | 53 |
1 files changed, 51 insertions, 2 deletions
diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c index 205542988e29..eab5c7c6f3c7 100644 --- a/drivers/scsi/scsi_transport_sas.c +++ b/drivers/scsi/scsi_transport_sas.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2005 Dell Inc. | 2 | * Copyright (C) 2005-2006 Dell Inc. |
3 | * Released under GPL v2. | 3 | * Released under GPL v2. |
4 | * | 4 | * |
5 | * Serial Attached SCSI (SAS) transport class. | 5 | * Serial Attached SCSI (SAS) transport class. |
@@ -38,7 +38,7 @@ | |||
38 | 38 | ||
39 | #define SAS_HOST_ATTRS 0 | 39 | #define SAS_HOST_ATTRS 0 |
40 | #define SAS_PORT_ATTRS 17 | 40 | #define SAS_PORT_ATTRS 17 |
41 | #define SAS_RPORT_ATTRS 5 | 41 | #define SAS_RPORT_ATTRS 7 |
42 | 42 | ||
43 | struct sas_internal { | 43 | struct sas_internal { |
44 | struct scsi_transport_template t; | 44 | struct scsi_transport_template t; |
@@ -533,6 +533,53 @@ show_sas_rphy_device_type(struct class_device *cdev, char *buf) | |||
533 | static SAS_CLASS_DEVICE_ATTR(rphy, device_type, S_IRUGO, | 533 | static SAS_CLASS_DEVICE_ATTR(rphy, device_type, S_IRUGO, |
534 | show_sas_rphy_device_type, NULL); | 534 | show_sas_rphy_device_type, NULL); |
535 | 535 | ||
536 | static ssize_t | ||
537 | show_sas_rphy_enclosure_identifier(struct class_device *cdev, char *buf) | ||
538 | { | ||
539 | struct sas_rphy *rphy = transport_class_to_rphy(cdev); | ||
540 | struct sas_phy *phy = dev_to_phy(rphy->dev.parent); | ||
541 | struct Scsi_Host *shost = dev_to_shost(phy->dev.parent); | ||
542 | struct sas_internal *i = to_sas_internal(shost->transportt); | ||
543 | u64 identifier; | ||
544 | int error; | ||
545 | |||
546 | /* | ||
547 | * Only devices behind an expander are supported, because the | ||
548 | * enclosure identifier is a SMP feature. | ||
549 | */ | ||
550 | if (phy->local_attached) | ||
551 | return -EINVAL; | ||
552 | |||
553 | error = i->f->get_enclosure_identifier(rphy, &identifier); | ||
554 | if (error) | ||
555 | return error; | ||
556 | return sprintf(buf, "0x%llx\n", (unsigned long long)identifier); | ||
557 | } | ||
558 | |||
559 | static SAS_CLASS_DEVICE_ATTR(rphy, enclosure_identifier, S_IRUGO, | ||
560 | show_sas_rphy_enclosure_identifier, NULL); | ||
561 | |||
562 | static ssize_t | ||
563 | show_sas_rphy_bay_identifier(struct class_device *cdev, char *buf) | ||
564 | { | ||
565 | struct sas_rphy *rphy = transport_class_to_rphy(cdev); | ||
566 | struct sas_phy *phy = dev_to_phy(rphy->dev.parent); | ||
567 | struct Scsi_Host *shost = dev_to_shost(phy->dev.parent); | ||
568 | struct sas_internal *i = to_sas_internal(shost->transportt); | ||
569 | int val; | ||
570 | |||
571 | if (phy->local_attached) | ||
572 | return -EINVAL; | ||
573 | |||
574 | val = i->f->get_bay_identifier(rphy); | ||
575 | if (val < 0) | ||
576 | return val; | ||
577 | return sprintf(buf, "%d\n", val); | ||
578 | } | ||
579 | |||
580 | static SAS_CLASS_DEVICE_ATTR(rphy, bay_identifier, S_IRUGO, | ||
581 | show_sas_rphy_bay_identifier, NULL); | ||
582 | |||
536 | sas_rphy_protocol_attr(identify.initiator_port_protocols, | 583 | sas_rphy_protocol_attr(identify.initiator_port_protocols, |
537 | initiator_port_protocols); | 584 | initiator_port_protocols); |
538 | sas_rphy_protocol_attr(identify.target_port_protocols, target_port_protocols); | 585 | sas_rphy_protocol_attr(identify.target_port_protocols, target_port_protocols); |
@@ -845,6 +892,8 @@ sas_attach_transport(struct sas_function_template *ft) | |||
845 | SETUP_RPORT_ATTRIBUTE(rphy_device_type); | 892 | SETUP_RPORT_ATTRIBUTE(rphy_device_type); |
846 | SETUP_RPORT_ATTRIBUTE(rphy_sas_address); | 893 | SETUP_RPORT_ATTRIBUTE(rphy_sas_address); |
847 | SETUP_RPORT_ATTRIBUTE(rphy_phy_identifier); | 894 | SETUP_RPORT_ATTRIBUTE(rphy_phy_identifier); |
895 | SETUP_RPORT_ATTRIBUTE(rphy_enclosure_identifier); | ||
896 | SETUP_RPORT_ATTRIBUTE(rphy_bay_identifier); | ||
848 | i->rphy_attrs[count] = NULL; | 897 | i->rphy_attrs[count] = NULL; |
849 | 898 | ||
850 | return &i->t; | 899 | return &i->t; |