Commit 0b9b7b6e authored by Scott Teel's avatar Scott Teel Committed by Martin K. Petersen

hpsa: fix physical target reset

Set reset type in device_reset_handler to do either
logical unit reset for logical devices, or physical
target reset, for physical devices.
Reviewed-by: default avatarScott Teel <scott.teel@pmcs.com>
Reviewed-by: default avatarJustin Lindley <justin.lindley@pmcs.com>
Reviewed-by: default avatarKevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: default avatarTomas Henzl <thenzl@redhat.com>
Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
Signed-off-by: default avatarDon Brace <don.brace@pmcs.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent da03ded0
...@@ -2737,9 +2737,8 @@ static int hpsa_send_reset(struct ctlr_info *h, unsigned char *scsi3addr, ...@@ -2737,9 +2737,8 @@ static int hpsa_send_reset(struct ctlr_info *h, unsigned char *scsi3addr,
/* fill_cmd can't fail here, no data buffer to map. */ /* fill_cmd can't fail here, no data buffer to map. */
(void) fill_cmd(c, HPSA_DEVICE_RESET_MSG, h, NULL, 0, 0, (void) fill_cmd(c, reset_type, h, NULL, 0, 0,
scsi3addr, TYPE_MSG); scsi3addr, TYPE_MSG);
c->Request.CDB[1] = reset_type; /* fill_cmd defaults to LUN reset */
rc = hpsa_scsi_do_simple_cmd(h, c, reply_queue, NO_TIMEOUT); rc = hpsa_scsi_do_simple_cmd(h, c, reply_queue, NO_TIMEOUT);
if (rc) { if (rc) {
dev_warn(&h->pdev->dev, "Failed to send reset command\n"); dev_warn(&h->pdev->dev, "Failed to send reset command\n");
...@@ -5207,6 +5206,7 @@ static int hpsa_eh_device_reset_handler(struct scsi_cmnd *scsicmd) ...@@ -5207,6 +5206,7 @@ static int hpsa_eh_device_reset_handler(struct scsi_cmnd *scsicmd)
int rc; int rc;
struct ctlr_info *h; struct ctlr_info *h;
struct hpsa_scsi_dev_t *dev; struct hpsa_scsi_dev_t *dev;
u8 reset_type;
char msg[48]; char msg[48];
/* find the controller to which the command to be aborted was sent */ /* find the controller to which the command to be aborted was sent */
...@@ -5245,14 +5245,22 @@ static int hpsa_eh_device_reset_handler(struct scsi_cmnd *scsicmd) ...@@ -5245,14 +5245,22 @@ static int hpsa_eh_device_reset_handler(struct scsi_cmnd *scsicmd)
if (is_hba_lunid(dev->scsi3addr)) if (is_hba_lunid(dev->scsi3addr))
return SUCCESS; return SUCCESS;
hpsa_show_dev_msg(KERN_WARNING, h, dev, "resetting"); if (is_logical_dev_addr_mode(dev->scsi3addr))
reset_type = HPSA_DEVICE_RESET_MSG;
else
reset_type = HPSA_PHYS_TARGET_RESET;
sprintf(msg, "resetting %s",
reset_type == HPSA_DEVICE_RESET_MSG ? "logical " : "physical ");
hpsa_show_dev_msg(KERN_WARNING, h, dev, msg);
h->reset_in_progress = 1; h->reset_in_progress = 1;
/* send a reset to the SCSI LUN which the command was sent to */ /* send a reset to the SCSI LUN which the command was sent to */
rc = hpsa_do_reset(h, dev, dev->scsi3addr, HPSA_RESET_TYPE_LUN, rc = hpsa_do_reset(h, dev, dev->scsi3addr, reset_type,
DEFAULT_REPLY_QUEUE); DEFAULT_REPLY_QUEUE);
snprintf(msg, sizeof(msg), "reset %s", sprintf(msg, "reset %s %s",
reset_type == HPSA_DEVICE_RESET_MSG ? "logical " : "physical ",
rc == 0 ? "completed successfully" : "failed"); rc == 0 ? "completed successfully" : "failed");
hpsa_show_dev_msg(KERN_WARNING, h, dev, msg); hpsa_show_dev_msg(KERN_WARNING, h, dev, msg);
h->reset_in_progress = 0; h->reset_in_progress = 0;
...@@ -6370,6 +6378,20 @@ static int fill_cmd(struct CommandList *c, u8 cmd, struct ctlr_info *h, ...@@ -6370,6 +6378,20 @@ static int fill_cmd(struct CommandList *c, u8 cmd, struct ctlr_info *h,
} else if (cmd_type == TYPE_MSG) { } else if (cmd_type == TYPE_MSG) {
switch (cmd) { switch (cmd) {
case HPSA_PHYS_TARGET_RESET:
c->Request.CDBLen = 16;
c->Request.type_attr_dir =
TYPE_ATTR_DIR(cmd_type, ATTR_SIMPLE, XFER_NONE);
c->Request.Timeout = 0; /* Don't time out */
memset(&c->Request.CDB[0], 0, sizeof(c->Request.CDB));
c->Request.CDB[0] = HPSA_RESET;
c->Request.CDB[1] = HPSA_TARGET_RESET_TYPE;
/* Physical target reset needs no control bytes 4-7*/
c->Request.CDB[4] = 0x00;
c->Request.CDB[5] = 0x00;
c->Request.CDB[6] = 0x00;
c->Request.CDB[7] = 0x00;
break;
case HPSA_DEVICE_RESET_MSG: case HPSA_DEVICE_RESET_MSG:
c->Request.CDBLen = 16; c->Request.CDBLen = 16;
c->Request.type_attr_dir = c->Request.type_attr_dir =
......
...@@ -285,6 +285,7 @@ struct offline_device_entry { ...@@ -285,6 +285,7 @@ struct offline_device_entry {
#define HPSA_RESET_TYPE_BUS 0x01 #define HPSA_RESET_TYPE_BUS 0x01
#define HPSA_RESET_TYPE_TARGET 0x03 #define HPSA_RESET_TYPE_TARGET 0x03
#define HPSA_RESET_TYPE_LUN 0x04 #define HPSA_RESET_TYPE_LUN 0x04
#define HPSA_PHYS_TARGET_RESET 0x99 /* not defined by cciss spec */
#define HPSA_MSG_SEND_RETRY_LIMIT 10 #define HPSA_MSG_SEND_RETRY_LIMIT 10
#define HPSA_MSG_SEND_RETRY_INTERVAL_MSECS (10000) #define HPSA_MSG_SEND_RETRY_INTERVAL_MSECS (10000)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment