svn path=/branches/GSoC_2016/AHCI/; revision=71988
StorPortAcquireSpinLock(AdapterExtension, InterruptLock, NULL, &lockhandle);
Srb = RemoveQueue(&PortExtension->CompletionQueue);
StorPortAcquireSpinLock(AdapterExtension, InterruptLock, NULL, &lockhandle);
Srb = RemoveQueue(&PortExtension->CompletionQueue);
+ StorPortReleaseSpinLock(AdapterExtension, &lockhandle);
{
Srb->SrbStatus = SRB_STATUS_SUCCESS;
}
{
Srb->SrbStatus = SRB_STATUS_SUCCESS;
}
SrbExtension = GetSrbExtension(Srb);
SrbExtension = GetSrbExtension(Srb);
CompletionRoutine = SrbExtension->CompletionRoutine;
CompletionRoutine = SrbExtension->CompletionRoutine;
+ NT_ASSERT(CompletionRoutine != NULL);
- if (CompletionRoutine != NULL)
- {
- // now it's completion routine responsibility to set SrbStatus
- CompletionRoutine(PortExtension, Srb);
- }
- else
- {
- Srb->SrbStatus = SRB_STATUS_SUCCESS;
- //StorPortNotification(RequestComplete, AdapterExtension, Srb);
- }
+ // now it's completion routine responsibility to set SrbStatus
+ CompletionRoutine(PortExtension, Srb);
+
+ StorPortNotification(RequestComplete, AdapterExtension, Srb);
- StorPortReleaseSpinLock(AdapterExtension, &lockhandle);
return;
}// -- AhciCommandCompletionDpcRoutine();
return;
}// -- AhciCommandCompletionDpcRoutine();
{
ULONG NCS, i;
PSCSI_REQUEST_BLOCK Srb;
{
ULONG NCS, i;
PSCSI_REQUEST_BLOCK Srb;
+ PAHCI_SRB_EXTENSION SrbExtension;
PAHCI_ADAPTER_EXTENSION AdapterExtension;
AhciDebugPrint("AhciCompleteIssuedSrb()\n");
PAHCI_ADAPTER_EXTENSION AdapterExtension;
AhciDebugPrint("AhciCompleteIssuedSrb()\n");
if (((1 << i) & CommandsToComplete) != 0)
{
Srb = PortExtension->Slot[i];
if (((1 << i) & CommandsToComplete) != 0)
{
Srb = PortExtension->Slot[i];
- NT_ASSERT(Srb != NULL);
- AddQueue(&PortExtension->CompletionQueue, Srb);
- StorPortIssueDpc(AdapterExtension, &PortExtension->CommandCompletion, PortExtension, Srb);
+ if (Srb == NULL)
+ {
+ continue;
+ }
+
+ SrbExtension = GetSrbExtension(Srb);
+ NT_ASSERT(SrbExtension != NULL);
+
+ if (SrbExtension->CompletionRoutine != NULL)
+ {
+ AddQueue(&PortExtension->CompletionQueue, Srb);
+ StorPortIssueDpc(AdapterExtension, &PortExtension->CommandCompletion, PortExtension, Srb);
+ }
+ else
+ {
+ Srb->SrbStatus = SRB_STATUS_SUCCESS;
+ StorPortNotification(RequestComplete, AdapterExtension, Srb);
+ }
- AhciDebugPrint("\tPathId: %d Function: %x\n", Srb->PathId, Srb->Function);
switch(Srb->Function)
{
case SRB_FUNCTION_PNP:
switch(Srb->Function)
{
case SRB_FUNCTION_PNP:
- StorPortNotification(RequestComplete, AdapterExtension, Srb);
+ if (Srb->SrbStatus != SRB_STATUS_PENDING)
+ {
+ StorPortNotification(RequestComplete, AdapterExtension, Srb);
+ }
return TRUE;
}// -- AhciHwStartIo();
return TRUE;
}// -- AhciHwStartIo();
ConfigInfo->NumberOfPhysicalBreaks = 0x21;
ConfigInfo->MaximumNumberOfLogicalUnits = 1;
ConfigInfo->NumberOfBuses = MAXIMUM_AHCI_PORT_COUNT;
ConfigInfo->NumberOfPhysicalBreaks = 0x21;
ConfigInfo->MaximumNumberOfLogicalUnits = 1;
ConfigInfo->NumberOfBuses = MAXIMUM_AHCI_PORT_COUNT;
- ConfigInfo->MapBuffers = STOR_MAP_NON_READ_WRITE_BUFFERS;
ConfigInfo->MaximumTransferLength = MAXIMUM_TRANSFER_LENGTH;
ConfigInfo->SynchronizationModel = StorSynchronizeFullDuplex;
ConfigInfo->MaximumTransferLength = MAXIMUM_TRANSFER_LENGTH;
ConfigInfo->SynchronizationModel = StorSynchronizeFullDuplex;
ULONG QueueSlots, slotToActivate, tmp;
PAHCI_ADAPTER_EXTENSION AdapterExtension;
ULONG QueueSlots, slotToActivate, tmp;
PAHCI_ADAPTER_EXTENSION AdapterExtension;
- sact = StorPortReadRegisterUlong(AdapterExtension, &PortExtension->Port->SACT);
- ci = StorPortReadRegisterUlong(AdapterExtension, &PortExtension->Port->CI);
-
// get the lowest set bit
tmp = QueueSlots & (QueueSlots - 1);
// get the lowest set bit
tmp = QueueSlots & (QueueSlots - 1);
DataTransferLength = Srb->DataTransferLength;
BytesPerSector = PortExtension->DeviceParams.BytesPerLogicalSector;
DataTransferLength = Srb->DataTransferLength;
BytesPerSector = PortExtension->DeviceParams.BytesPerLogicalSector;
+ NT_ASSERT(BytesPerSector > 0);
+
ROUND_UP(DataTransferLength, BytesPerSector);
SectorCount = DataTransferLength / BytesPerSector;
ROUND_UP(DataTransferLength, BytesPerSector);
SectorCount = DataTransferLength / BytesPerSector;
NT_ASSERT(SectorCount > 0);
SrbExtension->AtaFunction = ATA_FUNCTION_ATA_READ;
NT_ASSERT(SectorCount > 0);
SrbExtension->AtaFunction = ATA_FUNCTION_ATA_READ;
- SrbExtension->Flags = ATA_FLAGS_USE_DMA;
+ SrbExtension->Flags |= ATA_FLAGS_USE_DMA;
SrbExtension->CompletionRoutine = NULL;
if (IsReading)
SrbExtension->CompletionRoutine = NULL;
if (IsReading)