mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-12-11 16:00:50 -07:00
PCI SCSI HBA emulation.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1946 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
0fc5c15a4f
commit
7d8406be69
6 changed files with 1629 additions and 15 deletions
|
|
@ -245,7 +245,7 @@ int32_t scsi_send_command(SCSIDevice *s, uint32_t tag, uint8_t *buf, int lun)
|
|||
s->buf_len = 4;
|
||||
break;
|
||||
case 0x12:
|
||||
DPRINTF("Inquiry (len %d)\n", len);
|
||||
DPRINTF("Inquiry (len %d)\n", len);
|
||||
if (len < 36) {
|
||||
BADF("Inquiry buffer too small (%d)\n", len);
|
||||
}
|
||||
|
|
@ -253,12 +253,13 @@ int32_t scsi_send_command(SCSIDevice *s, uint32_t tag, uint8_t *buf, int lun)
|
|||
if (bdrv_get_type_hint(s->bdrv) == BDRV_TYPE_CDROM) {
|
||||
s->buf[0] = 5;
|
||||
s->buf[1] = 0x80;
|
||||
memcpy(&s->buf[16], "QEMU CDROM ", 16);
|
||||
memcpy(&s->buf[16], "QEMU CD-ROM ", 16);
|
||||
} else {
|
||||
s->buf[0] = 0;
|
||||
memcpy(&s->buf[16], "QEMU HARDDISK ", 16);
|
||||
}
|
||||
memcpy(&s->buf[8], "QEMU ", 8);
|
||||
memcpy(&s->buf[32], QEMU_VERSION, 4);
|
||||
s->buf[2] = 3; /* SCSI-3 */
|
||||
s->buf[3] = 2; /* Format 2 */
|
||||
s->buf[4] = 32;
|
||||
|
|
@ -275,18 +276,27 @@ int32_t scsi_send_command(SCSIDevice *s, uint32_t tag, uint8_t *buf, int lun)
|
|||
goto fail;
|
||||
break;
|
||||
case 0x1a:
|
||||
DPRINTF("Mode Sense(6) (page %d, len %d)\n", buf[2], len);
|
||||
memset(s->buf, 0, 4);
|
||||
s->buf[0] = 0x16; /* Mode data length (4 + 0x12). */
|
||||
s->buf[1] = 0; /* Default media type. */
|
||||
s->buf[2] = 0; /* Write enabled. */
|
||||
s->buf[3] = 0; /* Block descriptor length. */
|
||||
/* Caching page. */
|
||||
s->buf[4 + 0] = 8;
|
||||
s->buf[4 + 1] = 0x12;
|
||||
s->buf[4 + 2] = 4; /* WCE */
|
||||
if (len > 0x16)
|
||||
len = 0x16;
|
||||
case 0x5a:
|
||||
DPRINTF("Mode Sense (page %d, len %d)\n", buf[2], len);
|
||||
if (bdrv_get_type_hint(s->bdrv) == BDRV_TYPE_CDROM) {
|
||||
memset(s->buf, 0, 4);
|
||||
s->buf[0] = 4; /* Mode data length. */
|
||||
s->buf[1] = 0; /* Default media type. */
|
||||
s->buf[2] = 0x80; /* Readonly. */
|
||||
s->buf[3] = 0; /* Block descriptor length. */
|
||||
} else {
|
||||
memset(s->buf, 0, 0x16);
|
||||
s->buf[0] = 0x16; /* Mode data length (4 + 0x12). */
|
||||
s->buf[1] = 0; /* Default media type. */
|
||||
s->buf[2] = 0; /* Write enabled. */
|
||||
s->buf[3] = 0; /* Block descriptor length. */
|
||||
/* Caching page. */
|
||||
s->buf[4 + 0] = 8;
|
||||
s->buf[4 + 1] = 0x12;
|
||||
s->buf[4 + 2] = 4; /* WCE */
|
||||
if (len > 0x16)
|
||||
len = 0x16;
|
||||
}
|
||||
s->buf_len = len;
|
||||
break;
|
||||
case 0x25:
|
||||
|
|
@ -317,6 +327,10 @@ int32_t scsi_send_command(SCSIDevice *s, uint32_t tag, uint8_t *buf, int lun)
|
|||
s->sector_count = len * s->cluster_size;
|
||||
is_write = 1;
|
||||
break;
|
||||
case 0x35:
|
||||
DPRINTF("Syncronise cache (sector %d, count %d)\n", lba, len);
|
||||
/* ??? Extend block layer and use fsync to implement this. */
|
||||
break;
|
||||
case 0x43:
|
||||
{
|
||||
int start_track, format, msf, toclen;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue