VirtualBox

Changeset 65110 in vbox for trunk/src


Ignore:
Timestamp:
Jan 4, 2017 2:07:41 PM (8 years ago)
Author:
vboxsync
Message:

Storage/Devices/DevATA: Make use of the new SCSI inline helpers and remove the the local inlines

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/DevATA.cpp

    r65075 r65110  
    6161#include <VBox/sup.h>
    6262#include <VBox/scsi.h>
     63#include <VBox/scsiinline.h>
    6364#include <VBox/ata.h>
    6465
     
    10971098            pbDst[i ^ 1] = ' ';
    10981099    }
    1099 }
    1100 
    1101 
    1102 static void ataR3SCSIPadStr(uint8_t *pbDst, const char *pbSrc, uint32_t cbSize)
    1103 {
    1104     for (uint32_t i = 0; i < cbSize; i++)
    1105     {
    1106         if (*pbSrc)
    1107             pbDst[i] = *pbSrc++;
    1108         else
    1109             pbDst[i] = ' ';
    1110     }
    1111 }
    1112 
    1113 
    1114 DECLINLINE(void) ataH2BE_U16(uint8_t *pbBuf, uint16_t val)
    1115 {
    1116     pbBuf[0] = val >> 8;
    1117     pbBuf[1] = val;
    1118 }
    1119 
    1120 
    1121 DECLINLINE(void) ataH2BE_U24(uint8_t *pbBuf, uint32_t val)
    1122 {
    1123     pbBuf[0] = val >> 16;
    1124     pbBuf[1] = val >> 8;
    1125     pbBuf[2] = val;
    1126 }
    1127 
    1128 
    1129 DECLINLINE(void) ataH2BE_U32(uint8_t *pbBuf, uint32_t val)
    1130 {
    1131     pbBuf[0] = val >> 24;
    1132     pbBuf[1] = val >> 16;
    1133     pbBuf[2] = val >> 8;
    1134     pbBuf[3] = val;
    1135 }
    1136 
    1137 
    1138 DECLINLINE(uint16_t) ataBE2H_U16(const uint8_t *pbBuf)
    1139 {
    1140     return (pbBuf[0] << 8) | pbBuf[1];
    1141 }
    1142 
    1143 
    1144 DECLINLINE(uint32_t) ataBE2H_U24(const uint8_t *pbBuf)
    1145 {
    1146     return (pbBuf[0] << 16) | (pbBuf[1] << 8) | pbBuf[2];
    1147 }
    1148 
    1149 
    1150 DECLINLINE(uint32_t) ataBE2H_U32(const uint8_t *pbBuf)
    1151 {
    1152     return (pbBuf[0] << 24) | (pbBuf[1] << 16) | (pbBuf[2] << 8) | pbBuf[3];
    1153 }
    1154 
    1155 
    1156 DECLINLINE(void) ataLBA2MSF(uint8_t *pbBuf, uint32_t iATAPILBA)
    1157 {
    1158     iATAPILBA += 150;
    1159     pbBuf[0] = (iATAPILBA / 75) / 60;
    1160     pbBuf[1] = (iATAPILBA / 75) % 60;
    1161     pbBuf[2] = iATAPILBA % 75;
    1162 }
    1163 
    1164 
    1165 DECLINLINE(uint32_t) ataMSF2LBA(const uint8_t *pbBuf)
    1166 {
    1167     return (pbBuf[0] * 60 + pbBuf[1]) * 75 + pbBuf[2];
    11681100}
    11691101
     
    18451777                *pbBuf++ = 0x00;
    18461778                /* MSF */
    1847                 ataLBA2MSF(pbBuf, i);
     1779                scsiLBA2MSF(pbBuf, i);
    18481780                pbBuf += 3;
    18491781                *pbBuf++ = 0x01; /* mode 1 data */
     
    19501882        case SCSI_MODE_SELECT_10:
    19511883        {
    1952             size_t cbBlkDescLength = ataBE2H_U16(&s->CTX_SUFF(pbIOBuffer)[6]);
     1884            size_t cbBlkDescLength = scsiBE2H_U16(&s->CTX_SUFF(pbIOBuffer)[6]);
    19531885
    19541886            SCSILogModePage(szBuf, sizeof(szBuf) - 1,
     
    19911923            case SCSI_WRITE_10:
    19921924            case SCSI_WRITE_AND_VERIFY_10:
    1993                 iATAPILBA = ataBE2H_U32(s->aATAPICmd + 2);
    1994                 cSectors = ataBE2H_U16(s->aATAPICmd + 7);
     1925                iATAPILBA = scsiBE2H_U32(s->aATAPICmd + 2);
     1926                cSectors = scsiBE2H_U16(s->aATAPICmd + 7);
    19951927                break;
    19961928            case SCSI_READ_12:
    19971929            case SCSI_WRITE_12:
    1998                 iATAPILBA = ataBE2H_U32(s->aATAPICmd + 2);
    1999                 cSectors = ataBE2H_U32(s->aATAPICmd + 6);
     1930                iATAPILBA = scsiBE2H_U32(s->aATAPICmd + 2);
     1931                cSectors = scsiBE2H_U32(s->aATAPICmd + 6);
    20001932                break;
    20011933            case SCSI_READ_CD:
    2002                 iATAPILBA = ataBE2H_U32(s->aATAPICmd + 2);
    2003                 cSectors = ataBE2H_U24(s->aATAPICmd + 6);
     1934                iATAPILBA = scsiBE2H_U32(s->aATAPICmd + 2);
     1935                cSectors = scsiBE2H_U24(s->aATAPICmd + 6);
    20041936                break;
    20051937            case SCSI_READ_CD_MSF:
    2006                 iATAPILBA = ataMSF2LBA(s->aATAPICmd + 3);
    2007                 cSectors = ataMSF2LBA(s->aATAPICmd + 6) - iATAPILBA;
     1938                iATAPILBA = scsiMSF2LBA(s->aATAPICmd + 3);
     1939                cSectors = scsiMSF2LBA(s->aATAPICmd + 6) - iATAPILBA;
    20081940                break;
    20091941            default:
     
    20341966                case SCSI_WRITE_10:
    20351967                case SCSI_WRITE_AND_VERIFY_10:
    2036                     ataH2BE_U32(aATAPICmd + 2, iATAPILBA);
    2037                     ataH2BE_U16(aATAPICmd + 7, cReqSectors);
     1968                    scsiH2BE_U32(aATAPICmd + 2, iATAPILBA);
     1969                    scsiH2BE_U16(aATAPICmd + 7, cReqSectors);
    20381970                    break;
    20391971                case SCSI_READ_12:
    20401972                case SCSI_WRITE_12:
    2041                     ataH2BE_U32(aATAPICmd + 2, iATAPILBA);
    2042                     ataH2BE_U32(aATAPICmd + 6, cReqSectors);
     1973                    scsiH2BE_U32(aATAPICmd + 2, iATAPILBA);
     1974                    scsiH2BE_U32(aATAPICmd + 6, cReqSectors);
    20431975                    break;
    20441976                case SCSI_READ_CD:
    2045                     ataH2BE_U32(aATAPICmd + 2, iATAPILBA);
    2046                     ataH2BE_U24(aATAPICmd + 6, cReqSectors);
     1977                    scsiH2BE_U32(aATAPICmd + 2, iATAPILBA);
     1978                    scsiH2BE_U24(aATAPICmd + 6, cReqSectors);
    20471979                    break;
    20481980                case SCSI_READ_CD_MSF:
    2049                     ataLBA2MSF(aATAPICmd + 3, iATAPILBA);
    2050                     ataLBA2MSF(aATAPICmd + 6, iATAPILBA + cReqSectors);
     1981                    scsiLBA2MSF(aATAPICmd + 3, iATAPILBA);
     1982                    scsiLBA2MSF(aATAPICmd + 6, iATAPILBA + cReqSectors);
    20511983                    break;
    20521984            }
     
    20671999                case SCSI_WRITE_10:
    20682000                case SCSI_WRITE_AND_VERIFY_10:
    2069                     ataH2BE_U32(s->aATAPICmd + 2, iATAPILBA);
    2070                     ataH2BE_U16(s->aATAPICmd + 7, cSectors - cSectorsMax);
     2001                    scsiH2BE_U32(s->aATAPICmd + 2, iATAPILBA);
     2002                    scsiH2BE_U16(s->aATAPICmd + 7, cSectors - cSectorsMax);
    20712003                    break;
    20722004                case SCSI_READ_12:
    20732005                case SCSI_WRITE_12:
    2074                     ataH2BE_U32(s->aATAPICmd + 2, iATAPILBA);
    2075                     ataH2BE_U32(s->aATAPICmd + 6, cSectors - cSectorsMax);
     2006                    scsiH2BE_U32(s->aATAPICmd + 2, iATAPILBA);
     2007                    scsiH2BE_U32(s->aATAPICmd + 6, cSectors - cSectorsMax);
    20762008                    break;
    20772009                case SCSI_READ_CD:
    2078                     ataH2BE_U32(s->aATAPICmd + 2, iATAPILBA);
    2079                     ataH2BE_U24(s->aATAPICmd + 6, cSectors - cSectorsMax);
     2010                    scsiH2BE_U32(s->aATAPICmd + 2, iATAPILBA);
     2011                    scsiH2BE_U24(s->aATAPICmd + 6, cSectors - cSectorsMax);
    20802012                    break;
    20812013                case SCSI_READ_CD_MSF:
    2082                     ataLBA2MSF(s->aATAPICmd + 3, iATAPILBA);
    2083                     ataLBA2MSF(s->aATAPICmd + 6, iATAPILBA + cSectors - cSectorsMax);
     2014                    scsiLBA2MSF(s->aATAPICmd + 3, iATAPILBA);
     2015                    scsiLBA2MSF(s->aATAPICmd + 6, iATAPILBA + cSectors - cSectorsMax);
    20842016                    break;
    20852017                default:
     
    21632095                 *             invisible as possible to the guest. */
    21642096                Log3(("ATAPI PT inquiry data before (%d): %.*Rhxs\n", cbTransfer, cbTransfer, s->CTX_SUFF(pbIOBuffer)));
    2165                 ataR3SCSIPadStr(s->CTX_SUFF(pbIOBuffer) + 8, "VBOX", 8);
    2166                 ataR3SCSIPadStr(s->CTX_SUFF(pbIOBuffer) + 16, "CD-ROM", 16);
    2167                 ataR3SCSIPadStr(s->CTX_SUFF(pbIOBuffer) + 32, "1.0", 4);
     2097                scsiPadStr(s->CTX_SUFF(pbIOBuffer) + 8, "VBOX", 8);
     2098                scsiPadStr(s->CTX_SUFF(pbIOBuffer) + 16, "CD-ROM", 16);
     2099                scsiPadStr(s->CTX_SUFF(pbIOBuffer) + 32, "1.0", 4);
    21682100            }
    21692101
     
    22132145    int format = s->aATAPICmd[7];
    22142146
    2215     uint16_t max_len = ataBE2H_U16(&s->aATAPICmd[8]);
     2147    uint16_t max_len = scsiBE2H_U16(&s->aATAPICmd[8]);
    22162148
    22172149    memset(buf, 0, max_len);
     
    22702202
    22712203                        /* FIXME: 0x30000 per spec? */
    2272                         ataH2BE_U32(buf + 8, 0); /* start sector */
    2273                         ataH2BE_U32(buf + 12, total_sectors - 1); /* end sector */
    2274                         ataH2BE_U32(buf + 16, total_sectors - 1); /* l0 end sector */
     2204                        scsiH2BE_U32(buf + 8, 0); /* start sector */
     2205                        scsiH2BE_U32(buf + 12, total_sectors - 1); /* end sector */
     2206                        scsiH2BE_U32(buf + 16, total_sectors - 1); /* l0 end sector */
    22752207
    22762208                        /* Size of buffer, not including 2 byte size field */
    2277                         ataH2BE_U32(&buf[0], 2048 + 2);
     2209                        scsiH2BE_U32(&buf[0], 2048 + 2);
    22782210
    22792211                        /* 2k data + 4 byte header */
     
    22862218
    22872219                        /* Size of buffer, not including 2 byte size field */
    2288                         ataH2BE_U16(buf, 4 + 2);
     2220                        scsiH2BE_U16(buf, 4 + 2);
    22892221
    22902222                        /* 4 byte header + 4 byte data */
     
    22982230                    case 0x04: /* DVD disc manufacturing information */
    22992231                        /* Size of buffer, not including 2 byte size field */
    2300                         ataH2BE_U16(buf, 2048 + 2);
     2232                        scsiH2BE_U16(buf, 2048 + 2);
    23012233
    23022234                        /* 2k data + 4 byte header */
     
    23112243                        buf[4] = 0x00; /* Physical format */
    23122244                        buf[5] = 0x40; /* Not writable, is readable */
    2313                         ataH2BE_U16((buf + 6), 2048 + 4);
     2245                        scsiH2BE_U16((buf + 6), 2048 + 4);
    23142246
    23152247                        buf[8] = 0x01; /* Copyright info */
    23162248                        buf[9] = 0x40; /* Not writable, is readable */
    2317                         ataH2BE_U16((buf + 10), 4 + 4);
     2249                        scsiH2BE_U16((buf + 10), 4 + 4);
    23182250
    23192251                        buf[12] = 0x03; /* BCA info */
    23202252                        buf[13] = 0x40; /* Not writable, is readable */
    2321                         ataH2BE_U16((buf + 14), 188 + 4);
     2253                        scsiH2BE_U16((buf + 14), 188 + 4);
    23222254
    23232255                        buf[16] = 0x04; /* Manufacturing info */
    23242256                        buf[17] = 0x40; /* Not writable, is readable */
    2325                         ataH2BE_U16((buf + 18), 2048 + 4);
     2257                        scsiH2BE_U16((buf + 18), 2048 + 4);
    23262258
    23272259                        /* Size of buffer, not including 2 byte size field */
    2328                         ataH2BE_U16(buf, 16 + 2);
     2260                        scsiH2BE_U16(buf, 16 + 2);
    23292261
    23302262                        /* data written + 4 byte header */
     
    23802312    Assert(s->uTxDir == PDMMEDIATXDIR_FROM_DEVICE);
    23812313    Assert(s->cbElementaryTransfer <= 8);
    2382     ataH2BE_U32(pbBuf, s->cTotalSectors - 1);
    2383     ataH2BE_U32(pbBuf + 4, 2048);
     2314    scsiH2BE_U32(pbBuf, s->cTotalSectors - 1);
     2315    scsiH2BE_U32(pbBuf + 4, 2048);
    23842316    s->iSourceSink = ATAFN_SS_NULL;
    23852317    atapiR3CmdOK(s);
     
    23952327    Assert(s->cbElementaryTransfer <= 34);
    23962328    memset(pbBuf, '\0', 34);
    2397     ataH2BE_U16(pbBuf, 32);
     2329    scsiH2BE_U16(pbBuf, 32);
    23982330    pbBuf[2] = (0 << 4) | (3 << 2) | (2 << 0); /* not erasable, complete session, complete disc */
    23992331    pbBuf[3] = 1; /* number of first track */
     
    24062338    pbBuf[10] = 0; /* number of sessions (MSB) */
    24072339    pbBuf[11] = 0; /* number of sessions (MSB) */
    2408     ataH2BE_U32(pbBuf + 16, 0x00ffffff); /* last session lead-in start time is not available */
    2409     ataH2BE_U32(pbBuf + 20, 0x00ffffff); /* last possible start time for lead-out is not available */
     2340    scsiH2BE_U32(pbBuf + 16, 0x00ffffff); /* last session lead-in start time is not available */
     2341    scsiH2BE_U32(pbBuf + 20, 0x00ffffff); /* last possible start time for lead-out is not available */
    24102342    s->iSourceSink = ATAFN_SS_NULL;
    24112343    atapiR3CmdOK(s);
     
    24212353    Assert(s->cbElementaryTransfer <= 36);
    24222354    /* Accept address/number type of 1 only, and only track 1 exists. */
    2423     if ((s->aATAPICmd[1] & 0x03) != 1 || ataBE2H_U32(&s->aATAPICmd[2]) != 1)
     2355    if ((s->aATAPICmd[1] & 0x03) != 1 || scsiBE2H_U32(&s->aATAPICmd[2]) != 1)
    24242356    {
    24252357        atapiR3CmdErrorSimple(s, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_INV_FIELD_IN_CMD_PACKET);
     
    24272359    }
    24282360    memset(pbBuf, '\0', 36);
    2429     ataH2BE_U16(pbBuf, 34);
     2361    scsiH2BE_U16(pbBuf, 34);
    24302362    pbBuf[2] = 1; /* track number (LSB) */
    24312363    pbBuf[3] = 1; /* session number (LSB) */
     
    24332365    pbBuf[6] = (0 << 7) | (0 << 6) | (0 << 5) | (0 << 6) | (1 << 0); /* not reserved track, not blank, not packet writing, not fixed packet, data mode 1 */
    24342366    pbBuf[7] = (0 << 1) | (0 << 0); /* last recorded address not valid, next recordable address not valid */
    2435     ataH2BE_U32(pbBuf + 8, 0); /* track start address is 0 */
    2436     ataH2BE_U32(pbBuf + 24, s->cTotalSectors); /* track size */
     2367    scsiH2BE_U32(pbBuf + 8, 0); /* track start address is 0 */
     2368    scsiH2BE_U32(pbBuf + 24, s->cTotalSectors); /* track size */
    24372369    pbBuf[32] = 0; /* track number (MSB) */
    24382370    pbBuf[33] = 0; /* session number (MSB) */
     
    24482380        return 0;
    24492381
    2450     ataH2BE_U16(pbBuf, 0x0); /* feature 0: list of profiles supported */
     2382    scsiH2BE_U16(pbBuf, 0x0); /* feature 0: list of profiles supported */
    24512383    pbBuf[2] = (0 << 2) | (1 << 1) | (1 << 0); /* version 0, persistent, current */
    24522384    pbBuf[3] = 8; /* additional bytes for profiles */
    24532385    /* The MMC-3 spec says that DVD-ROM read capability should be reported
    24542386     * before CD-ROM read capability. */
    2455     ataH2BE_U16(pbBuf + 4, 0x10); /* profile: read-only DVD */
     2387    scsiH2BE_U16(pbBuf + 4, 0x10); /* profile: read-only DVD */
    24562388    pbBuf[6] = (0 << 0); /* NOT current profile */
    2457     ataH2BE_U16(pbBuf + 8, 0x08); /* profile: read only CD */
     2389    scsiH2BE_U16(pbBuf + 8, 0x08); /* profile: read only CD */
    24582390    pbBuf[10] = (1 << 0); /* current profile */
    24592391
     
    24672399        return 0;
    24682400
    2469     ataH2BE_U16(pbBuf, 0x1); /* feature 0001h: Core Feature */
     2401    scsiH2BE_U16(pbBuf, 0x1); /* feature 0001h: Core Feature */
    24702402    pbBuf[2] = (0x2 << 2) | RT_BIT(1) | RT_BIT(0); /* Version | Persistent | Current */
    24712403    pbBuf[3] = 8; /* Additional length */
    2472     ataH2BE_U16(pbBuf + 4, 0x00000002); /* Physical interface ATAPI. */
     2404    scsiH2BE_U16(pbBuf + 4, 0x00000002); /* Physical interface ATAPI. */
    24732405    pbBuf[8] = RT_BIT(0); /* DBE */
    24742406    /* Rest is reserved. */
     
    24832415        return 0;
    24842416
    2485     ataH2BE_U16(pbBuf, 0x2); /* feature 0002h: Morphing Feature */
     2417    scsiH2BE_U16(pbBuf, 0x2); /* feature 0002h: Morphing Feature */
    24862418    pbBuf[2] = (0x1 << 2) | RT_BIT(1) | RT_BIT(0); /* Version | Persistent | Current */
    24872419    pbBuf[3] = 4; /* Additional length */
     
    24982430        return 0;
    24992431
    2500     ataH2BE_U16(pbBuf, 0x3); /* feature 0003h: Removable Medium Feature */
     2432    scsiH2BE_U16(pbBuf, 0x3); /* feature 0003h: Removable Medium Feature */
    25012433    pbBuf[2] = (0x2 << 2) | RT_BIT(1) | RT_BIT(0); /* Version | Persistent | Current */
    25022434    pbBuf[3] = 4; /* Additional length */
     
    25142446        return 0;
    25152447
    2516     ataH2BE_U16(pbBuf, 0x10); /* feature 0010h: Random Readable Feature */
     2448    scsiH2BE_U16(pbBuf, 0x10); /* feature 0010h: Random Readable Feature */
    25172449    pbBuf[2] = (0x0 << 2) | RT_BIT(1) | RT_BIT(0); /* Version | Persistent | Current */
    25182450    pbBuf[3] = 8; /* Additional length */
    2519     ataH2BE_U32(pbBuf + 4, 2048); /* Logical block size. */
    2520     ataH2BE_U16(pbBuf + 8, 0x10); /* Blocking (0x10 for DVD, CD is not defined). */
     2451    scsiH2BE_U32(pbBuf + 4, 2048); /* Logical block size. */
     2452    scsiH2BE_U16(pbBuf + 8, 0x10); /* Blocking (0x10 for DVD, CD is not defined). */
    25212453    pbBuf[10] = 0; /* PP not present */
    25222454    /* Rest is reserved. */
     
    25312463        return 0;
    25322464
    2533     ataH2BE_U16(pbBuf, 0x1e); /* feature 001Eh: CD Read Feature */
     2465    scsiH2BE_U16(pbBuf, 0x1e); /* feature 001Eh: CD Read Feature */
    25342466    pbBuf[2] = (0x2 << 2) | RT_BIT(1) | RT_BIT(0); /* Version | Persistent | Current */
    25352467    pbBuf[3] = 0; /* Additional length */
     
    25462478        return 0;
    25472479
    2548     ataH2BE_U16(pbBuf, 0x100); /* feature 0100h: Power Management Feature */
     2480    scsiH2BE_U16(pbBuf, 0x100); /* feature 0100h: Power Management Feature */
    25492481    pbBuf[2] = (0x0 << 2) | RT_BIT(1) | RT_BIT(0); /* Version | Persistent | Current */
    25502482    pbBuf[3] = 0; /* Additional length */
     
    25592491        return 0;
    25602492
    2561     ataH2BE_U16(pbBuf, 0x105); /* feature 0105h: Timeout Feature */
     2493    scsiH2BE_U16(pbBuf, 0x105); /* feature 0105h: Timeout Feature */
    25622494    pbBuf[2] = (0x0 << 2) | RT_BIT(1) | RT_BIT(0); /* Version | Persistent | Current */
    25632495    pbBuf[3] = 4; /* Additional length */
     
    25722504    uint32_t cbBuf = s->cbIOBuffer;
    25732505    uint32_t cbCopied = 0;
    2574     uint16_t u16Sfn = ataBE2H_U16(&s->aATAPICmd[2]);
     2506    uint16_t u16Sfn = scsiBE2H_U16(&s->aATAPICmd[2]);
    25752507
    25762508    Assert(s->uTxDir == PDMMEDIATXDIR_FROM_DEVICE);
     
    25862518     * way to differentiate them right now is based on the image size). */
    25872519    if (s->cTotalSectors)
    2588         ataH2BE_U16(pbBuf + 6, 0x08); /* current profile: read-only CD */
     2520        scsiH2BE_U16(pbBuf + 6, 0x08); /* current profile: read-only CD */
    25892521    else
    2590         ataH2BE_U16(pbBuf + 6, 0x00); /* current profile: none -> no media */
     2522        scsiH2BE_U16(pbBuf + 6, 0x00); /* current profile: none -> no media */
    25912523    cbBuf    -= 8;
    25922524    pbBuf    += 8;
     
    26252557
    26262558    /* Set data length now - the field is not included in the final length. */
    2627     ataH2BE_U32(s->CTX_SUFF(pbIOBuffer), s->cbIOBuffer - cbBuf - 4);
     2559    scsiH2BE_U32(s->CTX_SUFF(pbIOBuffer), s->cbIOBuffer - cbBuf - 4);
    26282560
    26292561    /* Other profiles we might want to add in the future: 0x40 (BD-ROM) and 0x50 (HDDVD-ROM) */
     
    26572589            case ATA_EVENT_STATUS_MEDIA_NEW:
    26582590                /* mount */
    2659                 ataH2BE_U16(pbBuf + 0, 6);
     2591                scsiH2BE_U16(pbBuf + 0, 6);
    26602592                pbBuf[2] = 0x04; /* media */
    26612593                pbBuf[3] = 0x5e; /* supported = busy|media|external|power|operational */
     
    26692601            case ATA_EVENT_STATUS_MEDIA_REMOVED:
    26702602                /* umount */
    2671                 ataH2BE_U16(pbBuf + 0, 6);
     2603                scsiH2BE_U16(pbBuf + 0, 6);
    26722604                pbBuf[2] = 0x04; /* media */
    26732605                pbBuf[3] = 0x5e; /* supported = busy|media|external|power|operational */
     
    26812613
    26822614            case ATA_EVENT_STATUS_MEDIA_EJECT_REQUESTED: /* currently unused */
    2683                 ataH2BE_U16(pbBuf + 0, 6);
     2615                scsiH2BE_U16(pbBuf + 0, 6);
    26842616                pbBuf[2] = 0x04; /* media */
    26852617                pbBuf[3] = 0x5e; /* supported = busy|media|external|power|operational */
     
    26922624            case ATA_EVENT_STATUS_UNCHANGED:
    26932625            default:
    2694                 ataH2BE_U16(pbBuf + 0, 6);
     2626                scsiH2BE_U16(pbBuf + 0, 6);
    26952627                pbBuf[2] = 0x01; /* operational change request / notification */
    26962628                pbBuf[3] = 0x5e; /* supported = busy|media|external|power|operational */
     
    27282660    pbBuf[6] = 0; /* reserved */
    27292661    pbBuf[7] = 0; /* reserved */
    2730     ataR3SCSIPadStr(pbBuf + 8, s->szInquiryVendorId, 8);
    2731     ataR3SCSIPadStr(pbBuf + 16, s->szInquiryProductId, 16);
    2732     ataR3SCSIPadStr(pbBuf + 32, s->szInquiryRevision, 4);
     2662    scsiPadStr(pbBuf + 8, s->szInquiryVendorId, 8);
     2663    scsiPadStr(pbBuf + 16, s->szInquiryProductId, 16);
     2664    scsiPadStr(pbBuf + 32, s->szInquiryRevision, 4);
    27332665    s->iSourceSink = ATAFN_SS_NULL;
    27342666    atapiR3CmdOK(s);
     
    27432675    Assert(s->uTxDir == PDMMEDIATXDIR_FROM_DEVICE);
    27442676    Assert(s->cbElementaryTransfer <= 16);
    2745     ataH2BE_U16(&pbBuf[0], 16 + 6);
     2677    scsiH2BE_U16(&pbBuf[0], 16 + 6);
    27462678    pbBuf[2] = (uint8_t)s->MediaTrackType;
    27472679    pbBuf[3] = 0;
     
    27712703    Assert(s->uTxDir == PDMMEDIATXDIR_FROM_DEVICE);
    27722704    Assert(s->cbElementaryTransfer <= 40);
    2773     ataH2BE_U16(&pbBuf[0], 38);
     2705    scsiH2BE_U16(&pbBuf[0], 38);
    27742706    pbBuf[2] = (uint8_t)s->MediaTrackType;
    27752707    pbBuf[3] = 0;
     
    27922724        pbBuf[14] |= 1 << 1; /* report lock state */
    27932725    pbBuf[15] = 0; /* no subchannel reads supported, no separate audio volume control, no changer etc. */
    2794     ataH2BE_U16(&pbBuf[16], 5632); /* (obsolete) claim 32x speed support */
    2795     ataH2BE_U16(&pbBuf[18], 2); /* number of audio volume levels */
    2796     ataH2BE_U16(&pbBuf[20], s->cbIOBuffer / _1K); /* buffer size supported in Kbyte */
    2797     ataH2BE_U16(&pbBuf[22], 5632); /* (obsolete) current read speed 32x */
     2726    scsiH2BE_U16(&pbBuf[16], 5632); /* (obsolete) claim 32x speed support */
     2727    scsiH2BE_U16(&pbBuf[18], 2); /* number of audio volume levels */
     2728    scsiH2BE_U16(&pbBuf[20], s->cbIOBuffer / _1K); /* buffer size supported in Kbyte */
     2729    scsiH2BE_U16(&pbBuf[22], 5632); /* (obsolete) current read speed 32x */
    27982730    pbBuf[24] = 0; /* reserved */
    27992731    pbBuf[25] = 0; /* reserved for digital audio (see idx 15) */
    2800     ataH2BE_U16(&pbBuf[26], 0); /* (obsolete) maximum write speed */
    2801     ataH2BE_U16(&pbBuf[28], 0); /* (obsolete) current write speed */
    2802     ataH2BE_U16(&pbBuf[30], 0); /* copy management revision supported 0=no CSS */
     2732    scsiH2BE_U16(&pbBuf[26], 0); /* (obsolete) maximum write speed */
     2733    scsiH2BE_U16(&pbBuf[28], 0); /* (obsolete) current write speed */
     2734    scsiH2BE_U16(&pbBuf[30], 0); /* copy management revision supported 0=no CSS */
    28032735    pbBuf[32] = 0; /* reserved */
    28042736    pbBuf[33] = 0; /* reserved */
    28052737    pbBuf[34] = 0; /* reserved */
    28062738    pbBuf[35] = 1; /* rotation control CAV */
    2807     ataH2BE_U16(&pbBuf[36], 0); /* current write speed */
    2808     ataH2BE_U16(&pbBuf[38], 0); /* number of write speed performance descriptors */
     2739    scsiH2BE_U16(&pbBuf[36], 0); /* current write speed */
     2740    scsiH2BE_U16(&pbBuf[38], 0); /* number of write speed performance descriptors */
    28092741    s->iSourceSink = ATAFN_SS_NULL;
    28102742    atapiR3CmdOK(s);
     
    28322764    Assert(s->uTxDir == PDMMEDIATXDIR_FROM_DEVICE);
    28332765    Assert(s->cbElementaryTransfer <= 8);
    2834     ataH2BE_U16(pbBuf, 0);
     2766    scsiH2BE_U16(pbBuf, 0);
    28352767    /* no current LBA */
    28362768    pbBuf[2] = 0;
     
    28382770    pbBuf[4] = 0;
    28392771    pbBuf[5] = 1;
    2840     ataH2BE_U16(pbBuf + 6, 0);
     2772    scsiH2BE_U16(pbBuf + 6, 0);
    28412773    s->iSourceSink = ATAFN_SS_NULL;
    28422774    atapiR3CmdOK(s);
     
    28712803        {
    28722804            *q++ = 0; /* reserved */
    2873             ataLBA2MSF(q, 0);
     2805            scsiLBA2MSF(q, 0);
    28742806            q += 3;
    28752807        }
     
    28772809        {
    28782810            /* sector 0 */
    2879             ataH2BE_U32(q, 0);
     2811            scsiH2BE_U32(q, 0);
    28802812            q += 4;
    28812813        }
     
    28892821    {
    28902822        *q++ = 0; /* reserved */
    2891         ataLBA2MSF(q, s->cTotalSectors);
     2823        scsiLBA2MSF(q, s->cTotalSectors);
    28922824        q += 3;
    28932825    }
    28942826    else
    28952827    {
    2896         ataH2BE_U32(q, s->cTotalSectors);
     2828        scsiH2BE_U32(q, s->cTotalSectors);
    28972829        q += 4;
    28982830    }
    28992831    cbSize = q - pbBuf;
    2900     ataH2BE_U16(pbBuf, cbSize - 2);
     2832    scsiH2BE_U16(pbBuf, cbSize - 2);
    29012833    if (cbSize < s->cbTotalTransfer)
    29022834        s->cbTotalTransfer = cbSize;
     
    29262858    {
    29272859        pbBuf[8] = 0; /* reserved */
    2928         ataLBA2MSF(&pbBuf[9], 0);
     2860        scsiLBA2MSF(&pbBuf[9], 0);
    29292861    }
    29302862    else
    29312863    {
    29322864        /* sector 0 */
    2933         ataH2BE_U32(pbBuf + 8, 0);
     2865        scsiH2BE_U32(pbBuf + 8, 0);
    29342866    }
    29352867    s->iSourceSink = ATAFN_SS_NULL;
     
    29872919    {
    29882920        *q++ = 0; /* reserved */
    2989         ataLBA2MSF(q, s->cTotalSectors);
     2921        scsiLBA2MSF(q, s->cTotalSectors);
    29902922        q += 3;
    29912923    }
    29922924    else
    29932925    {
    2994         ataH2BE_U32(q, s->cTotalSectors);
     2926        scsiH2BE_U32(q, s->cTotalSectors);
    29952927        q += 4;
    29962928    }
     
    30062938    {
    30072939        *q++ = 0; /* reserved */
    3008         ataLBA2MSF(q, 0);
     2940        scsiLBA2MSF(q, 0);
    30092941        q += 3;
    30102942    }
     
    30122944    {
    30132945        /* sector 0 */
    3014         ataH2BE_U32(q, 0);
     2946        scsiH2BE_U32(q, 0);
    30152947        q += 4;
    30162948    }
    30172949
    30182950    cbSize = q - pbBuf;
    3019     ataH2BE_U16(pbBuf, cbSize - 2);
     2951    scsiH2BE_U16(pbBuf, cbSize - 2);
    30202952    if (cbSize < s->cbTotalTransfer)
    30212953        s->cbTotalTransfer = cbSize;
     
    30502982            break;
    30512983        case SCSI_GET_EVENT_STATUS_NOTIFICATION:
    3052             cbMax = ataBE2H_U16(pbPacket + 7);
     2984            cbMax = scsiBE2H_U16(pbPacket + 7);
    30532985            ataR3StartTransfer(s, RT_MIN(cbMax, 8), PDMMEDIATXDIR_FROM_DEVICE, ATAFN_BT_ATAPI_CMD, ATAFN_SS_ATAPI_GET_EVENT_STATUS_NOTIFICATION, true);
    30542986            break;
     
    30562988        {
    30572989            uint8_t uPageControl, uPageCode;
    3058             cbMax = ataBE2H_U16(pbPacket + 7);
     2990            cbMax = scsiBE2H_U16(pbPacket + 7);
    30592991            uPageControl = pbPacket[2] >> 6;
    30602992            uPageCode = pbPacket[2] & 0x3f;
     
    31183050            }
    31193051            if (pbPacket[0] == SCSI_READ_10)
    3120                 cSectors = ataBE2H_U16(pbPacket + 7);
     3052                cSectors = scsiBE2H_U16(pbPacket + 7);
    31213053            else
    3122                 cSectors = ataBE2H_U32(pbPacket + 6);
    3123             iATAPILBA = ataBE2H_U32(pbPacket + 2);
     3054                cSectors = scsiBE2H_U32(pbPacket + 6);
     3055            iATAPILBA = scsiBE2H_U32(pbPacket + 2);
    31243056            if (cSectors == 0)
    31253057            {
     
    31613093            }
    31623094            cSectors = (pbPacket[6] << 16) | (pbPacket[7] << 8) | pbPacket[8];
    3163             iATAPILBA = ataBE2H_U32(pbPacket + 2);
     3095            iATAPILBA = scsiBE2H_U32(pbPacket + 2);
    31643096            if (cSectors == 0)
    31653097            {
     
    32173149                break;
    32183150            }
    3219             iATAPILBA = ataBE2H_U32(pbPacket + 2);
     3151            iATAPILBA = scsiBE2H_U32(pbPacket + 2);
    32203152            if (iATAPILBA > s->cTotalSectors)
    32213153            {
     
    32833215        case SCSI_MECHANISM_STATUS:
    32843216        {
    3285             cbMax = ataBE2H_U16(pbPacket + 8);
     3217            cbMax = scsiBE2H_U16(pbPacket + 8);
    32863218            ataR3StartTransfer(s, RT_MIN(cbMax, 8), PDMMEDIATXDIR_FROM_DEVICE, ATAFN_BT_ATAPI_CMD, ATAFN_SS_ATAPI_MECHANISM_STATUS, true);
    32873219            break;
     
    33023234                break;
    33033235            }
    3304             cbMax = ataBE2H_U16(pbPacket + 7);
     3236            cbMax = scsiBE2H_U16(pbPacket + 7);
    33053237            /* SCSI MMC-3 spec says format is at offset 2 (lower 4 bits),
    33063238             * but Linux kernel uses offset 9 (topmost 2 bits). Hope that
     
    33513283                break;
    33523284            }
    3353             cbMax = ataBE2H_U16(pbPacket + 7);
     3285            cbMax = scsiBE2H_U16(pbPacket + 7);
    33543286            ataR3StartTransfer(s, RT_MIN(cbMax, 34), PDMMEDIATXDIR_FROM_DEVICE, ATAFN_BT_ATAPI_CMD, ATAFN_SS_ATAPI_READ_DISC_INFORMATION, true);
    33553287            break;
     
    33663298                break;
    33673299            }
    3368             cbMax = ataBE2H_U16(pbPacket + 7);
     3300            cbMax = scsiBE2H_U16(pbPacket + 7);
    33693301            ataR3StartTransfer(s, RT_MIN(cbMax, 36), PDMMEDIATXDIR_FROM_DEVICE, ATAFN_BT_ATAPI_CMD, ATAFN_SS_ATAPI_READ_TRACK_INFORMATION, true);
    33703302            break;
    33713303        case SCSI_GET_CONFIGURATION:
    33723304            /* No media change stuff here, it can confuse Linux guests. */
    3373             cbMax = ataBE2H_U16(pbPacket + 7);
     3305            cbMax = scsiBE2H_U16(pbPacket + 7);
    33743306            ataR3StartTransfer(s, RT_MIN(cbMax, 80), PDMMEDIATXDIR_FROM_DEVICE, ATAFN_BT_ATAPI_CMD, ATAFN_SS_ATAPI_GET_CONFIGURATION, true);
    33753307            break;
    33763308        case SCSI_INQUIRY:
    3377             cbMax = ataBE2H_U16(pbPacket + 3);
     3309            cbMax = scsiBE2H_U16(pbPacket + 3);
    33783310            ataR3StartTransfer(s, RT_MIN(cbMax, 36), PDMMEDIATXDIR_FROM_DEVICE, ATAFN_BT_ATAPI_CMD, ATAFN_SS_ATAPI_INQUIRY, true);
    33793311            break;
    33803312        case SCSI_READ_DVD_STRUCTURE:
    33813313        {
    3382             cbMax = ataBE2H_U16(pbPacket + 8);
     3314            cbMax = scsiBE2H_U16(pbPacket + 8);
    33833315            ataR3StartTransfer(s, RT_MIN(cbMax, 4), PDMMEDIATXDIR_FROM_DEVICE, ATAFN_BT_ATAPI_CMD, ATAFN_SS_ATAPI_READ_DVD_STRUCTURE, true);
    33843316            break;
     
    34113343            goto sendcmd;
    34123344        case SCSI_ERASE_10:
    3413             iATAPILBA = ataBE2H_U32(pbPacket + 2);
    3414             cbTransfer = ataBE2H_U16(pbPacket + 7);
     3345            iATAPILBA = scsiBE2H_U32(pbPacket + 2);
     3346            cbTransfer = scsiBE2H_U16(pbPacket + 7);
    34153347            Log2(("ATAPI PT: lba %d\n", iATAPILBA));
    34163348            uTxDir = PDMMEDIATXDIR_TO_DEVICE;
     
    34213353            goto sendcmd;
    34223354        case SCSI_GET_CONFIGURATION:
    3423             cbTransfer = ataBE2H_U16(pbPacket + 7);
     3355            cbTransfer = scsiBE2H_U16(pbPacket + 7);
    34243356            uTxDir = PDMMEDIATXDIR_FROM_DEVICE;
    34253357            goto sendcmd;
    34263358        case SCSI_GET_EVENT_STATUS_NOTIFICATION:
    3427             cbTransfer = ataBE2H_U16(pbPacket + 7);
     3359            cbTransfer = scsiBE2H_U16(pbPacket + 7);
    34283360            if (ASMAtomicReadU32(&s->MediaEventStatus) != ATA_EVENT_STATUS_UNCHANGED)
    34293361            {
     
    34383370            goto sendcmd;
    34393371        case SCSI_INQUIRY:
    3440             cbTransfer = ataBE2H_U16(pbPacket + 3);
     3372            cbTransfer = scsiBE2H_U16(pbPacket + 3);
    34413373            uTxDir = PDMMEDIATXDIR_FROM_DEVICE;
    34423374            goto sendcmd;
     
    34443376            goto sendcmd;
    34453377        case SCSI_MECHANISM_STATUS:
    3446             cbTransfer = ataBE2H_U16(pbPacket + 8);
     3378            cbTransfer = scsiBE2H_U16(pbPacket + 8);
    34473379            uTxDir = PDMMEDIATXDIR_FROM_DEVICE;
    34483380            goto sendcmd;
    34493381        case SCSI_MODE_SELECT_10:
    3450             cbTransfer = ataBE2H_U16(pbPacket + 7);
     3382            cbTransfer = scsiBE2H_U16(pbPacket + 7);
    34513383            uTxDir = PDMMEDIATXDIR_TO_DEVICE;
    34523384            goto sendcmd;
    34533385        case SCSI_MODE_SENSE_10:
    3454             cbTransfer = ataBE2H_U16(pbPacket + 7);
     3386            cbTransfer = scsiBE2H_U16(pbPacket + 7);
    34553387            uTxDir = PDMMEDIATXDIR_FROM_DEVICE;
    34563388            goto sendcmd;
     
    34673399            goto sendcmd;
    34683400        case SCSI_READ_10:
    3469             iATAPILBA = ataBE2H_U32(pbPacket + 2);
    3470             cSectors = ataBE2H_U16(pbPacket + 7);
     3401            iATAPILBA = scsiBE2H_U32(pbPacket + 2);
     3402            cSectors = scsiBE2H_U16(pbPacket + 7);
    34713403            Log2(("ATAPI PT: lba %d sectors %d\n", iATAPILBA, cSectors));
    34723404            s->cbATAPISector = 2048;
     
    34753407            goto sendcmd;
    34763408        case SCSI_READ_12:
    3477             iATAPILBA = ataBE2H_U32(pbPacket + 2);
    3478             cSectors = ataBE2H_U32(pbPacket + 6);
     3409            iATAPILBA = scsiBE2H_U32(pbPacket + 2);
     3410            cSectors = scsiBE2H_U32(pbPacket + 6);
    34793411            Log2(("ATAPI PT: lba %d sectors %d\n", iATAPILBA, cSectors));
    34803412            s->cbATAPISector = 2048;
     
    34833415            goto sendcmd;
    34843416        case SCSI_READ_BUFFER:
    3485             cbTransfer = ataBE2H_U24(pbPacket + 6);
     3417            cbTransfer = scsiBE2H_U24(pbPacket + 6);
    34863418            uTxDir = PDMMEDIATXDIR_FROM_DEVICE;
    34873419            goto sendcmd;
    34883420        case SCSI_READ_BUFFER_CAPACITY:
    3489             cbTransfer = ataBE2H_U16(pbPacket + 7);
     3421            cbTransfer = scsiBE2H_U16(pbPacket + 7);
    34903422            uTxDir = PDMMEDIATXDIR_FROM_DEVICE;
    34913423            goto sendcmd;
     
    35053437
    35063438                    if (pbPacket[0] == SCSI_READ_CD)
    3507                         iLbaStart = ataBE2H_U32(&pbPacket[2]);
     3439                        iLbaStart = scsiBE2H_U32(&pbPacket[2]);
    35083440                    else
    3509                         iLbaStart = ataMSF2LBA(&pbPacket[3]);
     3441                        iLbaStart = scsiMSF2LBA(&pbPacket[3]);
    35103442
    35113443                    if (s->pTrackList)
     
    35363468
    35373469            if (pbPacket[0] == SCSI_READ_CD)
    3538                 cbTransfer = ataBE2H_U24(pbPacket + 6) * s->cbATAPISector;
     3470                cbTransfer = scsiBE2H_U24(pbPacket + 6) * s->cbATAPISector;
    35393471            else /* SCSI_READ_MSF */
    35403472            {
    3541                 cSectors = ataMSF2LBA(pbPacket + 6) - ataMSF2LBA(pbPacket + 3);
     3473                cSectors = scsiMSF2LBA(pbPacket + 6) - scsiMSF2LBA(pbPacket + 3);
    35423474                if (cSectors > 32)
    35433475                    cSectors = 32; /* Limit transfer size to 64~74K. Safety first. In any case this can only harm software doing CDDA extraction. */
     
    35483480        }
    35493481        case SCSI_READ_DISC_INFORMATION:
    3550             cbTransfer = ataBE2H_U16(pbPacket + 7);
     3482            cbTransfer = scsiBE2H_U16(pbPacket + 7);
    35513483            uTxDir = PDMMEDIATXDIR_FROM_DEVICE;
    35523484            goto sendcmd;
    35533485        case SCSI_READ_DVD_STRUCTURE:
    3554             cbTransfer = ataBE2H_U16(pbPacket + 8);
     3486            cbTransfer = scsiBE2H_U16(pbPacket + 8);
    35553487            uTxDir = PDMMEDIATXDIR_FROM_DEVICE;
    35563488            goto sendcmd;
    35573489        case SCSI_READ_FORMAT_CAPACITIES:
    3558             cbTransfer = ataBE2H_U16(pbPacket + 7);
     3490            cbTransfer = scsiBE2H_U16(pbPacket + 7);
    35593491            uTxDir = PDMMEDIATXDIR_FROM_DEVICE;
    35603492            goto sendcmd;
    35613493        case SCSI_READ_SUBCHANNEL:
    3562             cbTransfer = ataBE2H_U16(pbPacket + 7);
     3494            cbTransfer = scsiBE2H_U16(pbPacket + 7);
    35633495            uTxDir = PDMMEDIATXDIR_FROM_DEVICE;
    35643496            goto sendcmd;
    35653497        case SCSI_READ_TOC_PMA_ATIP:
    3566             cbTransfer = ataBE2H_U16(pbPacket + 7);
     3498            cbTransfer = scsiBE2H_U16(pbPacket + 7);
    35673499            uTxDir = PDMMEDIATXDIR_FROM_DEVICE;
    35683500            goto sendcmd;
    35693501        case SCSI_READ_TRACK_INFORMATION:
    3570             cbTransfer = ataBE2H_U16(pbPacket + 7);
     3502            cbTransfer = scsiBE2H_U16(pbPacket + 7);
    35713503            uTxDir = PDMMEDIATXDIR_FROM_DEVICE;
    35723504            goto sendcmd;
     
    35743506            goto sendcmd;
    35753507        case SCSI_REPORT_KEY:
    3576             cbTransfer = ataBE2H_U16(pbPacket + 8);
     3508            cbTransfer = scsiBE2H_U16(pbPacket + 8);
    35773509            uTxDir = PDMMEDIATXDIR_FROM_DEVICE;
    35783510            goto sendcmd;
     
    35933525            goto sendcmd;
    35943526        case SCSI_SEND_CUE_SHEET:
    3595             cbTransfer = ataBE2H_U24(pbPacket + 6);
     3527            cbTransfer = scsiBE2H_U24(pbPacket + 6);
    35963528            uTxDir = PDMMEDIATXDIR_TO_DEVICE;
    35973529            goto sendcmd;
    35983530        case SCSI_SEND_DVD_STRUCTURE:
    3599             cbTransfer = ataBE2H_U16(pbPacket + 8);
     3531            cbTransfer = scsiBE2H_U16(pbPacket + 8);
    36003532            uTxDir = PDMMEDIATXDIR_TO_DEVICE;
    36013533            goto sendcmd;
    36023534        case SCSI_SEND_EVENT:
    3603             cbTransfer = ataBE2H_U16(pbPacket + 8);
     3535            cbTransfer = scsiBE2H_U16(pbPacket + 8);
    36043536            uTxDir = PDMMEDIATXDIR_TO_DEVICE;
    36053537            goto sendcmd;
    36063538        case SCSI_SEND_KEY:
    3607             cbTransfer = ataBE2H_U16(pbPacket + 8);
     3539            cbTransfer = scsiBE2H_U16(pbPacket + 8);
    36083540            uTxDir = PDMMEDIATXDIR_TO_DEVICE;
    36093541            goto sendcmd;
    36103542        case SCSI_SEND_OPC_INFORMATION:
    3611             cbTransfer = ataBE2H_U16(pbPacket + 7);
     3543            cbTransfer = scsiBE2H_U16(pbPacket + 7);
    36123544            uTxDir = PDMMEDIATXDIR_TO_DEVICE;
    36133545            goto sendcmd;
     
    36173549            goto sendcmd;
    36183550        case SCSI_SET_STREAMING:
    3619             cbTransfer = ataBE2H_U16(pbPacket + 9);
     3551            cbTransfer = scsiBE2H_U16(pbPacket + 9);
    36203552            uTxDir = PDMMEDIATXDIR_TO_DEVICE;
    36213553            goto sendcmd;
     
    36323564        case SCSI_WRITE_10:
    36333565        case SCSI_WRITE_AND_VERIFY_10:
    3634             iATAPILBA = ataBE2H_U32(pbPacket + 2);
    3635             cSectors = ataBE2H_U16(pbPacket + 7);
     3566            iATAPILBA = scsiBE2H_U32(pbPacket + 2);
     3567            cSectors = scsiBE2H_U16(pbPacket + 7);
    36363568            if (s->pTrackList)
    36373569                s->cbATAPISector = ATAPIPassthroughTrackListGetSectorSizeFromLba(s->pTrackList, iATAPILBA);
     
    36433575            goto sendcmd;
    36443576        case SCSI_WRITE_12:
    3645             iATAPILBA = ataBE2H_U32(pbPacket + 2);
    3646             cSectors = ataBE2H_U32(pbPacket + 6);
     3577            iATAPILBA = scsiBE2H_U32(pbPacket + 2);
     3578            cSectors = scsiBE2H_U32(pbPacket + 6);
    36473579            if (s->pTrackList)
    36483580                s->cbATAPISector = ATAPIPassthroughTrackListGetSectorSizeFromLba(s->pTrackList, iATAPILBA);
     
    36663598                    break;
    36673599                default:
    3668                     cbTransfer = ataBE2H_U16(pbPacket + 6);
     3600                    cbTransfer = scsiBE2H_U16(pbPacket + 6);
    36693601                    uTxDir = PDMMEDIATXDIR_TO_DEVICE;
    36703602                    goto sendcmd;
     
    36723604            break;
    36733605        case SCSI_REPORT_LUNS: /* Not part of MMC-3, but used by Windows. */
    3674             cbTransfer = ataBE2H_U32(pbPacket + 6);
     3606            cbTransfer = scsiBE2H_U32(pbPacket + 6);
    36753607            uTxDir = PDMMEDIATXDIR_FROM_DEVICE;
    36763608            goto sendcmd;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette