Changeset 63909 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Sep 20, 2016 10:08:22 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DevAHCI.cpp
r63690 r63909 4503 4503 break; 4504 4504 default: 4505 goto error_cmd; 4505 atapiCmdErrorSimple(pAhciPort, pAhciReq, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_INV_FIELD_IN_CMD_PACKET); 4506 break; 4506 4507 } 4507 4508 break; 4508 4509 case SCSI_PAGECONTROL_CHANGEABLE: 4509 goto error_cmd;4510 4510 case SCSI_PAGECONTROL_DEFAULT: 4511 goto error_cmd; 4511 atapiCmdErrorSimple(pAhciPort, pAhciReq, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_INV_FIELD_IN_CMD_PACKET); 4512 break; 4512 4513 default: 4513 4514 case SCSI_PAGECONTROL_SAVED: … … 4760 4761 break; 4761 4762 default: 4762 error_cmd:4763 4763 atapiCmdErrorSimple(pAhciPort, pAhciReq, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_INV_FIELD_IN_CMD_PACKET); 4764 4764 break; … … 4840 4840 uint32_t cbTransfer = 0; 4841 4841 AHCITXDIR enmTxDir = AHCITXDIR_NONE; 4842 bool fSendCmd = false; 4842 4843 4843 4844 pbPacket = pAhciReq->aATAPICmd; … … 4845 4846 { 4846 4847 case SCSI_BLANK: 4847 goto sendcmd; 4848 fSendCmd = true; 4849 break; 4848 4850 case SCSI_CLOSE_TRACK_SESSION: 4849 goto sendcmd; 4851 fSendCmd = true; 4852 break; 4850 4853 case SCSI_ERASE_10: 4851 4854 iATAPILBA = ataBE2H_U32(pbPacket + 2); … … 4853 4856 Log2(("ATAPI PT: lba %d\n", iATAPILBA)); 4854 4857 enmTxDir = AHCITXDIR_WRITE; 4855 goto sendcmd; 4858 fSendCmd = true; 4859 break; 4856 4860 case SCSI_FORMAT_UNIT: 4857 4861 cbTransfer = pAhciReq->cmdFis[AHCI_CMDFIS_CYLL] | (pAhciReq->cmdFis[AHCI_CMDFIS_CYLH] << 8); /* use ATAPI transfer length */ 4858 4862 enmTxDir = AHCITXDIR_WRITE; 4859 goto sendcmd; 4863 fSendCmd = true; 4864 break; 4860 4865 case SCSI_GET_CONFIGURATION: 4861 4866 cbTransfer = ataBE2H_U16(pbPacket + 7); 4862 4867 enmTxDir = AHCITXDIR_READ; 4863 goto sendcmd; 4868 fSendCmd = true; 4869 break; 4864 4870 case SCSI_GET_EVENT_STATUS_NOTIFICATION: 4865 4871 cbTransfer = ataBE2H_U16(pbPacket + 7); … … 4871 4877 } 4872 4878 enmTxDir = AHCITXDIR_READ; 4873 goto sendcmd; 4879 fSendCmd = true; 4880 break; 4874 4881 case SCSI_GET_PERFORMANCE: 4875 4882 cbTransfer = pAhciReq->cmdFis[AHCI_CMDFIS_CYLL] | (pAhciReq->cmdFis[AHCI_CMDFIS_CYLH] << 8); /* use ATAPI transfer length */ 4876 4883 enmTxDir = AHCITXDIR_READ; 4877 goto sendcmd; 4884 fSendCmd = true; 4885 break; 4878 4886 case SCSI_INQUIRY: 4879 4887 cbTransfer = ataBE2H_U16(pbPacket + 3); 4880 4888 enmTxDir = AHCITXDIR_READ; 4881 goto sendcmd; 4889 fSendCmd = true; 4890 break; 4882 4891 case SCSI_LOAD_UNLOAD_MEDIUM: 4883 goto sendcmd; 4892 fSendCmd = true; 4893 break; 4884 4894 case SCSI_MECHANISM_STATUS: 4885 4895 cbTransfer = ataBE2H_U16(pbPacket + 8); 4886 4896 enmTxDir = AHCITXDIR_READ; 4887 goto sendcmd; 4897 fSendCmd = true; 4898 break; 4888 4899 case SCSI_MODE_SELECT_10: 4889 4900 cbTransfer = ataBE2H_U16(pbPacket + 7); 4890 4901 enmTxDir = AHCITXDIR_WRITE; 4891 goto sendcmd; 4902 fSendCmd = true; 4903 break; 4892 4904 case SCSI_MODE_SENSE_10: 4893 4905 cbTransfer = ataBE2H_U16(pbPacket + 7); 4894 4906 enmTxDir = AHCITXDIR_READ; 4895 goto sendcmd; 4907 fSendCmd = true; 4908 break; 4896 4909 case SCSI_PAUSE_RESUME: 4897 goto sendcmd; 4910 fSendCmd = true; 4911 break; 4898 4912 case SCSI_PLAY_AUDIO_10: 4899 goto sendcmd; 4913 fSendCmd = true; 4914 break; 4900 4915 case SCSI_PLAY_AUDIO_12: 4901 goto sendcmd; 4916 fSendCmd = true; 4917 break; 4902 4918 case SCSI_PLAY_AUDIO_MSF: 4903 goto sendcmd; 4919 fSendCmd = true; 4920 break; 4904 4921 case SCSI_PREVENT_ALLOW_MEDIUM_REMOVAL: 4905 4922 /** @todo do not forget to unlock when a VM is shut down */ 4906 goto sendcmd; 4923 fSendCmd = true; 4924 break; 4907 4925 case SCSI_READ_10: 4908 4926 iATAPILBA = ataBE2H_U32(pbPacket + 2); … … 4912 4930 cbTransfer = cSectors * pAhciReq->cbATAPISector; 4913 4931 enmTxDir = AHCITXDIR_READ; 4914 goto sendcmd; 4932 fSendCmd = true; 4933 break; 4915 4934 case SCSI_READ_12: 4916 4935 iATAPILBA = ataBE2H_U32(pbPacket + 2); … … 4920 4939 cbTransfer = cSectors * pAhciReq->cbATAPISector; 4921 4940 enmTxDir = AHCITXDIR_READ; 4922 goto sendcmd; 4941 fSendCmd = true; 4942 break; 4923 4943 case SCSI_READ_BUFFER: 4924 4944 cbTransfer = ataBE2H_U24(pbPacket + 6); 4925 4945 enmTxDir = AHCITXDIR_READ; 4926 goto sendcmd; 4946 fSendCmd = true; 4947 break; 4927 4948 case SCSI_READ_BUFFER_CAPACITY: 4928 4949 cbTransfer = ataBE2H_U16(pbPacket + 7); 4929 4950 enmTxDir = AHCITXDIR_READ; 4930 goto sendcmd; 4951 fSendCmd = true; 4952 break; 4931 4953 case SCSI_READ_CAPACITY: 4932 4954 cbTransfer = 8; 4933 4955 enmTxDir = AHCITXDIR_READ; 4934 goto sendcmd; 4956 fSendCmd = true; 4957 break; 4935 4958 case SCSI_READ_CD: 4936 4959 case SCSI_READ_CD_MSF: … … 4984 5007 } 4985 5008 enmTxDir = AHCITXDIR_READ; 4986 goto sendcmd; 5009 fSendCmd = true; 5010 break; 4987 5011 } 4988 5012 case SCSI_READ_DISC_INFORMATION: 4989 5013 cbTransfer = ataBE2H_U16(pbPacket + 7); 4990 5014 enmTxDir = AHCITXDIR_READ; 4991 goto sendcmd; 5015 fSendCmd = true; 5016 break; 4992 5017 case SCSI_READ_DVD_STRUCTURE: 4993 5018 cbTransfer = ataBE2H_U16(pbPacket + 8); 4994 5019 enmTxDir = AHCITXDIR_READ; 4995 goto sendcmd; 5020 fSendCmd = true; 5021 break; 4996 5022 case SCSI_READ_FORMAT_CAPACITIES: 4997 5023 cbTransfer = ataBE2H_U16(pbPacket + 7); 4998 5024 enmTxDir = AHCITXDIR_READ; 4999 goto sendcmd; 5025 fSendCmd = true; 5026 break; 5000 5027 case SCSI_READ_SUBCHANNEL: 5001 5028 cbTransfer = ataBE2H_U16(pbPacket + 7); 5002 5029 enmTxDir = AHCITXDIR_READ; 5003 goto sendcmd; 5030 fSendCmd = true; 5031 break; 5004 5032 case SCSI_READ_TOC_PMA_ATIP: 5005 5033 cbTransfer = ataBE2H_U16(pbPacket + 7); 5006 5034 enmTxDir = AHCITXDIR_READ; 5007 goto sendcmd; 5035 fSendCmd = true; 5036 break; 5008 5037 case SCSI_READ_TRACK_INFORMATION: 5009 5038 cbTransfer = ataBE2H_U16(pbPacket + 7); 5010 5039 enmTxDir = AHCITXDIR_READ; 5011 goto sendcmd; 5040 fSendCmd = true; 5041 break; 5012 5042 case SCSI_REPAIR_TRACK: 5013 goto sendcmd; 5043 fSendCmd = true; 5044 break; 5014 5045 case SCSI_REPORT_KEY: 5015 5046 cbTransfer = ataBE2H_U16(pbPacket + 8); 5016 5047 enmTxDir = AHCITXDIR_READ; 5017 goto sendcmd; 5048 fSendCmd = true; 5049 break; 5018 5050 case SCSI_REQUEST_SENSE: 5019 5051 cbTransfer = pbPacket[4]; … … 5026 5058 } 5027 5059 enmTxDir = AHCITXDIR_READ; 5028 goto sendcmd; 5060 fSendCmd = true; 5061 break; 5029 5062 case SCSI_RESERVE_TRACK: 5030 goto sendcmd; 5063 fSendCmd = true; 5064 break; 5031 5065 case SCSI_SCAN: 5032 goto sendcmd; 5066 fSendCmd = true; 5067 break; 5033 5068 case SCSI_SEEK_10: 5034 goto sendcmd; 5069 fSendCmd = true; 5070 break; 5035 5071 case SCSI_SEND_CUE_SHEET: 5036 5072 cbTransfer = ataBE2H_U24(pbPacket + 6); 5037 5073 enmTxDir = AHCITXDIR_WRITE; 5038 goto sendcmd; 5074 fSendCmd = true; 5075 break; 5039 5076 case SCSI_SEND_DVD_STRUCTURE: 5040 5077 cbTransfer = ataBE2H_U16(pbPacket + 8); 5041 5078 enmTxDir = AHCITXDIR_WRITE; 5042 goto sendcmd; 5079 fSendCmd = true; 5080 break; 5043 5081 case SCSI_SEND_EVENT: 5044 5082 cbTransfer = ataBE2H_U16(pbPacket + 8); 5045 5083 enmTxDir = AHCITXDIR_WRITE; 5046 goto sendcmd; 5084 fSendCmd = true; 5085 break; 5047 5086 case SCSI_SEND_KEY: 5048 5087 cbTransfer = ataBE2H_U16(pbPacket + 8); 5049 5088 enmTxDir = AHCITXDIR_WRITE; 5050 goto sendcmd; 5089 fSendCmd = true; 5090 break; 5051 5091 case SCSI_SEND_OPC_INFORMATION: 5052 5092 cbTransfer = ataBE2H_U16(pbPacket + 7); 5053 5093 enmTxDir = AHCITXDIR_WRITE; 5054 goto sendcmd; 5094 fSendCmd = true; 5095 break; 5055 5096 case SCSI_SET_CD_SPEED: 5056 goto sendcmd; 5097 fSendCmd = true; 5098 break; 5057 5099 case SCSI_SET_READ_AHEAD: 5058 goto sendcmd; 5100 fSendCmd = true; 5101 break; 5059 5102 case SCSI_SET_STREAMING: 5060 5103 cbTransfer = ataBE2H_U16(pbPacket + 9); 5061 5104 enmTxDir = AHCITXDIR_WRITE; 5062 goto sendcmd; 5105 fSendCmd = true; 5106 break; 5063 5107 case SCSI_START_STOP_UNIT: 5064 goto sendcmd; 5108 fSendCmd = true; 5109 break; 5065 5110 case SCSI_STOP_PLAY_SCAN: 5066 goto sendcmd; 5111 fSendCmd = true; 5112 break; 5067 5113 case SCSI_SYNCHRONIZE_CACHE: 5068 goto sendcmd; 5114 fSendCmd = true; 5115 break; 5069 5116 case SCSI_TEST_UNIT_READY: 5070 goto sendcmd; 5117 fSendCmd = true; 5118 break; 5071 5119 case SCSI_VERIFY_10: 5072 goto sendcmd; 5120 fSendCmd = true; 5121 break; 5073 5122 case SCSI_WRITE_10: 5074 5123 case SCSI_WRITE_AND_VERIFY_10: … … 5082 5131 cbTransfer = cSectors * pAhciReq->cbATAPISector; 5083 5132 enmTxDir = AHCITXDIR_WRITE; 5084 goto sendcmd; 5133 fSendCmd = true; 5134 break; 5085 5135 case SCSI_WRITE_12: 5086 5136 iATAPILBA = ataBE2H_U32(pbPacket + 2); … … 5093 5143 cbTransfer = cSectors * pAhciReq->cbATAPISector; 5094 5144 enmTxDir = AHCITXDIR_WRITE; 5095 goto sendcmd; 5145 fSendCmd = true; 5146 break; 5096 5147 case SCSI_WRITE_BUFFER: 5097 5148 switch (pbPacket[1] & 0x1f) … … 5109 5160 cbTransfer = ataBE2H_U16(pbPacket + 6); 5110 5161 enmTxDir = AHCITXDIR_WRITE; 5111 goto sendcmd; 5162 fSendCmd = true; 5163 break; 5112 5164 } 5113 5165 break; … … 5115 5167 cbTransfer = ataBE2H_U32(pbPacket + 6); 5116 5168 enmTxDir = AHCITXDIR_READ; 5117 goto sendcmd; 5169 fSendCmd = true; 5170 break; 5118 5171 case SCSI_REZERO_UNIT: 5119 5172 /* Obsolete command used by cdrecord. What else would one expect? … … 5128 5181 atapiCmdErrorSimple(pAhciPort, pAhciReq, SCSI_SENSE_ILLEGAL_REQUEST, SCSI_ASC_ILLEGAL_OPCODE); 5129 5182 break; 5130 sendcmd: 5131 /* Send a command to the drive, passing data in/out as required. */ 5132 Log2(("ATAPI PT: max size %d\n", cbTransfer)); 5133 if (cbTransfer == 0) 5134 enmTxDir = AHCITXDIR_NONE; 5135 pAhciReq->enmTxDir = enmTxDir; 5136 pAhciReq->cbTransfer = cbTransfer; 5137 atapiDoTransfer(pAhciPort, pAhciReq, cbTransfer, ATAFN_SS_ATAPI_PASSTHROUGH); 5183 } 5184 5185 if (fSendCmd) 5186 { 5187 /* Send a command to the drive, passing data in/out as required. */ 5188 Log2(("ATAPI PT: max size %d\n", cbTransfer)); 5189 if (cbTransfer == 0) 5190 enmTxDir = AHCITXDIR_NONE; 5191 pAhciReq->enmTxDir = enmTxDir; 5192 pAhciReq->cbTransfer = cbTransfer; 5193 atapiDoTransfer(pAhciPort, pAhciReq, cbTransfer, ATAFN_SS_ATAPI_PASSTHROUGH); 5138 5194 } 5139 5195
Note:
See TracChangeset
for help on using the changeset viewer.