Author: jgardou
Date: Sat Oct 30 00:03:28 2010
New Revision: 49345
URL:
http://svn.reactos.org/svn/reactos?rev=49345&view=rev
Log:
[CLASSPNP]
- fix a whole bunch of function prototype. (how does t even work in trunk?)
[CMAKE]
- add classpnp.sys to build
Added:
branches/cmake-bringup/drivers/storage/classpnp/CMakeLists.txt (with props)
Modified:
branches/cmake-bringup/drivers/storage/CMakeLists.txt
branches/cmake-bringup/drivers/storage/classpnp/autorun.c
branches/cmake-bringup/drivers/storage/classpnp/class.c
branches/cmake-bringup/drivers/storage/classpnp/classp.h
branches/cmake-bringup/drivers/storage/classpnp/classwmi.c
branches/cmake-bringup/drivers/storage/classpnp/lock.c
branches/cmake-bringup/drivers/storage/classpnp/obsolete.c
branches/cmake-bringup/drivers/storage/classpnp/power.c
branches/cmake-bringup/drivers/storage/classpnp/utils.c
Modified: branches/cmake-bringup/drivers/storage/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/drivers/storage/C…
==============================================================================
--- branches/cmake-bringup/drivers/storage/CMakeLists.txt [iso-8859-1] (original)
+++ branches/cmake-bringup/drivers/storage/CMakeLists.txt [iso-8859-1] Sat Oct 30 00:03:28
2010
@@ -1,5 +1,6 @@
add_subdirectory(class)
+add_subdirectory(classpnp)
add_subdirectory(floppy)
add_subdirectory(ide)
add_subdirectory(port)
Added: branches/cmake-bringup/drivers/storage/classpnp/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/drivers/storage/c…
==============================================================================
--- branches/cmake-bringup/drivers/storage/classpnp/CMakeLists.txt (added)
+++ branches/cmake-bringup/drivers/storage/classpnp/CMakeLists.txt [iso-8859-1] Sat Oct 30
00:03:28 2010
@@ -1,0 +1,42 @@
+
+include_directories(../inc)
+
+add_definitions(
+ -DCLASS_GLOBAL_BREAK_ON_LOST_IRPS=0
+ -DCLASS_GLOBAL_SECONDS_TO_WAIT_FOR_SYNCHRONOUS_SRB=100
+ -DCLASS_GLOBAL_USE_DELAYED_RETRY=1
+ -DCLASS_GLOBAL_BUFFERED_DEBUG_PRINT=0
+ -DCLASS_GLOBAL_BUFFERED_DEBUG_PRINT_BUFFER_SIZE=512
+ -DCLASS_GLOBAL_BUFFERED_DEBUG_PRINT_BUFFERS=512
+)
+
+list(APPEND SOURCE
+ autorun.c
+ class.c
+ classwmi.c
+ clntirp.c
+ create.c
+ data.c
+ debug.c
+ dictlib.c
+ lock.c
+ obsolete.c
+ power.c
+ retry.c
+ utils.c
+ xferpkt.c
+ class.rc
+)
+
+spec2def(classpnp ${CMAKE_CURRENT_SOURCE_DIR}/class.spec
${CMAKE_CURRENT_BINARY_DIR}/class.def)
+
+add_library(classpnp SHARED ${SOURCE})
+target_link_libraries(classpnp ${CMAKE_CURRENT_BINARY_DIR}/class.def pseh libcntpr)
+add_dependencies(classpnp classpnp_def)
+
+set_module_type(classpnp kernelmodedriver)
+
+add_importlibs(classpnp hal ntoskrnl)
+
+add_minicd_target(classpnp reactos classpnp.sys)
+add_livecd_target(classpnp reactos/system32/drivers)
Propchange: branches/cmake-bringup/drivers/storage/classpnp/CMakeLists.txt
------------------------------------------------------------------------------
svn:eol-style = native
Modified: branches/cmake-bringup/drivers/storage/classpnp/autorun.c
URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/drivers/storage/c…
==============================================================================
--- branches/cmake-bringup/drivers/storage/classpnp/autorun.c [iso-8859-1] (original)
+++ branches/cmake-bringup/drivers/storage/classpnp/autorun.c [iso-8859-1] Sat Oct 30
00:03:28 2010
@@ -148,14 +148,14 @@
// 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 @@
{
PTARGET_DEVICE_CUSTOM_NOTIFICATION notification;
ULONG requiredSize;
-
+
requiredSize =
(sizeof(TARGET_DEVICE_CUSTOM_NOTIFICATION) - sizeof(UCHAR)) +
ExtraDataSize;
@@ -186,11 +186,11 @@
requiredSize));
return;
}
-
+
notification = ExAllocatePoolWithTag(NonPagedPool,
requiredSize,
'oNcS');
-
+
//
// if none allocated, exit
//
@@ -202,7 +202,7 @@
//
// Prepare and send the request!
//
-
+
RtlZeroMemory(notification, requiredSize);
notification->Version = 1;
notification->Size = (USHORT)(requiredSize);
@@ -214,7 +214,7 @@
IoReportTargetDeviceChangeAsynchronous(FdoExtension->LowerPdo,
notification,
NULL, NULL);
-
+
ExFreePool(notification);
notification = NULL;
return;
@@ -236,7 +236,7 @@
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 @@
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 @@
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 @@
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 @@
"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 @@
&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 @@
// 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 @@
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 @@
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 @@
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 @@
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 @@
MediaPresent - indicates whether the device has media inserted into it
(TRUE) or not (FALSE).
-
+
Return Value:
none
@@ -656,7 +656,7 @@
sizeof(ULONG),
&data);
- }
+ }
else if (NewState == MediaNotPresent) {
DBGTRACE(ClassDebugTrace, ("ClasspInternalSetMediaChangeState: media
REMOVAL"));
@@ -673,7 +673,7 @@
return;
}
-
+
return;
} // end ClasspInternalSetMediaChangeState()
@@ -769,7 +769,10 @@
return;
} // end ClassSetMediaChangeStateEx()
+
+SCSIPORTAPI
VOID
+NTAPI
ClassSetMediaChangeState(
IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension,
IN MEDIA_CHANGE_DETECTION_STATE NewState,
@@ -833,11 +836,11 @@
/*
* 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
@@ -846,15 +849,15 @@
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
@@ -873,15 +876,15 @@
&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
//
@@ -893,7 +896,7 @@
DBGTRACE(ClassDebugMCN, ("ClasspMediaChangeDetectionCompletion -
succeeded (GESN supported)."));
}
}
-
+
if (info->Gesn.Supported) {
if (status == STATUS_DATA_OVERRUN) {
@@ -901,7 +904,7 @@
status = STATUS_SUCCESS;
}
- if (!NT_SUCCESS(status)) {
+ if (!NT_SUCCESS(status)) {
DBGTRACE(ClassDebugMCN, ("ClasspMediaChangeDetectionCompletion: GESN
failed with status %x", status));
} else {
@@ -909,7 +912,7 @@
// 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,
@@ -946,7 +949,7 @@
//
if (retryImmediately) {
-
+
info->MediaChangeRetryCount++;
if (info->MediaChangeRetryCount > MAXIMUM_IMMEDIATE_MCN_RETRIES) {
ASSERT(!"Recursing too often in MCN?");
@@ -955,7 +958,7 @@
}
} else {
-
+
info->MediaChangeRetryCount = 0;
}
@@ -970,7 +973,7 @@
ClassAcquireRemoveLock(DeviceObject, (PIRP)(&uniqueValue));
ClassReleaseRemoveLock(DeviceObject, Irp);
-
+
//
// set the irp as not in use
//
@@ -992,18 +995,18 @@
else {
DBGTRACE(ClassDebugMCN, ("ClasspMediaChangeDetectionCompletion - not
retrying immediately"));
}
-
+
//
// release the temporary remove lock
//
-
+
ClassReleaseRemoveLock(DeviceObject, (PIRP)(&uniqueValue));
}
DBGTRACE(ClassDebugMCN, ("< ClasspMediaChangeDetectionCompletion"));
return STATUS_MORE_PROCESSING_REQUIRED;
-}
+}
/*++////////////////////////////////////////////////////////////////////////////
@@ -1015,8 +1018,8 @@
Arguments:
- DeviceObject -
- Irp -
+ DeviceObject -
+ Irp -
Return Value:
@@ -1057,7 +1060,7 @@
if (status == REMOVE_COMPLETE) {
ASSERT(status != REMOVE_COMPLETE);
return NULL;
- }
+ }
else if (status == REMOVE_PENDING) {
ClassReleaseRemoveLock(FdoExtension->DeviceObject, irp);
return NULL;
@@ -1105,12 +1108,12 @@
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) {
@@ -1119,9 +1122,9 @@
"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",
@@ -1131,9 +1134,9 @@
}
}
-
+
if (!UseGesn) {
-
+
srb->CdbLength = 6;
srb->DataTransferLength = 0;
SET_FLAG(srb->SrbFlags, SRB_FLAGS_NO_DATA_TRANSFER);
@@ -1142,16 +1145,16 @@
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 =
@@ -1194,8 +1197,8 @@
Arguments:
- DeviceObject -
- Irp -
+ DeviceObject -
+ Irp -
Return Value:
@@ -1346,7 +1349,7 @@
// device object directly or to the device's StartIo
// routine (which doesn't acquire the lock).
//
-
+
requestPending = TRUE;
DBGTRACE(ClassDebugMCN, (" ClasspSendMediaStateIrp - calling
IoCallDriver."));
@@ -1365,7 +1368,7 @@
}
DBGTRACE(ClassDebugMCN, ("< ClasspSendMediaStateIrp"));
-
+
return;
} // end ClasspSendMediaStateIrp()
@@ -1388,7 +1391,9 @@
none
--*/
+SCSIPORTAPI
VOID
+NTAPI
ClassCheckMediaState(
IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension
)
@@ -1429,7 +1434,7 @@
Routine Description:
Resets the media change count down timer to the default number of seconds.
-
+
Arguments:
FdoExtension - the device to reset the timer for
@@ -1439,7 +1444,9 @@
None
--*/
+SCSIPORTAPI
VOID
+NTAPI
ClassResetMediaChangeTimer(
IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension
)
@@ -1463,8 +1470,8 @@
Arguments:
- DeviceObject -
- Irp -
+ DeviceObject -
+ Irp -
Return Value:
@@ -1502,11 +1509,11 @@
/*
* 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;
@@ -1627,7 +1634,7 @@
"ClasspInitializePolling: GESN *NOT* available
"
"for %p\n", FdoExtension->DeviceObject));
}
-
+
ASSERT(info->Gesn.Supported == 0);
ASSERT(info->Gesn.Buffer == NULL);
ASSERT(info->Gesn.BufferSize == 0);
@@ -1654,7 +1661,7 @@
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;
@@ -1665,7 +1672,7 @@
ULONG i;
ULONG atapiResets;
-
+
PAGED_CODE();
ASSERT(Info == FdoExtension->MediaChangeDetectionInfo);
@@ -1677,7 +1684,7 @@
CLASSP_REG_SUBKEY_NAME,
CLASSP_REG_MMC_DETECTION_VALUE_NAME,
(PULONG)&detectionState);
-
+
if (detectionState == ClassDetectionUnsupported) {
goto ExitWithError;
}
@@ -1688,7 +1695,7 @@
if (TEST_FLAG(FdoExtension->PrivateFdoData->HackFlags,
FDO_HACK_GESN_IS_BAD)) {
-
+
detectionState = ClassDetectionUnsupported;
ClassSetDeviceParameter(FdoExtension,
CLASSP_REG_SUBKEY_NAME,
@@ -1700,7 +1707,7 @@
//
- // 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.
//
@@ -1743,7 +1750,7 @@
atapiResets = 0;
retryImmediately = TRUE;
for (i = 0; i < 16 && retryImmediately == TRUE; i++) {
-
+
irp = ClasspPrepareMcnIrp(FdoExtension, Info, TRUE);
if (irp == NULL) {
status = STATUS_INSUFFICIENT_RESOURCES;
@@ -1751,19 +1758,19 @@
}
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,
@@ -1773,7 +1780,7 @@
ASSERT(NT_SUCCESS(status));
}
ClassReleaseRemoveLock(FdoExtension->DeviceObject, irp);
-
+
if (SRB_STATUS(Info->MediaChangeSrb.SrbStatus) != SRB_STATUS_SUCCESS) {
ClassInterpretSenseInfo(FdoExtension->DeviceObject,
&(Info->MediaChangeSrb),
@@ -1808,18 +1815,18 @@
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,
@@ -1829,9 +1836,9 @@
status, FdoExtension->DeviceObject));
goto ExitWithError;
-
- }
-
+
+ }
+
if (!NT_SUCCESS(status)) {
//
@@ -1844,21 +1851,21 @@
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,
@@ -1879,13 +1886,13 @@
// 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
@@ -1899,7 +1906,7 @@
// 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",
@@ -1912,7 +1919,7 @@
}
} else {
-
+
//
// not the first time looping through, so interpret the results.
//
@@ -1935,13 +1942,13 @@
// 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));
@@ -1955,7 +1962,7 @@
return STATUS_SUCCESS;
}
-
+
KdPrintEx((DPFLTR_CLASSPNP_ID, ClassDebugMCN,
"Classpnp => GESN available but not enabled for fdo %p\n",
FdoExtension->DeviceObject));
@@ -1994,16 +2001,18 @@
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
@@ -2022,22 +2031,24 @@
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
@@ -2108,7 +2119,7 @@
if (disabled) {
return;
}
-
+
//
// if the drive is not a CDROM, allow the drive to sleep
//
@@ -2661,7 +2672,7 @@
}
ZwClose(serviceKey);
-
+
DebugPrint((ClassDebugMCN, "ClassCheckServiceMCN: "
"Autoplay for device %p is %s\n",
FdoExtension->DeviceObject,
@@ -2687,13 +2698,15 @@
Arguments:
- DeviceObject -
- Irp -
+ DeviceObject -
+ Irp -
Return Value:
--*/
+SCSIPORTAPI
VOID
+NTAPI
ClassEnableMediaChangeDetection(
IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension
)
@@ -2769,15 +2782,17 @@
Arguments:
- DeviceObject -
- Irp -
+ DeviceObject -
+ Irp -
Return Value:
--*/
ULONG BreakOnMcnDisable = FALSE;
+SCSIPORTAPI
VOID
+NTAPI
ClassDisableMediaChangeDetection(
IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension
)
@@ -2822,7 +2837,9 @@
Return Value:
--*/
+SCSIPORTAPI
VOID
+NTAPI
ClassCleanupMediaChangeDetection(
IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension
)
@@ -2836,7 +2853,7 @@
}
FdoExtension->MediaChangeDetectionInfo = NULL;
-
+
if (info->Gesn.Buffer) {
ExFreePool(info->Gesn.Buffer);
}
@@ -2856,8 +2873,8 @@
Arguments:
- DeviceObject -
- Irp -
+ DeviceObject -
+ Irp -
Return Value:
@@ -3050,8 +3067,8 @@
Arguments:
- DeviceObject -
- Irp -
+ DeviceObject -
+ Irp -
Return Value:
@@ -3197,8 +3214,8 @@
Arguments:
- DeviceObject -
- Irp -
+ DeviceObject -
+ Irp -
Return Value:
@@ -3247,8 +3264,8 @@
Arguments:
- DeviceObject -
- Irp -
+ DeviceObject -
+ Irp -
Return Value:
@@ -3300,8 +3317,8 @@
Arguments:
- DeviceObject -
- Irp -
+ DeviceObject -
+ Irp -
Return Value:
@@ -3433,7 +3450,9 @@
Return Value:
--*/
+SCSIPORTAPI
VOID
+NTAPI
ClassNotifyFailurePredicted(
PFUNCTIONAL_DEVICE_EXTENSION FdoExtension,
PUCHAR Buffer,
@@ -3516,7 +3535,9 @@
NT Status
--*/
+SCSIPORTAPI
NTSTATUS
+NTAPI
ClassSetFailurePredictionPoll(
PFUNCTIONAL_DEVICE_EXTENSION FdoExtension,
FAILURE_PREDICTION_METHOD FailurePredictionMethod,
Modified: branches/cmake-bringup/drivers/storage/classpnp/class.c
URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/drivers/storage/c…
==============================================================================
--- branches/cmake-bringup/drivers/storage/classpnp/class.c [iso-8859-1] (original)
+++ branches/cmake-bringup/drivers/storage/classpnp/class.c [iso-8859-1] Sat Oct 30
00:03:28 2010
@@ -115,7 +115,9 @@
A valid return code for a DriverEntry routine.
--*/
+SCSIPORTAPI
ULONG
+NTAPI
ClassInitialize(
IN PVOID Argument1,
IN PVOID Argument2,
@@ -130,7 +132,7 @@
NTSTATUS status;
PAGED_CODE();
-
+
DebugPrint((3,"\n\nSCSI Class Driver\n"));
ClasspInitializeDebugGlobals();
@@ -361,7 +363,9 @@
Status Code
--*/
+SCSIPORTAPI
ULONG
+NTAPI
ClassInitializeEx(
IN PDRIVER_OBJECT DriverObject,
IN LPGUID Guid,
@@ -1725,7 +1729,10 @@
Status is returned.
--*/
-NTSTATUS ClassReadDriveCapacity(IN PDEVICE_OBJECT Fdo)
+SCSIPORTAPI
+NTSTATUS
+NTAPI
+ClassReadDriveCapacity(IN PDEVICE_OBJECT Fdo)
{
READ_CAPACITY_DATA readCapacityBuffer = {0};
NTSTATUS status;
@@ -2008,7 +2015,9 @@
None.
--*/
+SCSIPORTAPI
VOID
+NTAPI
ClassSendStartUnit(
IN PDEVICE_OBJECT Fdo
)
@@ -2161,7 +2170,9 @@
None.
--*/
+SCSIPORTAPI
NTSTATUS
+NTAPI
ClassAsynchronousCompletion(
PDEVICE_OBJECT DeviceObject,
PIRP Irp,
@@ -2427,7 +2438,9 @@
NT status
--*/
+SCSIPORTAPI
NTSTATUS
+NTAPI
ClassIoComplete(
IN PDEVICE_OBJECT Fdo,
IN PIRP Irp,
@@ -2643,7 +2656,9 @@
Srb->DataTransferLength
--*/
+SCSIPORTAPI
NTSTATUS
+NTAPI
ClassSendSrbSynchronous(
PDEVICE_OBJECT Fdo,
PSCSI_REQUEST_BLOCK Srb,
@@ -2989,7 +3004,9 @@
FALSE: Drivers should not retry this request.
--*/
+SCSIPORTAPI
BOOLEAN
+NTAPI
ClassInterpretSenseInfo(
IN PDEVICE_OBJECT Fdo,
IN PSCSI_REQUEST_BLOCK Srb,
@@ -4053,7 +4070,7 @@
/*
* 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){
@@ -4061,7 +4078,7 @@
logError = FALSE;
}
else {
- fdoData->LoggedTURFailureSinceLastIO = TRUE;
+ fdoData->LoggedTURFailureSinceLastIO = TRUE;
}
}
if (logError){
@@ -4120,7 +4137,10 @@
Length of the transferred data is returned.
--*/
-ULONG ClassModeSense( IN PDEVICE_OBJECT Fdo,
+SCSIPORTAPI
+ULONG
+NTAPI
+ClassModeSense( IN PDEVICE_OBJECT Fdo,
IN PCHAR ModeSenseBuffer,
IN ULONG Length,
IN UCHAR PageMode)
@@ -4206,7 +4226,9 @@
then NULL is return.
--*/
+SCSIPORTAPI
PVOID
+NTAPI
ClassFindModePage(
IN PCHAR ModeSenseBuffer,
IN ULONG Length,
@@ -4317,7 +4339,9 @@
or returns a status value to indicate why it failed.
--*/
+SCSIPORTAPI
NTSTATUS
+NTAPI
ClassSendSrbAsynchronous(
PDEVICE_OBJECT Fdo,
PSCSI_REQUEST_BLOCK Srb,
@@ -4585,7 +4609,9 @@
Returns back a STATUS_PENDING or a completion status.
--*/
+SCSIPORTAPI
NTSTATUS
+NTAPI
ClassDeviceControl(
PDEVICE_OBJECT DeviceObject,
PIRP Irp
@@ -5608,6 +5634,7 @@
--*/
NTSTATUS
+NTAPI
ClassShutdownFlush(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
@@ -5680,7 +5707,9 @@
NTSTATUS
--*/
+SCSIPORTAPI
NTSTATUS
+NTAPI
ClassCreateDeviceObject(
IN PDRIVER_OBJECT DriverObject,
IN PCCHAR ObjectNameBuffer,
@@ -5977,7 +6006,9 @@
Returns a status indicating success or failure of the operation.
--*/
+SCSIPORTAPI
NTSTATUS
+NTAPI
ClassClaimDevice(
IN PDEVICE_OBJECT LowerDeviceObject,
IN BOOLEAN Release
@@ -6108,7 +6139,9 @@
Returns back a STATUS_PENDING or a completion status.
--*/
+SCSIPORTAPI
NTSTATUS
+NTAPI
ClassInternalIoControl(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
@@ -6180,7 +6213,9 @@
None, but it sets a new default timeout for a class of devices.
--*/
+SCSIPORTAPI
ULONG
+NTAPI
ClassQueryTimeOutRegistryValue(
IN PDEVICE_OBJECT DeviceObject
)
@@ -6287,7 +6322,9 @@
NT status
--*/
+SCSIPORTAPI
NTSTATUS
+NTAPI
ClassCheckVerifyComplete(
IN PDEVICE_OBJECT Fdo,
IN PIRP Irp,
@@ -6352,7 +6389,9 @@
buffer allocated on behalf of the caller.
--*/
+SCSIPORTAPI
NTSTATUS
+NTAPI
ClassGetDescriptor(
IN PDEVICE_OBJECT DeviceObject,
IN PSTORAGE_PROPERTY_ID PropertyId,
@@ -6501,7 +6540,9 @@
STATUS_MORE_PROCESSING_REQUIRED
--*/
+SCSIPORTAPI
NTSTATUS
+NTAPI
ClassSignalCompletion(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp,
@@ -6588,7 +6629,9 @@
None
--*/
+SCSIPORTAPI
VOID
+NTAPI
ClassMarkChildrenMissing(
IN PFUNCTIONAL_DEVICE_EXTENSION Fdo
)
@@ -6640,7 +6683,9 @@
to PNP.
--*/
+SCSIPORTAPI
BOOLEAN
+NTAPI
ClassMarkChildMissing(
IN PPHYSICAL_DEVICE_EXTENSION Child,
IN BOOLEAN AcquireChildLock
@@ -6894,7 +6939,9 @@
none
--*/
+SCSIPORTAPI
VOID
+NTAPI
ClassInvalidateBusRelations(
IN PDEVICE_OBJECT Fdo
)
@@ -6949,7 +6996,9 @@
status
--*/
+SCSIPORTAPI
NTSTATUS
+NTAPI
ClassRemoveDevice(
IN PDEVICE_OBJECT DeviceObject,
IN UCHAR RemoveType
@@ -7213,7 +7262,9 @@
Either NULL if none, or a pointer to the driver extension
--*/
+SCSIPORTAPI
PCLASS_DRIVER_EXTENSION
+NTAPI
ClassGetDriverExtension(
IN PDRIVER_OBJECT DriverObject
)
@@ -7297,7 +7348,9 @@
None
--*/
+SCSIPORTAPI
VOID
+NTAPI
ClassUpdateInformationInRegistry(
IN PDEVICE_OBJECT Fdo,
IN PCHAR DeviceName,
@@ -7634,7 +7687,9 @@
Return Value:
--*/
+SCSIPORTAPI
VOID
+NTAPI
ClassSendDeviceIoControlSynchronous(
IN ULONG IoControlCode,
IN PDEVICE_OBJECT TargetDeviceObject,
@@ -7891,7 +7946,9 @@
Return Value:
--*/
+SCSIPORTAPI
NTSTATUS
+NTAPI
ClassForwardIrpSynchronous(
IN PCOMMON_DEVICE_EXTENSION CommonExtension,
IN PIRP Irp
@@ -7920,7 +7977,9 @@
Return Value:
--*/
+SCSIPORTAPI
NTSTATUS
+NTAPI
ClassSendIrpSynchronous(
IN PDEVICE_OBJECT TargetDeviceObject,
IN PIRP Irp
@@ -8019,7 +8078,9 @@
the VPB, or NULL if none.
--*/
+SCSIPORTAPI
PVPB
+NTAPI
ClassGetVpb(
IN PDEVICE_OBJECT DeviceObject
)
@@ -8128,7 +8189,9 @@
None.
--*/
+SCSIPORTAPI
VOID
+NTAPI
ClassReleaseQueue(
IN PDEVICE_OBJECT Fdo
)
@@ -8448,7 +8511,9 @@
None
--*/
+SCSIPORTAPI
VOID
+NTAPI
ClassAcquireChildLock(
IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension
)
@@ -8490,7 +8555,9 @@
None.
--*/
+SCSIPORTAPI
VOID
+NTAPI
ClassReleaseChildLock(
IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension
)
Modified: branches/cmake-bringup/drivers/storage/classpnp/classp.h
URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/drivers/storage/c…
==============================================================================
--- branches/cmake-bringup/drivers/storage/classpnp/classp.h [iso-8859-1] (original)
+++ branches/cmake-bringup/drivers/storage/classpnp/classp.h [iso-8859-1] Sat Oct 30
00:03:28 2010
@@ -424,7 +424,7 @@
BOOLEAN TimerStarted;
BOOLEAN LoggedTURFailureSinceLastIO;
-
+
//
// privately allocated release queue irp
// protected by fdoExtension->ReleaseQueueSpinLock
@@ -508,6 +508,7 @@
}
NTSTATUS
+NTAPI
DriverEntry(
IN PDRIVER_OBJECT DriverObject,
IN PUNICODE_STRING RegistryPath
@@ -556,12 +557,6 @@
);
NTSTATUS
-ClassDeviceControl(
- PDEVICE_OBJECT DeviceObject,
- PIRP Irp
- );
-
-NTSTATUS
ClassDispatchPnp(
PDEVICE_OBJECT DeviceObject,
PIRP Irp
@@ -573,12 +568,7 @@
);
NTSTATUS
-ClassInternalIoControl (
- IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp
- );
-
-NTSTATUS
+NTAPI
ClassShutdownFlush(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
Modified: branches/cmake-bringup/drivers/storage/classpnp/classwmi.c
URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/drivers/storage/c…
==============================================================================
--- branches/cmake-bringup/drivers/storage/classpnp/classwmi.c [iso-8859-1] (original)
+++ branches/cmake-bringup/drivers/storage/classpnp/classwmi.c [iso-8859-1] Sat Oct 30
00:03:28 2010
@@ -256,14 +256,14 @@
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 @@
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,6 +561,7 @@
--*/
SCSIPORTAPI
NTSTATUS
+NTAPI
ClassWmiCompleteRequest(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp,
@@ -724,7 +725,9 @@
status
--*/
+SCSIPORTAPI
NTSTATUS
+NTAPI
ClassWmiFireEvent(
IN PDEVICE_OBJECT DeviceObject,
IN LPGUID Guid,
Modified: branches/cmake-bringup/drivers/storage/classpnp/lock.c
URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/drivers/storage/c…
==============================================================================
--- branches/cmake-bringup/drivers/storage/classpnp/lock.c [iso-8859-1] (original)
+++ branches/cmake-bringup/drivers/storage/classpnp/lock.c [iso-8859-1] Sat Oct 30
00:03:28 2010
@@ -78,7 +78,9 @@
lock.
--*/
+SCSIPORTAPI
ULONG
+NTAPI
ClassAcquireRemoveLockEx(
IN PDEVICE_OBJECT DeviceObject,
IN OPTIONAL PVOID Tag,
@@ -123,14 +125,14 @@
&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;
@@ -208,7 +210,9 @@
none
--*/
+SCSIPORTAPI
VOID
+NTAPI
ClassReleaseRemoveLock(
IN PDEVICE_OBJECT DeviceObject,
IN OPTIONAL PIRP Tag
@@ -361,9 +365,9 @@
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:
@@ -371,7 +375,9 @@
none
--*/
+SCSIPORTAPI
VOID
+NTAPI
ClassCompleteRequest(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp,
Modified: branches/cmake-bringup/drivers/storage/classpnp/obsolete.c
URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/drivers/storage/c…
==============================================================================
--- branches/cmake-bringup/drivers/storage/classpnp/obsolete.c [iso-8859-1] (original)
+++ branches/cmake-bringup/drivers/storage/classpnp/obsolete.c [iso-8859-1] Sat Oct 30
00:03:28 2010
@@ -51,7 +51,10 @@
* StartIo routine when the transfer size is too large for the hardware.
* We map it to our new read/write handler.
*/
-VOID ClassSplitRequest(IN PDEVICE_OBJECT Fdo, IN PIRP Irp, IN ULONG MaximumBytes)
+SCSIPORTAPI
+VOID
+NTAPI
+ClassSplitRequest(IN PDEVICE_OBJECT Fdo, IN PIRP Irp, IN ULONG MaximumBytes)
{
PFUNCTIONAL_DEVICE_EXTENSION fdoExt = Fdo->DeviceExtension;
PCLASS_PRIVATE_FDO_DATA fdoData = fdoExt->PrivateFdoData;
@@ -68,7 +71,7 @@
}
ServiceTransferRequest(Fdo, Irp);
-}
+}
/*++////////////////////////////////////////////////////////////////////////////
@@ -99,7 +102,9 @@
NT status
--*/
+SCSIPORTAPI
NTSTATUS
+NTAPI
ClassIoCompleteAssociated(
IN PDEVICE_OBJECT Fdo,
IN PIRP Irp,
@@ -476,7 +481,9 @@
NT Status
--*/
+SCSIPORTAPI
NTSTATUS
+NTAPI
ClassBuildRequest(
PDEVICE_OBJECT Fdo,
PIRP Irp
@@ -739,13 +746,13 @@
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) {
@@ -768,7 +775,7 @@
}
//
- // 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.
//
@@ -787,25 +794,25 @@
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;
@@ -817,7 +824,7 @@
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.
//
@@ -838,22 +845,22 @@
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;
@@ -869,7 +876,7 @@
// memory leak.
//
ASSERT(!TEST_FLAG(Srb->SrbFlags, SRB_FLAGS_FREE_SENSE_BUFFER));
-
+
if (commonExt->IsSrbLookasideListInitialized){
/*
* Put the SRB back in our lookaside list.
@@ -896,7 +903,7 @@
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.
@@ -909,7 +916,10 @@
None
--*/
-VOID ClassDeleteSrbLookasideList(IN PCOMMON_DEVICE_EXTENSION CommonExtension)
+SCSIPORTAPI
+VOID
+NTAPI
+ClassDeleteSrbLookasideList(IN PCOMMON_DEVICE_EXTENSION CommonExtension)
{
PAGED_CODE();
@@ -923,7 +933,7 @@
else {
DBGWARN(("ClassDeleteSrbLookasideList: attempt to delete uninitialized or
freed srblookasidelist"));
}
-}
+}
/*++////////////////////////////////////////////////////////////////////////////
@@ -934,7 +944,7 @@
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.
@@ -944,7 +954,7 @@
NumberElements - Supplies the maximum depth of the lookaside list.
-
+
Note:
The Windows 2000 version of classpnp did not return any status value from
@@ -952,7 +962,10 @@
--*/
-VOID ClassInitializeSrbLookasideList( IN PCOMMON_DEVICE_EXTENSION CommonExtension,
+SCSIPORTAPI
+VOID
+NTAPI
+ClassInitializeSrbLookasideList( IN PCOMMON_DEVICE_EXTENSION CommonExtension,
IN ULONG NumberElements)
{
PAGED_CODE();
@@ -973,8 +986,8 @@
CommonExtension->IsSrbLookasideListInitialized = TRUE;
}
-
-}
+
+}
@@ -1008,7 +1021,7 @@
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.
//
Modified: branches/cmake-bringup/drivers/storage/classpnp/power.c
URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/drivers/storage/c…
==============================================================================
--- branches/cmake-bringup/drivers/storage/classpnp/power.c [iso-8859-1] (original)
+++ branches/cmake-bringup/drivers/storage/classpnp/power.c [iso-8859-1] Sat Oct 30
00:03:28 2010
@@ -77,8 +77,8 @@
Arguments:
- DeviceObject -
- Irp -
+ DeviceObject -
+ Irp -
Return Value:
@@ -151,7 +151,7 @@
STATUS_MORE_PROCESSING_REQUIRED or
STATUS_SUCCESS
-
+
--*/
NTSTATUS
ClasspPowerUpCompletion(
@@ -389,7 +389,7 @@
break;
}
-
+
// reset retries
Context->RetryCount = MAXIMUM_RETRIES;
@@ -406,7 +406,7 @@
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 @@
// 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 @@
//
// 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 @@
// no break in case the device doesn't like synch_cache commands
}
-
+
case PowerDownDeviceFlushed2: {
PCDB cdb;
@@ -843,9 +843,9 @@
//
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 @@
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 @@
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 @@
Irp->IoStatus.Information = 0;
if (NT_SUCCESS(status)) {
-
+
//
// Set the new power state
//
@@ -989,7 +989,7 @@
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 @@
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 @@
}
break;
}
-
+
break;
}
@@ -1311,7 +1311,7 @@
if (DeviceObject->Characteristics & FILE_REMOVABLE_MEDIA) {
- PFUNCTIONAL_DEVICE_EXTENSION fdoExtension =
+ PFUNCTIONAL_DEVICE_EXTENSION fdoExtension =
DeviceObject->DeviceExtension;
//
@@ -1319,9 +1319,9 @@
//
if (irpStack->MinorFunction == IRP_MN_SET_POWER){
PVPB vpb;
-
+
switch (irpStack->Parameters.Power.ShutdownType){
-
+
case PowerActionSleep:
case PowerActionHibernate:
//
@@ -1331,11 +1331,11 @@
//
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 @@
if (irpStack->MinorFunction != IRP_MN_SET_POWER &&
irpStack->MinorFunction != IRP_MN_QUERY_POWER) {
-
+
NOTHING;
} else {
@@ -1371,7 +1371,7 @@
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,7 +1387,9 @@
None
--*/
+SCSIPORTAPI
NTSTATUS
+NTAPI
ClassSpinDownPowerHandler(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp
@@ -1449,12 +1451,14 @@
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
Modified: branches/cmake-bringup/drivers/storage/classpnp/utils.c
URL:
http://svn.reactos.org/svn/reactos/branches/cmake-bringup/drivers/storage/c…
==============================================================================
--- branches/cmake-bringup/drivers/storage/classpnp/utils.c [iso-8859-1] (original)
+++ branches/cmake-bringup/drivers/storage/classpnp/utils.c [iso-8859-1] Sat Oct 30
00:03:28 2010
@@ -55,7 +55,10 @@
}
-VOID ClassGetDeviceParameter(
+SCSIPORTAPI
+VOID
+NTAPI
+ClassGetDeviceParameter(
IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension,
IN PWSTR SubkeyName OPTIONAL,
IN PWSTR ParameterName,
@@ -140,7 +143,10 @@
} // end ClassGetDeviceParameter()
-NTSTATUS ClassSetDeviceParameter(
+SCSIPORTAPI
+NTSTATUS
+NTAPI
+ClassSetDeviceParameter(
IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension,
IN PWSTR SubkeyName OPTIONAL,
IN PWSTR ParameterName,
@@ -218,7 +224,10 @@
* hardware based upon id strings. it does not check the registry.
*/
-VOID ClassScanForSpecial(
+SCSIPORTAPI
+VOID
+NTAPI
+ClassScanForSpecial(
IN PFUNCTIONAL_DEVICE_EXTENSION FdoExtension,
IN CLASSPNP_SCAN_FOR_SPECIAL_INFO DeviceList[],
IN PCLASS_SCAN_FOR_SPECIAL_HANDLER Function)