mirror of
https://github.com/reactos/reactos.git
synced 2024-08-03 18:10:54 +00:00
revert 49345 as requested by ros arm team.
svn path=/branches/cmake-bringup/; revision=49373
This commit is contained in:
parent
d1dfa87850
commit
b3346b150f
|
@ -148,14 +148,14 @@ ClassSendEjectionNotification(
|
|||
// ejection request occured, we could see if any locks for the media
|
||||
// existed. if locked, broadcast. if not, we send the eject irp.
|
||||
//
|
||||
|
||||
|
||||
//
|
||||
// for now, just always broadcast. make this a public routine,
|
||||
// so class drivers can add special hacks to broadcast this for their
|
||||
// non-MMC-compliant devices also from sense codes.
|
||||
//
|
||||
|
||||
DBGTRACE(ClassDebugTrace, ("ClassSendEjectionNotification: media EJECT_REQUEST"));
|
||||
DBGTRACE(ClassDebugTrace, ("ClassSendEjectionNotification: media EJECT_REQUEST"));
|
||||
ClasspSendNotification(FdoExtension,
|
||||
&GUID_IO_MEDIA_EJECT_REQUEST,
|
||||
0,
|
||||
|
@ -174,7 +174,7 @@ ClasspSendNotification(
|
|||
{
|
||||
PTARGET_DEVICE_CUSTOM_NOTIFICATION notification;
|
||||
ULONG requiredSize;
|
||||
|
||||
|
||||
requiredSize =
|
||||
(sizeof(TARGET_DEVICE_CUSTOM_NOTIFICATION) - sizeof(UCHAR)) +
|
||||
ExtraDataSize;
|
||||
|
@ -186,11 +186,11 @@ ClasspSendNotification(
|
|||
requiredSize));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
notification = ExAllocatePoolWithTag(NonPagedPool,
|
||||
requiredSize,
|
||||
'oNcS');
|
||||
|
||||
|
||||
//
|
||||
// if none allocated, exit
|
||||
//
|
||||
|
@ -202,7 +202,7 @@ ClasspSendNotification(
|
|||
//
|
||||
// Prepare and send the request!
|
||||
//
|
||||
|
||||
|
||||
RtlZeroMemory(notification, requiredSize);
|
||||
notification->Version = 1;
|
||||
notification->Size = (USHORT)(requiredSize);
|
||||
|
@ -214,7 +214,7 @@ ClasspSendNotification(
|
|||
IoReportTargetDeviceChangeAsynchronous(FdoExtension->LowerPdo,
|
||||
notification,
|
||||
NULL, NULL);
|
||||
|
||||
|
||||
ExFreePool(notification);
|
||||
notification = NULL;
|
||||
return;
|
||||
|
@ -236,7 +236,7 @@ Routine Description:
|
|||
Arguments:
|
||||
|
||||
FdoExtension - the device
|
||||
|
||||
|
||||
DataBuffer - the resulting data from a GESN event.
|
||||
requires at least EIGHT valid bytes (header == 4, data == 4)
|
||||
|
||||
|
@ -245,14 +245,14 @@ Arguments:
|
|||
event was of the DEVICE BUSY class, else true.
|
||||
|
||||
Return Value:
|
||||
|
||||
|
||||
None
|
||||
|
||||
|
||||
Notes:
|
||||
|
||||
DataBuffer must be at least four bytes of valid data (header == 4 bytes),
|
||||
and have at least eight bytes of allocated memory (all events == 4 bytes).
|
||||
|
||||
|
||||
The call to StartNextPacket may occur before this routine is completed.
|
||||
the operational change notifications are informational in nature, and
|
||||
while useful, are not neccessary to ensure proper operation. For example,
|
||||
|
@ -261,12 +261,12 @@ Notes:
|
|||
IOCTL_IS_DISK_WRITABLE may be called and get an incorrect response. If
|
||||
a device supports software write protect, it is expected that the
|
||||
application can handle such a case.
|
||||
|
||||
|
||||
NOTE: perhaps setting the updaterequired byte to one should be done here.
|
||||
if so, it relies upon the setting of a 32-byte value to be an atomic
|
||||
operation. unfortunately, there is no simple way to notify a class driver
|
||||
which wants to know that the device behavior requires updating.
|
||||
|
||||
|
||||
Not ready events may be sent every second. For example, if we were
|
||||
to minimize the number of asynchronous notifications, an application may
|
||||
register just after a large busy time was reported. This would then
|
||||
|
@ -339,7 +339,7 @@ ClasspInterpretGesnData(
|
|||
lowestSetBit ^= (info->Gesn.EventMask);
|
||||
|
||||
if (thisEventBit != lowestSetBit) {
|
||||
|
||||
|
||||
//
|
||||
// HACKHACK - REF #0001
|
||||
// the first time we ever see an event set that is not the lowest
|
||||
|
@ -352,11 +352,11 @@ ClasspInterpretGesnData(
|
|||
"Classpnp => GESN::NONE: Compliant drive found, "
|
||||
"removing GESN hack (%x, %x)\n",
|
||||
thisEventBit, info->Gesn.EventMask));
|
||||
|
||||
|
||||
info->Gesn.HackEventMask = FALSE;
|
||||
|
||||
} else if (thisEvent == 0) {
|
||||
|
||||
|
||||
//
|
||||
// HACKHACK - REF #0001
|
||||
// note: this hack prevents poorly implemented firmware from constantly
|
||||
|
@ -409,13 +409,13 @@ ClasspInterpretGesnData(
|
|||
&GUID_IO_GENERIC_GESN_EVENT,
|
||||
sizeof(NOTIFICATION_EVENT_STATUS_HEADER) + dataLength,
|
||||
Header)
|
||||
*/
|
||||
*/
|
||||
|
||||
switch (Header->NotificationClass) {
|
||||
|
||||
case NOTIFICATION_EXTERNAL_REQUEST_CLASS_EVENTS: { // 0x3
|
||||
|
||||
PNOTIFICATION_EXTERNAL_STATUS externalInfo =
|
||||
|
||||
PNOTIFICATION_EXTERNAL_STATUS externalInfo =
|
||||
(PNOTIFICATION_EXTERNAL_STATUS)(Header->ClassEventData);
|
||||
DEVICE_EVENT_EXTERNAL_REQUEST externalData;
|
||||
|
||||
|
@ -424,12 +424,12 @@ ClasspInterpretGesnData(
|
|||
// about keys being pressed, and not released. this makes keys
|
||||
// single-function, but simplifies the code significantly.
|
||||
//
|
||||
|
||||
|
||||
if (externalInfo->ExternalEvent !=
|
||||
NOTIFICATION_EXTERNAL_EVENT_BUTTON_DOWN) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
*ResendImmediately = TRUE;
|
||||
KdPrintEx((DPFLTR_CLASSPNP_ID, ClassDebugMCN,
|
||||
"Classpnp => GESN::EXTERNAL: Event: %x Status %x Req %x\n",
|
||||
|
@ -447,28 +447,28 @@ ClasspInterpretGesnData(
|
|||
KeQuerySystemTime(&(externalData.SystemTime));
|
||||
externalData.SystemTime.QuadPart *= (LONGLONG)KeQueryTimeIncrement();
|
||||
|
||||
DBGTRACE(ClassDebugTrace, ("ClasspInterpretGesnData: media DEVICE_EXTERNAL_REQUEST"));
|
||||
DBGTRACE(ClassDebugTrace, ("ClasspInterpretGesnData: media DEVICE_EXTERNAL_REQUEST"));
|
||||
ClasspSendNotification(FdoExtension,
|
||||
&GUID_IO_DEVICE_EXTERNAL_REQUEST,
|
||||
sizeof(DEVICE_EVENT_EXTERNAL_REQUEST),
|
||||
&externalData);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
case NOTIFICATION_MEDIA_STATUS_CLASS_EVENTS: { // 0x4
|
||||
|
||||
|
||||
PNOTIFICATION_MEDIA_STATUS mediaInfo =
|
||||
(PNOTIFICATION_MEDIA_STATUS)(Header->ClassEventData);
|
||||
|
||||
|
||||
if (mediaInfo->MediaEvent == NOTIFICATION_MEDIA_EVENT_NO_CHANGE) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
*ResendImmediately = TRUE;
|
||||
KdPrintEx((DPFLTR_CLASSPNP_ID, ClassDebugMCN,
|
||||
"Classpnp => GESN::MEDIA: Event: %x Status %x\n",
|
||||
mediaInfo->MediaEvent, mediaInfo->MediaStatus));
|
||||
|
||||
|
||||
if ((mediaInfo->MediaEvent == NOTIFICATION_MEDIA_EVENT_NEW_MEDIA) ||
|
||||
(mediaInfo->MediaEvent == NOTIFICATION_MEDIA_EVENT_MEDIA_CHANGE)) {
|
||||
|
||||
|
@ -489,29 +489,29 @@ ClasspInterpretGesnData(
|
|||
TRUE);
|
||||
|
||||
} else if (mediaInfo->MediaEvent == NOTIFICATION_MEDIA_EVENT_MEDIA_REMOVAL) {
|
||||
|
||||
|
||||
ClasspSetMediaChangeStateEx(FdoExtension,
|
||||
MediaNotPresent,
|
||||
FALSE,
|
||||
TRUE);
|
||||
|
||||
|
||||
} else if (mediaInfo->MediaEvent == NOTIFICATION_MEDIA_EVENT_EJECT_REQUEST) {
|
||||
|
||||
KdPrintEx((DPFLTR_CLASSPNP_ID, ClassDebugError,
|
||||
"Classpnp => GESN Ejection request received!\n"));
|
||||
ClassSendEjectionNotification(FdoExtension);
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
case NOTIFICATION_DEVICE_BUSY_CLASS_EVENTS: { // lowest priority events...
|
||||
|
||||
|
||||
PNOTIFICATION_BUSY_STATUS busyInfo =
|
||||
(PNOTIFICATION_BUSY_STATUS)(Header->ClassEventData);
|
||||
DEVICE_EVENT_BECOMING_READY busyData;
|
||||
|
||||
|
||||
//
|
||||
// NOTE: we never actually need to immediately retry for these
|
||||
// events: if one exists, the device is busy, and if not,
|
||||
|
@ -521,7 +521,7 @@ ClasspInterpretGesnData(
|
|||
if (busyInfo->DeviceBusyStatus == NOTIFICATION_BUSY_STATUS_NO_EVENT) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// else we want to report the approximated time till it's ready.
|
||||
//
|
||||
|
@ -531,28 +531,28 @@ ClasspInterpretGesnData(
|
|||
busyData.Reason = busyInfo->DeviceBusyStatus;
|
||||
busyData.Estimated100msToReady = (busyInfo->Time[0] << 8) |
|
||||
(busyInfo->Time[1] & 0xff);
|
||||
|
||||
|
||||
KdPrintEx((DPFLTR_CLASSPNP_ID, ClassDebugMCN,
|
||||
"Classpnp => GESN::BUSY: Event: %x Status %x Time %x\n",
|
||||
busyInfo->DeviceBusyEvent, busyInfo->DeviceBusyStatus,
|
||||
busyData.Estimated100msToReady
|
||||
));
|
||||
|
||||
DBGTRACE(ClassDebugTrace, ("ClasspInterpretGesnData: media BECOMING_READY"));
|
||||
DBGTRACE(ClassDebugTrace, ("ClasspInterpretGesnData: media BECOMING_READY"));
|
||||
ClasspSendNotification(FdoExtension,
|
||||
&GUID_IO_DEVICE_BECOMING_READY,
|
||||
sizeof(DEVICE_EVENT_BECOMING_READY),
|
||||
&busyData);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
default: {
|
||||
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
} // end switch on notification class
|
||||
|
||||
} // end switch on notification class
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -577,7 +577,7 @@ Arguments:
|
|||
|
||||
MediaPresent - indicates whether the device has media inserted into it
|
||||
(TRUE) or not (FALSE).
|
||||
|
||||
|
||||
Return Value:
|
||||
|
||||
none
|
||||
|
@ -656,7 +656,7 @@ ClasspInternalSetMediaChangeState(
|
|||
sizeof(ULONG),
|
||||
&data);
|
||||
|
||||
}
|
||||
}
|
||||
else if (NewState == MediaNotPresent) {
|
||||
|
||||
DBGTRACE(ClassDebugTrace, ("ClasspInternalSetMediaChangeState: media REMOVAL"));
|
||||
|
@ -673,7 +673,7 @@ ClasspInternalSetMediaChangeState(
|
|||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
} // end ClasspInternalSetMediaChangeState()
|
||||
|
||||
|
@ -769,10 +769,7 @@ ClasspSetMediaChangeStateEx(
|
|||
|
||||
return;
|
||||
} // end ClassSetMediaChangeStateEx()
|
||||
|
||||
SCSIPORTAPI
|
||||
VOID
|
||||
NTAPI
|
||||
ClassSetMediaChangeState(
|
||||
IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension,
|
||||
IN MEDIA_CHANGE_DETECTION_STATE NewState,
|
||||
|
@ -836,11 +833,11 @@ ClasspMediaChangeDetectionCompletion(
|
|||
|
||||
/*
|
||||
* HACK for IoMega 2GB Jaz drive:
|
||||
* This drive spins down on its own to preserve the media.
|
||||
* This drive spins down on its own to preserve the media.
|
||||
* When spun down, TUR fails with 2/4/0 (SCSI_SENSE_NOT_READY/SCSI_ADSENSE_LUN_NOT_READY/?).
|
||||
* ClassInterpretSenseInfo would then call ClassSendStartUnit to spin the media up, which defeats the
|
||||
* purpose of the spindown.
|
||||
* So in this case, make this into a successful TUR.
|
||||
* So in this case, make this into a successful TUR.
|
||||
* This allows the drive to stay spun down until it is actually accessed again.
|
||||
* (If the media were actually removed, TUR would fail with 2/3a/0 ).
|
||||
* This hack only applies to drives with the CAUSE_NOT_REPORTABLE_HACK bit set; this
|
||||
|
@ -849,15 +846,15 @@ ClasspMediaChangeDetectionCompletion(
|
|||
if ((SRB_STATUS(Srb->SrbStatus) != SRB_STATUS_SUCCESS) &&
|
||||
TEST_FLAG(fdoExtension->ScanForSpecialFlags, CLASS_SPECIAL_CAUSE_NOT_REPORTABLE_HACK) &&
|
||||
(Srb->SenseInfoBufferLength >= RTL_SIZEOF_THROUGH_FIELD(SENSE_DATA, AdditionalSenseCode))){
|
||||
|
||||
|
||||
PSENSE_DATA senseData = Srb->SenseInfoBuffer;
|
||||
|
||||
if ((senseData->SenseKey == SCSI_SENSE_NOT_READY) &&
|
||||
|
||||
if ((senseData->SenseKey == SCSI_SENSE_NOT_READY) &&
|
||||
(senseData->AdditionalSenseCode == SCSI_ADSENSE_LUN_NOT_READY)){
|
||||
Srb->SrbStatus = SRB_STATUS_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// use ClassInterpretSenseInfo() to check for media state, and also
|
||||
|
@ -876,15 +873,15 @@ ClasspMediaChangeDetectionCompletion(
|
|||
&status,
|
||||
NULL);
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
|
||||
fdoData->LoggedTURFailureSinceLastIO = FALSE;
|
||||
|
||||
|
||||
if (!info->Gesn.Supported) {
|
||||
|
||||
DBGTRACE(ClassDebugMCN, ("ClasspMediaChangeDetectionCompletion - succeeded and GESN NOT supported, setting MediaPresent."));
|
||||
|
||||
|
||||
//
|
||||
// success != media for GESN case
|
||||
//
|
||||
|
@ -896,7 +893,7 @@ ClasspMediaChangeDetectionCompletion(
|
|||
DBGTRACE(ClassDebugMCN, ("ClasspMediaChangeDetectionCompletion - succeeded (GESN supported)."));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (info->Gesn.Supported) {
|
||||
|
||||
if (status == STATUS_DATA_OVERRUN) {
|
||||
|
@ -904,7 +901,7 @@ ClasspMediaChangeDetectionCompletion(
|
|||
status = STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
if (!NT_SUCCESS(status)) {
|
||||
if (!NT_SUCCESS(status)) {
|
||||
DBGTRACE(ClassDebugMCN, ("ClasspMediaChangeDetectionCompletion: GESN failed with status %x", status));
|
||||
} else {
|
||||
|
||||
|
@ -912,7 +909,7 @@ ClasspMediaChangeDetectionCompletion(
|
|||
// for GESN, need to interpret the results of the data.
|
||||
// this may also require an immediate retry
|
||||
//
|
||||
|
||||
|
||||
if (Irp->IoStatus.Information == 8 ) {
|
||||
ClasspInterpretGesnData(fdoExtension,
|
||||
(PVOID)info->Gesn.Buffer,
|
||||
|
@ -949,7 +946,7 @@ ClasspMediaChangeDetectionCompletion(
|
|||
//
|
||||
|
||||
if (retryImmediately) {
|
||||
|
||||
|
||||
info->MediaChangeRetryCount++;
|
||||
if (info->MediaChangeRetryCount > MAXIMUM_IMMEDIATE_MCN_RETRIES) {
|
||||
ASSERT(!"Recursing too often in MCN?");
|
||||
|
@ -958,7 +955,7 @@ ClasspMediaChangeDetectionCompletion(
|
|||
}
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
info->MediaChangeRetryCount = 0;
|
||||
|
||||
}
|
||||
|
@ -973,7 +970,7 @@ ClasspMediaChangeDetectionCompletion(
|
|||
ClassAcquireRemoveLock(DeviceObject, (PIRP)(&uniqueValue));
|
||||
ClassReleaseRemoveLock(DeviceObject, Irp);
|
||||
|
||||
|
||||
|
||||
//
|
||||
// set the irp as not in use
|
||||
//
|
||||
|
@ -995,18 +992,18 @@ ClasspMediaChangeDetectionCompletion(
|
|||
else {
|
||||
DBGTRACE(ClassDebugMCN, ("ClasspMediaChangeDetectionCompletion - not retrying immediately"));
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// release the temporary remove lock
|
||||
//
|
||||
|
||||
|
||||
ClassReleaseRemoveLock(DeviceObject, (PIRP)(&uniqueValue));
|
||||
}
|
||||
|
||||
DBGTRACE(ClassDebugMCN, ("< ClasspMediaChangeDetectionCompletion"));
|
||||
|
||||
return STATUS_MORE_PROCESSING_REQUIRED;
|
||||
}
|
||||
}
|
||||
|
||||
/*++////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -1018,8 +1015,8 @@ Routine Description:
|
|||
|
||||
Arguments:
|
||||
|
||||
DeviceObject -
|
||||
Irp -
|
||||
DeviceObject -
|
||||
Irp -
|
||||
|
||||
Return Value:
|
||||
|
||||
|
@ -1060,7 +1057,7 @@ ClasspPrepareMcnIrp(
|
|||
if (status == REMOVE_COMPLETE) {
|
||||
ASSERT(status != REMOVE_COMPLETE);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else if (status == REMOVE_PENDING) {
|
||||
ClassReleaseRemoveLock(FdoExtension->DeviceObject, irp);
|
||||
return NULL;
|
||||
|
@ -1108,12 +1105,12 @@ ClasspPrepareMcnIrp(
|
|||
srb->ScsiStatus = 0;
|
||||
srb->OriginalRequest = irp;
|
||||
srb->SenseInfoBufferLength = SENSE_BUFFER_SIZE;
|
||||
|
||||
|
||||
srb->SrbFlags = FdoExtension->SrbFlags;
|
||||
SET_FLAG(srb->SrbFlags, Info->SrbFlags);
|
||||
|
||||
srb->TimeOutValue = FdoExtension->TimeOutValue * 2;
|
||||
|
||||
|
||||
if (srb->TimeOutValue == 0) {
|
||||
|
||||
if (FdoExtension->TimeOutValue == 0) {
|
||||
|
@ -1122,9 +1119,9 @@ ClasspPrepareMcnIrp(
|
|||
"ClassSendTestUnitIrp: FdoExtension->TimeOutValue "
|
||||
"is set to zero?! -- resetting to 10\n"));
|
||||
srb->TimeOutValue = 10 * 2; // reasonable default
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
KdPrintEx((DPFLTR_CLASSPNP_ID, DPFLTR_ERROR_LEVEL,
|
||||
"ClassSendTestUnitIrp: Someone set "
|
||||
"srb->TimeOutValue to zero?! -- resetting to %x\n",
|
||||
|
@ -1134,9 +1131,9 @@ ClasspPrepareMcnIrp(
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (!UseGesn) {
|
||||
|
||||
|
||||
srb->CdbLength = 6;
|
||||
srb->DataTransferLength = 0;
|
||||
SET_FLAG(srb->SrbFlags, SRB_FLAGS_NO_DATA_TRANSFER);
|
||||
|
@ -1145,16 +1142,16 @@ ClasspPrepareMcnIrp(
|
|||
srb->DataBuffer = NULL;
|
||||
srb->DataTransferLength = 0;
|
||||
irp->MdlAddress = NULL;
|
||||
|
||||
|
||||
cdb = (PCDB) &srb->Cdb[0];
|
||||
cdb->CDB6GENERIC.OperationCode = SCSIOP_TEST_UNIT_READY;
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
ASSERT(Info->Gesn.Buffer);
|
||||
|
||||
srb->TimeOutValue = GESN_TIMEOUT_VALUE; // much shorter timeout for GESN
|
||||
|
||||
|
||||
srb->CdbLength = 10;
|
||||
SET_FLAG(srb->SrbFlags, SRB_FLAGS_DATA_IN);
|
||||
nextIrpStack->Parameters.DeviceIoControl.IoControlCode =
|
||||
|
@ -1197,8 +1194,8 @@ Routine Description:
|
|||
|
||||
Arguments:
|
||||
|
||||
DeviceObject -
|
||||
Irp -
|
||||
DeviceObject -
|
||||
Irp -
|
||||
|
||||
Return Value:
|
||||
|
||||
|
@ -1349,7 +1346,7 @@ ClasspSendMediaStateIrp(
|
|||
// device object directly or to the device's StartIo
|
||||
// routine (which doesn't acquire the lock).
|
||||
//
|
||||
|
||||
|
||||
requestPending = TRUE;
|
||||
|
||||
DBGTRACE(ClassDebugMCN, (" ClasspSendMediaStateIrp - calling IoCallDriver."));
|
||||
|
@ -1368,7 +1365,7 @@ ClasspSendMediaStateIrp(
|
|||
}
|
||||
|
||||
DBGTRACE(ClassDebugMCN, ("< ClasspSendMediaStateIrp"));
|
||||
|
||||
|
||||
return;
|
||||
} // end ClasspSendMediaStateIrp()
|
||||
|
||||
|
@ -1391,9 +1388,7 @@ Return Value:
|
|||
none
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
VOID
|
||||
NTAPI
|
||||
ClassCheckMediaState(
|
||||
IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension
|
||||
)
|
||||
|
@ -1434,7 +1429,7 @@ ClassResetMediaChangeTimer()
|
|||
Routine Description:
|
||||
|
||||
Resets the media change count down timer to the default number of seconds.
|
||||
|
||||
|
||||
Arguments:
|
||||
|
||||
FdoExtension - the device to reset the timer for
|
||||
|
@ -1444,9 +1439,7 @@ Return Value:
|
|||
None
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
VOID
|
||||
NTAPI
|
||||
ClassResetMediaChangeTimer(
|
||||
IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension
|
||||
)
|
||||
|
@ -1470,8 +1463,8 @@ Routine Description:
|
|||
|
||||
Arguments:
|
||||
|
||||
DeviceObject -
|
||||
Irp -
|
||||
DeviceObject -
|
||||
Irp -
|
||||
|
||||
Return Value:
|
||||
|
||||
|
@ -1509,11 +1502,11 @@ ClasspInitializePolling(
|
|||
|
||||
/*
|
||||
* Allocate an IRP to carry the Test-Unit-Ready.
|
||||
* Allocate an extra IRP stack location
|
||||
* Allocate an extra IRP stack location
|
||||
* so we can cache our device object in the top location.
|
||||
*/
|
||||
irp = IoAllocateIrp((CCHAR)(fdo->StackSize+1), FALSE);
|
||||
|
||||
|
||||
if (irp != NULL) {
|
||||
|
||||
PVOID buffer;
|
||||
|
@ -1634,7 +1627,7 @@ ClasspInitializePolling(
|
|||
"ClasspInitializePolling: GESN *NOT* available "
|
||||
"for %p\n", FdoExtension->DeviceObject));
|
||||
}
|
||||
|
||||
|
||||
ASSERT(info->Gesn.Supported == 0);
|
||||
ASSERT(info->Gesn.Buffer == NULL);
|
||||
ASSERT(info->Gesn.BufferSize == 0);
|
||||
|
@ -1661,7 +1654,7 @@ ClasspInitializeGesn(
|
|||
IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension,
|
||||
IN PMEDIA_CHANGE_DETECTION_INFO Info
|
||||
)
|
||||
{
|
||||
{
|
||||
PNOTIFICATION_EVENT_STATUS_HEADER header;
|
||||
CLASS_DETECTION_STATE detectionState = ClassDetectionUnknown;
|
||||
PSTORAGE_ADAPTER_DESCRIPTOR adapterDescriptor;
|
||||
|
@ -1672,7 +1665,7 @@ ClasspInitializeGesn(
|
|||
ULONG i;
|
||||
ULONG atapiResets;
|
||||
|
||||
|
||||
|
||||
PAGED_CODE();
|
||||
ASSERT(Info == FdoExtension->MediaChangeDetectionInfo);
|
||||
|
||||
|
@ -1684,7 +1677,7 @@ ClasspInitializeGesn(
|
|||
CLASSP_REG_SUBKEY_NAME,
|
||||
CLASSP_REG_MMC_DETECTION_VALUE_NAME,
|
||||
(PULONG)&detectionState);
|
||||
|
||||
|
||||
if (detectionState == ClassDetectionUnsupported) {
|
||||
goto ExitWithError;
|
||||
}
|
||||
|
@ -1695,7 +1688,7 @@ ClasspInitializeGesn(
|
|||
|
||||
if (TEST_FLAG(FdoExtension->PrivateFdoData->HackFlags,
|
||||
FDO_HACK_GESN_IS_BAD)) {
|
||||
|
||||
|
||||
detectionState = ClassDetectionUnsupported;
|
||||
ClassSetDeviceParameter(FdoExtension,
|
||||
CLASSP_REG_SUBKEY_NAME,
|
||||
|
@ -1707,7 +1700,7 @@ ClasspInitializeGesn(
|
|||
|
||||
|
||||
//
|
||||
// else go through the process since we allocate buffers and
|
||||
// else go through the process since we allocate buffers and
|
||||
// get all sorts of device settings.
|
||||
//
|
||||
|
||||
|
@ -1750,7 +1743,7 @@ ClasspInitializeGesn(
|
|||
atapiResets = 0;
|
||||
retryImmediately = TRUE;
|
||||
for (i = 0; i < 16 && retryImmediately == TRUE; i++) {
|
||||
|
||||
|
||||
irp = ClasspPrepareMcnIrp(FdoExtension, Info, TRUE);
|
||||
if (irp == NULL) {
|
||||
status = STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
@ -1758,19 +1751,19 @@ ClasspInitializeGesn(
|
|||
}
|
||||
|
||||
ASSERT(TEST_FLAG(Info->MediaChangeSrb.SrbFlags, SRB_FLAGS_NO_QUEUE_FREEZE));
|
||||
|
||||
|
||||
//
|
||||
// replace the completion routine with a different one this time...
|
||||
//
|
||||
|
||||
|
||||
IoSetCompletionRoutine(irp,
|
||||
ClassSignalCompletion,
|
||||
&event,
|
||||
TRUE, TRUE, TRUE);
|
||||
KeInitializeEvent(&event, SynchronizationEvent, FALSE);
|
||||
|
||||
|
||||
status = IoCallDriver(FdoExtension->CommonExtension.LowerDeviceObject, irp);
|
||||
|
||||
|
||||
if (status == STATUS_PENDING) {
|
||||
status = KeWaitForSingleObject(&event,
|
||||
Executive,
|
||||
|
@ -1780,7 +1773,7 @@ ClasspInitializeGesn(
|
|||
ASSERT(NT_SUCCESS(status));
|
||||
}
|
||||
ClassReleaseRemoveLock(FdoExtension->DeviceObject, irp);
|
||||
|
||||
|
||||
if (SRB_STATUS(Info->MediaChangeSrb.SrbStatus) != SRB_STATUS_SUCCESS) {
|
||||
ClassInterpretSenseInfo(FdoExtension->DeviceObject,
|
||||
&(Info->MediaChangeSrb),
|
||||
|
@ -1815,18 +1808,18 @@ ClasspInitializeGesn(
|
|||
if (status == STATUS_DATA_OVERRUN) {
|
||||
status = STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
if ((status == STATUS_INVALID_DEVICE_REQUEST) ||
|
||||
(status == STATUS_TIMEOUT) ||
|
||||
(status == STATUS_IO_DEVICE_ERROR) ||
|
||||
(status == STATUS_IO_TIMEOUT)
|
||||
) {
|
||||
|
||||
|
||||
//
|
||||
// with these error codes, we don't ever want to try this command
|
||||
// again on this device, since it reacts poorly.
|
||||
//
|
||||
|
||||
|
||||
ClassSetDeviceParameter(FdoExtension,
|
||||
CLASSP_REG_SUBKEY_NAME,
|
||||
CLASSP_REG_MMC_DETECTION_VALUE_NAME,
|
||||
|
@ -1836,9 +1829,9 @@ ClasspInitializeGesn(
|
|||
status, FdoExtension->DeviceObject));
|
||||
goto ExitWithError;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (!NT_SUCCESS(status)) {
|
||||
|
||||
//
|
||||
|
@ -1851,21 +1844,21 @@ ClasspInitializeGesn(
|
|||
status, FdoExtension->DeviceObject));
|
||||
goto ExitWithError;
|
||||
}
|
||||
|
||||
|
||||
if (i == 0) {
|
||||
|
||||
//
|
||||
// the first time, the request was just retrieving a mask of
|
||||
// available bits. use this to mask future requests.
|
||||
//
|
||||
|
||||
|
||||
header = (PNOTIFICATION_EVENT_STATUS_HEADER)(Info->Gesn.Buffer);
|
||||
|
||||
|
||||
KdPrintEx((DPFLTR_CLASSPNP_ID, ClassDebugMCN,
|
||||
"Classpnp => Fdo %p supports event mask %x\n",
|
||||
FdoExtension->DeviceObject, header->SupportedEventClasses));
|
||||
|
||||
|
||||
|
||||
|
||||
if (TEST_FLAG(header->SupportedEventClasses,
|
||||
NOTIFICATION_MEDIA_STATUS_CLASS_MASK)) {
|
||||
KdPrintEx((DPFLTR_CLASSPNP_ID, ClassDebugMCN,
|
||||
|
@ -1886,13 +1879,13 @@ ClasspInitializeGesn(
|
|||
// therefore, we should not bother querying for the other,
|
||||
// unknown events. clear all but the above flags.
|
||||
//
|
||||
|
||||
|
||||
Info->Gesn.EventMask &=
|
||||
NOTIFICATION_EXTERNAL_REQUEST_CLASS_MASK |
|
||||
NOTIFICATION_MEDIA_STATUS_CLASS_MASK |
|
||||
NOTIFICATION_DEVICE_BUSY_CLASS_MASK ;
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// HACKHACK - REF #0001
|
||||
// Some devices will *never* report an event if we've also requested
|
||||
|
@ -1906,7 +1899,7 @@ ClasspInitializeGesn(
|
|||
// drives, default to enabling the hack until we find evidence of
|
||||
// proper firmware.
|
||||
//
|
||||
|
||||
|
||||
if (CountOfSetBitsUChar(Info->Gesn.EventMask) == 1) {
|
||||
KdPrintEx((DPFLTR_CLASSPNP_ID, ClassDebugMCN,
|
||||
"Classpnp => GESN hack %s for FDO %p\n",
|
||||
|
@ -1919,7 +1912,7 @@ ClasspInitializeGesn(
|
|||
}
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
//
|
||||
// not the first time looping through, so interpret the results.
|
||||
//
|
||||
|
@ -1942,13 +1935,13 @@ ClasspInitializeGesn(
|
|||
// since we also rely upon NOT_READY events to change the cursor
|
||||
// into a "wait" cursor, we can't use GESN without NOT_READY support.
|
||||
//
|
||||
|
||||
|
||||
if (TEST_FLAG(Info->Gesn.EventMask,
|
||||
NOTIFICATION_MEDIA_STATUS_CLASS_MASK) &&
|
||||
TEST_FLAG(Info->Gesn.EventMask,
|
||||
NOTIFICATION_DEVICE_BUSY_CLASS_MASK)
|
||||
) {
|
||||
|
||||
|
||||
KdPrintEx((DPFLTR_CLASSPNP_ID, ClassDebugMCN,
|
||||
"Classpnp => Enabling GESN support for fdo %p\n",
|
||||
FdoExtension->DeviceObject));
|
||||
|
@ -1962,7 +1955,7 @@ ClasspInitializeGesn(
|
|||
return STATUS_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
|
||||
KdPrintEx((DPFLTR_CLASSPNP_ID, ClassDebugMCN,
|
||||
"Classpnp => GESN available but not enabled for fdo %p\n",
|
||||
FdoExtension->DeviceObject));
|
||||
|
@ -2001,18 +1994,16 @@ Routine Description:
|
|||
Arguments:
|
||||
|
||||
FdoExtension is the device to poll
|
||||
|
||||
|
||||
AllowDriveToSleep says whether to attempt to allow the drive to sleep
|
||||
or not. This only affects system-known spin down states, so if a
|
||||
or not. This only affects system-known spin down states, so if a
|
||||
drive spins itself down, this has no effect until the system spins
|
||||
it down.
|
||||
|
||||
Return Value:
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
ClassInitializeTestUnitPolling(
|
||||
IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension,
|
||||
IN BOOLEAN AllowDriveToSleep
|
||||
|
@ -2031,24 +2022,22 @@ Routine Description:
|
|||
to autorun) for a given device. It will then check the device-type wide
|
||||
key "Autorun" in the service key (for legacy reasons), and then look in
|
||||
the device-specific key to potentially override that setting.
|
||||
|
||||
|
||||
If MCN is to be enabled, all neccessary structures and memory are
|
||||
allocated and initialized.
|
||||
|
||||
|
||||
This routine MUST be called only from the ClassInit() callback.
|
||||
|
||||
Arguments:
|
||||
|
||||
FdoExtension - the device to initialize MCN for, if appropriate
|
||||
|
||||
|
||||
EventPrefix - unused, legacy argument. Set to zero.
|
||||
|
||||
Return Value:
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
VOID
|
||||
NTAPI
|
||||
ClassInitializeMediaChangeDetection(
|
||||
IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension,
|
||||
IN PUCHAR EventPrefix
|
||||
|
@ -2119,7 +2108,7 @@ ClassInitializeMediaChangeDetection(
|
|||
if (disabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// if the drive is not a CDROM, allow the drive to sleep
|
||||
//
|
||||
|
@ -2672,7 +2661,7 @@ ClasspIsMediaChangeDisabledForClass(
|
|||
|
||||
}
|
||||
ZwClose(serviceKey);
|
||||
|
||||
|
||||
DebugPrint((ClassDebugMCN, "ClassCheckServiceMCN: "
|
||||
"Autoplay for device %p is %s\n",
|
||||
FdoExtension->DeviceObject,
|
||||
|
@ -2698,15 +2687,13 @@ Routine Description:
|
|||
|
||||
Arguments:
|
||||
|
||||
DeviceObject -
|
||||
Irp -
|
||||
DeviceObject -
|
||||
Irp -
|
||||
|
||||
Return Value:
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
VOID
|
||||
NTAPI
|
||||
ClassEnableMediaChangeDetection(
|
||||
IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension
|
||||
)
|
||||
|
@ -2782,17 +2769,15 @@ Routine Description:
|
|||
|
||||
Arguments:
|
||||
|
||||
DeviceObject -
|
||||
Irp -
|
||||
DeviceObject -
|
||||
Irp -
|
||||
|
||||
Return Value:
|
||||
|
||||
--*/
|
||||
ULONG BreakOnMcnDisable = FALSE;
|
||||
|
||||
SCSIPORTAPI
|
||||
VOID
|
||||
NTAPI
|
||||
ClassDisableMediaChangeDetection(
|
||||
IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension
|
||||
)
|
||||
|
@ -2837,9 +2822,7 @@ Arguments:
|
|||
Return Value:
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
VOID
|
||||
NTAPI
|
||||
ClassCleanupMediaChangeDetection(
|
||||
IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension
|
||||
)
|
||||
|
@ -2853,7 +2836,7 @@ ClassCleanupMediaChangeDetection(
|
|||
}
|
||||
|
||||
FdoExtension->MediaChangeDetectionInfo = NULL;
|
||||
|
||||
|
||||
if (info->Gesn.Buffer) {
|
||||
ExFreePool(info->Gesn.Buffer);
|
||||
}
|
||||
|
@ -2873,8 +2856,8 @@ Routine Description:
|
|||
|
||||
Arguments:
|
||||
|
||||
DeviceObject -
|
||||
Irp -
|
||||
DeviceObject -
|
||||
Irp -
|
||||
|
||||
Return Value:
|
||||
|
||||
|
@ -3067,8 +3050,8 @@ Routine Description:
|
|||
|
||||
Arguments:
|
||||
|
||||
DeviceObject -
|
||||
Irp -
|
||||
DeviceObject -
|
||||
Irp -
|
||||
|
||||
Return Value:
|
||||
|
||||
|
@ -3214,8 +3197,8 @@ Routine Description:
|
|||
|
||||
Arguments:
|
||||
|
||||
DeviceObject -
|
||||
Irp -
|
||||
DeviceObject -
|
||||
Irp -
|
||||
|
||||
Return Value:
|
||||
|
||||
|
@ -3264,8 +3247,8 @@ Routine Description:
|
|||
|
||||
Arguments:
|
||||
|
||||
DeviceObject -
|
||||
Irp -
|
||||
DeviceObject -
|
||||
Irp -
|
||||
|
||||
Return Value:
|
||||
|
||||
|
@ -3317,8 +3300,8 @@ Routine Description:
|
|||
|
||||
Arguments:
|
||||
|
||||
DeviceObject -
|
||||
Irp -
|
||||
DeviceObject -
|
||||
Irp -
|
||||
|
||||
Return Value:
|
||||
|
||||
|
@ -3450,9 +3433,7 @@ Arguments:
|
|||
Return Value:
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
VOID
|
||||
NTAPI
|
||||
ClassNotifyFailurePredicted(
|
||||
PFUNCTIONAL_DEVICE_EXTENSION FdoExtension,
|
||||
PUCHAR Buffer,
|
||||
|
@ -3535,9 +3516,7 @@ Return Value:
|
|||
NT Status
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
ClassSetFailurePredictionPoll(
|
||||
PFUNCTIONAL_DEVICE_EXTENSION FdoExtension,
|
||||
FAILURE_PREDICTION_METHOD FailurePredictionMethod,
|
||||
|
|
|
@ -115,9 +115,7 @@ Return Value:
|
|||
A valid return code for a DriverEntry routine.
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
ULONG
|
||||
NTAPI
|
||||
ClassInitialize(
|
||||
IN PVOID Argument1,
|
||||
IN PVOID Argument2,
|
||||
|
@ -132,7 +130,7 @@ ClassInitialize(
|
|||
NTSTATUS status;
|
||||
|
||||
PAGED_CODE();
|
||||
|
||||
|
||||
DebugPrint((3,"\n\nSCSI Class Driver\n"));
|
||||
|
||||
ClasspInitializeDebugGlobals();
|
||||
|
@ -363,9 +361,7 @@ Return Value:
|
|||
Status Code
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
ULONG
|
||||
NTAPI
|
||||
ClassInitializeEx(
|
||||
IN PDRIVER_OBJECT DriverObject,
|
||||
IN LPGUID Guid,
|
||||
|
@ -1729,10 +1725,7 @@ Return Value:
|
|||
Status is returned.
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
ClassReadDriveCapacity(IN PDEVICE_OBJECT Fdo)
|
||||
NTSTATUS ClassReadDriveCapacity(IN PDEVICE_OBJECT Fdo)
|
||||
{
|
||||
READ_CAPACITY_DATA readCapacityBuffer = {0};
|
||||
NTSTATUS status;
|
||||
|
@ -2015,9 +2008,7 @@ Return Value:
|
|||
None.
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
VOID
|
||||
NTAPI
|
||||
ClassSendStartUnit(
|
||||
IN PDEVICE_OBJECT Fdo
|
||||
)
|
||||
|
@ -2170,9 +2161,7 @@ Return Value:
|
|||
None.
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
ClassAsynchronousCompletion(
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp,
|
||||
|
@ -2438,9 +2427,7 @@ Return Value:
|
|||
NT status
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
ClassIoComplete(
|
||||
IN PDEVICE_OBJECT Fdo,
|
||||
IN PIRP Irp,
|
||||
|
@ -2656,9 +2643,7 @@ Return Value:
|
|||
Srb->DataTransferLength
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
ClassSendSrbSynchronous(
|
||||
PDEVICE_OBJECT Fdo,
|
||||
PSCSI_REQUEST_BLOCK Srb,
|
||||
|
@ -3004,9 +2989,7 @@ Return Value:
|
|||
FALSE: Drivers should not retry this request.
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
BOOLEAN
|
||||
NTAPI
|
||||
ClassInterpretSenseInfo(
|
||||
IN PDEVICE_OBJECT Fdo,
|
||||
IN PSCSI_REQUEST_BLOCK Srb,
|
||||
|
@ -4070,7 +4053,7 @@ ClassInterpretSenseInfo(
|
|||
|
||||
/*
|
||||
* If logError is set, also save this log in the system's error log.
|
||||
* But make sure we don't log TUR failures over and over
|
||||
* But make sure we don't log TUR failures over and over
|
||||
* (e.g. if an external drive was switched off and we're still sending TUR's to it every second).
|
||||
*/
|
||||
if ((((PCDB)Srb->Cdb)->CDB10.OperationCode == SCSIOP_TEST_UNIT_READY) && logError){
|
||||
|
@ -4078,7 +4061,7 @@ ClassInterpretSenseInfo(
|
|||
logError = FALSE;
|
||||
}
|
||||
else {
|
||||
fdoData->LoggedTURFailureSinceLastIO = TRUE;
|
||||
fdoData->LoggedTURFailureSinceLastIO = TRUE;
|
||||
}
|
||||
}
|
||||
if (logError){
|
||||
|
@ -4137,10 +4120,7 @@ Return Value:
|
|||
Length of the transferred data is returned.
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
ULONG
|
||||
NTAPI
|
||||
ClassModeSense( IN PDEVICE_OBJECT Fdo,
|
||||
ULONG ClassModeSense( IN PDEVICE_OBJECT Fdo,
|
||||
IN PCHAR ModeSenseBuffer,
|
||||
IN ULONG Length,
|
||||
IN UCHAR PageMode)
|
||||
|
@ -4226,9 +4206,7 @@ Return Value:
|
|||
then NULL is return.
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
PVOID
|
||||
NTAPI
|
||||
ClassFindModePage(
|
||||
IN PCHAR ModeSenseBuffer,
|
||||
IN ULONG Length,
|
||||
|
@ -4339,9 +4317,7 @@ Return Value:
|
|||
or returns a status value to indicate why it failed.
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
ClassSendSrbAsynchronous(
|
||||
PDEVICE_OBJECT Fdo,
|
||||
PSCSI_REQUEST_BLOCK Srb,
|
||||
|
@ -4609,9 +4585,7 @@ Return Value:
|
|||
Returns back a STATUS_PENDING or a completion status.
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
ClassDeviceControl(
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp
|
||||
|
@ -5634,7 +5608,6 @@ Return Value:
|
|||
|
||||
--*/
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
ClassShutdownFlush(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp
|
||||
|
@ -5707,9 +5680,7 @@ Return Value:
|
|||
NTSTATUS
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
ClassCreateDeviceObject(
|
||||
IN PDRIVER_OBJECT DriverObject,
|
||||
IN PCCHAR ObjectNameBuffer,
|
||||
|
@ -6006,9 +5977,7 @@ Return Value:
|
|||
Returns a status indicating success or failure of the operation.
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
ClassClaimDevice(
|
||||
IN PDEVICE_OBJECT LowerDeviceObject,
|
||||
IN BOOLEAN Release
|
||||
|
@ -6139,9 +6108,7 @@ Return Value:
|
|||
Returns back a STATUS_PENDING or a completion status.
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
ClassInternalIoControl(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp
|
||||
|
@ -6213,9 +6180,7 @@ Return Value:
|
|||
None, but it sets a new default timeout for a class of devices.
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
ULONG
|
||||
NTAPI
|
||||
ClassQueryTimeOutRegistryValue(
|
||||
IN PDEVICE_OBJECT DeviceObject
|
||||
)
|
||||
|
@ -6322,9 +6287,7 @@ Return Value:
|
|||
NT status
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
ClassCheckVerifyComplete(
|
||||
IN PDEVICE_OBJECT Fdo,
|
||||
IN PIRP Irp,
|
||||
|
@ -6389,9 +6352,7 @@ Return Value:
|
|||
buffer allocated on behalf of the caller.
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
ClassGetDescriptor(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PSTORAGE_PROPERTY_ID PropertyId,
|
||||
|
@ -6540,9 +6501,7 @@ Return Value:
|
|||
STATUS_MORE_PROCESSING_REQUIRED
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
ClassSignalCompletion(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp,
|
||||
|
@ -6629,9 +6588,7 @@ Return Value:
|
|||
None
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
VOID
|
||||
NTAPI
|
||||
ClassMarkChildrenMissing(
|
||||
IN PFUNCTIONAL_DEVICE_EXTENSION Fdo
|
||||
)
|
||||
|
@ -6683,9 +6640,7 @@ Return Value:
|
|||
to PNP.
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
BOOLEAN
|
||||
NTAPI
|
||||
ClassMarkChildMissing(
|
||||
IN PPHYSICAL_DEVICE_EXTENSION Child,
|
||||
IN BOOLEAN AcquireChildLock
|
||||
|
@ -6939,9 +6894,7 @@ Return Value:
|
|||
none
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
VOID
|
||||
NTAPI
|
||||
ClassInvalidateBusRelations(
|
||||
IN PDEVICE_OBJECT Fdo
|
||||
)
|
||||
|
@ -6996,9 +6949,7 @@ Return Value:
|
|||
status
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
ClassRemoveDevice(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN UCHAR RemoveType
|
||||
|
@ -7262,9 +7213,7 @@ Return Value:
|
|||
Either NULL if none, or a pointer to the driver extension
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
PCLASS_DRIVER_EXTENSION
|
||||
NTAPI
|
||||
ClassGetDriverExtension(
|
||||
IN PDRIVER_OBJECT DriverObject
|
||||
)
|
||||
|
@ -7348,9 +7297,7 @@ Return Value:
|
|||
None
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
VOID
|
||||
NTAPI
|
||||
ClassUpdateInformationInRegistry(
|
||||
IN PDEVICE_OBJECT Fdo,
|
||||
IN PCHAR DeviceName,
|
||||
|
@ -7687,9 +7634,7 @@ Arguments:
|
|||
Return Value:
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
VOID
|
||||
NTAPI
|
||||
ClassSendDeviceIoControlSynchronous(
|
||||
IN ULONG IoControlCode,
|
||||
IN PDEVICE_OBJECT TargetDeviceObject,
|
||||
|
@ -7946,9 +7891,7 @@ Arguments:
|
|||
Return Value:
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
ClassForwardIrpSynchronous(
|
||||
IN PCOMMON_DEVICE_EXTENSION CommonExtension,
|
||||
IN PIRP Irp
|
||||
|
@ -7977,9 +7920,7 @@ Arguments:
|
|||
Return Value:
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
ClassSendIrpSynchronous(
|
||||
IN PDEVICE_OBJECT TargetDeviceObject,
|
||||
IN PIRP Irp
|
||||
|
@ -8078,9 +8019,7 @@ Return Value:
|
|||
the VPB, or NULL if none.
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
PVPB
|
||||
NTAPI
|
||||
ClassGetVpb(
|
||||
IN PDEVICE_OBJECT DeviceObject
|
||||
)
|
||||
|
@ -8189,9 +8128,7 @@ Return Value:
|
|||
None.
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
VOID
|
||||
NTAPI
|
||||
ClassReleaseQueue(
|
||||
IN PDEVICE_OBJECT Fdo
|
||||
)
|
||||
|
@ -8511,9 +8448,7 @@ Return Value:
|
|||
None
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
VOID
|
||||
NTAPI
|
||||
ClassAcquireChildLock(
|
||||
IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension
|
||||
)
|
||||
|
@ -8555,9 +8490,7 @@ Return Value:
|
|||
None.
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
VOID
|
||||
NTAPI
|
||||
ClassReleaseChildLock(
|
||||
IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension
|
||||
)
|
||||
|
|
|
@ -424,7 +424,7 @@ struct _CLASS_PRIVATE_FDO_DATA {
|
|||
|
||||
BOOLEAN TimerStarted;
|
||||
BOOLEAN LoggedTURFailureSinceLastIO;
|
||||
|
||||
|
||||
//
|
||||
// privately allocated release queue irp
|
||||
// protected by fdoExtension->ReleaseQueueSpinLock
|
||||
|
@ -508,7 +508,6 @@ static inline BOOLEAN SimpleIsSlistEmpty(SINGLE_LIST_ENTRY *SListHdr)
|
|||
}
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
DriverEntry(
|
||||
IN PDRIVER_OBJECT DriverObject,
|
||||
IN PUNICODE_STRING RegistryPath
|
||||
|
@ -556,6 +555,12 @@ ClassDeviceControlDispatch(
|
|||
PIRP Irp
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
ClassDeviceControl(
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
PIRP Irp
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
ClassDispatchPnp(
|
||||
PDEVICE_OBJECT DeviceObject,
|
||||
|
@ -568,7 +573,12 @@ ClassPnpStartDevice(
|
|||
);
|
||||
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
ClassInternalIoControl (
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
ClassShutdownFlush(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp
|
||||
|
|
|
@ -256,14 +256,14 @@ ClassSystemControl(
|
|||
ClassQueryWmiRegInfoEx = commonExtension->IsFdo ?
|
||||
driverExtension->ClassFdoQueryWmiRegInfoEx :
|
||||
driverExtension->ClassPdoQueryWmiRegInfoEx;
|
||||
|
||||
|
||||
if (ClassQueryWmiRegInfoEx == NULL)
|
||||
{
|
||||
status = classWmiInfo->ClassQueryWmiRegInfo(
|
||||
DeviceObject,
|
||||
&nameFlags,
|
||||
&name);
|
||||
|
||||
|
||||
RtlInitUnicodeString(&mofName, MOFRESOURCENAME);
|
||||
} else {
|
||||
RtlInitUnicodeString(&mofName, L"");
|
||||
|
@ -545,13 +545,13 @@ Arguments:
|
|||
DeviceObject - Supplies a pointer to the device object for this request.
|
||||
|
||||
Irp - Supplies the Irp making the request.
|
||||
|
||||
|
||||
Status - Status to complete the irp with. STATUS_BUFFER_TOO_SMALL is used
|
||||
to indicate that more buffer is required for the data requested.
|
||||
|
||||
|
||||
BufferUsed - number of bytes of actual data to return (not including WMI
|
||||
specific structures)
|
||||
|
||||
|
||||
PriorityBoost - priority boost to pass to ClassCompleteRequest
|
||||
|
||||
Return Value:
|
||||
|
@ -561,7 +561,6 @@ Return Value:
|
|||
--*/
|
||||
SCSIPORTAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
ClassWmiCompleteRequest(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp,
|
||||
|
@ -725,9 +724,7 @@ Return Value:
|
|||
status
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
ClassWmiFireEvent(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN LPGUID Guid,
|
||||
|
|
|
@ -78,9 +78,7 @@ Return Value:
|
|||
lock.
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
ULONG
|
||||
NTAPI
|
||||
ClassAcquireRemoveLockEx(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN OPTIONAL PVOID Tag,
|
||||
|
@ -125,14 +123,14 @@ ClassAcquireRemoveLockEx(
|
|||
&oldIrql);
|
||||
|
||||
commonExtension->RemoveTrackingUntrackedCount++;
|
||||
|
||||
|
||||
DebugPrint((ClassDebugWarning, ">>>>>ClassAcquireRemoveLock: "
|
||||
"Cannot track Tag %p - currently %d untracked requsts\n",
|
||||
Tag, commonExtension->RemoveTrackingUntrackedCount));
|
||||
|
||||
KeReleaseSpinLock(&commonExtension->RemoveTrackingSpinlock,
|
||||
oldIrql);
|
||||
}
|
||||
}
|
||||
else {
|
||||
PREMOVE_TRACKING_BLOCK *removeTrackingList =
|
||||
(PREMOVE_TRACKING_BLOCK)&commonExtension->RemoveTrackingList;
|
||||
|
@ -210,9 +208,7 @@ Return Value:
|
|||
none
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
VOID
|
||||
NTAPI
|
||||
ClassReleaseRemoveLock(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN OPTIONAL PIRP Tag
|
||||
|
@ -365,9 +361,9 @@ Routine Description:
|
|||
Arguments:
|
||||
|
||||
DeviceObject - the device object that was handling this request
|
||||
|
||||
|
||||
Irp - the irp to be completed by IoCompleteRequest
|
||||
|
||||
|
||||
PriorityBoost - the priority boost to pass to IoCompleteRequest
|
||||
|
||||
Return Value:
|
||||
|
@ -375,9 +371,7 @@ Return Value:
|
|||
none
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
VOID
|
||||
NTAPI
|
||||
ClassCompleteRequest(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp,
|
||||
|
|
|
@ -51,10 +51,7 @@ typedef struct _CSCAN_LIST_ENTRY {
|
|||
* StartIo routine when the transfer size is too large for the hardware.
|
||||
* We map it to our new read/write handler.
|
||||
*/
|
||||
SCSIPORTAPI
|
||||
VOID
|
||||
NTAPI
|
||||
ClassSplitRequest(IN PDEVICE_OBJECT Fdo, IN PIRP Irp, IN ULONG MaximumBytes)
|
||||
VOID ClassSplitRequest(IN PDEVICE_OBJECT Fdo, IN PIRP Irp, IN ULONG MaximumBytes)
|
||||
{
|
||||
PFUNCTIONAL_DEVICE_EXTENSION fdoExt = Fdo->DeviceExtension;
|
||||
PCLASS_PRIVATE_FDO_DATA fdoData = fdoExt->PrivateFdoData;
|
||||
|
@ -71,7 +68,7 @@ ClassSplitRequest(IN PDEVICE_OBJECT Fdo, IN PIRP Irp, IN ULONG MaximumBytes)
|
|||
}
|
||||
|
||||
ServiceTransferRequest(Fdo, Irp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*++////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -102,9 +99,7 @@ Return Value:
|
|||
NT status
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
ClassIoCompleteAssociated(
|
||||
IN PDEVICE_OBJECT Fdo,
|
||||
IN PIRP Irp,
|
||||
|
@ -481,9 +476,7 @@ Return Value:
|
|||
NT Status
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
ClassBuildRequest(
|
||||
PDEVICE_OBJECT Fdo,
|
||||
PIRP Irp
|
||||
|
@ -746,13 +739,13 @@ VOID ClasspInsertCScanList(IN PLIST_ENTRY ListHead, IN PCSCAN_LIST_ENTRY Entry)
|
|||
DBGWARN(("ClasspInsertCScanList is OBSOLETE !"));
|
||||
|
||||
//
|
||||
// Iterate through the list. Insert this entry in the sorted list in
|
||||
// order (after other requests for the same block). At each stop if
|
||||
// Iterate through the list. Insert this entry in the sorted list in
|
||||
// order (after other requests for the same block). At each stop if
|
||||
// blockNumber(Entry) >= blockNumber(t) then move on.
|
||||
//
|
||||
|
||||
for(t = (PCSCAN_LIST_ENTRY) ListHead->Flink;
|
||||
t != (PCSCAN_LIST_ENTRY) ListHead;
|
||||
for(t = (PCSCAN_LIST_ENTRY) ListHead->Flink;
|
||||
t != (PCSCAN_LIST_ENTRY) ListHead;
|
||||
t = (PCSCAN_LIST_ENTRY) t->Entry.Flink) {
|
||||
|
||||
if(Entry->BlockNumber < t->BlockNumber) {
|
||||
|
@ -775,7 +768,7 @@ VOID ClasspInsertCScanList(IN PLIST_ENTRY ListHead, IN PCSCAN_LIST_ENTRY Entry)
|
|||
}
|
||||
|
||||
//
|
||||
// Insert this entry at the tail of the list. If the list was empty this
|
||||
// Insert this entry at the tail of the list. If the list was empty this
|
||||
// will also be the head of the list.
|
||||
//
|
||||
|
||||
|
@ -794,25 +787,25 @@ Routine Description:
|
|||
to the access of the list.
|
||||
|
||||
Low priority requests are always scheduled to run on the next sweep across
|
||||
the disk. Normal priority requests will be inserted into the current or
|
||||
the disk. Normal priority requests will be inserted into the current or
|
||||
next sweep based on the standard C-SCAN algorithm.
|
||||
|
||||
Arguments:
|
||||
|
||||
List - the list to insert into
|
||||
|
||||
|
||||
Irp - the irp to be inserted.
|
||||
|
||||
|
||||
BlockNumber - the block number for this request.
|
||||
|
||||
LowPriority - indicates that the request is lower priority and should be
|
||||
done on the next sweep across the disk.
|
||||
|
||||
LowPriority - indicates that the request is lower priority and should be
|
||||
done on the next sweep across the disk.
|
||||
|
||||
Return Value:
|
||||
|
||||
none
|
||||
|
||||
--*/
|
||||
|
||||
--*/
|
||||
{
|
||||
PCSCAN_LIST_ENTRY entry = (PCSCAN_LIST_ENTRY)Irp->Tail.Overlay.DriverContext;
|
||||
|
||||
|
@ -824,7 +817,7 @@ Return Value:
|
|||
entry->BlockNumber = BlockNumber;
|
||||
|
||||
//
|
||||
// If it's a normal priority request and further down the disk than our
|
||||
// If it's a normal priority request and further down the disk than our
|
||||
// current position then insert this entry into the current sweep.
|
||||
//
|
||||
|
||||
|
@ -845,22 +838,22 @@ VOID ClassFreeOrReuseSrb( IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension,
|
|||
|
||||
Routine Description:
|
||||
|
||||
This routine will attempt to reuse the provided SRB to start a blocked
|
||||
read/write request.
|
||||
This routine will attempt to reuse the provided SRB to start a blocked
|
||||
read/write request.
|
||||
If there is no need to reuse the request it will be returned
|
||||
to the SRB lookaside list.
|
||||
|
||||
Arguments:
|
||||
|
||||
Fdo - the device extension
|
||||
|
||||
|
||||
Srb - the SRB which is to be reused or freed.
|
||||
|
||||
|
||||
Return Value:
|
||||
|
||||
none.
|
||||
|
||||
--*/
|
||||
|
||||
--*/
|
||||
|
||||
{
|
||||
PCLASS_PRIVATE_FDO_DATA privateData = FdoExtension->PrivateFdoData;
|
||||
|
@ -876,7 +869,7 @@ Return Value:
|
|||
// memory leak.
|
||||
//
|
||||
ASSERT(!TEST_FLAG(Srb->SrbFlags, SRB_FLAGS_FREE_SENSE_BUFFER));
|
||||
|
||||
|
||||
if (commonExt->IsSrbLookasideListInitialized){
|
||||
/*
|
||||
* Put the SRB back in our lookaside list.
|
||||
|
@ -903,7 +896,7 @@ Routine Description:
|
|||
|
||||
This routine deletes a lookaside listhead for srbs, and should be called
|
||||
only during the final removal.
|
||||
|
||||
|
||||
If called at other times, the caller is responsible for
|
||||
synchronization and removal issues.
|
||||
|
||||
|
@ -916,10 +909,7 @@ Return Value:
|
|||
None
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
VOID
|
||||
NTAPI
|
||||
ClassDeleteSrbLookasideList(IN PCOMMON_DEVICE_EXTENSION CommonExtension)
|
||||
VOID ClassDeleteSrbLookasideList(IN PCOMMON_DEVICE_EXTENSION CommonExtension)
|
||||
{
|
||||
PAGED_CODE();
|
||||
|
||||
|
@ -933,7 +923,7 @@ ClassDeleteSrbLookasideList(IN PCOMMON_DEVICE_EXTENSION CommonExtension)
|
|||
else {
|
||||
DBGWARN(("ClassDeleteSrbLookasideList: attempt to delete uninitialized or freed srblookasidelist"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*++////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -944,7 +934,7 @@ Routine Description:
|
|||
|
||||
This routine sets up a lookaside listhead for srbs, and should be called
|
||||
only from the ClassInitDevice() routine to prevent race conditions.
|
||||
|
||||
|
||||
If called from other locations, the caller is responsible for
|
||||
synchronization and removal issues.
|
||||
|
||||
|
@ -954,7 +944,7 @@ Arguments:
|
|||
|
||||
NumberElements - Supplies the maximum depth of the lookaside list.
|
||||
|
||||
|
||||
|
||||
Note:
|
||||
|
||||
The Windows 2000 version of classpnp did not return any status value from
|
||||
|
@ -962,10 +952,7 @@ Note:
|
|||
|
||||
--*/
|
||||
|
||||
SCSIPORTAPI
|
||||
VOID
|
||||
NTAPI
|
||||
ClassInitializeSrbLookasideList( IN PCOMMON_DEVICE_EXTENSION CommonExtension,
|
||||
VOID ClassInitializeSrbLookasideList( IN PCOMMON_DEVICE_EXTENSION CommonExtension,
|
||||
IN ULONG NumberElements)
|
||||
{
|
||||
PAGED_CODE();
|
||||
|
@ -986,8 +973,8 @@ ClassInitializeSrbLookasideList( IN PCOMMON_DEVICE_EXTENSION CommonExtension,
|
|||
|
||||
CommonExtension->IsSrbLookasideListInitialized = TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1021,7 +1008,7 @@ VOID ClasspStartNextSweep(PCSCAN_LIST List)
|
|||
List->CurrentSweep = List->NextSweep;
|
||||
|
||||
//
|
||||
// Unlink the next sweep list from the list head now that we have a copy
|
||||
// Unlink the next sweep list from the list head now that we have a copy
|
||||
// of it.
|
||||
//
|
||||
|
||||
|
|
|
@ -77,8 +77,8 @@ Routine Description:
|
|||
|
||||
Arguments:
|
||||
|
||||
DeviceObject -
|
||||
Irp -
|
||||
DeviceObject -
|
||||
Irp -
|
||||
|
||||
Return Value:
|
||||
|
||||
|
@ -151,7 +151,7 @@ Return Value:
|
|||
|
||||
STATUS_MORE_PROCESSING_REQUIRED or
|
||||
STATUS_SUCCESS
|
||||
|
||||
|
||||
--*/
|
||||
NTSTATUS
|
||||
ClasspPowerUpCompletion(
|
||||
|
@ -389,7 +389,7 @@ ClasspPowerUpCompletion(
|
|||
break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
// reset retries
|
||||
Context->RetryCount = MAXIMUM_RETRIES;
|
||||
|
||||
|
@ -406,7 +406,7 @@ ClasspPowerUpCompletionFailure:
|
|||
Context->Srb.SrbFlags = SRB_FLAGS_BYPASS_LOCKED_QUEUE;
|
||||
Context->Srb.SrbStatus = Context->Srb.ScsiStatus = 0;
|
||||
Context->Srb.DataTransferLength = 0;
|
||||
|
||||
|
||||
nextStack->Parameters.Scsi.Srb = &(Context->Srb);
|
||||
nextStack->MajorFunction = IRP_MJ_SCSI;
|
||||
|
||||
|
@ -466,7 +466,7 @@ ClasspPowerUpCompletionFailure:
|
|||
// Indicate to Po that we've been successfully powered up so
|
||||
// it can do it's notification stuff.
|
||||
//
|
||||
|
||||
|
||||
PoSetPowerState(DeviceObject,
|
||||
currentStack->Parameters.Power.Type,
|
||||
currentStack->Parameters.Power.State);
|
||||
|
@ -623,45 +623,45 @@ ClasspPowerDownCompletion(
|
|||
//
|
||||
// send SCSIOP_SYNCHRONIZE_CACHE
|
||||
//
|
||||
|
||||
|
||||
Context->Srb.Length = sizeof(SCSI_REQUEST_BLOCK);
|
||||
Context->Srb.Function = SRB_FUNCTION_EXECUTE_SCSI;
|
||||
|
||||
|
||||
Context->Srb.TimeOutValue = fdoExtension->TimeOutValue;
|
||||
|
||||
|
||||
Context->Srb.SrbFlags = SRB_FLAGS_NO_DATA_TRANSFER |
|
||||
SRB_FLAGS_DISABLE_AUTOSENSE |
|
||||
SRB_FLAGS_DISABLE_SYNCH_TRANSFER |
|
||||
SRB_FLAGS_NO_QUEUE_FREEZE |
|
||||
SRB_FLAGS_BYPASS_LOCKED_QUEUE;
|
||||
|
||||
|
||||
Context->Srb.SrbStatus = Context->Srb.ScsiStatus = 0;
|
||||
Context->Srb.DataTransferLength = 0;
|
||||
|
||||
|
||||
Context->Srb.CdbLength = 10;
|
||||
|
||||
|
||||
cdb = (PCDB) Context->Srb.Cdb;
|
||||
|
||||
|
||||
RtlZeroMemory(cdb, sizeof(CDB));
|
||||
cdb->SYNCHRONIZE_CACHE10.OperationCode = SCSIOP_SYNCHRONIZE_CACHE;
|
||||
|
||||
|
||||
IoSetCompletionRoutine(Irp,
|
||||
ClasspPowerDownCompletion,
|
||||
Context,
|
||||
TRUE,
|
||||
TRUE,
|
||||
TRUE);
|
||||
|
||||
|
||||
nextStack->Parameters.Scsi.Srb = &(Context->Srb);
|
||||
nextStack->MajorFunction = IRP_MJ_SCSI;
|
||||
|
||||
|
||||
status = IoCallDriver(commonExtension->LowerDeviceObject, Irp);
|
||||
|
||||
|
||||
DebugPrint((1, "(%p)\tIoCallDriver returned %lx\n", Irp, status));
|
||||
break;
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
DebugPrint((1, "(%p)\tPower Down: not sending SYNCH_CACHE\n",
|
||||
DeviceObject));
|
||||
Context->PowerChangeState.PowerDown2++;
|
||||
|
@ -671,7 +671,7 @@ ClasspPowerDownCompletion(
|
|||
// no break in case the device doesn't like synch_cache commands
|
||||
|
||||
}
|
||||
|
||||
|
||||
case PowerDownDeviceFlushed2: {
|
||||
|
||||
PCDB cdb;
|
||||
|
@ -843,9 +843,9 @@ ClasspPowerDownCompletion(
|
|||
//
|
||||
|
||||
if (!NT_SUCCESS(status)) {
|
||||
|
||||
|
||||
PSENSE_DATA senseBuffer = Context->Srb.SenseInfoBuffer;
|
||||
|
||||
|
||||
if (TEST_FLAG(Context->Srb.SrbStatus,
|
||||
SRB_STATUS_AUTOSENSE_VALID) &&
|
||||
((senseBuffer->SenseKey & 0xf) == SCSI_SENSE_NOT_READY) &&
|
||||
|
@ -881,7 +881,7 @@ ClasspPowerDownCompletion(
|
|||
DebugPrint((1, "(%p)\tPoCallDriver returned %lx\n", Irp, status));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// else fall through w/o sending the power irp, since the device
|
||||
// is reporting an error that would be "really bad" to power down
|
||||
// during.
|
||||
|
@ -900,7 +900,7 @@ ClasspPowerDownCompletion(
|
|||
if (Context->QueueLocked) {
|
||||
|
||||
DebugPrint((1, "(%p)\tUnlocking queue\n", Irp));
|
||||
|
||||
|
||||
Context->Srb.Length = sizeof(SCSI_REQUEST_BLOCK);
|
||||
|
||||
Context->Srb.SrbStatus = Context->Srb.ScsiStatus = 0;
|
||||
|
@ -956,7 +956,7 @@ ClasspPowerDownCompletion(
|
|||
Irp->IoStatus.Information = 0;
|
||||
|
||||
if (NT_SUCCESS(status)) {
|
||||
|
||||
|
||||
//
|
||||
// Set the new power state
|
||||
//
|
||||
|
@ -989,7 +989,7 @@ Routine Description:
|
|||
This routine reduces the number of useless spinups and spindown requests
|
||||
sent to a given device by ignoring transitions to power states we are
|
||||
currently in.
|
||||
|
||||
|
||||
ISSUE-2000/02/20-henrygab - by ignoring spin-up requests, we may be
|
||||
allowing the drive
|
||||
|
||||
|
@ -1046,7 +1046,7 @@ ClasspPowerHandler(
|
|||
irpStack->Parameters.Power.State.SystemState));
|
||||
|
||||
switch (irpStack->Parameters.Power.ShutdownType){
|
||||
|
||||
|
||||
case PowerActionSleep:
|
||||
case PowerActionHibernate:
|
||||
if (fdoData->HotplugInfo.MediaRemovable || fdoData->HotplugInfo.MediaHotplug){
|
||||
|
@ -1060,7 +1060,7 @@ ClasspPowerHandler(
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1311,7 +1311,7 @@ ClassMinimalPowerHandler(
|
|||
|
||||
if (DeviceObject->Characteristics & FILE_REMOVABLE_MEDIA) {
|
||||
|
||||
PFUNCTIONAL_DEVICE_EXTENSION fdoExtension =
|
||||
PFUNCTIONAL_DEVICE_EXTENSION fdoExtension =
|
||||
DeviceObject->DeviceExtension;
|
||||
|
||||
//
|
||||
|
@ -1319,9 +1319,9 @@ ClassMinimalPowerHandler(
|
|||
//
|
||||
if (irpStack->MinorFunction == IRP_MN_SET_POWER){
|
||||
PVPB vpb;
|
||||
|
||||
|
||||
switch (irpStack->Parameters.Power.ShutdownType){
|
||||
|
||||
|
||||
case PowerActionSleep:
|
||||
case PowerActionHibernate:
|
||||
//
|
||||
|
@ -1331,11 +1331,11 @@ ClassMinimalPowerHandler(
|
|||
//
|
||||
vpb = ClassGetVpb(fdoExtension->DeviceObject);
|
||||
if (vpb && (vpb->Flags & VPB_MOUNTED)){
|
||||
SET_FLAG(fdoExtension->DeviceObject->Flags, DO_VERIFY_VOLUME);
|
||||
}
|
||||
SET_FLAG(fdoExtension->DeviceObject->Flags, DO_VERIFY_VOLUME);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IoCopyCurrentIrpStackLocationToNext(Irp);
|
||||
|
@ -1345,7 +1345,7 @@ ClassMinimalPowerHandler(
|
|||
|
||||
if (irpStack->MinorFunction != IRP_MN_SET_POWER &&
|
||||
irpStack->MinorFunction != IRP_MN_QUERY_POWER) {
|
||||
|
||||
|
||||
NOTHING;
|
||||
|
||||
} else {
|
||||
|
@ -1371,7 +1371,7 @@ Routine Description:
|
|||
a start and a stop to be sent to the device. (actually the starts are
|
||||
almost always optional, since most device power themselves on to process
|
||||
commands, but i digress).
|
||||
|
||||
|
||||
Determines proper use of spinup, spindown, and queue locking based upon
|
||||
ScanForSpecialFlags in the FdoExtension. This is the most common power
|
||||
handler passed into classpnp.sys
|
||||
|
@ -1387,9 +1387,7 @@ Return Value:
|
|||
None
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
ClassSpinDownPowerHandler(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp
|
||||
|
@ -1451,14 +1449,12 @@ Routine Description:
|
|||
This routine is an outdated call. To achieve equivalent functionality,
|
||||
the driver should set the following flags in ScanForSpecialFlags in the
|
||||
FdoExtension:
|
||||
|
||||
|
||||
CLASS_SPECIAL_DISABLE_SPIN_UP
|
||||
CLASS_SPECIAL_NO_QUEUE_LOCK
|
||||
|
||||
--*/
|
||||
SCSIPORTAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
ClassStopUnitPowerHandler(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp
|
||||
|
|
|
@ -55,10 +55,7 @@ BOOLEAN ClasspMyStringMatches(IN PCHAR StringToMatch OPTIONAL, IN PCHAR TargetSt
|
|||
}
|
||||
|
||||
|
||||
SCSIPORTAPI
|
||||
VOID
|
||||
NTAPI
|
||||
ClassGetDeviceParameter(
|
||||
VOID ClassGetDeviceParameter(
|
||||
IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension,
|
||||
IN PWSTR SubkeyName OPTIONAL,
|
||||
IN PWSTR ParameterName,
|
||||
|
@ -143,10 +140,7 @@ ClassGetDeviceParameter(
|
|||
} // end ClassGetDeviceParameter()
|
||||
|
||||
|
||||
SCSIPORTAPI
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
ClassSetDeviceParameter(
|
||||
NTSTATUS ClassSetDeviceParameter(
|
||||
IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension,
|
||||
IN PWSTR SubkeyName OPTIONAL,
|
||||
IN PWSTR ParameterName,
|
||||
|
@ -224,10 +218,7 @@ ClassSetDeviceParameter(
|
|||
* hardware based upon id strings. it does not check the registry.
|
||||
*/
|
||||
|
||||
SCSIPORTAPI
|
||||
VOID
|
||||
NTAPI
|
||||
ClassScanForSpecial(
|
||||
VOID ClassScanForSpecial(
|
||||
IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension,
|
||||
IN CLASSPNP_SCAN_FOR_SPECIAL_INFO DeviceList[],
|
||||
IN PCLASS_SCAN_FOR_SPECIAL_HANDLER Function)
|
||||
|
|
Loading…
Reference in a new issue