X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fdevices%2Fatapi.h;h=15e8eecdf3789b357b66d53471d86d5f062209e6;hb=83790cde959d56c148be1b5f64d2e4a4414acac9;hp=27bed29013c38b629e9376f839022c63013fac07;hpb=fd7801687cc7266183a92f8b4e9b28c98cf39193;p=palacios.git diff --git a/palacios/src/devices/atapi.h b/palacios/src/devices/atapi.h index 27bed29..15e8eec 100644 --- a/palacios/src/devices/atapi.h +++ b/palacios/src/devices/atapi.h @@ -128,7 +128,8 @@ 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, 1, drive->current_lba, drive->private_data); + int ret = drive->ops->read(drive->data_buf, drive->current_lba * ATAPI_BLOCK_SIZE, ATAPI_BLOCK_SIZE, +drive->private_data); if (ret == -1) { PrintError("IDE: Error reading CD block (LBA=%p)\n", (void *)(addr_t)(drive->current_lba)); @@ -160,7 +161,9 @@ static int atapi_update_data_buf(struct vm_device * dev, struct ide_channel * ch return 0; } -static int atapi_read10(struct vm_device * dev, struct ide_channel * channel) { +static int atapi_read10(struct guest_info * core, + struct vm_device * dev, + struct ide_channel * channel) { struct ide_drive * drive = get_selected_drive(channel); struct atapi_read10_cmd * cmd = (struct atapi_read10_cmd *)(drive->data_buf); uint32_t lba = be_to_le_32(cmd->lba); @@ -177,10 +180,10 @@ static int atapi_read10(struct vm_device * dev, struct ide_channel * channel) { return 0; } - if (lba + xfer_len > drive->cd_ops->get_capacity(drive->private_data)) { + if (lba + xfer_len > drive->ops->get_capacity(drive->private_data)) { PrintError("IDE: xfer len exceeded capacity (lba=%d) (xfer_len=%d) (ReadEnd=%d) (capacity=%d)\n", lba, xfer_len, lba + xfer_len, - drive->cd_ops->get_capacity(drive->private_data)); + (uint32_t)drive->ops->get_capacity(drive->private_data)); atapi_cmd_error(dev, channel, ATAPI_SEN_ILL_REQ, ASC_LOG_BLK_OOR); ide_raise_irq(dev, channel); return 0; @@ -197,7 +200,7 @@ static int atapi_read10(struct vm_device * dev, struct ide_channel * channel) { if (channel->features.dma) { if (channel->dma_status.active == 1) { - if (dma_read(dev, channel) == -1) { + if (dma_read(core, dev, channel) == -1) { PrintError("Error in DMA read for CD Read10 command\n"); return -1; } @@ -238,7 +241,7 @@ static void atapi_req_sense(struct vm_device * dev, struct ide_channel * channel static int atapi_get_capacity(struct vm_device * dev, struct ide_channel * channel) { struct ide_drive * drive = get_selected_drive(channel); struct atapi_rd_capacity_resp * resp = (struct atapi_rd_capacity_resp *)(drive->data_buf); - uint32_t capacity = drive->cd_ops->get_capacity(drive->private_data); + uint32_t capacity = drive->ops->get_capacity(drive->private_data); resp->lba = le_to_be_32(capacity); resp->block_len = le_to_be_32(ATAPI_BLOCK_SIZE); @@ -449,7 +452,7 @@ static int atapi_cmd_is_data_op(uint8_t cmd) { } -static int atapi_handle_packet(struct vm_device * dev, struct ide_channel * channel) { +static int atapi_handle_packet(struct guest_info * core, struct vm_device * dev, struct ide_channel * channel) { struct ide_drive * drive = get_selected_drive(channel); uint8_t cmd = drive->data_buf[0]; @@ -474,7 +477,7 @@ static int atapi_handle_packet(struct vm_device * dev, struct ide_channel * chan break; case 0x28: // read(10) - if (atapi_read10(dev, channel) == -1) { + if (atapi_read10(core, dev, channel) == -1) { PrintError("IDE: Error in ATAPI read (%x)\n", cmd); return -1; } @@ -510,6 +513,8 @@ static int atapi_handle_packet(struct vm_device * dev, struct ide_channel * chan } break; + + case 0x4a: // Get Status/event case 0x51: // read disk info // no-op to keep the Linux CD-ROM driver happy PrintDebug("Error: Read disk info no-op to keep the Linux CD-ROM driver happy\n"); @@ -551,8 +556,7 @@ static int atapi_handle_packet(struct vm_device * dev, struct ide_channel * chan case 0xba: // scan case 0xbb: // set cd speed case 0x4e: // stop play/scan - - case 0x4a: // ??? + default: PrintError("Unhandled ATAPI command %x\n", cmd); atapi_cmd_error(dev, channel, ATAPI_SEN_ILL_REQ, ASC_INV_CMD_FIELD);