static void cmd_read_cd(IDEState *s, uint8_t* buf)

{

    int nb_sectors, lba, transfer_request;



    nb_sectors = (buf[6] << 16) | (buf[7] << 8) | buf[8];

    lba = ube32_to_cpu(buf + 2);



    if (nb_sectors == 0) {

        ide_atapi_cmd_ok(s);

        return;

    }



    transfer_request = buf[9];

    switch(transfer_request & 0xf8) {

    case 0x00:

        /* nothing */

        ide_atapi_cmd_ok(s);

        break;

    case 0x10:

        /* normal read */

        ide_atapi_cmd_read(s, lba, nb_sectors, 2048);

        break;

    case 0xf8:

        /* read all data */

        ide_atapi_cmd_read(s, lba, nb_sectors, 2352);

        break;

    default:

        ide_atapi_cmd_error(s, ILLEGAL_REQUEST,

                            ASC_INV_FIELD_IN_CMD_PACKET);

        break;

    }

}

static void cmd_read_cd(IDEState *s, uint8_t* buf)

{

    int nb_sectors, lba, transfer_request;



    nb_sectors = (buf[6] << 16) | (buf[7] << 8) | buf[8];

    lba = ube32_to_cpu(buf + 2);



    if (nb_sectors == 0) {

        ide_atapi_cmd_ok(s);

        return;

    }



    transfer_request = buf[9];

    switch(transfer_request & 0xf8) {

    case 0x00:

        

        ide_atapi_cmd_ok(s);

        break;

    case 0x10:

        

        ide_atapi_cmd_read(s, lba, nb_sectors, 2048);

        break;

    case 0xf8:

        

        ide_atapi_cmd_read(s, lba, nb_sectors, 2352);

        break;

    default:

        ide_atapi_cmd_error(s, ILLEGAL_REQUEST,

                            ASC_INV_FIELD_IN_CMD_PACKET);

        break;

    }

}

    transfer_request = buf[9];     switch(transfer_request & 0xf8) {     case 0x00:         break;
static void FUNC_0(IDEState *VAR_0, uint8_t* VAR_1)

{

    int VAR_2, VAR_3, VAR_4;



    VAR_2 = (VAR_1[6] << 16) | (VAR_1[7] << 8) | VAR_1[8];

    VAR_3 = ube32_to_cpu(VAR_1 + 2);



    if (VAR_2 == 0) {

        ide_atapi_cmd_ok(VAR_0);

        return;

    }



    VAR_4 = VAR_1[9];

    switch(VAR_4 & 0xf8) {

    case 0x00:

        

        ide_atapi_cmd_ok(VAR_0);

        break;

    case 0x10:

        

        ide_atapi_cmd_read(VAR_0, VAR_3, VAR_2, 2048);

        break;

    case 0xf8:

        

        ide_atapi_cmd_read(VAR_0, VAR_3, VAR_2, 2352);

        break;

    default:

        ide_atapi_cmd_error(VAR_0, ILLEGAL_REQUEST,

                            ASC_INV_FIELD_IN_CMD_PACKET);

        break;

    }

}

static void FUNC_0(IDEState *VAR_0, uint8_t* VAR_1)
{ int VAR_2, VAR_3, VAR_4; VAR_2 = (VAR_1[6] << 16) | (VAR_1[7] << 8) | VAR_1[8]; VAR_3 = ube32_to_cpu(VAR_1 + 2); if (VAR_2 == 0) { ide_atapi_cmd_ok(VAR_0); return; } VAR_4 = VAR_1[9]; switch(VAR_4 & 0xf8) { case 0x00:
ide_atapi_cmd_ok(VAR_0); break; case 0x10:
ide_atapi_cmd_read(VAR_0, VAR_3, VAR_2, 2048); break; case 0xf8:
ide_atapi_cmd_read(VAR_0, VAR_3, VAR_2, 2352); break; default:
ide_atapi_cmd_error(VAR_0, ILLEGAL_REQUEST,
ASC_INV_FIELD_IN_CMD_PACKET); break; } }