~ubuntu-branches/ubuntu/vivid/virtualbox-ose/vivid

« back to all changes in this revision

Viewing changes to src/VBox/Devices/Storage/DrvSCSI.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2009-10-13 23:06:00 UTC
  • mfrom: (0.3.2 upstream) (0.1.12 sid)
  • Revision ID: james.westby@ubuntu.com-20091013230600-xhu2pwizq0wo63l9
Tags: 3.0.8-dfsg-1ubuntu1
* Merge from debian unstable (LP: #444812), remaining changes:
  - Enable DKMS support on virtualbox host and guest modules (LP: #267097)
    - Drop virtualbox-ose{-guest,}-modules-* package templates
    - Recommend *-source instead of *-modules packages
    - Replace error messages related to missing/mismatched
      kernel module accordingly
  - Autoload kernel module
    - LOAD_VBOXDRV_MODULE=1 in virtualbox-ose.default
  - Disable update action
    - patches/u01-disable-update-action.dpatch
  - Virtualbox should go in Accessories, not in System tools (LP: #288590)
    - virtualbox-ose-qt.files/virtualbox-ose.desktop
  - Add apport hook
    - virtualbox-ose.files/source_virtualbox-ose.py
    - virtualbox-ose.install
  - Add launchpad integration
    - control
    - lpi-bug.xpm
    - patches/u02-lp-integration.dpatch
* Try to remove existing dkms modules before adding the new modules
  (LP: #434503)
  - debian/virtualbox-ose-source.postinst
  - debian/virtualbox-ose-guest-source.postinst
* Don't fail if dkms modules have already been removed
  - debian/virtualbox-ose-source.prerm
  - debian/virtualbox-ose-guest-source.prerm

Show diffs side-by-side

added added

removed removed

Lines of Context:
260
260
    pbBuf[3] = val;
261
261
}
262
262
 
 
263
DECLINLINE(void) drvscsiH2BE_U64(uint8_t *pbBuf, uint64_t val)
 
264
{
 
265
    pbBuf[0] = val >> 56;
 
266
    pbBuf[1] = val >> 48;
 
267
    pbBuf[2] = val >> 40;
 
268
    pbBuf[3] = val >> 32;
 
269
    pbBuf[4] = val >> 24;
 
270
    pbBuf[5] = val >> 16;
 
271
    pbBuf[6] = val >> 8;
 
272
    pbBuf[7] = val;
 
273
}
263
274
 
264
275
DECLINLINE(uint16_t) drvscsiBE2H_U16(const uint8_t *pbBuf)
265
276
{
446
457
                    {
447
458
                        iTxDir = PDMBLOCKTXDIR_FROM_DEVICE;
448
459
                        *puOffset = drvscsiBE2H_U64(&pRequest->pbCDB[2]) * 512;
449
 
                        *pcbToTransfer = ((uint32_t)drvscsiBE2H_U32(&pRequest->pbCDB[6])) * 512;
 
460
                        *pcbToTransfer = ((uint32_t)drvscsiBE2H_U32(&pRequest->pbCDB[10])) * 512;
450
461
                        break;
451
462
                    }
452
463
                    case SCSI_WRITE_6:
476
487
                    {
477
488
                        iTxDir = PDMBLOCKTXDIR_TO_DEVICE;
478
489
                        *puOffset = drvscsiBE2H_U64(&pRequest->pbCDB[2]) * 512;
479
 
                        *pcbToTransfer = ((uint32_t)drvscsiBE2H_U32(&pRequest->pbCDB[6])) * 512;
 
490
                        *pcbToTransfer = ((uint32_t)drvscsiBE2H_U32(&pRequest->pbCDB[10])) * 512;
480
491
                        break;
481
492
                    }
482
493
                    case SCSI_SYNCHRONIZE_CACHE:
550
561
                        }
551
562
                        break;
552
563
                    }
 
564
                    case SCSI_SERVICE_ACTION_IN_16:
 
565
                    {
 
566
                        switch (pRequest->pbCDB[1] & 0x1f)
 
567
                        {
 
568
                            case SCSI_SVC_ACTION_IN_READ_CAPACITY_16:
 
569
                            {
 
570
                                uint8_t aReply[32];
 
571
 
 
572
                                memset(aReply, 0, sizeof(aReply));
 
573
                                drvscsiH2BE_U64(aReply, pThis->cSectors - 1);
 
574
                                drvscsiH2BE_U32(&aReply[8], 512);
 
575
                                /* Leave the rest 0 */
 
576
 
 
577
                                drvscsiScatterGatherListCopyFromBuffer(pRequest, aReply, sizeof(aReply));
 
578
                                rc =  drvscsiCmdOk(pRequest);
 
579
                                break;
 
580
                            }
 
581
                            default:
 
582
                                rc = drvscsiCmdError(pRequest, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_INV_FIELD_IN_CMD_PACKET); /* Don't know if this is correct */
 
583
                        }
 
584
                        break;
 
585
                    }
553
586
                    default:
554
587
                        //AssertMsgFailed(("Command %#x [%s] not implemented\n", pRequest->pbCDB[0], SCSICmdText(pRequest->pbCDB[0])));
555
588
                        rc = drvscsiCmdError(pRequest, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_ILLEGAL_OPCODE);
625
658
            cSegmentsLeft--;
626
659
        }
627
660
        AssertMsg(!cbToTransfer && !cSegmentsLeft,
628
 
                  ("Transfer incomplete cbToTransfer=%u cSegmentsLeft=%u", cbToTransfer, cSegmentsLeft));
 
661
                  ("Transfer incomplete cbToTransfer=%u cSegmentsLeft=%u\n", cbToTransfer, cSegmentsLeft));
629
662
        drvscsiCmdOk(pRequest);
630
663
    }
631
664