Author: apriyadarshi
Date: Mon Jul 25 19:50:09 2016
New Revision: 71999
URL:
http://svn.reactos.org/svn/reactos?rev=71999&view=rev
Log:
Handled SCSIOP_MODE_SENSE, Fixes made to maxLba count.
FileSystem detection is still not working :/
Modified:
branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.c
branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.h
Modified: branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.c
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/AHCI/drivers/storage/…
==============================================================================
--- branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.c [iso-8859-1] (original)
+++ branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.c [iso-8859-1] Mon Jul 25
19:50:09 2016
@@ -845,6 +845,9 @@
case SCSIOP_TEST_UNIT_READY:
Srb->SrbStatus = DeviceRequestComplete(AdapterExtension, Srb,
cdb);
break;
+ case SCSIOP_MODE_SENSE:
+ Srb->SrbStatus = DeviceRequestSense(AdapterExtension, Srb,
cdb);
+ break;
case SCSIOP_READ:
//case SCSIOP_WRITE:
Srb->SrbStatus = DeviceRequestReadWrite(AdapterExtension, Srb,
cdb);
@@ -1688,6 +1691,54 @@
}// -- InquiryCompletion();
/**
+ * @name DeviceRequestSense
+ * @implemented
+ *
+ * Handle SCSIOP_MODE_SENSE OperationCode
+ *
+ * @param AdapterExtension
+ * @param Srb
+ * @param Cdb
+ *
+ * @return
+ * return STOR status for DeviceRequestSense
+ */
+UCHAR DeviceRequestSense (
+ __in PAHCI_ADAPTER_EXTENSION AdapterExtension,
+ __in PSCSI_REQUEST_BLOCK Srb,
+ __in PCDB Cdb
+ )
+{
+ PMODE_PARAMETER_HEADER ModeHeader;
+
+ AhciDebugPrint("DeviceRequestSense()\n");
+
+ UNREFERENCED_PARAMETER(AdapterExtension);
+
+ NT_ASSERT(IsPortValid(AdapterExtension, Srb->PathId));
+ NT_ASSERT(Cdb->CDB10.OperationCode == SCSIOP_MODE_SENSE);
+
+ ModeHeader = (PMODE_PARAMETER_HEADER)Srb->DataBuffer;
+
+ NT_ASSERT(ModeHeader != NULL);
+
+ AhciZeroMemory((PCHAR)ModeHeader, Srb->DataTransferLength);
+
+ ModeHeader->ModeDataLength = sizeof(MODE_PARAMETER_HEADER);
+ ModeHeader->MediumType = 0;
+ ModeHeader->DeviceSpecificParameter = MODE_DSP_WRITE_PROTECT;
+ ModeHeader->BlockDescriptorLength = 0;
+
+ if (Cdb->MODE_SENSE.PageCode == MODE_SENSE_CURRENT_VALUES)
+ {
+ ModeHeader->ModeDataLength = sizeof(MODE_PARAMETER_HEADER) +
sizeof(MODE_PARAMETER_BLOCK);
+ ModeHeader->BlockDescriptorLength = sizeof(MODE_PARAMETER_BLOCK);
+ }
+
+ return SRB_STATUS_SUCCESS;
+}// -- DeviceRequestSense();
+
+/**
* @name DeviceRequestReadWrite
* @implemented
*
@@ -1817,9 +1868,8 @@
{
ReadCapacity = (PREAD_CAPACITY_DATA)Srb->DataBuffer;
-
BytesPerLogicalSector = PortExtension->DeviceParams.BytesPerLogicalSector;
- MaxLba = (ULONG)PortExtension->DeviceParams.MaxLba.QuadPart;
+ MaxLba = (ULONG)PortExtension->DeviceParams.MaxLba.QuadPart - 1;
// I trust you windows :D
NT_ASSERT(Srb->DataTransferLength >= sizeof(READ_CAPACITY_DATA));
Modified: branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.h
URL:
http://svn.reactos.org/svn/reactos/branches/GSoC_2016/AHCI/drivers/storage/…
==============================================================================
--- branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.h [iso-8859-1] (original)
+++ branches/GSoC_2016/AHCI/drivers/storage/storahci/storahci.h [iso-8859-1] Mon Jul 25
19:50:09 2016
@@ -591,6 +591,12 @@
__in ULONG pathId
);
+UCHAR DeviceRequestSense (
+ __in PAHCI_ADAPTER_EXTENSION AdapterExtension,
+ __in PSCSI_REQUEST_BLOCK Srb,
+ __in PCDB Cdb
+ );
+
UCHAR DeviceRequestReadWrite (
__in PAHCI_ADAPTER_EXTENSION AdapterExtension,
__in PSCSI_REQUEST_BLOCK Srb,