megasas: fixup MFI_DCMD_LD_LIST_QUERY
The MFI_DCMD_LD_LIST_QUERY function is using a different format than MFI_DCMD_LD_LIST, so we need to implement it differently. Signed-off-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
1894df0281
commit
d97ae36848
|
@ -1123,15 +1123,46 @@ static int megasas_dcmd_ld_get_list(MegasasState *s, MegasasCmd *cmd)
|
||||||
static int megasas_dcmd_ld_list_query(MegasasState *s, MegasasCmd *cmd)
|
static int megasas_dcmd_ld_list_query(MegasasState *s, MegasasCmd *cmd)
|
||||||
{
|
{
|
||||||
uint16_t flags;
|
uint16_t flags;
|
||||||
|
struct mfi_ld_targetid_list info;
|
||||||
|
size_t dcmd_size = sizeof(info), resid;
|
||||||
|
uint32_t num_ld_disks = 0, max_ld_disks = s->fw_luns;
|
||||||
|
BusChild *kid;
|
||||||
|
|
||||||
/* mbox0 contains flags */
|
/* mbox0 contains flags */
|
||||||
flags = le16_to_cpu(cmd->frame->dcmd.mbox[0]);
|
flags = le16_to_cpu(cmd->frame->dcmd.mbox[0]);
|
||||||
trace_megasas_dcmd_ld_list_query(cmd->index, flags);
|
trace_megasas_dcmd_ld_list_query(cmd->index, flags);
|
||||||
if (flags == MR_LD_QUERY_TYPE_ALL ||
|
if (flags != MR_LD_QUERY_TYPE_ALL &&
|
||||||
flags == MR_LD_QUERY_TYPE_EXPOSED_TO_HOST) {
|
flags != MR_LD_QUERY_TYPE_EXPOSED_TO_HOST) {
|
||||||
return megasas_dcmd_ld_get_list(s, cmd);
|
max_ld_disks = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
memset(&info, 0, dcmd_size);
|
||||||
|
if (cmd->iov_size < 12) {
|
||||||
|
trace_megasas_dcmd_invalid_xfer_len(cmd->index, cmd->iov_size,
|
||||||
|
dcmd_size);
|
||||||
|
return MFI_STAT_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
dcmd_size = sizeof(uint32_t) * 2 + 3;
|
||||||
|
|
||||||
|
if (megasas_is_jbod(s)) {
|
||||||
|
max_ld_disks = 0;
|
||||||
|
}
|
||||||
|
QTAILQ_FOREACH(kid, &s->bus.qbus.children, sibling) {
|
||||||
|
SCSIDevice *sdev = DO_UPCAST(SCSIDevice, qdev, kid->child);
|
||||||
|
|
||||||
|
if (num_ld_disks >= max_ld_disks) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
info.targetid[num_ld_disks] = sdev->lun;
|
||||||
|
num_ld_disks++;
|
||||||
|
dcmd_size++;
|
||||||
|
}
|
||||||
|
info.ld_count = cpu_to_le32(num_ld_disks);
|
||||||
|
info.size = dcmd_size;
|
||||||
|
trace_megasas_dcmd_ld_get_list(cmd->index, num_ld_disks, max_ld_disks);
|
||||||
|
|
||||||
|
resid = dma_buf_read((uint8_t *)&info, dcmd_size, &cmd->qsg);
|
||||||
|
cmd->iov_size = dcmd_size - resid;
|
||||||
return MFI_STAT_OK;
|
return MFI_STAT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1111,6 +1111,13 @@ struct mfi_ld_list {
|
||||||
} ld_list[MFI_MAX_LD];
|
} ld_list[MFI_MAX_LD];
|
||||||
} QEMU_PACKED;
|
} QEMU_PACKED;
|
||||||
|
|
||||||
|
struct mfi_ld_targetid_list {
|
||||||
|
uint32_t size;
|
||||||
|
uint32_t ld_count;
|
||||||
|
uint8_t pad[3];
|
||||||
|
uint8_t targetid[MFI_MAX_LD];
|
||||||
|
} QEMU_PACKED;
|
||||||
|
|
||||||
enum mfi_ld_access {
|
enum mfi_ld_access {
|
||||||
MFI_LD_ACCESS_RW = 0,
|
MFI_LD_ACCESS_RW = 0,
|
||||||
MFI_LD_ACCSSS_RO = 2,
|
MFI_LD_ACCSSS_RO = 2,
|
||||||
|
|
Loading…
Reference in a new issue