Changeset 65060 in vbox for trunk/src/VBox/Devices/Storage
- Timestamp:
- Jan 3, 2017 10:44:49 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DevATA.cpp
r64393 r65060 1809 1809 static void atapiR3PassthroughCmdBT(ATADevState *s) 1810 1810 { 1811 /** @todo implement an algorithm for correctly determining the read and1812 * write sector size without sending additional commands to the drive.1813 * This should be doable by saving processing the configuration requests1814 * and replies. */1815 # if 01816 if (s->uTxDir == PDMMEDIATXDIR_TO_DEVICE)1817 {1818 uint8_t cmd = s->aATAPICmd[0];1819 if (cmd == SCSI_WRITE_10 || cmd == SCSI_WRITE_12 || cmd == SCSI_WRITE_AND_VERIFY_10)1820 {1821 uint8_t aModeSenseCmd[10];1822 uint8_t aModeSenseResult[16];1823 uint8_t uDummySense;1824 uint32_t cbTransfer;1825 int rc;1826 1827 cbTransfer = sizeof(aModeSenseResult);1828 aModeSenseCmd[0] = SCSI_MODE_SENSE_10;1829 aModeSenseCmd[1] = 0x08; /* disable block descriptor = 1 */1830 aModeSenseCmd[2] = (SCSI_PAGECONTROL_CURRENT << 6) | SCSI_MODEPAGE_WRITE_PARAMETER;1831 aModeSenseCmd[3] = 0; /* subpage code */1832 aModeSenseCmd[4] = 0; /* reserved */1833 aModeSenseCmd[5] = 0; /* reserved */1834 aModeSenseCmd[6] = 0; /* reserved */1835 aModeSenseCmd[7] = cbTransfer >> 8;1836 aModeSenseCmd[8] = cbTransfer & 0xff;1837 aModeSenseCmd[9] = 0; /* control */1838 rc = s->pDrvMedia->pfnSendCmd(s->pDrvMedia, aModeSenseCmd, PDMMEDIATXDIR_FROM_DEVICE, aModeSenseResult, &cbTransfer, &uDummySense, 500);1839 if (RT_FAILURE(rc))1840 {1841 atapiR3CmdErrorSimple(s, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_NONE);1842 return;1843 }1844 /* Select sector size based on the current data block type. */1845 switch (aModeSenseResult[12] & 0x0f)1846 {1847 case 0:1848 s->cbATAPISector = 2352;1849 break;1850 case 1:1851 s->cbATAPISector = 2368;1852 break;1853 case 2:1854 case 3:1855 s->cbATAPISector = 2448;1856 break;1857 case 8:1858 case 10:1859 s->cbATAPISector = 2048;1860 break;1861 case 9:1862 s->cbATAPISector = 2336;1863 break;1864 case 11:1865 s->cbATAPISector = 2056;1866 break;1867 case 12:1868 s->cbATAPISector = 2324;1869 break;1870 case 13:1871 s->cbATAPISector = 2332;1872 break;1873 default:1874 s->cbATAPISector = 0;1875 }1876 Log2(("%s: sector size %d\n", __FUNCTION__, s->cbATAPISector));1877 s->cbTotalTransfer *= s->cbATAPISector;1878 if (s->cbTotalTransfer == 0)1879 s->uTxDir = PDMMEDIATXDIR_NONE;1880 }1881 }1882 # endif1883 1811 atapiR3CmdBT(s); 1884 1812 }
Note:
See TracChangeset
for help on using the changeset viewer.