hpsa.c (4e1881840933587f42e3ad3788f2c392d19827a6) hpsa.c (3026ff9b0339a64d6bdef8858636174d453dce54)
1/*
2 * Disk Array driver for HP Smart Array SAS controllers
3 * Copyright 2016 Microsemi Corporation
4 * Copyright 2014-2015 PMC-Sierra, Inc.
5 * Copyright 2000,2009-2015 Hewlett-Packard Development Company, L.P.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by

--- 2915 unchanged lines hidden (view full) ---

2924 c = cmd_alloc(h);
2925
2926 if (fill_cmd(c, HPSA_INQUIRY, h, buf, bufsize,
2927 page, scsi3addr, TYPE_CMD)) {
2928 rc = -1;
2929 goto out;
2930 }
2931 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
1/*
2 * Disk Array driver for HP Smart Array SAS controllers
3 * Copyright 2016 Microsemi Corporation
4 * Copyright 2014-2015 PMC-Sierra, Inc.
5 * Copyright 2000,2009-2015 Hewlett-Packard Development Company, L.P.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by

--- 2915 unchanged lines hidden (view full) ---

2924 c = cmd_alloc(h);
2925
2926 if (fill_cmd(c, HPSA_INQUIRY, h, buf, bufsize,
2927 page, scsi3addr, TYPE_CMD)) {
2928 rc = -1;
2929 goto out;
2930 }
2931 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
2932 PCI_DMA_FROMDEVICE, DEFAULT_TIMEOUT);
2932 PCI_DMA_FROMDEVICE, NO_TIMEOUT);
2933 if (rc)
2934 goto out;
2935 ei = c->err_info;
2936 if (ei->CommandStatus != 0 && ei->CommandStatus != CMD_DATA_UNDERRUN) {
2937 hpsa_scsi_interpret_error(h, c);
2938 rc = -1;
2939 }
2940out:

--- 267 unchanged lines hidden (view full) ---

3208 if (fill_cmd(c, HPSA_GET_RAID_MAP, h, &this_device->raid_map,
3209 sizeof(this_device->raid_map), 0,
3210 scsi3addr, TYPE_CMD)) {
3211 dev_warn(&h->pdev->dev, "hpsa_get_raid_map fill_cmd failed\n");
3212 cmd_free(h, c);
3213 return -1;
3214 }
3215 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
2933 if (rc)
2934 goto out;
2935 ei = c->err_info;
2936 if (ei->CommandStatus != 0 && ei->CommandStatus != CMD_DATA_UNDERRUN) {
2937 hpsa_scsi_interpret_error(h, c);
2938 rc = -1;
2939 }
2940out:

--- 267 unchanged lines hidden (view full) ---

3208 if (fill_cmd(c, HPSA_GET_RAID_MAP, h, &this_device->raid_map,
3209 sizeof(this_device->raid_map), 0,
3210 scsi3addr, TYPE_CMD)) {
3211 dev_warn(&h->pdev->dev, "hpsa_get_raid_map fill_cmd failed\n");
3212 cmd_free(h, c);
3213 return -1;
3214 }
3215 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
3216 PCI_DMA_FROMDEVICE, DEFAULT_TIMEOUT);
3216 PCI_DMA_FROMDEVICE, NO_TIMEOUT);
3217 if (rc)
3218 goto out;
3219 ei = c->err_info;
3220 if (ei->CommandStatus != 0 && ei->CommandStatus != CMD_DATA_UNDERRUN) {
3221 hpsa_scsi_interpret_error(h, c);
3222 rc = -1;
3223 goto out;
3224 }

--- 26 unchanged lines hidden (view full) ---

3251 0, RAID_CTLR_LUNID, TYPE_CMD);
3252 if (rc)
3253 goto out;
3254
3255 c->Request.CDB[2] = bmic_device_index & 0xff;
3256 c->Request.CDB[9] = (bmic_device_index >> 8) & 0xff;
3257
3258 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
3217 if (rc)
3218 goto out;
3219 ei = c->err_info;
3220 if (ei->CommandStatus != 0 && ei->CommandStatus != CMD_DATA_UNDERRUN) {
3221 hpsa_scsi_interpret_error(h, c);
3222 rc = -1;
3223 goto out;
3224 }

--- 26 unchanged lines hidden (view full) ---

3251 0, RAID_CTLR_LUNID, TYPE_CMD);
3252 if (rc)
3253 goto out;
3254
3255 c->Request.CDB[2] = bmic_device_index & 0xff;
3256 c->Request.CDB[9] = (bmic_device_index >> 8) & 0xff;
3257
3258 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
3259 PCI_DMA_FROMDEVICE, DEFAULT_TIMEOUT);
3259 PCI_DMA_FROMDEVICE, NO_TIMEOUT);
3260 if (rc)
3261 goto out;
3262 ei = c->err_info;
3263 if (ei->CommandStatus != 0 && ei->CommandStatus != CMD_DATA_UNDERRUN) {
3264 hpsa_scsi_interpret_error(h, c);
3265 rc = -1;
3266 }
3267out:

--- 11 unchanged lines hidden (view full) ---

3279 c = cmd_alloc(h);
3280
3281 rc = fill_cmd(c, BMIC_IDENTIFY_CONTROLLER, h, buf, bufsize,
3282 0, RAID_CTLR_LUNID, TYPE_CMD);
3283 if (rc)
3284 goto out;
3285
3286 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
3260 if (rc)
3261 goto out;
3262 ei = c->err_info;
3263 if (ei->CommandStatus != 0 && ei->CommandStatus != CMD_DATA_UNDERRUN) {
3264 hpsa_scsi_interpret_error(h, c);
3265 rc = -1;
3266 }
3267out:

--- 11 unchanged lines hidden (view full) ---

3279 c = cmd_alloc(h);
3280
3281 rc = fill_cmd(c, BMIC_IDENTIFY_CONTROLLER, h, buf, bufsize,
3282 0, RAID_CTLR_LUNID, TYPE_CMD);
3283 if (rc)
3284 goto out;
3285
3286 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
3287 PCI_DMA_FROMDEVICE, DEFAULT_TIMEOUT);
3287 PCI_DMA_FROMDEVICE, NO_TIMEOUT);
3288 if (rc)
3289 goto out;
3290 ei = c->err_info;
3291 if (ei->CommandStatus != 0 && ei->CommandStatus != CMD_DATA_UNDERRUN) {
3292 hpsa_scsi_interpret_error(h, c);
3293 rc = -1;
3294 }
3295out:

--- 14 unchanged lines hidden (view full) ---

3310 0, RAID_CTLR_LUNID, TYPE_CMD);
3311 if (rc)
3312 goto out;
3313
3314 c->Request.CDB[2] = bmic_device_index & 0xff;
3315 c->Request.CDB[9] = (bmic_device_index >> 8) & 0xff;
3316
3317 hpsa_scsi_do_simple_cmd_with_retry(h, c, PCI_DMA_FROMDEVICE,
3288 if (rc)
3289 goto out;
3290 ei = c->err_info;
3291 if (ei->CommandStatus != 0 && ei->CommandStatus != CMD_DATA_UNDERRUN) {
3292 hpsa_scsi_interpret_error(h, c);
3293 rc = -1;
3294 }
3295out:

--- 14 unchanged lines hidden (view full) ---

3310 0, RAID_CTLR_LUNID, TYPE_CMD);
3311 if (rc)
3312 goto out;
3313
3314 c->Request.CDB[2] = bmic_device_index & 0xff;
3315 c->Request.CDB[9] = (bmic_device_index >> 8) & 0xff;
3316
3317 hpsa_scsi_do_simple_cmd_with_retry(h, c, PCI_DMA_FROMDEVICE,
3318 DEFAULT_TIMEOUT);
3318 NO_TIMEOUT);
3319 ei = c->err_info;
3320 if (ei->CommandStatus != 0 && ei->CommandStatus != CMD_DATA_UNDERRUN) {
3321 hpsa_scsi_interpret_error(h, c);
3322 rc = -1;
3323 }
3324out:
3325 cmd_free(h, c);
3326

--- 56 unchanged lines hidden (view full) ---

3383 goto out;
3384
3385 if (id_phys->phys_connector[1] == 'E')
3386 c->Request.CDB[5] = id_phys->box_index;
3387 else
3388 c->Request.CDB[5] = 0;
3389
3390 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, PCI_DMA_FROMDEVICE,
3319 ei = c->err_info;
3320 if (ei->CommandStatus != 0 && ei->CommandStatus != CMD_DATA_UNDERRUN) {
3321 hpsa_scsi_interpret_error(h, c);
3322 rc = -1;
3323 }
3324out:
3325 cmd_free(h, c);
3326

--- 56 unchanged lines hidden (view full) ---

3383 goto out;
3384
3385 if (id_phys->phys_connector[1] == 'E')
3386 c->Request.CDB[5] = id_phys->box_index;
3387 else
3388 c->Request.CDB[5] = 0;
3389
3390 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c, PCI_DMA_FROMDEVICE,
3391 DEFAULT_TIMEOUT);
3391 NO_TIMEOUT);
3392 if (rc)
3393 goto out;
3394
3395 ei = c->err_info;
3396 if (ei->CommandStatus != 0 && ei->CommandStatus != CMD_DATA_UNDERRUN) {
3397 rc = -1;
3398 goto out;
3399 }

--- 223 unchanged lines hidden (view full) ---

3623 if (fill_cmd(c, logical ? HPSA_REPORT_LOG : HPSA_REPORT_PHYS, h,
3624 buf, bufsize, 0, scsi3addr, TYPE_CMD)) {
3625 rc = -EAGAIN;
3626 goto out;
3627 }
3628 if (extended_response)
3629 c->Request.CDB[1] = extended_response;
3630 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
3392 if (rc)
3393 goto out;
3394
3395 ei = c->err_info;
3396 if (ei->CommandStatus != 0 && ei->CommandStatus != CMD_DATA_UNDERRUN) {
3397 rc = -1;
3398 goto out;
3399 }

--- 223 unchanged lines hidden (view full) ---

3623 if (fill_cmd(c, logical ? HPSA_REPORT_LOG : HPSA_REPORT_PHYS, h,
3624 buf, bufsize, 0, scsi3addr, TYPE_CMD)) {
3625 rc = -EAGAIN;
3626 goto out;
3627 }
3628 if (extended_response)
3629 c->Request.CDB[1] = extended_response;
3630 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
3631 PCI_DMA_FROMDEVICE, DEFAULT_TIMEOUT);
3631 PCI_DMA_FROMDEVICE, NO_TIMEOUT);
3632 if (rc)
3633 goto out;
3634 ei = c->err_info;
3635 if (ei->CommandStatus != 0 &&
3636 ei->CommandStatus != CMD_DATA_UNDERRUN) {
3637 hpsa_scsi_interpret_error(h, c);
3638 rc = -EIO;
3639 } else {

--- 118 unchanged lines hidden (view full) ---

3758#define ASC_LUN_NOT_READY 0x04
3759#define ASCQ_LUN_NOT_READY_FORMAT_IN_PROGRESS 0x04
3760#define ASCQ_LUN_NOT_READY_INITIALIZING_CMD_REQ 0x02
3761
3762 c = cmd_alloc(h);
3763
3764 (void) fill_cmd(c, TEST_UNIT_READY, h, NULL, 0, 0, scsi3addr, TYPE_CMD);
3765 rc = hpsa_scsi_do_simple_cmd(h, c, DEFAULT_REPLY_QUEUE,
3632 if (rc)
3633 goto out;
3634 ei = c->err_info;
3635 if (ei->CommandStatus != 0 &&
3636 ei->CommandStatus != CMD_DATA_UNDERRUN) {
3637 hpsa_scsi_interpret_error(h, c);
3638 rc = -EIO;
3639 } else {

--- 118 unchanged lines hidden (view full) ---

3758#define ASC_LUN_NOT_READY 0x04
3759#define ASCQ_LUN_NOT_READY_FORMAT_IN_PROGRESS 0x04
3760#define ASCQ_LUN_NOT_READY_INITIALIZING_CMD_REQ 0x02
3761
3762 c = cmd_alloc(h);
3763
3764 (void) fill_cmd(c, TEST_UNIT_READY, h, NULL, 0, 0, scsi3addr, TYPE_CMD);
3765 rc = hpsa_scsi_do_simple_cmd(h, c, DEFAULT_REPLY_QUEUE,
3766 DEFAULT_TIMEOUT);
3766 NO_TIMEOUT);
3767 if (rc) {
3768 cmd_free(h, c);
3769 return HPSA_VPD_LV_STATUS_UNSUPPORTED;
3770 }
3771 sense = c->err_info->SenseInfo;
3772 if (c->err_info->SenseLen > sizeof(c->err_info->SenseInfo))
3773 sense_len = sizeof(c->err_info->SenseInfo);
3774 else

--- 4840 unchanged lines hidden (view full) ---

8615 c = cmd_alloc(h);
8616
8617 /* first, get the current diag options settings */
8618 if (fill_cmd(c, BMIC_SENSE_DIAG_OPTIONS, h, options, 4, 0,
8619 RAID_CTLR_LUNID, TYPE_CMD))
8620 goto errout;
8621
8622 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
3767 if (rc) {
3768 cmd_free(h, c);
3769 return HPSA_VPD_LV_STATUS_UNSUPPORTED;
3770 }
3771 sense = c->err_info->SenseInfo;
3772 if (c->err_info->SenseLen > sizeof(c->err_info->SenseInfo))
3773 sense_len = sizeof(c->err_info->SenseInfo);
3774 else

--- 4840 unchanged lines hidden (view full) ---

8615 c = cmd_alloc(h);
8616
8617 /* first, get the current diag options settings */
8618 if (fill_cmd(c, BMIC_SENSE_DIAG_OPTIONS, h, options, 4, 0,
8619 RAID_CTLR_LUNID, TYPE_CMD))
8620 goto errout;
8621
8622 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
8623 PCI_DMA_FROMDEVICE, DEFAULT_TIMEOUT);
8623 PCI_DMA_FROMDEVICE, NO_TIMEOUT);
8624 if ((rc != 0) || (c->err_info->CommandStatus != 0))
8625 goto errout;
8626
8627 /* Now, set the bit for disabling the RLD caching */
8628 *options |= HPSA_DIAG_OPTS_DISABLE_RLD_CACHING;
8629
8630 if (fill_cmd(c, BMIC_SET_DIAG_OPTIONS, h, options, 4, 0,
8631 RAID_CTLR_LUNID, TYPE_CMD))
8632 goto errout;
8633
8634 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
8624 if ((rc != 0) || (c->err_info->CommandStatus != 0))
8625 goto errout;
8626
8627 /* Now, set the bit for disabling the RLD caching */
8628 *options |= HPSA_DIAG_OPTS_DISABLE_RLD_CACHING;
8629
8630 if (fill_cmd(c, BMIC_SET_DIAG_OPTIONS, h, options, 4, 0,
8631 RAID_CTLR_LUNID, TYPE_CMD))
8632 goto errout;
8633
8634 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
8635 PCI_DMA_TODEVICE, DEFAULT_TIMEOUT);
8635 PCI_DMA_TODEVICE, NO_TIMEOUT);
8636 if ((rc != 0) || (c->err_info->CommandStatus != 0))
8637 goto errout;
8638
8639 /* Now verify that it got set: */
8640 if (fill_cmd(c, BMIC_SENSE_DIAG_OPTIONS, h, options, 4, 0,
8641 RAID_CTLR_LUNID, TYPE_CMD))
8642 goto errout;
8643
8644 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
8636 if ((rc != 0) || (c->err_info->CommandStatus != 0))
8637 goto errout;
8638
8639 /* Now verify that it got set: */
8640 if (fill_cmd(c, BMIC_SENSE_DIAG_OPTIONS, h, options, 4, 0,
8641 RAID_CTLR_LUNID, TYPE_CMD))
8642 goto errout;
8643
8644 rc = hpsa_scsi_do_simple_cmd_with_retry(h, c,
8645 PCI_DMA_FROMDEVICE, DEFAULT_TIMEOUT);
8645 PCI_DMA_FROMDEVICE, NO_TIMEOUT);
8646 if ((rc != 0) || (c->err_info->CommandStatus != 0))
8647 goto errout;
8648
8649 if (*options & HPSA_DIAG_OPTS_DISABLE_RLD_CACHING)
8650 goto out;
8651
8652errout:
8653 dev_err(&h->pdev->dev,

--- 983 unchanged lines hidden ---
8646 if ((rc != 0) || (c->err_info->CommandStatus != 0))
8647 goto errout;
8648
8649 if (*options & HPSA_DIAG_OPTS_DISABLE_RLD_CACHING)
8650 goto out;
8651
8652errout:
8653 dev_err(&h->pdev->dev,

--- 983 unchanged lines hidden ---