Revision b6c251ab hw/scsi-disk.c

b/hw/scsi-disk.c
567 567
    return buflen;
568 568
}
569 569

  
570
static int scsi_read_dvd_structure(SCSIDiskState *s, SCSIDiskReq *r,
571
                                   uint8_t *outbuf)
572
{
573
    scsi_check_condition(r, SENSE_CODE(INVALID_OPCODE));
574
    return -1;
575
}
576

  
577
static int scsi_get_event_status_notification(SCSIDiskState *s,
578
                                              SCSIDiskReq *r, uint8_t *outbuf)
579
{
580
    scsi_check_condition(r, SENSE_CODE(INVALID_OPCODE));
581
    return -1;
582
}
583

  
584
static int scsi_get_configuration(SCSIDiskState *s, SCSIDiskReq *r,
585
                                  uint8_t *outbuf)
586
{
587
    if (s->qdev.type != TYPE_ROM) {
588
        return -1;
589
    }
590
    memset(outbuf, 0, 8);
591
    /* ??? This should probably return much more information.  For now
592
       just return the basic header indicating the CD-ROM profile.  */
593
    outbuf[7] = 8; /* CD-ROM */
594
    return 8;
595
}
596

  
597
static int scsi_emulate_mechanism_status(SCSIDiskState *s, uint8_t *outbuf)
598
{
599
    if (s->qdev.type != TYPE_ROM) {
600
        return -1;
601
    }
602
    memset(outbuf, 0, 8);
603
    outbuf[5] = 1; /* CD-ROM */
604
    return 8;
605
}
606

  
570 607
static int mode_sense_page(SCSIDiskState *s, int page, uint8_t **p_outbuf,
571 608
                           int page_control)
572 609
{
......
964 1001
        outbuf[7] = 0;
965 1002
        buflen = 8;
966 1003
        break;
1004
    case MECHANISM_STATUS:
1005
        buflen = scsi_emulate_mechanism_status(s, outbuf);
1006
        if (buflen < 0) {
1007
            goto illegal_request;
1008
        }
1009
        break;
967 1010
    case GET_CONFIGURATION:
968
        memset(outbuf, 0, 8);
969
        /* ??? This should probably return much more information.  For now
970
           just return the basic header indicating the CD-ROM profile.  */
971
        outbuf[7] = 8; // CD-ROM
972
        buflen = 8;
1011
        buflen = scsi_get_configuration(s, r, outbuf);
1012
        if (buflen < 0) {
1013
            goto illegal_request;
1014
        }
1015
        break;
1016
    case GET_EVENT_STATUS_NOTIFICATION:
1017
        buflen = scsi_get_event_status_notification(s, r, outbuf);
1018
        if (buflen < 0) {
1019
            goto illegal_request;
1020
        }
1021
        break;
1022
    case READ_DVD_STRUCTURE:
1023
        buflen = scsi_read_dvd_structure(s, r, outbuf);
1024
        if (buflen < 0) {
1025
            goto illegal_request;
1026
        }
973 1027
        break;
974 1028
    case SERVICE_ACTION_IN_16:
975 1029
        /* Service Action In subcommands. */
......
1073 1127
    case ALLOW_MEDIUM_REMOVAL:
1074 1128
    case READ_CAPACITY_10:
1075 1129
    case READ_TOC:
1130
    case READ_DVD_STRUCTURE:
1076 1131
    case GET_CONFIGURATION:
1132
    case GET_EVENT_STATUS_NOTIFICATION:
1133
    case MECHANISM_STATUS:
1077 1134
    case SERVICE_ACTION_IN_16:
1078 1135
    case VERIFY_10:
1079 1136
        rc = scsi_disk_emulate_command(r);

Also available in: Unified diff