提交 38215553 编写于 作者: G Gerd Hoffmann 提交者: Anthony Liguori

scsi-disk: restruct emulation: GET_CONFIGURATION

Move GET_CONFIGURATION emulation from scsi_send_command() to
scsi_disk_emulate_command().

Also add GET_CONFIGURATION to scsi-defs.h and scsi_command_name().
Signed-off-by: NGerd Hoffmann <kraxel@redhat.com>
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
上级 02880f43
...@@ -440,6 +440,7 @@ static const char *scsi_command_name(uint8_t cmd) ...@@ -440,6 +440,7 @@ static const char *scsi_command_name(uint8_t cmd)
[ REWIND ] = "REWIND", [ REWIND ] = "REWIND",
[ REPORT_DENSITY_SUPPORT ] = "REPORT_DENSITY_SUPPORT", [ REPORT_DENSITY_SUPPORT ] = "REPORT_DENSITY_SUPPORT",
[ GET_CONFIGURATION ] = "GET_CONFIGURATION",
[ LOAD_UNLOAD ] = "LOAD_UNLOAD", [ LOAD_UNLOAD ] = "LOAD_UNLOAD",
[ SET_CD_SPEED ] = "SET_CD_SPEED", [ SET_CD_SPEED ] = "SET_CD_SPEED",
[ BLANK ] = "BLANK", [ BLANK ] = "BLANK",
......
...@@ -99,6 +99,7 @@ ...@@ -99,6 +99,7 @@
/* from hw/scsi-generic.c */ /* from hw/scsi-generic.c */
#define REWIND 0x01 #define REWIND 0x01
#define REPORT_DENSITY_SUPPORT 0x44 #define REPORT_DENSITY_SUPPORT 0x44
#define GET_CONFIGURATION 0x46
#define LOAD_UNLOAD 0xa6 #define LOAD_UNLOAD 0xa6
#define SET_CD_SPEED 0xbb #define SET_CD_SPEED 0xbb
#define BLANK 0xa1 #define BLANK 0xa1
......
...@@ -749,6 +749,13 @@ static int scsi_disk_emulate_command(SCSIRequest *req, uint8_t *outbuf) ...@@ -749,6 +749,13 @@ static int scsi_disk_emulate_command(SCSIRequest *req, uint8_t *outbuf)
case SYNCHRONIZE_CACHE: case SYNCHRONIZE_CACHE:
bdrv_flush(bdrv); bdrv_flush(bdrv);
break; break;
case GET_CONFIGURATION:
memset(outbuf, 0, 8);
/* ??? This should probably return much more information. For now
just return the basic header indicating the CD-ROM profile. */
outbuf[7] = 8; // CD-ROM
buflen = 8;
break;
default: default:
goto illegal_request; goto illegal_request;
} }
...@@ -865,6 +872,7 @@ static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag, ...@@ -865,6 +872,7 @@ static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag,
case READ_CAPACITY: case READ_CAPACITY:
case SYNCHRONIZE_CACHE: case SYNCHRONIZE_CACHE:
case READ_TOC: case READ_TOC:
case GET_CONFIGURATION:
rc = scsi_disk_emulate_command(&r->req, outbuf); rc = scsi_disk_emulate_command(&r->req, outbuf);
if (rc > 0) { if (rc > 0) {
r->iov.iov_len = rc; r->iov.iov_len = rc;
...@@ -893,14 +901,6 @@ static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag, ...@@ -893,14 +901,6 @@ static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag,
r->sector_count = len * s->cluster_size; r->sector_count = len * s->cluster_size;
is_write = 1; is_write = 1;
break; break;
case 0x46:
DPRINTF("Get Configuration (rt %d, maxlen %d)\n", buf[1] & 3, len);
memset(outbuf, 0, 8);
/* ??? This should probably return much more information. For now
just return the basic header indicating the CD-ROM profile. */
outbuf[7] = 8; // CD-ROM
r->iov.iov_len = 8;
break;
case 0x9e: case 0x9e:
/* Service Action In subcommands. */ /* Service Action In subcommands. */
if ((buf[1] & 31) == 0x10) { if ((buf[1] & 31) == 0x10) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册