Received: from eggs.gnu.org ([2001:4830:134:3::10]:47294) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XkFyK-0005sk-5U for qemu-devel@nongnu.org; Fri, 31 Oct 2014 13:26:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XkFyF-0007Z1-8G for qemu-devel@nongnu.org; Fri, 31 Oct 2014 13:26:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55951) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XkFyE-0007Ys-Qo for qemu-devel@nongnu.org; Fri, 31 Oct 2014 13:26:43 -0400 From: Paolo Bonzini Date: Fri, 31 Oct 2014 18:25:50 +0100 Message-Id: <1414776373-9704-13-git-send-email-pbonzini@redhat.com> In-Reply-To: <1414776373-9704-1-git-send-email-pbonzini@redhat.com> References: <1414776373-9704-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PULL 12/35] megasas: Implement DCMD_CLUSTER_RESET_LD List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Hannes Reinecke From: Hannes Reinecke Some implementations use DCMD_CLUSTER_RESET_LD to simulate a device reset. Signed-off-by: Hannes Reinecke [Compare against id, not lun. - Paolo] Signed-off-by: Paolo Bonzini --- hw/scsi/megasas.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c index ed4cc1b..dcfef63 100644 --- a/hw/scsi/megasas.c +++ b/hw/scsi/megasas.c @@ -1416,9 +1416,23 @@ static int megasas_ctrl_shutdown(MegasasState *s, MegasasCmd *cmd) return MFI_STAT_OK; } +/* Some implementations use CLUSTER RESET LD to simulate a device reset */ static int megasas_cluster_reset_ld(MegasasState *s, MegasasCmd *cmd) { - return MFI_STAT_INVALID_DCMD; + uint16_t target_id; + int i; + + /* mbox0 contains the device index */ + target_id = le16_to_cpu(cmd->frame->dcmd.mbox[0]); + trace_megasas_dcmd_reset_ld(cmd->index, target_id); + for (i = 0; i < s->fw_cmds; i++) { + MegasasCmd *tmp_cmd = &s->frames[i]; + if (tmp_cmd->req && tmp_cmd->req->dev->id == target_id) { + SCSIDevice *d = tmp_cmd->req->dev; + qdev_reset_all(&d->qdev); + } + } + return MFI_STAT_OK; } static int megasas_dcmd_set_properties(MegasasState *s, MegasasCmd *cmd) -- 1.8.3.1