qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] SCSI command 0x51 implementation


From: Jasper Hartline
Subject: [Qemu-devel] SCSI command 0x51 implementation
Date: Sat, 7 Aug 2010 02:09:57 -0700

Hi.

I'm trying to implement this properly: GPCMD_READ_DISC_INFO 0x51

What I have done is added this to ide_atapi_cmd() in hw/ide/core.c in
Qemu 0.12.3
however I think with the help of you guys, you might help me implement
it properly.


    case GPCMD_READ_DISC_INFO:
        {
            uint64_t total_sectors;

            bdrv_get_geometry(s->bs, &total_sectors);
            total_sectors >>= 2;
            if (total_sectors == 0) {
                ide_atapi_cmd_error(s, SENSE_NOT_READY,
                                    ASC_MEDIUM_NOT_PRESENT);
            };

            int msf, start_track, len;
            msf = (packet[1] >> 1) & 1;
            start_track = packet[6];

            len = cdrom_read_toc(total_sectors, buf, msf, start_track);
            if (len < 0) {
                ide_atapi_cmd_error(s, SENSE_NOT_READY,
                                    ASC_MEDIUM_NOT_PRESENT);
            };

            cpu_to_ube16(&buf[0], 32);
                    buf[2] = 0x01;
                    buf[3] = 0;
                    buf[4] = 0;
                    buf[5] = 0;
                    buf[6] = len;
                    buf[7] = 0;
                    buf[8] = 0x20;
                    buf[9] = 0x00;
                    buf[10] = 0x01;
                    buf[11] = 0x00;

            ide_atapi_cmd_reply(s, 12, 32);
        }
        break;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]