diff options
author | Hannes Reinecke <hare@suse.de> | 2016-12-02 05:36:13 -0500 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2016-12-05 17:13:35 -0500 |
commit | 2a80d5458a027f6d514987c09f0b51f45c3a5be4 (patch) | |
tree | 4b33e85c2f67d57c46afd79ff8815acedbe11025 | |
parent | d29425b065cdab5c5e65a48108adde5ea72d4656 (diff) |
scsi: hpsa: fallback to use legacy REPORT PHYS command
Older SmartArray controllers (eg SmartArray 64xx) do not support the
extended REPORT PHYS command, so fallback to use the legacy version
here.
Signed-off-by: Hannes Reinecke <hare@suse.com>
Acked-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r-- | drivers/scsi/hpsa.c | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index 220ccd40dcbc..f5ab690b3091 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c | |||
@@ -3632,8 +3632,32 @@ out: | |||
3632 | static inline int hpsa_scsi_do_report_phys_luns(struct ctlr_info *h, | 3632 | static inline int hpsa_scsi_do_report_phys_luns(struct ctlr_info *h, |
3633 | struct ReportExtendedLUNdata *buf, int bufsize) | 3633 | struct ReportExtendedLUNdata *buf, int bufsize) |
3634 | { | 3634 | { |
3635 | return hpsa_scsi_do_report_luns(h, 0, buf, bufsize, | 3635 | int rc; |
3636 | HPSA_REPORT_PHYS_EXTENDED); | 3636 | struct ReportLUNdata *lbuf; |
3637 | |||
3638 | rc = hpsa_scsi_do_report_luns(h, 0, buf, bufsize, | ||
3639 | HPSA_REPORT_PHYS_EXTENDED); | ||
3640 | if (!rc || !hpsa_allow_any) | ||
3641 | return rc; | ||
3642 | |||
3643 | /* REPORT PHYS EXTENDED is not supported */ | ||
3644 | lbuf = kzalloc(sizeof(*lbuf), GFP_KERNEL); | ||
3645 | if (!lbuf) | ||
3646 | return -ENOMEM; | ||
3647 | |||
3648 | rc = hpsa_scsi_do_report_luns(h, 0, lbuf, sizeof(*lbuf), 0); | ||
3649 | if (!rc) { | ||
3650 | int i; | ||
3651 | u32 nphys; | ||
3652 | |||
3653 | /* Copy ReportLUNdata header */ | ||
3654 | memcpy(buf, lbuf, 8); | ||
3655 | nphys = be32_to_cpu(*((__be32 *)lbuf->LUNListLength)) / 8; | ||
3656 | for (i = 0; i < nphys; i++) | ||
3657 | memcpy(buf->LUN[i].lunid, lbuf->LUN[i], 8); | ||
3658 | } | ||
3659 | kfree(lbuf); | ||
3660 | return rc; | ||
3637 | } | 3661 | } |
3638 | 3662 | ||
3639 | static inline int hpsa_scsi_do_report_log_luns(struct ctlr_info *h, | 3663 | static inline int hpsa_scsi_do_report_log_luns(struct ctlr_info *h, |