static int scsi_get_configuration(SCSIDiskState *s, uint8_t *outbuf)

{

    int current;



    if (s->qdev.type != TYPE_ROM) {

        return -1;

    }

    current = media_is_dvd(s) ? MMC_PROFILE_DVD_ROM : MMC_PROFILE_CD_ROM;

    memset(outbuf, 0, 40);

    stl_be_p(&outbuf[0], 36); /* Bytes after the data length field */

    stw_be_p(&outbuf[6], current);

    /* outbuf[8] - outbuf[19]: Feature 0 - Profile list */

    outbuf[10] = 0x03; /* persistent, current */

    outbuf[11] = 8; /* two profiles */

    stw_be_p(&outbuf[12], MMC_PROFILE_DVD_ROM);

    outbuf[14] = (current == MMC_PROFILE_DVD_ROM);

    stw_be_p(&outbuf[16], MMC_PROFILE_CD_ROM);

    outbuf[18] = (current == MMC_PROFILE_CD_ROM);

    /* outbuf[20] - outbuf[31]: Feature 1 - Core feature */

    stw_be_p(&outbuf[20], 1);

    outbuf[22] = 0x08 | 0x03; /* version 2, persistent, current */

    outbuf[23] = 8;

    stl_be_p(&outbuf[24], 1); /* SCSI */

    outbuf[28] = 1; /* DBE = 1, mandatory */

    /* outbuf[32] - outbuf[39]: Feature 3 - Removable media feature */

    stw_be_p(&outbuf[32], 3);

    outbuf[34] = 0x08 | 0x03; /* version 2, persistent, current */

    outbuf[35] = 4;

    outbuf[36] = 0x39; /* tray, load=1, eject=1, unlocked at powerup, lock=1 */

    /* TODO: Random readable, CD read, DVD read, drive serial number,

       power management */

    return 40;

}

static int scsi_get_configuration(SCSIDiskState *s, uint8_t *outbuf)

{

    int current;



    if (s->qdev.type != TYPE_ROM) {

        return -1;

    }

    current = media_is_dvd(s) ? MMC_PROFILE_DVD_ROM : MMC_PROFILE_CD_ROM;

    memset(outbuf, 0, 40);

    stl_be_p(&outbuf[0], 36); 

    stw_be_p(&outbuf[6], current);

    

    outbuf[10] = 0x03; 

    outbuf[11] = 8; 

    stw_be_p(&outbuf[12], MMC_PROFILE_DVD_ROM);

    outbuf[14] = (current == MMC_PROFILE_DVD_ROM);

    stw_be_p(&outbuf[16], MMC_PROFILE_CD_ROM);

    outbuf[18] = (current == MMC_PROFILE_CD_ROM);

    

    stw_be_p(&outbuf[20], 1);

    outbuf[22] = 0x08 | 0x03; 

    outbuf[23] = 8;

    stl_be_p(&outbuf[24], 1); 

    outbuf[28] = 1; 

    

    stw_be_p(&outbuf[32], 3);

    outbuf[34] = 0x08 | 0x03; 

    outbuf[35] = 4;

    outbuf[36] = 0x39; 

    



    return 40;

}

    current = media_is_dvd(s) ? MMC_PROFILE_DVD_ROM : MMC_PROFILE_CD_ROM;
static int FUNC_0(SCSIDiskState *VAR_0, uint8_t *VAR_1)

{

    int VAR_2;



    if (VAR_0->qdev.type != TYPE_ROM) {

        return -1;

    }

    VAR_2 = media_is_dvd(VAR_0) ? MMC_PROFILE_DVD_ROM : MMC_PROFILE_CD_ROM;

    memset(VAR_1, 0, 40);

    stl_be_p(&VAR_1[0], 36); 

    stw_be_p(&VAR_1[6], VAR_2);

    

    VAR_1[10] = 0x03; 

    VAR_1[11] = 8; 

    stw_be_p(&VAR_1[12], MMC_PROFILE_DVD_ROM);

    VAR_1[14] = (VAR_2 == MMC_PROFILE_DVD_ROM);

    stw_be_p(&VAR_1[16], MMC_PROFILE_CD_ROM);

    VAR_1[18] = (VAR_2 == MMC_PROFILE_CD_ROM);

    

    stw_be_p(&VAR_1[20], 1);

    VAR_1[22] = 0x08 | 0x03; 

    VAR_1[23] = 8;

    stl_be_p(&VAR_1[24], 1); 

    VAR_1[28] = 1; 

    

    stw_be_p(&VAR_1[32], 3);

    VAR_1[34] = 0x08 | 0x03; 

    VAR_1[35] = 4;

    VAR_1[36] = 0x39; 

    



    return 40;

}

static int FUNC_0(SCSIDiskState *VAR_0, uint8_t *VAR_1)
{ int VAR_2; if (VAR_0->qdev.type != TYPE_ROM) { return -1; } VAR_2 = media_is_dvd(VAR_0) ? MMC_PROFILE_DVD_ROM : MMC_PROFILE_CD_ROM; memset(VAR_1, 0, 40); stl_be_p(&VAR_1[0], 36); stw_be_p(&VAR_1[6], VAR_2); VAR_1[10] = 0x03; VAR_1[11] = 8; stw_be_p(&VAR_1[12], MMC_PROFILE_DVD_ROM); VAR_1[14] = (VAR_2 == MMC_PROFILE_DVD_ROM); stw_be_p(&VAR_1[16], MMC_PROFILE_CD_ROM); VAR_1[18] = (VAR_2 == MMC_PROFILE_CD_ROM); stw_be_p(&VAR_1[20], 1); VAR_1[22] = 0x08 | 0x03; VAR_1[23] = 8; stl_be_p(&VAR_1[24], 1); VAR_1[28] = 1; stw_be_p(&VAR_1[32], 3); VAR_1[34] = 0x08 | 0x03; VAR_1[35] = 4; VAR_1[36] = 0x39; return 40; }