X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fdevices%2Fatapi.h;h=ec613d7f5627fea0db304e6af368b4e8f8bfcd8d;hb=b8f6183dad926e051fb7dd10835cff2318993b17;hp=3d98a75563a516e8b44584ee6b52651ceb848d4a;hpb=a3843aa9457ed5a02159fd5a83620426b0a0f3fe;p=palacios.git diff --git a/palacios/src/devices/atapi.h b/palacios/src/devices/atapi.h index 3d98a75..ec613d7 100644 --- a/palacios/src/devices/atapi.h +++ b/palacios/src/devices/atapi.h @@ -18,7 +18,6 @@ */ #define ATAPI_PACKET_SIZE 12 -#define ATAPI_BLOCK_SIZE 2048 #include "atapi-types.h" @@ -129,10 +128,10 @@ static void atapi_cmd_nop(struct vm_device * dev, struct ide_channel * channel) static int atapi_read_chunk(struct vm_device * dev, struct ide_channel * channel) { struct ide_drive * drive = get_selected_drive(channel); - int ret = drive->cd_ops->read(drive->data_buf, ATAPI_BLOCK_SIZE, drive->cd_state.current_lba, drive->private_data); - + int ret = drive->cd_ops->read(drive->data_buf, 1, drive->current_lba, drive->private_data); + if (ret == -1) { - PrintError("IDE: Error reading CD block (LBA=%x)\n", drive->cd_state.current_lba); + PrintError("IDE: Error reading CD block (LBA=%p)\n", (void *)(addr_t)(drive->current_lba)); return -1; } @@ -148,7 +147,7 @@ static int atapi_update_data_buf(struct vm_device * dev, struct ide_channel * ch case 0xa8: // read(12) // Update lba address to point to next block - drive->cd_state.current_lba++; + drive->current_lba++; // read the next block return atapi_read_chunk(dev, channel); @@ -189,18 +188,28 @@ static int atapi_read10(struct vm_device * dev, struct ide_channel * channel) { // PrintDebug("Reading %d blocks from LBA 0x%x\n", xfer_len, lba); - drive->cd_state.current_lba = lba; + drive->current_lba = lba; // Update the request length value in the cylinder registers - + drive->transfer_length = xfer_len * ATAPI_BLOCK_SIZE; + drive->transfer_index = 0; + + if (channel->features.dma) { + + if (channel->dma_status.active == 1) { + if (dma_read(dev, channel) == -1) { + PrintError("Error in DMA read for CD Read10 command\n"); + return -1; + } + } + return 0; + } + if (atapi_read_chunk(dev, channel) == -1) { PrintError("IDE: Could not read initial chunk from CD\n"); return -1; } - drive->transfer_length = xfer_len * ATAPI_BLOCK_SIZE; - drive->transfer_index = 0; - // Length of ATAPI buffer sits in cylinder registers // This is weird... The host sets this value to say what it would like to transfer, // if it is larger than the correct size, the device shrinks it to the correct size