Ignore:
Timestamp:
Nov 29, 2016, 5:30:22 AM (9 years ago)
Author:
David Azarewicz
Message:

Major reorganization

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/os2ahci/atapi.c

    r155 r178  
    44 * Copyright (c) 2011 thi.guten Software Development
    55 * Copyright (c) 2011 Mensys B.V.
     6 * Copyright (c) 2013-2016 David Azarewicz
    67 *
    78 * Authors: Christian Mueller, Markus Thielen
     
    3839/* -------------------------- function prototypes -------------------------- */
    3940
    40 static void atapi_req_sense_pp      (IORBH _far *iorb);
    41 static int atapi_pad_cdb            (u8 _far *cmd_in, u16 cmd_in_len,
    42                                      u8 _far *cmd_out, u16 _far *cmd_out_len);
     41static void atapi_req_sense_pp(IORBH FAR16DATA *vIorb, IORBH *pIorb);
     42static int atapi_pad_cdb(u8 *cmd_in, u16 cmd_in_len, u8 *cmd_out, u16 *cmd_out_len);
    4343
    4444/* ------------------------ global/static variables ------------------------ */
     
    4949 * Get device or media geometry. This function is not expected to be called.
    5050 */
    51 int atapi_get_geometry(IORBH _far *iorb, int slot)
    52 {
    53   dprintf("atapi_get_geometry called\n");
    54   iorb_seterr(iorb, IOERR_CMD_NOT_SUPPORTED);
     51int atapi_get_geometry(IORBH FAR16DATA *vIorb, IORBH *pIorb, int slot)
     52{
     53  DPRINTF(2,"atapi_get_geometry called\n");
     54  iorb_seterr(pIorb, IOERR_CMD_NOT_SUPPORTED);
    5555  return(-1);
    5656}
     
    5959 * Test whether unit is ready. This function is not expected to be called.
    6060 */
    61 int atapi_unit_ready(IORBH _far *iorb, int slot)
    62 {
    63   dprintf("atapi_unit_ready called\n");
    64   iorb_seterr(iorb, IOERR_CMD_NOT_SUPPORTED);
     61int atapi_unit_ready(IORBH FAR16DATA *vIorb, IORBH *pIorb, int slot)
     62{
     63  DPRINTF(2,"atapi_unit_ready called\n");
     64  iorb_seterr(pIorb, IOERR_CMD_NOT_SUPPORTED);
    6565  return(-1);
    6666}
     
    6969 * Read sectors from AHCI device.
    7070 */
    71 int atapi_read(IORBH _far *iorb, int slot)
    72 {
    73   IORB_EXECUTEIO _far *io = (IORB_EXECUTEIO _far *) iorb;
     71int atapi_read(IORBH FAR16DATA *vIorb, IORBH *pIorb, int slot)
     72{
     73  IORB_EXECUTEIO *io = (IORB_EXECUTEIO *)pIorb;
     74  SCATGATENTRY *pSGList = (SCATGATENTRY*)Far16ToFlat(io->pSGList);
    7475  ATAPI_CDB_12 cdb;
    75   AD_INFO *ai = ad_infos + iorb_unit_adapter(iorb);
     76  AD_INFO *ai = ad_infos + iorb_unit_adapter(pIorb);
    7677  USHORT count = io->BlockCount - io->BlocksXferred;
    7778  USHORT sg_indx;
    7879  USHORT sg_cnt;
    79   int p = iorb_unit_port(iorb);
    80   int d = iorb_unit_device(iorb);
     80  int p = iorb_unit_port(pIorb);
     81  int d = iorb_unit_device(pIorb);
    8182  int rc;
    8283
    83   if (io->BlockCount == 0) {
     84  if (io->BlockCount == 0)
     85  {
    8486    /* NOP; return -1 without error in IORB to indicate success */
    8587    return(-1);
    8688  }
    8789
    88   if (add_workspace(iorb)->unaligned) {
     90  if (add_workspace(pIorb)->unaligned)
     91  {
    8992    /* unaligned S/G addresses present; need to use double buffers */
    90     return(atapi_read_unaligned(iorb, slot));
     93    return(atapi_read_unaligned(pIorb, slot));
    9194  }
    9295
     
    101104  do {
    102105    /* update sector count (might have been updated due to S/G limitations) */
    103     SET_CDB_32(cdb.trans_len, (u32) count);
     106    SET_CDB_32(cdb.trans_len, count);
    104107
    105108    /* update S/G count and index */
     
    109112    /* issue command */
    110113    rc = ata_cmd(ai, p, d, slot, ATA_CMD_PACKET,
    111                  AP_ATAPI_CMD, (void _far *) &cdb, sizeof(cdb),
    112                  AP_SGLIST,    io->pSGList + sg_indx, (u16) sg_cnt,
     114                 AP_ATAPI_CMD, (void *) &cdb, sizeof(cdb),
     115                 AP_SGLIST,    pSGList + sg_indx, sg_cnt,
    113116                 AP_DEVICE,    0x40,
    114117                 AP_FEATURES,  ATAPI_FEAT_DMA | ATAPI_FEAT_DMA_TO_HOST,
    115118                 AP_END);
    116119
    117     if (rc > 0) {
     120    if (rc > 0)
     121    {
    118122      /* couldn't map all S/G elements */
    119123      ata_max_sg_cnt(io, sg_indx, (USHORT) rc, &sg_cnt, &count);
     
    121125  } while (rc > 0 && sg_cnt > 0);
    122126
    123   if (rc == 0) {
    124     add_workspace(iorb)->blocks = count;
    125     add_workspace(iorb)->ppfunc = ata_read_pp;
    126 
    127   } else if (rc > 0) {
    128     iorb_seterr(iorb, IOERR_CMD_SGLIST_BAD);
    129 
    130   } else if (rc == ATA_CMD_UNALIGNED_ADDR) {
     127  if (rc == 0)
     128  {
     129    add_workspace(pIorb)->blocks = count;
     130    add_workspace(pIorb)->ppfunc = ata_read_pp;
     131  }
     132  else if (rc > 0)
     133  {
     134    iorb_seterr(pIorb, IOERR_CMD_SGLIST_BAD);
     135  }
     136  else if (rc == ATA_CMD_UNALIGNED_ADDR)
     137  {
    131138    /* unaligned S/G addresses detected; need to use double buffers */
    132     add_workspace(iorb)->unaligned = 1;
    133     return(atapi_read_unaligned(iorb, slot));
    134 
    135   } else {
    136     iorb_seterr(iorb, IOERR_CMD_ADD_SOFTWARE_FAILURE);
     139    add_workspace(pIorb)->unaligned = 1;
     140    return(atapi_read_unaligned(pIorb, slot));
     141  }
     142  else
     143  {
     144    iorb_seterr(pIorb, IOERR_CMD_ADD_SOFTWARE_FAILURE);
    137145  }
    138146
     
    146154 * use a transfer buffer and copy the data manually.
    147155 */
    148 int atapi_read_unaligned(IORBH _far *iorb, int slot)
    149 {
    150   IORB_EXECUTEIO _far *io = (IORB_EXECUTEIO _far *) iorb;
    151   ADD_WORKSPACE _far *aws = add_workspace(iorb);
     156int atapi_read_unaligned(IORBH *pIorb, int slot)
     157{
     158  IORB_EXECUTEIO *io = (IORB_EXECUTEIO *)pIorb;
     159  ADD_WORKSPACE *aws = add_workspace(pIorb);
    152160  ATAPI_CDB_12 cdb;
    153   AD_INFO *ai = ad_infos + iorb_unit_adapter(iorb);
    154   int p = iorb_unit_port(iorb);
    155   int d = iorb_unit_device(iorb);
     161  AD_INFO *ai = ad_infos + iorb_unit_adapter(pIorb);
     162  int p = iorb_unit_port(pIorb);
     163  int d = iorb_unit_device(pIorb);
    156164  int rc;
    157165
     
    166174
    167175  /* allocate transfer buffer */
    168   if ((aws->buf = malloc(io->BlockSize)) == NULL) {
    169     iorb_seterr(iorb, IOERR_CMD_SW_RESOURCE);
     176  if ((aws->buf = MemAlloc(io->BlockSize)) == NULL)
     177  {
     178    iorb_seterr(pIorb, IOERR_CMD_SW_RESOURCE);
    170179    return(-1);
    171180  }
    172181
    173182  rc = ata_cmd(ai, p, d, slot, ATA_CMD_PACKET,
    174                AP_ATAPI_CMD, (void _far *) &cdb, sizeof(cdb),
    175                AP_VADDR,     (void _far *) aws->buf, (u16) io->BlockSize,
     183               AP_ATAPI_CMD, (void *) &cdb, sizeof(cdb),
     184               AP_VADDR,     (void *) aws->buf, io->BlockSize,
    176185               AP_DEVICE,    0x40,
    177186               AP_FEATURES,  ATAPI_FEAT_DMA | ATAPI_FEAT_DMA_TO_HOST,
    178187               AP_END);
    179188
    180   if (rc == 0) {
    181     add_workspace(iorb)->blocks = 1;
    182     add_workspace(iorb)->ppfunc = ata_read_pp;
    183 
    184   } else if (rc > 0) {
    185     iorb_seterr(iorb, IOERR_CMD_SGLIST_BAD);
    186 
    187   } else {
    188     iorb_seterr(iorb, IOERR_CMD_ADD_SOFTWARE_FAILURE);
     189  if (rc == 0)
     190  {
     191    add_workspace(pIorb)->blocks = 1;
     192    add_workspace(pIorb)->ppfunc = ata_read_pp;
     193
     194  }
     195  else if (rc > 0)
     196  {
     197    iorb_seterr(pIorb, IOERR_CMD_SGLIST_BAD);
     198
     199  }
     200  else
     201  {
     202    iorb_seterr(pIorb, IOERR_CMD_ADD_SOFTWARE_FAILURE);
    189203  }
    190204
     
    196210 * to be called.
    197211 */
    198 int atapi_verify(IORBH _far *iorb, int slot)
    199 {
    200   ddprintf("atapi_verify called\n");
    201   iorb_seterr(iorb, IOERR_CMD_NOT_SUPPORTED);
     212int atapi_verify(IORBH FAR16DATA *vIorb, IORBH *pIorb, int slot)
     213{
     214  DPRINTF(3,"atapi_verify called\n");
     215  iorb_seterr(pIorb, IOERR_CMD_NOT_SUPPORTED);
    202216  return(-1);
    203217}
     
    206220 * Write sectors to AHCI device. This function is not expected to be called.
    207221 */
    208 int atapi_write(IORBH _far *iorb, int slot)
    209 {
    210   ddprintf("atapi_write called\n");
    211   iorb_seterr(iorb, IOERR_CMD_NOT_SUPPORTED);
     222int atapi_write(IORBH FAR16DATA *vIorb, IORBH *pIorb, int slot)
     223{
     224  DPRINTF(3,"atapi_write called\n");
     225  iorb_seterr(pIorb, IOERR_CMD_NOT_SUPPORTED);
    212226  return(-1);
    213227}
     
    216230 * Execute ATAPI command.
    217231 */
    218 int atapi_execute_cdb(IORBH _far *iorb, int slot)
    219 {
    220   IORB_ADAPTER_PASSTHRU _far *pt = (IORB_ADAPTER_PASSTHRU _far *) iorb;
     232int atapi_execute_cdb(IORBH FAR16DATA *vIorb, IORBH *pIorb, int slot)
     233{
     234  IORB_ADAPTER_PASSTHRU *pt = (IORB_ADAPTER_PASSTHRU *)pIorb;
     235  SCATGATENTRY *pSGList = (SCATGATENTRY*)Far16ToFlat(pt->pSGList);
    221236  int rc;
    222237  u8 cdb[ATAPI_MAX_CDB_LEN];
    223238  u16 cdb_len;
    224239
    225   if (pt->ControllerCmdLen > ATAPI_MAX_CDB_LEN) {
    226     iorb_seterr(iorb, IOERR_CMD_SYNTAX);
     240  if (pt->ControllerCmdLen > ATAPI_MAX_CDB_LEN)
     241  {
     242    iorb_seterr(pIorb, IOERR_CMD_SYNTAX);
    227243    return -1;
    228244  }
    229245  /* AHCI requires 12 or 16 byte commands */
    230   atapi_pad_cdb(pt->pControllerCmd, pt->ControllerCmdLen,
    231                 (u8 _far *) cdb, (u16 _far *) &cdb_len);
    232 
    233   if (cdb[0] == 0x12 || cdb[0] == 0x5a) {
     246  atapi_pad_cdb(Far16ToFlat(pt->pControllerCmd), pt->ControllerCmdLen,
     247                (u8 *) cdb, (u16 *) &cdb_len);
     248
     249  if (cdb[0] == 0x12 || cdb[0] == 0x5a)
     250  {
    234251    /* somebody sets the direction flag incorrectly for those commands */
    235252    pt->Flags |= PT_DIRECTION_IN;
     
    240257   * mechanism:" -- Storage Device Driver Reference, Scatter/Gather Lists
    241258   */
    242   rc = ata_cmd(ad_infos + iorb_unit_adapter(iorb), iorb_unit_port(iorb),
    243                iorb_unit_device(iorb), slot, ATA_CMD_PACKET,
    244                AP_ATAPI_CMD, (void _far *) cdb, cdb_len,
    245                AP_SGLIST, pt->pSGList, pt->cSGList,
     259  rc = ata_cmd(ad_infos + iorb_unit_adapter(pIorb), iorb_unit_port(pIorb),
     260               iorb_unit_device(pIorb), slot, ATA_CMD_PACKET,
     261               AP_ATAPI_CMD, (void *)cdb, cdb_len,
     262               AP_SGLIST, pSGList, pt->cSGList,
    246263               AP_WRITE, !(pt->Flags & PT_DIRECTION_IN),
    247264               AP_FEATURES, ATAPI_FEAT_DMA,
     
    249266               AP_END);
    250267
    251   if (rc) {
    252     iorb_seterr(iorb, IOERR_DEVICE_NONSPECIFIC);
     268  if (rc)
     269  {
     270    iorb_seterr(pIorb, IOERR_DEVICE_NONSPECIFIC);
    253271  }
    254272
     
    266284 *
    267285 */
    268 int atapi_req_sense(IORBH _far *iorb, int slot)
    269 {
    270   SCSI_STATUS_BLOCK _far *ssb;
    271   ADD_WORKSPACE _far *aws = add_workspace(iorb);
     286int atapi_req_sense(IORBH FAR16DATA *vIorb, IORBH *pIorb, int slot)
     287{
     288  SCSI_STATUS_BLOCK *ssb;
     289  ADD_WORKSPACE *aws = add_workspace(pIorb);
    272290  int rc;
    273291  u8 cdb[ATAPI_MIN_CDB_LEN];
    274   ATAPI_CDB_6 _far *pcdb = (ATAPI_CDB_6 _far *) cdb;
     292  ATAPI_CDB_6 *pcdb = (ATAPI_CDB_6 *) cdb;
    275293  size_t sense_buf_len = ATAPI_SENSE_LEN;
    276294
    277   dprintf("atapi_req_sense\n");
    278 
    279   if ((iorb->RequestControl & IORB_REQ_STATUSBLOCK) &&
    280       iorb->StatusBlockLen >= sizeof(*ssb) && iorb->pStatusBlock != 0) {
     295  DPRINTF(2,"atapi_req_sense\n");
     296
     297  if ((pIorb->RequestControl & IORB_REQ_STATUSBLOCK) &&
     298      pIorb->StatusBlockLen >= sizeof(*ssb) && pIorb->pStatusBlock != 0)
     299  {
     300    ULONG ulTmp;
     301
     302    ulTmp = (CastFar16ToULONG(vIorb) & 0xffff0000) + pIorb->pStatusBlock;
     303    ssb = (SCSI_STATUS_BLOCK *)Far16ToFlat(CastULONGToFar16(ulTmp));
    281304
    282305    /* don't request sense data if caller asked us not to; the flag
    283306     * STATUS_DISABLE_REQEST_SENSE is not defined in the old DDK we've been
    284307     * using so we'll use the hard-coded value (0x0008) */
    285     ssb = (SCSI_STATUS_BLOCK _far *) (((u32) iorb & 0xffff0000U) +
    286                                        (u16) iorb->pStatusBlock);
    287     if (ssb->Flags & 0x0008U) {
    288       iorb_seterr(iorb, IOERR_DEVICE_NONSPECIFIC);
     308    if (ssb->Flags & 0x0008U)
     309    {
     310      iorb_seterr(pIorb, IOERR_DEVICE_NONSPECIFIC);
    289311      return(-1);
    290312    }
     
    292314    /* if the sense buffer requested is larger than our default, adjust
    293315     * the length accordingly to satisfy the caller's requirements. */
    294     if (ssb->SenseData != NULL && ssb->ReqSenseLen > sense_buf_len) {
     316    if (ssb->SenseData != NULL && ssb->ReqSenseLen > sense_buf_len)
     317    {
    295318      sense_buf_len = ssb->ReqSenseLen;
    296319    }
     
    298321
    299322  /* allocate sense buffer in ADD workspace */
    300   if ((aws->buf = malloc(sense_buf_len)) == NULL) {
    301     iorb_seterr(iorb, IOERR_CMD_SW_RESOURCE);
     323  if ((aws->buf = MemAlloc(sense_buf_len)) == NULL)
     324  {
     325    iorb_seterr(pIorb, IOERR_CMD_SW_RESOURCE);
    302326    return(-1);
    303327  }
     
    310334
    311335  aws->ppfunc = atapi_req_sense_pp;
    312   rc = ata_cmd(ad_infos + iorb_unit_adapter(iorb),
    313                iorb_unit_port(iorb),
    314                iorb_unit_device(iorb),
     336  rc = ata_cmd(ad_infos + iorb_unit_adapter(pIorb),
     337               iorb_unit_port(pIorb),
     338               iorb_unit_device(pIorb),
    315339               slot,
    316340               ATA_CMD_PACKET,
    317                AP_ATAPI_CMD, (void _far*) cdb, sizeof(cdb),
    318                AP_VADDR, (void _far *) aws->buf, sense_buf_len,
     341               AP_ATAPI_CMD, (void *)cdb, sizeof(cdb),
     342               AP_VADDR, (void *)aws->buf, sense_buf_len,
    319343               AP_FEATURES,  ATAPI_FEAT_DMA,
    320344               AP_END);
    321345
    322   if (rc > 0) {
    323     iorb_seterr(iorb, IOERR_CMD_SGLIST_BAD);
    324 
    325   } else if (rc < 0) {
     346  if (rc > 0)
     347  {
     348    iorb_seterr(pIorb, IOERR_CMD_SGLIST_BAD);
     349  }
     350  else if (rc < 0)
     351  {
    326352    /* we failed to get info about an error -> return
    327353     * non specific device error
    328354     */
    329     iorb_seterr(iorb, IOERR_DEVICE_NONSPECIFIC);
     355    iorb_seterr(pIorb, IOERR_DEVICE_NONSPECIFIC);
    330356  }
    331357
     
    337363 * data returned and maps sense info to IORB error info.
    338364 */
    339 static void atapi_req_sense_pp(IORBH _far *iorb)
    340 {
    341   SCSI_STATUS_BLOCK _far *ssb;
    342   ADD_WORKSPACE _far *aws = add_workspace(iorb);
     365static void atapi_req_sense_pp(IORBH FAR16DATA *vIorb, IORBH *pIorb)
     366{
     367  SCSI_STATUS_BLOCK *ssb;
     368  ADD_WORKSPACE *aws = add_workspace(pIorb);
    343369  ATAPI_SENSE_DATA *psd = (ATAPI_SENSE_DATA *) aws->buf;
    344370
    345   dphex(psd, sizeof(*psd), "sense buffer:\n");
    346 
    347   if ((iorb->RequestControl & IORB_REQ_STATUSBLOCK) &&
    348       iorb->StatusBlockLen >= sizeof(*ssb) && iorb->pStatusBlock != 0) {
     371  DHEXDUMP(0,psd, sizeof(*psd), "sense buffer:\n");
     372
     373  if ((pIorb->RequestControl & IORB_REQ_STATUSBLOCK) &&
     374      pIorb->StatusBlockLen >= sizeof(*ssb) && pIorb->pStatusBlock != 0)
     375  {
     376    ULONG ulTmp;
    349377
    350378    /* copy sense data to IORB */
    351     ssb = (SCSI_STATUS_BLOCK _far *) (((u32) iorb & 0xffff0000U) +
    352                                        (u16) iorb->pStatusBlock);
     379    ulTmp = (CastFar16ToULONG(vIorb) & 0xffff0000) + pIorb->pStatusBlock;
     380    ssb = (SCSI_STATUS_BLOCK *)Far16ToFlat(CastULONGToFar16(ulTmp));
    353381    ssb->AdapterErrorCode = 0;
    354382    ssb->TargetStatus = SCSI_STAT_CHECKCOND;
     
    356384    memset(ssb->AdapterDiagInfo, 0x00, sizeof(ssb->AdapterDiagInfo));
    357385
    358     if (ssb->SenseData != NULL) {
     386    if (ssb->SenseData != NULL)
     387    {
    359388      memcpy(ssb->SenseData, psd, ssb->ReqSenseLen);
    360389      ssb->Flags |= STATUS_SENSEDATA_VALID;
    361390    }
    362     iorb->Status |= IORB_STATUSBLOCK_AVAIL;
     391    pIorb->Status |= IORB_STATUSBLOCK_AVAIL;
    363392  }
    364393
    365394  /* map sense data to some IOERR_ value */
    366   switch (ATAPI_GET_SENSE(psd)) {
    367 
     395  switch (ATAPI_GET_SENSE(psd))
     396  {
    368397  case ASENSE_NO_SENSE:
    369398  case ASENSE_RECOVERED_ERROR:
    370399    /* no error; this shouldn't happen because we'll only call
    371400     * atapi_req_sense() if we received an error interrupt */
    372     iorb_seterr(iorb, IOERR_DEVICE_NONSPECIFIC);
     401    iorb_seterr(pIorb, IOERR_DEVICE_NONSPECIFIC);
    373402    break;
    374403
    375404  case ASENSE_NOT_READY:
    376     iorb_seterr(iorb, IOERR_UNIT_NOT_READY);
     405    iorb_seterr(pIorb, IOERR_UNIT_NOT_READY);
    377406    break;
    378407
    379408  case ASENSE_UNIT_ATTENTION:
    380     iorb_seterr(iorb, IOERR_MEDIA_CHANGED);
     409    iorb_seterr(pIorb, IOERR_MEDIA_CHANGED);
    381410    break;
    382411
    383412  case ASENSE_MEDIUM_ERROR:
    384     iorb_seterr(iorb, IOERR_MEDIA);
     413    iorb_seterr(pIorb, IOERR_MEDIA);
    385414    break;
    386415
    387416  case ASENSE_ILLEGAL_REQUEST:
    388     iorb_seterr(iorb, IOERR_CMD_SYNTAX);
     417    iorb_seterr(pIorb, IOERR_CMD_SYNTAX);
    389418    break;
    390419
    391420  case ASENSE_DATA_PROTECT:
    392     iorb_seterr(iorb, IOERR_MEDIA_WRITE_PROTECT);
     421    iorb_seterr(pIorb, IOERR_MEDIA_WRITE_PROTECT);
    393422    break;
    394423
    395424  case ASENSE_BLANK_CHECK:
    396     iorb_seterr(iorb, IOERR_MEDIA_NOT_FORMATTED);
     425    iorb_seterr(pIorb, IOERR_MEDIA_NOT_FORMATTED);
    397426    break;
    398427
    399428  case ASENSE_ABORTED_COMMAND:
    400429  case ASENSE_COPY_ABORTED:
    401     iorb_seterr(iorb, IOERR_CMD_ABORTED);
     430    iorb_seterr(pIorb, IOERR_CMD_ABORTED);
    402431    break;
    403432
    404433  default:
    405     iorb_seterr(iorb, IOERR_DEVICE_NONSPECIFIC);
     434    iorb_seterr(pIorb, IOERR_DEVICE_NONSPECIFIC);
    406435    break;
    407436  }
     
    418447 * returns 0 on success, != 0 if the command can't be converted.
    419448 */
    420 int atapi_pad_cdb(u8 _far *cmd_in, u16 cmd_in_len,
    421                   u8 _far *cmd_out, u16 _far *cmd_out_len)
    422 {
    423   ATAPI_CDB_12 _far *p12;
     449int atapi_pad_cdb(u8 *cmd_in, u16 cmd_in_len, u8 *cmd_out, u16 *cmd_out_len)
     450{
     451  ATAPI_CDB_12 *p12;
    424452  u32 tmp;
    425453
    426   if (cmd_in_len == ATAPI_MIN_CDB_LEN || cmd_in_len == ATAPI_MAX_CDB_LEN) {
     454  if (cmd_in_len == ATAPI_MIN_CDB_LEN || cmd_in_len == ATAPI_MAX_CDB_LEN)
     455  {
    427456    /* command does not need to be converted */
    428457    memcpy(cmd_out, cmd_in, cmd_in_len);
     
    432461
    433462  memset(cmd_out, 0x00, ATAPI_MAX_CDB_LEN);
    434   p12 = (ATAPI_CDB_12 _far *) cmd_out;
     463  p12 = (ATAPI_CDB_12 *) cmd_out;
    435464  /* we always convert to 12 byte CDBs */
    436465  *cmd_out_len = ATAPI_MIN_CDB_LEN;
    437466
    438467  /* check if command can be converted */
    439   switch (cmd_in[0]) {
    440 
     468  switch (cmd_in[0])
     469  {
    441470  case ATAPI_CMD_READ_6:
    442471  case ATAPI_CMD_WRITE_6:
     
    446475    tmp = GET_CDB_24(cmd_in + 1) & 0x1fffffUL;
    447476    SET_CDB_32(p12->lba, tmp);
    448     SET_CDB_32(p12->trans_len, (u32)(cmd_in[4]));
     477    SET_CDB_32(p12->trans_len, (cmd_in[4]));
    449478    p12->control = cmd_in[5];
    450479    break;
Note: See TracChangeset for help on using the changeset viewer.