static void ide_atapi_cmd_reply(IDEState *s, int size, int max_size)

{

    if (size > max_size)

        size = max_size;

    s->lba = -1; /* no sector read */

    s->packet_transfer_size = size;

    s->io_buffer_size = size;    /* dma: send the reply data as one chunk */

    s->elementary_transfer_size = 0;

    s->io_buffer_index = 0;



    if (s->atapi_dma) {

        block_acct_start(bdrv_get_stats(s->bs), &s->acct, size,

                         BLOCK_ACCT_READ);

        s->status = READY_STAT | SEEK_STAT | DRQ_STAT;

        ide_start_dma(s, ide_atapi_cmd_read_dma_cb);

    } else {

        s->status = READY_STAT | SEEK_STAT;

        ide_atapi_cmd_reply_end(s);

    }

}

static void ide_atapi_cmd_reply(IDEState *s, int size, int max_size)

{

    if (size > max_size)

        size = max_size;

    s->lba = -1; 

    s->packet_transfer_size = size;

    s->io_buffer_size = size;    

    s->elementary_transfer_size = 0;

    s->io_buffer_index = 0;



    if (s->atapi_dma) {

        block_acct_start(bdrv_get_stats(s->bs), &s->acct, size,

                         BLOCK_ACCT_READ);

        s->status = READY_STAT | SEEK_STAT | DRQ_STAT;

        ide_start_dma(s, ide_atapi_cmd_read_dma_cb);

    } else {

        s->status = READY_STAT | SEEK_STAT;

        ide_atapi_cmd_reply_end(s);

    }

}

static void FUNC_0(IDEState *VAR_0, int VAR_1, int VAR_2)

{

    if (VAR_1 > VAR_2)

        VAR_1 = VAR_2;

    VAR_0->lba = -1; 

    VAR_0->packet_transfer_size = VAR_1;

    VAR_0->io_buffer_size = VAR_1;    

    VAR_0->elementary_transfer_size = 0;

    VAR_0->io_buffer_index = 0;



    if (VAR_0->atapi_dma) {

        block_acct_start(bdrv_get_stats(VAR_0->bs), &VAR_0->acct, VAR_1,

                         BLOCK_ACCT_READ);

        VAR_0->status = READY_STAT | SEEK_STAT | DRQ_STAT;

        ide_start_dma(VAR_0, ide_atapi_cmd_read_dma_cb);

    } else {

        VAR_0->status = READY_STAT | SEEK_STAT;

        ide_atapi_cmd_reply_end(VAR_0);

    }

}

static void FUNC_0(IDEState *VAR_0, int VAR_1, int VAR_2)
{ if (VAR_1 > VAR_2)
VAR_1 = VAR_2; VAR_0->lba = -1; VAR_0->packet_transfer_size = VAR_1; VAR_0->io_buffer_size = VAR_1; VAR_0->elementary_transfer_size = 0; VAR_0->io_buffer_index = 0; if (VAR_0->atapi_dma) { block_acct_start(bdrv_get_stats(VAR_0->bs), &VAR_0->acct, VAR_1,
BLOCK_ACCT_READ); VAR_0->status = READY_STAT | SEEK_STAT | DRQ_STAT; ide_start_dma(VAR_0, ide_atapi_cmd_read_dma_cb); } else { VAR_0->status = READY_STAT | SEEK_STAT; ide_atapi_cmd_reply_end(VAR_0); } }