X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fdevices%2Fatapi.h;h=0892f8c2f90e0620c43d88694e3d986d44a376ec;hb=36927aa4fd7f2aa4095de22589ec0a5210f91e99;hp=f32ed8daefc8091d96779f3873e9919cff51972b;hpb=ed7cae62acb31ddd833c7efb0f6cda1b4915e7cb;p=palacios.git diff --git a/palacios/src/devices/atapi.h b/palacios/src/devices/atapi.h index f32ed8d..0892f8c 100644 --- a/palacios/src/devices/atapi.h +++ b/palacios/src/devices/atapi.h @@ -460,6 +460,7 @@ static int atapi_mode_sense(struct ide_internal * ide, struct ide_channel * chan } + static int atapi_inquiry(struct ide_internal * ide, struct ide_channel * channel) { struct ide_drive * drive = get_selected_drive(channel); struct atapi_inquiry_cmd * inquiry_cmd = (struct atapi_inquiry_cmd *)(drive->data_buf); @@ -492,6 +493,28 @@ static int atapi_inquiry(struct ide_internal * ide, struct ide_channel * channel } +static int atapi_mech_status(struct ide_internal * ide, struct ide_channel * channel) { + struct ide_drive * drive = get_selected_drive(channel); + struct atapi_mech_status_cmd * status_cmd = (struct atapi_mech_status_cmd *)(drive->data_buf); + uint16_t alloc_len = be_to_le_16(status_cmd->alloc_len); + struct atapi_mech_status_resp * resp = (struct atapi_mech_status_resp *)(drive->data_buf); + int xfer_len = sizeof(struct atapi_mech_status_resp); + + memset(resp, 0, sizeof(struct atapi_mech_status_resp)); + + resp->lba = le_to_be_32(1); + resp->slot_table_len = le_to_be_16(0); + + if (alloc_len < xfer_len) { + xfer_len = alloc_len; + } + + atapi_setup_cmd_resp(ide, channel, xfer_len); + + return 0; +} + + static int atapi_cmd_is_data_op(uint8_t cmd) { switch (cmd) { case 0x28: // read (10) @@ -583,11 +606,18 @@ static int atapi_handle_packet(struct guest_info * core, struct ide_internal * i } break; + case 0xbd: // mechanism status + if (atapi_mech_status(ide, channel) == -1) { + PrintError("IDE: error in ATAPI Mechanism status query (%x)\n", cmd); + return -1; + } + break; + + case 0xa8: // read(12) case 0x1b: // start/stop drive - case 0xbd: // mechanism status case 0xbe: // read cd