static int megasas_handle_dcmd(MegasasState *s, MegasasCmd *cmd)

{

    int opcode, len;

    int retval = 0;

    const struct dcmd_cmd_tbl_t *cmdptr = dcmd_cmd_tbl;



    opcode = le32_to_cpu(cmd->frame->dcmd.opcode);

    trace_megasas_handle_dcmd(cmd->index, opcode);

    len = megasas_map_dcmd(s, cmd);

    if (len < 0) {

        return MFI_STAT_MEMORY_NOT_AVAILABLE;

    }

    while (cmdptr->opcode != -1 && cmdptr->opcode != opcode) {

        cmdptr++;

    }

    if (cmdptr->opcode == -1) {

        trace_megasas_dcmd_unhandled(cmd->index, opcode, len);

        retval = megasas_dcmd_dummy(s, cmd);

    } else {

        trace_megasas_dcmd_enter(cmd->index, cmdptr->desc, len);

        retval = cmdptr->func(s, cmd);

    }

    if (retval != MFI_STAT_INVALID_STATUS) {

        megasas_finish_dcmd(cmd, len);

    }

    return retval;

}

static int megasas_handle_dcmd(MegasasState *s, MegasasCmd *cmd)

{

    int opcode, len;

    int retval = 0;

    const struct dcmd_cmd_tbl_t *cmdptr = dcmd_cmd_tbl;



    opcode = le32_to_cpu(cmd->frame->dcmd.opcode);

    trace_megasas_handle_dcmd(cmd->index, opcode);

    len = megasas_map_dcmd(s, cmd);

    if (len < 0) {

        return MFI_STAT_MEMORY_NOT_AVAILABLE;

    }

    while (cmdptr->opcode != -1 && cmdptr->opcode != opcode) {

        cmdptr++;

    }

    if (cmdptr->opcode == -1) {

        trace_megasas_dcmd_unhandled(cmd->index, opcode, len);

        retval = megasas_dcmd_dummy(s, cmd);

    } else {

        trace_megasas_dcmd_enter(cmd->index, cmdptr->desc, len);

        retval = cmdptr->func(s, cmd);

    }

    if (retval != MFI_STAT_INVALID_STATUS) {

        megasas_finish_dcmd(cmd, len);

    }

    return retval;

}

    int opcode, len;     len = megasas_map_dcmd(s, cmd);     if (len < 0) {
static int FUNC_0(MegasasState *VAR_0, MegasasCmd *VAR_1)

{

    int VAR_2, VAR_3;

    int VAR_4 = 0;

    const struct dcmd_cmd_tbl_t *VAR_5 = dcmd_cmd_tbl;



    VAR_2 = le32_to_cpu(VAR_1->frame->dcmd.VAR_2);

    trace_megasas_handle_dcmd(VAR_1->index, VAR_2);

    VAR_3 = megasas_map_dcmd(VAR_0, VAR_1);

    if (VAR_3 < 0) {

        return MFI_STAT_MEMORY_NOT_AVAILABLE;

    }

    while (VAR_5->VAR_2 != -1 && VAR_5->VAR_2 != VAR_2) {

        VAR_5++;

    }

    if (VAR_5->VAR_2 == -1) {

        trace_megasas_dcmd_unhandled(VAR_1->index, VAR_2, VAR_3);

        VAR_4 = megasas_dcmd_dummy(VAR_0, VAR_1);

    } else {

        trace_megasas_dcmd_enter(VAR_1->index, VAR_5->desc, VAR_3);

        VAR_4 = VAR_5->func(VAR_0, VAR_1);

    }

    if (VAR_4 != MFI_STAT_INVALID_STATUS) {

        megasas_finish_dcmd(VAR_1, VAR_3);

    }

    return VAR_4;

}

static int FUNC_0(MegasasState *VAR_0, MegasasCmd *VAR_1)
{ int VAR_2, VAR_3; int VAR_4 = 0; const struct dcmd_cmd_tbl_t *VAR_5 = dcmd_cmd_tbl; VAR_2 = le32_to_cpu(VAR_1->frame->dcmd.VAR_2); trace_megasas_handle_dcmd(VAR_1->index, VAR_2); VAR_3 = megasas_map_dcmd(VAR_0, VAR_1); if (VAR_3 < 0) { return MFI_STAT_MEMORY_NOT_AVAILABLE; } while (VAR_5->VAR_2 != -1 && VAR_5->VAR_2 != VAR_2) { VAR_5++; } if (VAR_5->VAR_2 == -1) { trace_megasas_dcmd_unhandled(VAR_1->index, VAR_2, VAR_3); VAR_4 = megasas_dcmd_dummy(VAR_0, VAR_1); } else { trace_megasas_dcmd_enter(VAR_1->index, VAR_5->desc, VAR_3); VAR_4 = VAR_5->func(VAR_0, VAR_1); } if (VAR_4 != MFI_STAT_INVALID_STATUS) { megasas_finish_dcmd(VAR_1, VAR_3); } return VAR_4; }