[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 09/16] scsi: INQUIRY VPD fixes
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 09/16] scsi: INQUIRY VPD fixes |
Date: |
Tue, 30 Nov 2010 18:58:13 +0100 |
From: Hannes Reinecke <address@hidden>
We should announce and support the block device characterics page
only on block devices, not on CDROMs. And the VPD page 0x83 has
an off-by-one error.
Signed-off-by: Hannes Reinecke <address@hidden>
Acked-by: Christoph Hellwig <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
hw/scsi-disk.c | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index 7d85899..c41dcfc 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -398,15 +398,20 @@ static int scsi_disk_emulate_inquiry(SCSIRequest *req,
uint8_t *outbuf)
switch (page_code) {
case 0x00: /* Supported page codes, mandatory */
+ {
+ int pages;
DPRINTF("Inquiry EVPD[Supported pages] "
"buffer size %zd\n", req->cmd.xfer);
- outbuf[buflen++] = 4; // number of pages
+ pages = buflen++;
outbuf[buflen++] = 0x00; // list of supported pages (this page)
outbuf[buflen++] = 0x80; // unit serial number
outbuf[buflen++] = 0x83; // device identification
- outbuf[buflen++] = 0xb0; // block device characteristics
+ if (bdrv_get_type_hint(s->bs) != BDRV_TYPE_CDROM) {
+ outbuf[buflen++] = 0xb0; // block device characteristics
+ }
+ outbuf[pages] = buflen - pages - 1; // number of pages
break;
-
+ }
case 0x80: /* Device serial number, optional */
{
int l = strlen(s->serial);
@@ -434,7 +439,7 @@ static int scsi_disk_emulate_inquiry(SCSIRequest *req,
uint8_t *outbuf)
DPRINTF("Inquiry EVPD[Device identification] "
"buffer size %zd\n", req->cmd.xfer);
- outbuf[buflen++] = 3 + id_len;
+ outbuf[buflen++] = 4 + id_len;
outbuf[buflen++] = 0x2; // ASCII
outbuf[buflen++] = 0; // not officially assigned
outbuf[buflen++] = 0; // reserved
@@ -451,6 +456,11 @@ static int scsi_disk_emulate_inquiry(SCSIRequest *req,
uint8_t *outbuf)
unsigned int opt_io_size =
s->qdev.conf.opt_io_size / s->qdev.blocksize;
+ if (bdrv_get_type_hint(s->bs) == BDRV_TYPE_CDROM) {
+ DPRINTF("Inquiry (EVPD[%02X] not supported for CDROM\n",
+ page_code);
+ return -1;
+ }
/* required VPD size with unmap support */
outbuf[3] = buflen = 0x3c;
--
1.7.2.3
- [Qemu-devel] [PATCH 15/16] ide: Ignore double DMA transfer starts/stops, (continued)
- [Qemu-devel] [PATCH 15/16] ide: Ignore double DMA transfer starts/stops, Kevin Wolf, 2010/11/30
- [Qemu-devel] [PATCH 11/16] scsi-disk: Remove duplicate cdb parsing, Kevin Wolf, 2010/11/30
- [Qemu-devel] [PATCH 13/16] ide: Factor ide_dma_set_inactive out, Kevin Wolf, 2010/11/30
- [Qemu-devel] [PATCH 07/16] scsi: Increase the number of possible devices, Kevin Wolf, 2010/11/30
- [Qemu-devel] [PATCH 04/16] ide: convert bmdma address ioport to ioport_register(), Kevin Wolf, 2010/11/30
- [Qemu-devel] [PATCH 14/16] ide: Set bus master inactive on error, Kevin Wolf, 2010/11/30
- [Qemu-devel] [PATCH 12/16] raw-posix: raw_pwrite comment fixup, Kevin Wolf, 2010/11/30
- [Qemu-devel] [PATCH 10/16] scsi: Move sense handling into the driver, Kevin Wolf, 2010/11/30
- [Qemu-devel] [PATCH 08/16] scsi: Return SAM status codes, Kevin Wolf, 2010/11/30
- [Qemu-devel] [PATCH 05/16] qemu and qemu-xen: support empty write barriers in xen_disk, Kevin Wolf, 2010/11/30
- [Qemu-devel] [PATCH 09/16] scsi: INQUIRY VPD fixes,
Kevin Wolf <=
- [Qemu-devel] [PATCH 01/16] scsi-disk: Move active request asserts, Kevin Wolf, 2010/11/30
- [Qemu-devel] [PATCH 02/16] Implement drive_del to decouple block removal from device removal, Kevin Wolf, 2010/11/30
- [Qemu-devel] [PATCH 03/16] block migration: do not submit multiple AIOs for same sector (v2), Kevin Wolf, 2010/11/30
- [Qemu-devel] [PATCH 16/16] ide: Reset current_addr after stopping DMA, Kevin Wolf, 2010/11/30