diff options
-rw-r--r-- | drivers/scsi/hpsa.c | 50 | ||||
-rw-r--r-- | drivers/scsi/hpsa_cmd.h | 1 |
2 files changed, 38 insertions, 13 deletions
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index 97f50c71b7c9..5d25e8db281c 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c | |||
@@ -293,6 +293,8 @@ static int detect_controller_lockup(struct ctlr_info *h); | |||
293 | static void hpsa_disable_rld_caching(struct ctlr_info *h); | 293 | static void hpsa_disable_rld_caching(struct ctlr_info *h); |
294 | static inline int hpsa_scsi_do_report_phys_luns(struct ctlr_info *h, | 294 | static inline int hpsa_scsi_do_report_phys_luns(struct ctlr_info *h, |
295 | struct ReportExtendedLUNdata *buf, int bufsize); | 295 | struct ReportExtendedLUNdata *buf, int bufsize); |
296 | static bool hpsa_vpd_page_supported(struct ctlr_info *h, | ||
297 | unsigned char scsi3addr[], u8 page); | ||
296 | static int hpsa_luns_changed(struct ctlr_info *h); | 298 | static int hpsa_luns_changed(struct ctlr_info *h); |
297 | static bool hpsa_cmd_dev_match(struct ctlr_info *h, struct CommandList *c, | 299 | static bool hpsa_cmd_dev_match(struct ctlr_info *h, struct CommandList *c, |
298 | struct hpsa_scsi_dev_t *dev, | 300 | struct hpsa_scsi_dev_t *dev, |
@@ -3088,11 +3090,19 @@ static void hpsa_get_raid_level(struct ctlr_info *h, | |||
3088 | buf = kzalloc(64, GFP_KERNEL); | 3090 | buf = kzalloc(64, GFP_KERNEL); |
3089 | if (!buf) | 3091 | if (!buf) |
3090 | return; | 3092 | return; |
3091 | rc = hpsa_scsi_do_inquiry(h, scsi3addr, VPD_PAGE | 0xC1, buf, 64); | 3093 | |
3094 | if (!hpsa_vpd_page_supported(h, scsi3addr, | ||
3095 | HPSA_VPD_LV_DEVICE_GEOMETRY)) | ||
3096 | goto exit; | ||
3097 | |||
3098 | rc = hpsa_scsi_do_inquiry(h, scsi3addr, VPD_PAGE | | ||
3099 | HPSA_VPD_LV_DEVICE_GEOMETRY, buf, 64); | ||
3100 | |||
3092 | if (rc == 0) | 3101 | if (rc == 0) |
3093 | *raid_level = buf[8]; | 3102 | *raid_level = buf[8]; |
3094 | if (*raid_level > RAID_UNKNOWN) | 3103 | if (*raid_level > RAID_UNKNOWN) |
3095 | *raid_level = RAID_UNKNOWN; | 3104 | *raid_level = RAID_UNKNOWN; |
3105 | exit: | ||
3096 | kfree(buf); | 3106 | kfree(buf); |
3097 | return; | 3107 | return; |
3098 | } | 3108 | } |
@@ -3450,7 +3460,7 @@ static void hpsa_get_sas_address(struct ctlr_info *h, unsigned char *scsi3addr, | |||
3450 | } | 3460 | } |
3451 | 3461 | ||
3452 | /* Get a device id from inquiry page 0x83 */ | 3462 | /* Get a device id from inquiry page 0x83 */ |
3453 | static int hpsa_vpd_page_supported(struct ctlr_info *h, | 3463 | static bool hpsa_vpd_page_supported(struct ctlr_info *h, |
3454 | unsigned char scsi3addr[], u8 page) | 3464 | unsigned char scsi3addr[], u8 page) |
3455 | { | 3465 | { |
3456 | int rc; | 3466 | int rc; |
@@ -3460,7 +3470,7 @@ static int hpsa_vpd_page_supported(struct ctlr_info *h, | |||
3460 | 3470 | ||
3461 | buf = kzalloc(256, GFP_KERNEL); | 3471 | buf = kzalloc(256, GFP_KERNEL); |
3462 | if (!buf) | 3472 | if (!buf) |
3463 | return 0; | 3473 | return false; |
3464 | 3474 | ||
3465 | /* Get the size of the page list first */ | 3475 | /* Get the size of the page list first */ |
3466 | rc = hpsa_scsi_do_inquiry(h, scsi3addr, | 3476 | rc = hpsa_scsi_do_inquiry(h, scsi3addr, |
@@ -3487,10 +3497,10 @@ static int hpsa_vpd_page_supported(struct ctlr_info *h, | |||
3487 | goto exit_supported; | 3497 | goto exit_supported; |
3488 | exit_unsupported: | 3498 | exit_unsupported: |
3489 | kfree(buf); | 3499 | kfree(buf); |
3490 | return 0; | 3500 | return false; |
3491 | exit_supported: | 3501 | exit_supported: |
3492 | kfree(buf); | 3502 | kfree(buf); |
3493 | return 1; | 3503 | return true; |
3494 | } | 3504 | } |
3495 | 3505 | ||
3496 | static void hpsa_get_ioaccel_status(struct ctlr_info *h, | 3506 | static void hpsa_get_ioaccel_status(struct ctlr_info *h, |
@@ -3539,18 +3549,25 @@ static int hpsa_get_device_id(struct ctlr_info *h, unsigned char *scsi3addr, | |||
3539 | int rc; | 3549 | int rc; |
3540 | unsigned char *buf; | 3550 | unsigned char *buf; |
3541 | 3551 | ||
3542 | if (buflen > 16) | 3552 | /* Does controller have VPD for device id? */ |
3543 | buflen = 16; | 3553 | if (!hpsa_vpd_page_supported(h, scsi3addr, HPSA_VPD_LV_DEVICE_ID)) |
3554 | return 1; /* not supported */ | ||
3555 | |||
3544 | buf = kzalloc(64, GFP_KERNEL); | 3556 | buf = kzalloc(64, GFP_KERNEL); |
3545 | if (!buf) | 3557 | if (!buf) |
3546 | return -ENOMEM; | 3558 | return -ENOMEM; |
3547 | rc = hpsa_scsi_do_inquiry(h, scsi3addr, VPD_PAGE | 0x83, buf, 64); | 3559 | |
3548 | if (rc == 0) | 3560 | rc = hpsa_scsi_do_inquiry(h, scsi3addr, VPD_PAGE | |
3549 | memcpy(device_id, &buf[index], buflen); | 3561 | HPSA_VPD_LV_DEVICE_ID, buf, 64); |
3562 | if (rc == 0) { | ||
3563 | if (buflen > 16) | ||
3564 | buflen = 16; | ||
3565 | memcpy(device_id, &buf[8], buflen); | ||
3566 | } | ||
3550 | 3567 | ||
3551 | kfree(buf); | 3568 | kfree(buf); |
3552 | 3569 | ||
3553 | return rc != 0; | 3570 | return rc; /*0 - got id, otherwise, didn't */ |
3554 | } | 3571 | } |
3555 | 3572 | ||
3556 | static int hpsa_scsi_do_report_luns(struct ctlr_info *h, int logical, | 3573 | static int hpsa_scsi_do_report_luns(struct ctlr_info *h, int logical, |
@@ -3821,8 +3838,15 @@ static int hpsa_update_device_info(struct ctlr_info *h, | |||
3821 | sizeof(this_device->model)); | 3838 | sizeof(this_device->model)); |
3822 | memset(this_device->device_id, 0, | 3839 | memset(this_device->device_id, 0, |
3823 | sizeof(this_device->device_id)); | 3840 | sizeof(this_device->device_id)); |
3824 | hpsa_get_device_id(h, scsi3addr, this_device->device_id, 8, | 3841 | if (hpsa_get_device_id(h, scsi3addr, this_device->device_id, 8, |
3825 | sizeof(this_device->device_id)); | 3842 | sizeof(this_device->device_id))) |
3843 | dev_err(&h->pdev->dev, | ||
3844 | "hpsa%d: %s: can't get device id for host %d:C0:T%d:L%d\t%s\t%.16s\n", | ||
3845 | h->ctlr, __func__, | ||
3846 | h->scsi_host->host_no, | ||
3847 | this_device->target, this_device->lun, | ||
3848 | scsi_device_type(this_device->devtype), | ||
3849 | this_device->model); | ||
3826 | 3850 | ||
3827 | if ((this_device->devtype == TYPE_DISK || | 3851 | if ((this_device->devtype == TYPE_DISK || |
3828 | this_device->devtype == TYPE_ZBC) && | 3852 | this_device->devtype == TYPE_ZBC) && |
diff --git a/drivers/scsi/hpsa_cmd.h b/drivers/scsi/hpsa_cmd.h index a5be153d92d4..a584cdf07058 100644 --- a/drivers/scsi/hpsa_cmd.h +++ b/drivers/scsi/hpsa_cmd.h | |||
@@ -157,6 +157,7 @@ | |||
157 | 157 | ||
158 | /* VPD Inquiry types */ | 158 | /* VPD Inquiry types */ |
159 | #define HPSA_VPD_SUPPORTED_PAGES 0x00 | 159 | #define HPSA_VPD_SUPPORTED_PAGES 0x00 |
160 | #define HPSA_VPD_LV_DEVICE_ID 0x83 | ||
160 | #define HPSA_VPD_LV_DEVICE_GEOMETRY 0xC1 | 161 | #define HPSA_VPD_LV_DEVICE_GEOMETRY 0xC1 |
161 | #define HPSA_VPD_LV_IOACCEL_STATUS 0xC2 | 162 | #define HPSA_VPD_LV_IOACCEL_STATUS 0xC2 |
162 | #define HPSA_VPD_LV_STATUS 0xC3 | 163 | #define HPSA_VPD_LV_STATUS 0xC3 |